diff --git a/AICA/DOCS/Aica_spec100e/Thumbs.db b/AICA/DOCS/Aica_spec100e/Thumbs.db deleted file mode 100644 index c6f17d76..00000000 Binary files a/AICA/DOCS/Aica_spec100e/Thumbs.db and /dev/null differ diff --git a/AICA/DOCS/aica.htm b/AICA/DOCS/aica.htm new file mode 100644 index 00000000..aa924000 --- /dev/null +++ b/AICA/DOCS/aica.htm @@ -0,0 +1,2363 @@ +netbsd-bugs: port-dreamcast/22543: AICA audio driver for dreamcast + +Subject: port-dreamcast/22543: AICA audio driver for dreamcast
+To: None <gnats-bugs@gnats.netbsd.org>
+From: None <ryo@nerv.org>
+List: netbsd-bugs
+Date: 08/19/2003 12:21:57 +
>Number:         22543
+>Category:       port-dreamcast
+>Synopsis:       AICA audio driver for dreamcast
+>Confidential:   no
+>Severity:       non-critical
+>Priority:       medium
+>Responsible:    port-dreamcast-maintainer
+>State:          open
+>Class:          change-request
+>Submitter-Id:   net
+>Arrival-Date:   Tue Aug 19 03:23:00 UTC 2003
+>Closed-Date:
+>Last-Modified:
+>Originator:     Ryo Shimizu
+>Release:        NetBSD 1.6W
+>Organization:
+>Environment:
+System: NetBSD guruguru 1.6W NetBSD 1.6W (GURUGURU) #324: Mon Aug 18 04:58:42 JST 2003  ryo@moveq.nerv.org:/usr/src/sys/arch/dreamcast/compile/GURUGURU dreamcast
+Architecture: sh3
+Machine: dreamcast
+>Description:
+	This is an audio driver for dreamcast.
+	AICA has 64 pcm channels. But this driver support only 2 channels (left & right).
+	The remaining 62 channels are idle.
+>How-To-Repeat:
+
+>Fix:
+diff -ruN src.orig/sys/arch/dreamcast/conf/GENERIC src/sys/arch/dreamcast/conf/GENERIC
+--- src.orig/sys/arch/dreamcast/conf/GENERIC	2003-06-15 01:28:32.000000000 +0900
++++ src/sys/arch/dreamcast/conf/GENERIC	2003-08-19 12:13:35.000000000 +0900
+@@ -167,6 +167,9 @@
+ 
+ mbe*		at g2bus?			# SEGA LAN Adapter
+ 
++aica*		at g2bus?			# AICA Sound Processing Unit (ARM7)
++audio*		at aica?
++
+ #pseudo-device	cgd		2	# cryptographic disk devices
+ pseudo-device	md		1	# memory disk device (ramdisk)
+ pseudo-device	vnd		2	# disk-like interface to files
+diff -ruN src.orig/sys/arch/dreamcast/conf/files.dreamcast src/sys/arch/dreamcast/conf/files.dreamcast
+--- src.orig/sys/arch/dreamcast/conf/files.dreamcast	2003-06-15 01:15:16.000000000 +0900
++++ src/sys/arch/dreamcast/conf/files.dreamcast	2003-08-16 09:55:55.000000000 +0900
+@@ -99,4 +99,8 @@
+ attach	mbe at g2bus with mbe_g2bus
+ file	arch/dreamcast/dev/g2/if_mbe_g2.c		mbe_g2bus
+ 
++device	aica: audiobus, auconv, mulaw
++attach	aica at g2bus
++file	arch/dreamcast/dev/g2/aica.c			aica	needs-flag
++
+ include "arch/dreamcast/conf/majors.dreamcast"
+diff -ruN src.orig/sys/arch/dreamcast/dev/g2/aica.c src/sys/arch/dreamcast/dev/g2/aica.c
+--- src.orig/sys/arch/dreamcast/dev/g2/aica.c	1970-01-01 09:00:00.000000000 +0900
++++ src/sys/arch/dreamcast/dev/g2/aica.c	2003-08-16 16:22:38.000000000 +0900
+@@ -0,0 +1,767 @@
++/*	$NetBSD$	*/
++
++/*
++ * Copyright (c) 2003 SHIMIZU Ryo <ryo@misakimix.org>
++ * 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. The name of the author may not be used to endorse or promote products
++ *    derived from this software without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 "aica.h"
++#if NAICA > 0
++
++#include <sys/cdefs.h>
++#include <sys/param.h>
++#include <sys/systm.h>
++#include <sys/kernel.h>
++#include <sys/proc.h>
++
++#include <sys/audioio.h>
++#include <dev/audio_if.h>
++#include <dev/mulaw.h>
++#include <dev/auconv.h>
++
++#include <machine/sysasicvar.h>
++
++#include <dreamcast/dev/g2/g2busvar.h>
++#include <dreamcast/dev/g2/aicavar.h>
++#include <dreamcast/dev/g2/microcode/aica_armcode.h>
++
++#ifndef offsetof
++#define offsetof(type, member)	((size_t)(unsigned long)(&((type *)0)->member))
++#endif
++
++struct aica_softc {
++	struct device		sc_dev;		/* base device */
++	bus_space_tag_t		sc_memt;
++	bus_space_handle_t	sc_aica_regh;
++#define	AICA_REG_ADDR	0xa0700000
++	bus_space_handle_t	sc_aica_memh;
++#define	AICA_RAM_START	0xa0800000
++#define	AICA_RAM_END	0xa0a00000
++
++	/* audio property */
++	int			sc_open;
++	int			sc_encodings;
++	int			sc_precision;
++	int			sc_channels;
++	int			sc_rate;
++	void			(*sc_intr)(void *);
++	void			*sc_intr_arg;
++
++	int			sc_output_master;
++	int			sc_output_gain[2];
++#define	AICA_VOLUME_LEFT	0
++#define	AICA_VOLUME_RIGHT	1
++
++	/* work for output */
++	void			*sc_buffer;
++	void			*sc_buffer_start;
++	void			*sc_buffer_end;
++	int			sc_blksize;
++	int			sc_nextfill;
++};
++
++struct {
++	char	*name;
++	int 	encoding;
++	int 	precision;
++} aica_encodings[] = {
++	{AudioEadpcm,		AUDIO_ENCODING_ADPCM,		4},
++	{AudioEslinear,		AUDIO_ENCODING_SLINEAR,		8},
++	{AudioEulinear,		AUDIO_ENCODING_ULINEAR,		8},
++	{AudioEmulaw,		AUDIO_ENCODING_ULAW,		8},
++	{AudioEslinear_be,	AUDIO_ENCODING_SLINEAR_BE,	16},
++	{AudioEslinear_le,	AUDIO_ENCODING_SLINEAR_LE,	16},
++};
++
++
++int aica_match(struct device *, struct cfdata *, void *);
++void aica_attach(struct device *, struct device *, void *);
++int aica_print(void *, const char *);
++
++CFATTACH_DECL(aica, sizeof(struct aica_softc), aica_match, aica_attach, NULL, NULL);
++
++struct audio_device aica_device = {
++	"Dreamcast Sound",
++	"",
++	"aica"
++};
++
++inline static void aica_g2fifo_wait(void);
++void aica_enable(struct aica_softc *);
++void aica_disable(struct aica_softc *);
++void aica_memcpy(struct aica_softc *, u_int32_t *, u_int32_t *, int);
++void aica_ch2p16cpy(struct aica_softc *, u_int16_t *, u_int16_t *, int);
++void aica_ch2p8cpy(struct aica_softc *, u_int8_t *, u_int8_t *, int);
++void aica_command(void *,unsigned int);
++void aica_play(void *,int,int,int,int);
++void aica_sendparam(void *,unsigned int,int,int);
++void aica_fillbuffer(void *);
++
++/* intr */
++int aica_intr(void *);
++
++/* for audio */
++int aica_open(void *, int);
++void aica_close(void *);
++int aica_query_encoding(void *, struct audio_encoding *);
++int aica_set_params(void *, int, int, struct audio_params *, struct audio_params *);
++int aica_round_blocksize(void *, int);
++size_t aica_round_buffersize(void *, int, size_t);
++int aica_trigger_output(void *, void *, void *, int, void (*)(void *), void *, struct audio_params *);
++int aica_trigger_input(void *, void *, void *, int, void (*)(void *), void *, struct audio_params *);
++int aica_halt_output(void *);
++int aica_halt_input(void *);
++int aica_getdev(void *, struct audio_device *);
++int aica_set_port(void *, mixer_ctrl_t *);
++int aica_get_port(void *, mixer_ctrl_t *);
++int aica_query_devinfo(void *, mixer_devinfo_t *);
++void aica_encode(int, int, int, int, u_char *, u_short **);
++int aica_get_props(void *);
++
++struct audio_hw_if aica_hw_if = {
++	aica_open,
++	aica_close,
++	NULL,				/* aica_drain */
++	aica_query_encoding,
++	aica_set_params,
++	aica_round_blocksize,
++	NULL,				/* aica_commit_setting */
++	NULL,				/* aica_init_output */
++	NULL,				/* aica_init_input */
++	NULL,				/* aica_start_output */
++	NULL,				/* aica_start_input */
++	aica_halt_output,
++	aica_halt_input,
++	NULL,				/* aica_speaker_ctl */
++	aica_getdev,
++	NULL,				/* aica_setfd */
++	aica_set_port,
++	aica_get_port,
++	aica_query_devinfo,
++	NULL,				/* aica_allocm */
++	NULL,				/* aica_freem */
++
++	aica_round_buffersize,		/* aica_round_buffersize */
++
++	NULL,				/* aica_mappage */
++	aica_get_props,
++	aica_trigger_output,
++	aica_trigger_input,
++	NULL,				/* aica_dev_ioctl */
++};
++
++
++int
++aica_match(struct device *parent, struct cfdata *cf, void *aux)
++{
++	static int aica_matched = 0;
++
++	if (aica_matched)
++		return 0;
++
++	aica_matched = 1;
++	return 1;
++}
++
++
++void
++aica_attach(struct device *parent, struct device *self, void *aux)
++{
++	struct aica_softc *sc = (struct aica_softc *)self;
++	struct g2bus_attach_args *ga = aux;
++
++	printf(": ARM7 Sound Processing Unit\n");
++
++	sc->sc_memt = ga->ga_memt;
++
++	if (bus_space_map(sc->sc_memt, AICA_REG_ADDR, 0x3000, 0, &sc->sc_aica_regh) != 0)
++		panic("aica_attach: can't map AICA register space");
++
++	if (bus_space_map(sc->sc_memt, AICA_RAM_START, (AICA_RAM_END-AICA_RAM_START), 0, &sc->sc_aica_memh) != 0)
++		panic("aica_attach: can't map AICA memory space");
++
++	aica_disable(sc);
++	{
++		int ch;
++		for (ch=0; ch<64; ch++) {
++			bus_space_write_4(sc->sc_memt,sc->sc_aica_regh, 0x80*ch,
++			                  ((bus_space_read_4(sc->sc_memt,sc->sc_aica_regh, 0x80*ch) & ~0x4000) | 0x8000));
++		}
++	}
++
++	/* load microcode, and clear memory */
++	{
++		int i;
++		aica_memcpy(sc,0x00000000,(void*)aica_armcode,sizeof(aica_armcode));
++		for (i=(sizeof(aica_armcode)+3)&~3;i<AICA_ARM_END;i+=4) {
++			bus_space_write_4(sc->sc_memt,sc->sc_aica_memh,i,0);
++		}
++	}
++
++	aica_enable(sc);
++
++	printf("%s: interrupting at %s\n",sc->sc_dev.dv_xname,sysasic_intr_string(IPL_BIO));
++	sysasic_intr_establish(SYSASIC_EVENT_AICA, IPL_BIO, aica_intr, sc);
++
++	audio_attach_mi(&aica_hw_if, sc, &sc->sc_dev);
++
++
++	/* init parameters */
++	sc->sc_output_master = 255;
++	sc->sc_output_gain[AICA_VOLUME_LEFT]  = 255;
++	sc->sc_output_gain[AICA_VOLUME_RIGHT] = 255;
++}
++
++
++void
++aica_enable(struct aica_softc *sc)
++{
++	bus_space_write_4(sc->sc_memt, sc->sc_aica_regh, 0x28a8, 24);
++	bus_space_write_4(sc->sc_memt, sc->sc_aica_regh, 0x2c00,
++	                  bus_space_read_4(sc->sc_memt, sc->sc_aica_regh, 0x2c00) & ~1);
++}
++
++void
++aica_disable(struct aica_softc *sc)
++{
++	bus_space_write_4(sc->sc_memt, sc->sc_aica_regh, 0x2c00,
++	                  bus_space_read_4(sc->sc_memt, sc->sc_aica_regh, 0x2c00) | 1);
++}
++
++
++inline static void
++aica_g2fifo_wait()
++{
++	int i;
++	for (i=0x1800; (i>0) && !((*(volatile unsigned int *)0xa05f688c)&0x11); i--)
++		;
++}
++
++void
++aica_memcpy(struct aica_softc *sc, u_int32_t *dst, u_int32_t *src, int len)
++{
++	u_int32_t tmp[8];
++	int n = (len+3)/4;	/* u_int32_t * n (aligned) */
++
++	while (n>8) {
++		u_int32_t *d = tmp;
++		*d++ = *src++; *d++ = *src++; *d++ = *src++; *d++ = *src++;
++		*d++ = *src++; *d++ = *src++; *d++ = *src++; *d++ = *src++;
++
++		aica_g2fifo_wait();
++		bus_space_write_region_4(sc->sc_memt, sc->sc_aica_memh, (bus_size_t)dst, tmp, 8);
++
++		dst+=8;
++		n-=8;
++	}
++
++	if (n) {
++		int i;
++		for (i=0;i<n;i++)
++			tmp[i] = src[i];
++
++		aica_g2fifo_wait();
++		bus_space_write_region_4(sc->sc_memt, sc->sc_aica_memh, (bus_size_t)dst, tmp, n);
++	}
++}
++
++
++void
++aica_ch2p16cpy(struct aica_softc *sc, u_int16_t *dst, u_int16_t *src, int len)
++{
++	u_int32_t tmp[8];
++
++	while (len>=32) {
++		u_int16_t *d = (u_int16_t *)tmp;
++		*d++ = *src++; src++;  *d++ = *src++; src++;  *d++ = *src++; src++;  *d++ = *src++; src++;
++		*d++ = *src++; src++;  *d++ = *src++; src++;  *d++ = *src++; src++;  *d++ = *src++; src++;
++		*d++ = *src++; src++;  *d++ = *src++; src++;  *d++ = *src++; src++;  *d++ = *src++; src++;
++		*d++ = *src++; src++;  *d++ = *src++; src++;  *d++ = *src++; src++;  *d++ = *src++; src++;
++
++		aica_g2fifo_wait();
++		bus_space_write_region_4(sc->sc_memt, sc->sc_aica_memh, (bus_size_t)dst, tmp, 32/4);
++
++		dst+=16;
++		len-=32;
++	}
++
++	if (len) {
++		int i;
++		u_int16_t *d = (u_int16_t *)tmp;
++		for (i=0;i<len/2;i++) {
++			*d++ = *src++; src++;
++		}
++
++		aica_g2fifo_wait();
++		bus_space_write_region_4(sc->sc_memt, sc->sc_aica_memh, (bus_size_t)dst, tmp, len/4);
++	}
++}
++
++
++void
++aica_ch2p8cpy(struct aica_softc *sc, u_int8_t *dst, u_int8_t *src, int len)
++{
++	u_int32_t tmp[8];
++
++	while (len>=32) {
++		u_int8_t *d = (u_int8_t *)tmp;
++		*d++ = *src++; src++;  *d++ = *src++; src++;  *d++ = *src++; src++;  *d++ = *src++; src++;
++		*d++ = *src++; src++;  *d++ = *src++; src++;  *d++ = *src++; src++;  *d++ = *src++; src++;
++		*d++ = *src++; src++;  *d++ = *src++; src++;  *d++ = *src++; src++;  *d++ = *src++; src++;
++		*d++ = *src++; src++;  *d++ = *src++; src++;  *d++ = *src++; src++;  *d++ = *src++; src++;
++		*d++ = *src++; src++;  *d++ = *src++; src++;  *d++ = *src++; src++;  *d++ = *src++; src++;
++		*d++ = *src++; src++;  *d++ = *src++; src++;  *d++ = *src++; src++;  *d++ = *src++; src++;
++		*d++ = *src++; src++;  *d++ = *src++; src++;  *d++ = *src++; src++;  *d++ = *src++; src++;
++		*d++ = *src++; src++;  *d++ = *src++; src++;  *d++ = *src++; src++;  *d++ = *src++; src++;
++
++		aica_g2fifo_wait();
++		bus_space_write_region_4(sc->sc_memt, sc->sc_aica_memh, (bus_size_t)dst, tmp, 32/4);
++
++		dst+=32;
++		len-=32;
++	}
++
++	if (len) {
++		int i;
++		u_int8_t *d = (u_int8_t *)tmp;
++		for (i=0;i<len;i++) {
++			*d++ = *src++; src++;
++		}
++
++		aica_g2fifo_wait();
++		bus_space_write_region_4(sc->sc_memt, sc->sc_aica_memh, (bus_size_t)dst, tmp, len/4);
++	}
++}
++
++
++
++
++int
++aica_open(void *addr, int flags)
++{
++	struct aica_softc *sc = addr;
++
++	if (sc->sc_open)
++		return EBUSY;
++
++	sc->sc_intr = NULL;
++	sc->sc_open = 1;
++
++	return 0;
++}
++
++
++void
++aica_close(void *addr)
++{
++	struct aica_softc *sc = addr;
++
++	sc->sc_open = 0;
++	sc->sc_intr = NULL;
++}
++
++
++int
++aica_query_encoding(void *addr, struct audio_encoding *fp)
++{
++	if (fp->index >= sizeof(aica_encodings)/sizeof(aica_encodings[0]))
++		return EINVAL;
++
++	strcpy(fp->name, aica_encodings[fp->index].name);
++	fp->encoding = aica_encodings[fp->index].encoding;
++	fp->precision = aica_encodings[fp->index].precision;
++	fp->flags = 0;
++
++	return 0;
++}
++
++int
++aica_set_params(void *addr, int setmode, int usemode,
++                struct audio_params *play,
++                struct audio_params *rec)
++{
++	struct aica_softc *sc = addr;
++
++	if ((play->channels != 1) &&
++	    (play->channels != 2))
++		return EINVAL;
++
++	if ((play->precision != 4) &&
++	    (play->precision != 8) &&
++	    (play->precision != 16))
++		return EINVAL;
++
++	play->factor = 1;
++	play->factor_denom = 1;
++
++	play->hw_precision = play->precision;
++	play->hw_channels = play->channels;
++	play->hw_sample_rate = play->sample_rate;
++	play->hw_encoding = AUDIO_ENCODING_SLINEAR_LE;
++
++	play->sw_code = NULL;
++
++	sc->sc_precision = play->hw_precision;
++	sc->sc_channels = play->hw_channels;
++	sc->sc_rate = play->hw_sample_rate;
++	sc->sc_encodings = play->hw_encoding;
++
++
++#if 1
++	/* XXX: limit check */
++	if ((play->precision == 4) &&
++	    (play->channels == 1) &&
++	    (play->sample_rate >= 65536))
++		return EINVAL;
++
++	if ((play->precision == 8) &&
++	    (play->channels == 1) &&
++	    (play->sample_rate >= 65536))
++		return EINVAL;
++#endif
++
++
++	switch (play->encoding) {
++	case AUDIO_ENCODING_ADPCM:
++		if (play->precision != 4)
++			return EINVAL;
++		if (play->channels != 1)
++			return EINVAL;
++
++		play->hw_encoding = AUDIO_ENCODING_ADPCM;
++		play->hw_precision = 8;	/* 4? XXX */
++		sc->sc_precision = 4;
++		break;
++
++	case AUDIO_ENCODING_SLINEAR:
++		break;
++	case AUDIO_ENCODING_ULINEAR:
++		play->sw_code = change_sign8;
++		break;
++
++	case AUDIO_ENCODING_SLINEAR_BE:
++		if (play->precision == 16)
++			play->sw_code = swap_bytes;
++		break;
++	case AUDIO_ENCODING_SLINEAR_LE:
++		break;
++	case AUDIO_ENCODING_ULINEAR_BE:
++		if (play->precision == 16)
++			play->sw_code = swap_bytes_change_sign16_le;
++		break;
++	case AUDIO_ENCODING_ULINEAR_LE:
++		if (play->precision == 16)
++			play->sw_code = change_sign16_le;
++		break;
++
++	case AUDIO_ENCODING_ULAW:
++		play->sw_code = mulaw_to_slinear16_le;
++		play->hw_precision = 16;
++		sc->sc_precision = play->hw_precision;
++		break;
++	case AUDIO_ENCODING_ALAW:
++		play->sw_code = alaw_to_slinear16_le;
++		play->hw_precision = 16;
++		sc->sc_precision = play->hw_precision;
++		break;
++
++	default:
++		return EINVAL;
++	}
++
++	return 0;
++}
++
++int
++aica_round_blocksize(void *addr, int blk)
++{
++	struct aica_softc *sc = addr;
++	switch (sc->sc_precision) {
++	case 4:
++		if (sc->sc_channels == 1)
++			return AICA_DMABUF_SIZE/4;
++		else
++			return AICA_DMABUF_SIZE/2;
++		break;
++	case 8:
++		if (sc->sc_channels == 1)
++			return AICA_DMABUF_SIZE/2;
++		else
++			return AICA_DMABUF_SIZE;
++		break;
++	case 16:
++		if (sc->sc_channels == 1)
++			return AICA_DMABUF_SIZE;
++		else
++			return AICA_DMABUF_SIZE*2;
++		break;
++	default:
++		break;
++	}
++
++	return AICA_DMABUF_SIZE/4;
++}
++
++size_t
++aica_round_buffersize(void *addr, int dir, size_t bufsize)
++{
++	if (dir == AUMODE_PLAY)
++		return 65536;
++
++	return 512;	/* XXX: AUMINBUF */
++}
++
++
++void
++aica_command(void *addr,unsigned int command)
++{
++	struct aica_softc *sc = addr;
++
++	bus_space_write_4(sc->sc_memt,sc->sc_aica_memh,
++	                  AICA_ARM_CMD+offsetof(aica_cmd_t,command),
++	                  command);
++	bus_space_write_4(sc->sc_memt,sc->sc_aica_memh,
++	                  AICA_ARM_CMD+offsetof(aica_cmd_t,serial),
++	                  bus_space_read_4(sc->sc_memt,sc->sc_aica_memh,
++	                                   AICA_ARM_CMD+offsetof(aica_cmd_t,serial))+1);
++}
++
++void
++aica_sendparam(void *addr,unsigned int command,int lparam,int rparam)
++{
++	struct aica_softc *sc = addr;
++
++	bus_space_write_4(sc->sc_memt,sc->sc_aica_memh,
++	                  AICA_ARM_CMD+offsetof(aica_cmd_t,l_param),lparam);
++	bus_space_write_4(sc->sc_memt,sc->sc_aica_memh,
++	                  AICA_ARM_CMD+offsetof(aica_cmd_t,r_param),rparam);
++
++	aica_command(sc,command);
++}
++
++
++void
++aica_play(void *addr,int blksize,int channel,int rate,int prec)
++{
++	struct aica_softc *sc = addr;
++
++	bus_space_write_4(sc->sc_memt,sc->sc_aica_memh,
++	                  AICA_ARM_CMD+offsetof(aica_cmd_t,blocksize),blksize);
++	bus_space_write_4(sc->sc_memt,sc->sc_aica_memh,
++	                  AICA_ARM_CMD+offsetof(aica_cmd_t,channel),channel);
++	bus_space_write_4(sc->sc_memt,sc->sc_aica_memh,
++	                  AICA_ARM_CMD+offsetof(aica_cmd_t,rate),rate);
++	bus_space_write_4(sc->sc_memt,sc->sc_aica_memh,
++	                  AICA_ARM_CMD+offsetof(aica_cmd_t,precision),prec);
++
++	aica_command(sc,AICA_COMMAND_PLAY);
++}
++
++
++void
++aica_fillbuffer(void *addr)
++{
++	struct aica_softc *sc = addr;
++
++	if (sc->sc_channels == 2) {
++		if (sc->sc_precision == 16) {
++			aica_ch2p16cpy(sc,(void*)(AICA_DMABUF_LEFT +sc->sc_nextfill), (u_int16_t *)sc->sc_buffer+0, sc->sc_blksize/2);
++			aica_ch2p16cpy(sc,(void*)(AICA_DMABUF_RIGHT+sc->sc_nextfill), (u_int16_t *)sc->sc_buffer+1, sc->sc_blksize/2);
++		} else if (sc->sc_precision == 8) {
++			aica_ch2p8cpy(sc,(void*)(AICA_DMABUF_LEFT +sc->sc_nextfill), (u_int8_t *)sc->sc_buffer+0, sc->sc_blksize/2);
++			aica_ch2p8cpy(sc,(void*)(AICA_DMABUF_RIGHT+sc->sc_nextfill), (u_int8_t *)sc->sc_buffer+1, sc->sc_blksize/2);
++		}
++	} else {
++		aica_memcpy(sc,(void*)(AICA_DMABUF_LEFT+sc->sc_nextfill),sc->sc_buffer,sc->sc_blksize);
++	}
++
++	(char*)sc->sc_buffer+=sc->sc_blksize;
++	if (sc->sc_buffer >= sc->sc_buffer_end)
++		sc->sc_buffer = sc->sc_buffer_start;
++
++	sc->sc_nextfill ^= sc->sc_blksize/sc->sc_channels;
++}
++
++
++int
++aica_intr(void *arg)
++{
++	struct aica_softc *sc = arg;
++
++	aica_fillbuffer(sc);
++
++	/* call audio interrupt handler (audio_pint()) */
++	if (sc->sc_open && sc->sc_intr != NULL) {
++		(*(sc->sc_intr))(sc->sc_intr_arg);
++	}
++
++	bus_space_write_4(sc->sc_memt, sc->sc_aica_regh, 0x28bc, 0x20); /* clear SPU interrupt */
++	return 1;
++}
++
++
++int
++aica_trigger_output(void *addr, void *start, void *end, int blksize,
++                    void (*intr)(void *), void *arg, struct audio_params *param)
++{
++	struct aica_softc *sc = addr;
++
++	aica_command(sc,AICA_COMMAND_INIT);
++	tsleep(aica_trigger_output,PWAIT,"aicawait",hz/20);
++
++	sc->sc_buffer_start = sc->sc_buffer = start;
++	sc->sc_buffer_end = end;
++	sc->sc_blksize = blksize;
++	sc->sc_nextfill = 0;
++
++	sc->sc_intr = intr;
++	sc->sc_intr_arg = arg;
++
++	/* fill buffers in advance */
++	aica_intr(sc);
++	aica_intr(sc);
++
++	/* ...and start playing */
++	aica_play(addr,blksize/sc->sc_channels,sc->sc_channels,sc->sc_rate,sc->sc_precision);
++
++	return 0;
++}
++
++
++int
++aica_trigger_input(void *addr, void *start, void *end, int blksize,
++                   void (*intr)(void *), void *arg, struct audio_params *param)
++{
++	return ENODEV;
++}
++
++int
++aica_halt_output(void *addr)
++{
++	struct aica_softc *sc = addr;
++
++	aica_command(sc,AICA_COMMAND_STOP);
++
++	return 0;
++}
++
++int
++aica_halt_input(void *addr)
++{
++	return ENODEV;
++}
++
++int
++aica_getdev(void *addr, struct audio_device *ret)
++{
++	*ret = aica_device;
++	return 0;
++}
++
++int
++aica_set_port(void *addr, mixer_ctrl_t *mc)
++{
++	struct aica_softc *sc = addr;
++
++	switch (mc->dev) {
++	case AICA_MASTER_VOL:
++		sc->sc_output_master = mc->un.value.level[AUDIO_MIXER_LEVEL_MONO] & 0xff;
++		aica_sendparam(sc,AICA_COMMAND_MVOL,sc->sc_output_master,sc->sc_output_master);
++		break;
++	case AICA_OUTPUT_GAIN:
++		sc->sc_output_gain[AICA_VOLUME_LEFT]  = mc->un.value.level[AUDIO_MIXER_LEVEL_LEFT]  & 0xff;
++		sc->sc_output_gain[AICA_VOLUME_RIGHT] = mc->un.value.level[AUDIO_MIXER_LEVEL_RIGHT] & 0xff;
++		aica_sendparam(sc,AICA_COMMAND_VOL,
++		               sc->sc_output_gain[AICA_VOLUME_LEFT],
++		               sc->sc_output_gain[AICA_VOLUME_RIGHT]);
++		break;
++	default:
++		return EINVAL;
++	}
++
++	return 0;
++}
++
++int
++aica_get_port(void *addr, mixer_ctrl_t *mc)
++{
++	struct aica_softc *sc = addr;
++
++	switch (mc->dev) {
++	case AICA_MASTER_VOL:
++		if (mc->un.value.num_channels != 1)
++			return EINVAL;
++		mc->un.value.level[AUDIO_MIXER_LEVEL_MONO] = L16TO256(L256TO16(sc->sc_output_master));
++		break;
++	case AICA_OUTPUT_GAIN:
++		mc->un.value.level[AUDIO_MIXER_LEVEL_LEFT]  = sc->sc_output_gain[AICA_VOLUME_LEFT];
++		mc->un.value.level[AUDIO_MIXER_LEVEL_RIGHT] = sc->sc_output_gain[AICA_VOLUME_RIGHT];
++		break;
++	default:
++		return EINVAL;
++	}
++	return 0;
++}
++
++int
++aica_query_devinfo(void *addr, mixer_devinfo_t *md)
++{
++	switch (md->index) {
++	case AICA_MASTER_VOL:
++		md->type = AUDIO_MIXER_VALUE;
++		md->mixer_class = AICA_OUTPUT_CLASS;
++		md->prev = md->next = AUDIO_MIXER_LAST;
++		strcpy(md->label.name, AudioNmaster);
++		md->un.v.num_channels = 1;
++		strcpy(md->un.v.units.name, AudioNvolume);
++		return 0;
++	case AICA_OUTPUT_GAIN:
++		md->type = AUDIO_MIXER_VALUE;
++		md->mixer_class = AICA_OUTPUT_CLASS;
++		md->prev = md->next = AUDIO_MIXER_LAST;
++		strcpy(md->label.name, AudioNoutput);
++		md->un.v.num_channels = 2;
++		strcpy(md->label.name, AudioNvolume);
++		return 0;
++	case AICA_OUTPUT_CLASS:
++		md->type = AUDIO_MIXER_CLASS;
++		md->mixer_class = AICA_OUTPUT_CLASS;
++		md->next = md->prev = AUDIO_MIXER_LAST;
++		strcpy(md->label.name, AudioCoutputs);
++		return 0;
++	}
++
++	return ENXIO;
++}
++
++int
++aica_get_props(void *addr)
++{
++	return 0;
++}
++
++
++#endif /* NAICA > 0 */
+diff -ruN src.orig/sys/arch/dreamcast/dev/g2/aicavar.h src/sys/arch/dreamcast/dev/g2/aicavar.h
+--- src.orig/sys/arch/dreamcast/dev/g2/aicavar.h	1970-01-01 09:00:00.000000000 +0900
++++ src/sys/arch/dreamcast/dev/g2/aicavar.h	2003-08-16 12:02:01.000000000 +0900
+@@ -0,0 +1,82 @@
++/*	$NetBSD$	*/
++
++/*
++ * Copyright (c) 2003 SHIMIZU Ryo <ryo@misakimix.org>
++ * 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. The name of the author may not be used to endorse or promote products
++ *    derived from this software without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 _AICAVAR_H_
++#define _AICAVAR_H_
++
++typedef struct {
++	unsigned int serial;
++	unsigned int command;
++	unsigned int blocksize;
++	unsigned int channel;
++	unsigned int rate;
++	unsigned int precision;
++	unsigned int l_param;	/* volume,etc... for left */
++	unsigned int r_param;	/* volume,etc... for right */
++} aica_cmd_t;
++
++#define	AICA_COMMAND_NOP	0
++#define	AICA_COMMAND_PLAY	1
++#define	AICA_COMMAND_STOP	2
++#define	AICA_COMMAND_INIT	3
++#define	AICA_COMMAND_MVOL	4
++#define	AICA_COMMAND_VOL	5
++
++
++
++#define	AICA_ARM_CODE		0x00000000	/* text+data+bss+stack 0x00000000-0x0000ff00 */
++#define	AICA_ARM_CMD		0x0000ff00	/* SH4<->ARM work for communication */
++#define	AICA_ARM_END		0x00010000
++
++#define	AICA_DMABUF_START	0x00010000
++#define	AICA_DMABUF_LEFT	0x00010000	/* DMA buffer for PLAY 0x00010000-0x0001FFFF */
++#define	AICA_DMABUF_RIGHT	0x00020000	/* DMA buffer for PLAY 0x00020000-0x0002FFFF */
++#define	AICA_DMABUF_END		0x00030000
++
++#define	AICA_DMABUF_SIZE	0x0000ffc0
++
++#define	AICA_MEMORY_END		0x00200000
++
++
++#define L256TO16(l)	(((l)>>4)&0x0f)
++#define L16TO256(l)	((((l)<<4)&0xf0)+((l)&0x0f))
++
++
++enum MIXER_CLASS {
++	AICA_MASTER_VOL = 0,
++	AICA_OUTPUT_GAIN,
++	AICA_OUTPUT_CLASS,
++
++	AICA_NDEVS
++};
++
++
++#endif /* _AICAVAR_H_ */
++
+diff -ruN src.orig/sys/arch/dreamcast/dev/g2/g2bus_bus_mem.c src/sys/arch/dreamcast/dev/g2/g2bus_bus_mem.c
+--- src.orig/sys/arch/dreamcast/dev/g2/g2bus_bus_mem.c	2003-07-15 10:31:38.000000000 +0900
++++ src/sys/arch/dreamcast/dev/g2/g2bus_bus_mem.c	2003-07-20 08:32:51.000000000 +0900
+@@ -74,9 +74,17 @@
+ 
+ void	g2bus_bus_mem_read_region_1(void *, bus_space_handle_t, bus_size_t,
+ 	    u_int8_t *, bus_size_t);
++void	g2bus_bus_mem_read_region_2(void *, bus_space_handle_t, bus_size_t,
++	    u_int16_t *, bus_size_t);
++void	g2bus_bus_mem_read_region_4(void *, bus_space_handle_t, bus_size_t,
++	    u_int32_t *, bus_size_t);
+ 
+ void	g2bus_bus_mem_write_region_1(void *, bus_space_handle_t, bus_size_t,
+ 	    const u_int8_t *, bus_size_t);
++void	g2bus_bus_mem_write_region_2(void *, bus_space_handle_t, bus_size_t,
++	    const u_int16_t *, bus_size_t);
++void	g2bus_bus_mem_write_region_4(void *, bus_space_handle_t, bus_size_t,
++	    const u_int32_t *, bus_size_t);
+ 
+ u_int8_t g2bus_sparse_bus_mem_read_1(void *, bus_space_handle_t, bus_size_t);
+ u_int16_t g2bus_sparse_bus_mem_read_2(void *, bus_space_handle_t, bus_size_t);
+@@ -120,8 +128,12 @@
+ 	t->dbs_w_4 = g2bus_bus_mem_write_4;
+ 
+ 	t->dbs_rr_1 = g2bus_bus_mem_read_region_1;
++	t->dbs_rr_2 = g2bus_bus_mem_read_region_2;
++	t->dbs_rr_4 = g2bus_bus_mem_read_region_4;
+ 
+ 	t->dbs_wr_1 = g2bus_bus_mem_write_region_1;
++	t->dbs_wr_2 = g2bus_bus_mem_write_region_2;
++	t->dbs_wr_4 = g2bus_bus_mem_write_region_4;
+ }
+ 
+ int
+@@ -265,6 +277,36 @@
+ }
+ 
+ void
++g2bus_bus_mem_read_region_2(void *v, bus_space_handle_t sh, bus_size_t off,
++    u_int16_t *addr, bus_size_t len)
++{
++	G2LOCK_DECL;
++	__volatile const u_int16_t *baddr = (u_int16_t *)(sh + off);
++
++	G2_LOCK();
++
++	while (len--)
++		*addr++ = *baddr++;
++
++	G2_UNLOCK();
++}
++
++void
++g2bus_bus_mem_read_region_4(void *v, bus_space_handle_t sh, bus_size_t off,
++    u_int32_t *addr, bus_size_t len)
++{
++	G2LOCK_DECL;
++	__volatile const u_int32_t *baddr = (u_int32_t *)(sh + off);
++
++	G2_LOCK();
++
++	while (len--)
++		*addr++ = *baddr++;
++
++	G2_UNLOCK();
++}
++
++void
+ g2bus_bus_mem_write_region_1(void *v, bus_space_handle_t sh, bus_size_t off,
+     const u_int8_t *addr, bus_size_t len)
+ {
+@@ -280,6 +322,36 @@
+ }
+ 
+ void
++g2bus_bus_mem_write_region_2(void *v, bus_space_handle_t sh, bus_size_t off,
++    const u_int16_t *addr, bus_size_t len)
++{
++	G2LOCK_DECL;
++	__volatile u_int16_t *baddr = (u_int16_t *)(sh + off);
++
++	G2_LOCK();
++
++	while (len--)
++		*baddr++ = *addr++;
++
++	G2_UNLOCK();
++}
++
++void
++g2bus_bus_mem_write_region_4(void *v, bus_space_handle_t sh, bus_size_t off,
++    const u_int32_t *addr, bus_size_t len)
++{
++	G2LOCK_DECL;
++	__volatile u_int32_t *baddr = (u_int32_t *)(sh + off);
++
++	G2_LOCK();
++
++	while (len--)
++		*baddr++ = *addr++;
++
++	G2_UNLOCK();
++}
++
++void
+ g2bus_set_bus_mem_sparse(bus_space_tag_t memt)
+ {
+ 
+diff -ruN src.orig/sys/arch/dreamcast/dev/g2/microcode/Makefile src/sys/arch/dreamcast/dev/g2/microcode/Makefile
+--- src.orig/sys/arch/dreamcast/dev/g2/microcode/Makefile	1970-01-01 09:00:00.000000000 +0900
++++ src/sys/arch/dreamcast/dev/g2/microcode/Makefile	2003-08-17 05:35:27.000000000 +0900
+@@ -0,0 +1,25 @@
++
++CC	= arm--netbsdelf-gcc
++OBJCOPY	= arm--netbsdelf-objcopy
++CFLAGS	= -W -Wall -mlittle-endian -O3 -fomit-frame-pointer -funroll-loops -finline-functions
++AFLAGS	= -I../../../../../arch
++#AFLAGS	= -I../../../../../arch -mcpu=arm7tdmi -mthumb -mthumb-interwork -mapcs-32
++
++all: aica_armcode.h
++
++aica_armcode.h: aica_armcode.elf
++	echo "static u_int8_t aica_armcode[] = {" >aica_armcode.h
++	$(OBJCOPY) -O binary aica_armcode.elf aica_armcode.bin
++	hexdump -v -e '" /* %04.4_ax */\t" 4/1 "0x%02x, " "\n"' aica_armcode.bin >>aica_armcode.h
++	echo "0 };" >>aica_armcode.h
++
++aica_armcode.elf: aica_arm_locore.o aica_arm.o
++	$(CC) $(CFLAGS) -Wl,-Ttext,0 -Wl,-T ldscript -nostdlib -e 0 -o aica_armcode.elf aica_arm_locore.o aica_arm.o
++
++clean: clean-tmp
++	rm -f aica_armcode.h
++
++clean-tmp:
++	rm -f *.o aica_armcode.elf aica_armcode.bin
++
++
+diff -ruN src.orig/sys/arch/dreamcast/dev/g2/microcode/aica_arm.c src/sys/arch/dreamcast/dev/g2/microcode/aica_arm.c
+--- src.orig/sys/arch/dreamcast/dev/g2/microcode/aica_arm.c	1970-01-01 09:00:00.000000000 +0900
++++ src/sys/arch/dreamcast/dev/g2/microcode/aica_arm.c	2003-08-16 16:03:00.000000000 +0900
+@@ -0,0 +1,378 @@
++/*	$NetBSD$	*/
++
++/*
++ * Copyright (c) 2003 SHIMIZU Ryo <ryo@misakimix.org>
++ * 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. The name of the author may not be used to endorse or promote products
++ *    derived from this software without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 "../aicavar.h"
++
++#define	DC_REG_ADDR	0x00800000
++
++#define	REG_READ_1(off)		(*(volatile unsigned char *)((DC_REG_ADDR)+(off)))
++#define	REG_READ_2(off)		(*(volatile unsigned short *)((DC_REG_ADDR)+(off)))
++#define	REG_READ_4(off)		(*(volatile unsigned int *)((DC_REG_ADDR)+(off)))
++#define	REG_WRITE_1(off,val)	((*(volatile unsigned char *)((DC_REG_ADDR)+(off))) = (val))
++#define	REG_WRITE_2(off,val)	((*(volatile unsigned short *)((DC_REG_ADDR)+(off))) = (val))
++#define	REG_WRITE_4(off,val)	((*(volatile unsigned int *)((DC_REG_ADDR)+(off))) = (val))
++
++#define	CH_READ_1(ch,off)	REG_READ_1(0x80*(ch)+(off))
++#define	CH_READ_2(ch,off)	REG_READ_2(0x80*(ch)+(off))
++#define	CH_READ_4(ch,off)	REG_READ_4(0x80*(ch)+(off))
++#define	CH_WRITE_1(ch,off,val)	REG_WRITE_1(0x80*(ch)+(off),val)
++#define	CH_WRITE_2(ch,off,val)	REG_WRITE_2(0x80*(ch)+(off),val)
++#define	CH_WRITE_4(ch,off,val)	REG_WRITE_4(0x80*(ch)+(off),val)
++
++void
++aica_init()
++{
++	int ch,off;
++
++	/* Initialize AICA channels */
++	REG_WRITE_4(0x2800,0x0000);	/* Master volume: Min */
++
++	for (ch=0;ch<64;ch++) {
++		CH_WRITE_4(ch,0x00,0x8000);	/* Key off */
++		CH_WRITE_4(ch,0x04,0x0000);	/* DataAddress (low) */
++		CH_WRITE_4(ch,0x08,0x0000);	/* LoopStartPosition */
++		CH_WRITE_4(ch,0x0c,0x0000);	/* LoopEndPosition */
++		CH_WRITE_4(ch,0x10,0x001f);	/* AR = 0x1f = 0 msec */
++		CH_WRITE_4(ch,0x14,0x001f);	/* RR = 0x1f = 0 msec */
++		CH_WRITE_4(ch,0x18,0x0000);	/* Pitch */
++		CH_WRITE_4(ch,0x1c,0x0000);	/* LFO Control */
++		CH_WRITE_4(ch,0x20,0x0000);	/* DSP Channel to send */
++		CH_WRITE_4(ch,0x24,0x0000);	/* Pan & Volume */
++		CH_WRITE_4(ch,0x28,0x0024);	/* Volume & LowPassFilter */
++		CH_WRITE_4(ch,0x2c,0x0000);	/* LowPassFilter for Attack  */
++		CH_WRITE_4(ch,0x30,0x0000);	/* LowPassFilter for Decay   */
++		CH_WRITE_4(ch,0x34,0x0000);	/* LowPassFilter for Sustain */
++		CH_WRITE_4(ch,0x38,0x0000);	/* LowPassFilter for Keyoff  */
++		CH_WRITE_4(ch,0x3c,0x0000);	/* LowPassFilter for Release */
++		CH_WRITE_4(ch,0x40,0x0000);	/* LowPassFilter transition for Attack,Decay */
++		CH_WRITE_4(ch,0x44,0x0000);	/* LowPassFilter transition for Decay,Release */
++
++		for (off=0x48;off<0x80;off+=4) {
++			CH_WRITE_4(ch,off,0x0000);	/* other = 0 */
++		}
++	}
++
++	REG_WRITE_4(0x2800,0x000f);	/* Master volume: Max */
++}
++
++
++inline int
++in_first_half(unsigned int loophalf)
++{
++	REG_WRITE_1(0x280d,0);	/* select channel 0 */
++	return (REG_READ_4(0x2814) < loophalf);
++}
++
++inline int
++in_second_half(unsigned int loophalf)
++{
++	REG_WRITE_1(0x280d,0);	/* select channel 0 */
++	return (REG_READ_4(0x2814) >= loophalf);
++}
++
++
++void
++bzero_4(void *b,unsigned int len)
++{
++	len = (len+3) & ~3;
++	for (;len!=0;len-=4)
++		*(unsigned int*)b++ = 0;
++}
++
++void
++bzero(void *b,unsigned int len)
++{
++	for (;len!=0;len--)
++		*(unsigned char*)b++ = 0;
++}
++
++
++unsigned int
++rate2reg(unsigned int rate)
++{
++	unsigned int base,fns;
++	int oct;
++
++	base = 44100<<7;
++	for (oct=7; oct>=-8 && rate<base; oct--)
++		base>>=1;
++
++	if (rate<base)
++		return ((oct<<11)&0xf800);
++
++	rate-=base;
++
++#if 0
++	/* (base/2) : round off */
++	fns = (rate*1024+(base/2))/base;
++#else
++	/* avoid using udivsi3() */
++	{
++		unsigned int tmp = (rate*1024+(base/2));
++		for (fns=0;tmp>=base;tmp-=base,fns++)
++			;
++	}
++#endif
++
++	/* adjustment */
++	if (fns == 1024) {
++		oct++;
++		fns = 0;
++	} else {
++		if ((rate > base*fns/1024) &&
++		    (fns < 1023) &&
++		    (rate == base*(fns+1)/1024)) {
++			fns++;
++		} else if ((rate < base*fns/1024) &&
++		           (fns > 0) &&
++		           (rate == base*(fns-1)/1024)) {
++			fns--;
++		}
++	}
++
++	return ((oct<<11)&0xf800)+fns;
++}
++
++
++
++#ifdef DEBUG
++#include "debug_sound1.h"
++#include "debug_sound2.h"
++void
++debugbeep(int no)
++{
++	unsigned char *pcmdata;
++	unsigned int pcmlen;
++
++	if (no) {
++		pcmdata = (unsigned char *)debug_sound1;
++		pcmlen = sizeof(debug_sound1);
++	} else {
++		pcmdata = (unsigned char *)debug_sound2;
++		pcmlen = sizeof(debug_sound2);
++	}
++
++	CH_WRITE_4(2,0x00,0x8000);	/* Key off */
++
++	/* setup left */
++	CH_WRITE_4(2,0x08,0);			/* loop start */
++	CH_WRITE_4(2,0x0c,pcmlen/2);		/* loop end */
++	CH_WRITE_4(2,0x18,rate2reg(44100));	/* SamplingRate */
++	CH_WRITE_1(2,0x24,0x1f);		/* left pan */
++	CH_WRITE_1(2,0x25,0x0f);		/* volume MAX */
++	CH_WRITE_1(2,0x28,0x24);		/* LPF=off */
++	CH_WRITE_1(2,0x29,0x00);		/* volume MAX */
++	CH_WRITE_4(2,0x10,0x1f);		/* AR=0ms */
++	CH_WRITE_4(2,0x14,0x1f);		/* RR=0ms */
++	CH_WRITE_1(2,0x24,0);			/* middle balance */
++
++	CH_WRITE_4(2,0x04,(unsigned int)pcmdata & 0xffff);
++	CH_WRITE_4(2,0x00,0xc000/*PLAY*/|((unsigned int)pcmdata>>16));
++}
++#endif
++
++
++void
++aica_stop()
++{
++	CH_WRITE_4(0,0x00,0x8000);
++	CH_WRITE_4(1,0x00,0x8000);
++	bzero_4((void*)AICA_DMABUF_LEFT, AICA_DMABUF_SIZE);
++	bzero_4((void*)AICA_DMABUF_RIGHT,AICA_DMABUF_SIZE);
++}
++
++
++void
++aica_main()
++{
++	volatile aica_cmd_t *aicacmd = (volatile aica_cmd_t *)AICA_ARM_CMD;
++	int play_state;
++	unsigned int loopend=0,loophalf=0;
++	unsigned int blksize=0,ratepitch;
++	unsigned int cmd,serial;
++
++	aica_init();
++
++	REG_WRITE_4(0x28b4,0x0020);	/* INT Enable to SH4 */
++
++	bzero_4((void*)AICA_DMABUF_LEFT, AICA_DMABUF_SIZE);
++	bzero_4((void*)AICA_DMABUF_RIGHT,AICA_DMABUF_SIZE);
++
++	play_state = 0;
++	serial = aicacmd->serial = 0;
++
++	while (1) {
++		if (serial != aicacmd->serial) {
++			serial = aicacmd->serial;
++			cmd = aicacmd->command;
++			aicacmd->command = AICA_COMMAND_NOP;
++#ifdef DEBUG
++			debugbeep(0);
++#endif
++		} else {
++			cmd = AICA_COMMAND_NOP;
++		}
++
++		switch (cmd) {
++		case AICA_COMMAND_NOP:
++			/*
++			 * AICA_COMMAND_NOP - Idle process
++			 */
++			switch (play_state) {
++			case 0: /* not playing */
++				break;
++			case 1: /* first half */
++				if (in_second_half(loophalf)) {
++					REG_WRITE_4(0x28b8, 0x0020);	/* Send INT to SH4 */
++					play_state = 2;
++				}
++				break;
++			case 2: /* second halt */
++				if (in_first_half(loophalf)) {
++					REG_WRITE_4(0x28b8, 0x0020);	/* Send INT to SH4 */
++					play_state = 1;
++				}
++				break;
++			case 3:
++				if (in_second_half(loophalf)) {
++					aica_stop();
++					play_state = 0;
++				}
++				break;
++			case 4:
++				if (in_first_half(loophalf)) {
++					aica_stop();
++					play_state = 0;
++				}
++				break;
++			}
++			break;
++
++		case AICA_COMMAND_PLAY:
++			blksize = aicacmd->blocksize;
++
++			CH_WRITE_4(0,0x00, 0x8000);
++			CH_WRITE_4(1,0x00, 0x8000);
++
++			switch (aicacmd->precision) {
++			case 16:
++				loopend = blksize;
++				break;
++			case 8:
++				loopend = blksize * 2;
++				break;
++			case 4:
++				loopend = blksize * 4;
++				break;
++			}
++			loophalf = loopend/2;
++
++			ratepitch = rate2reg(aicacmd->rate);
++
++			/* setup left */
++			CH_WRITE_4(0,0x08,0);			/* loop start */
++			CH_WRITE_4(0,0x0c,loopend);		/* loop end */
++			CH_WRITE_4(0,0x18,ratepitch);		/* SamplingRate */
++			CH_WRITE_4(0,0x24,0x0f1f);		/* volume MAX, right PAN */
++
++			/* setup right */
++			CH_WRITE_4(1,0x08,0);			/* loop start */
++			CH_WRITE_4(1,0x0c,loopend);		/* loop end */
++			CH_WRITE_4(1,0x18,ratepitch);		/* SamplingRate */
++			CH_WRITE_4(1,0x24,0x0f0f);		/* volume MAX, right PAN */
++
++			{
++				unsigned int mode;
++
++				if (aicacmd->precision == 4)
++					mode = 3<<7;	/* 4bit ADPCM */
++				else if (aicacmd->precision == 8)
++					mode = 1<<7;	/* 8bit */
++				else
++					mode = 0;	/* 16bit */
++
++				switch (aicacmd->channel) {
++				case 2:
++					CH_WRITE_4(0,0x04, (unsigned int)AICA_DMABUF_LEFT  & 0xffff);
++					CH_WRITE_4(1,0x04, (unsigned int)AICA_DMABUF_RIGHT & 0xffff);
++					{
++						unsigned int lparam,rparam;
++						lparam = 0xc000/*PLAY*/|0x0200/*LOOP*/|mode|((unsigned int)AICA_DMABUF_LEFT>>16);
++						rparam = 0xc000/*PLAY*/|0x0200/*LOOP*/|mode|((unsigned int)AICA_DMABUF_RIGHT>>16);
++						CH_WRITE_4(0,0x00,lparam);
++						CH_WRITE_4(1,0x00,rparam);
++					}
++					break;
++				case 1:
++					CH_WRITE_1(0,0x24, 0);	/* middle balance */
++					CH_WRITE_4(0,0x04, ((unsigned int)AICA_DMABUF_LEFT  & 0xffff));
++					CH_WRITE_4(0,0x00, 0xc000/*PLAY*/|0x0200/*LOOP*/|mode|((unsigned int)AICA_DMABUF_LEFT>>16));
++					break;
++				}
++			}
++			play_state = 1;
++			break;
++
++		case AICA_COMMAND_STOP:
++			switch (play_state) {
++			case 1:
++				bzero_4((void*)(AICA_DMABUF_LEFT+blksize),blksize);
++				bzero_4((void*)(AICA_DMABUF_RIGHT+blksize),blksize);
++				play_state = 3;
++				break;
++			case 2:
++				bzero_4((void*)AICA_DMABUF_LEFT,blksize);
++				bzero_4((void*)AICA_DMABUF_RIGHT,blksize);
++				play_state = 4;
++				break;
++			default:
++				aica_stop();
++				play_state = 0;
++				break;
++			}
++			break;
++
++		case AICA_COMMAND_INIT:
++			aica_stop();
++			play_state = 0;
++			break;
++
++		case AICA_COMMAND_MVOL:
++			REG_WRITE_4(0x2800,L256TO16(aicacmd->l_param));
++			break;
++
++		case AICA_COMMAND_VOL:
++			CH_WRITE_1(0,0x29,255-(aicacmd->l_param & 0xff));
++			CH_WRITE_1(1,0x29,255-(aicacmd->r_param & 0xff));
++			break;
++
++		}
++	}
++}
+Binary files src.orig/sys/arch/dreamcast/dev/g2/microcode/aica_arm.o and src/sys/arch/dreamcast/dev/g2/microcode/aica_arm.o differ
+diff -ruN src.orig/sys/arch/dreamcast/dev/g2/microcode/aica_arm_locore.S src/sys/arch/dreamcast/dev/g2/microcode/aica_arm_locore.S
+--- src.orig/sys/arch/dreamcast/dev/g2/microcode/aica_arm_locore.S	1970-01-01 09:00:00.000000000 +0900
++++ src/sys/arch/dreamcast/dev/g2/microcode/aica_arm_locore.S	2003-08-17 05:44:41.000000000 +0900
+@@ -0,0 +1,74 @@
++/*	$NetBSD$	*/
++
++/*
++ * Copyright (c) 2003 SHIMIZU Ryo <ryo@misakimix.org>
++ * 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. The name of the author may not be used to endorse or promote products
++ *    derived from this software without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 <arm/include/asm.h>
++
++	.text
++	.globl
++
++	b	exp_reset
++	b	exp_undef
++	b	exp_swi
++	b	exp_pabort
++	b	exp_dabort
++	b	exp_reserved
++	b	exp_irq
++/*	b	exp_fiq	*/
++exp_fiq:
++	sub	pc,r14,#4
++
++exp_reset:
++	mov	sp,#0xff00	/* setup stack */
++
++	mrs	r0,CPSR		/* disable interrupt */
++	bic	r0,r0,#0x80
++	bic	r0,r0,#0x40
++	msr	CPSR_all,r0
++
++	bl	_C_LABEL(aica_main)
++
++exp_reserved:
++	b	exp_reserved
++
++exp_irq:
++	sub	pc,r14,#4
++
++exp_dabort:
++	sub	pc,r14,#8
++
++exp_pabort:
++	sub	pc,r14,#4
++
++exp_swi:
++	mov	pc,r14
++
++exp_undef:
++	mov	pc,r14
++
+diff -ruN src.orig/sys/arch/dreamcast/dev/g2/microcode/aica_armcode.h src/sys/arch/dreamcast/dev/g2/microcode/aica_armcode.h
+--- src.orig/sys/arch/dreamcast/dev/g2/microcode/aica_armcode.h	1970-01-01 09:00:00.000000000 +0900
++++ src/sys/arch/dreamcast/dev/g2/microcode/aica_armcode.h	2003-08-17 16:34:36.000000000 +0900
+@@ -0,0 +1,813 @@
++static u_int8_t aica_armcode[] = {
++ /* 0000 */	0x06, 0x00, 0x00, 0xea,
++ /* 0004 */	0x10, 0x00, 0x00, 0xea,
++ /* 0008 */	0x0e, 0x00, 0x00, 0xea,
++ /* 000c */	0x0c, 0x00, 0x00, 0xea,
++ /* 0010 */	0x0a, 0x00, 0x00, 0xea,
++ /* 0014 */	0x07, 0x00, 0x00, 0xea,
++ /* 0018 */	0x07, 0x00, 0x00, 0xea,
++ /* 001c */	0x04, 0xf0, 0x4e, 0xe2,
++ /* 0020 */	0xff, 0xdc, 0xa0, 0xe3,
++ /* 0024 */	0x00, 0x00, 0x0f, 0xe1,
++ /* 0028 */	0x80, 0x00, 0xc0, 0xe3,
++ /* 002c */	0x40, 0x00, 0xc0, 0xe3,
++ /* 0030 */	0x00, 0xf0, 0x29, 0xe1,
++ /* 0034 */	0xaa, 0x00, 0x00, 0xeb,
++ /* 0038 */	0xfe, 0xff, 0xff, 0xea,
++ /* 003c */	0x04, 0xf0, 0x4e, 0xe2,
++ /* 0040 */	0x08, 0xf0, 0x4e, 0xe2,
++ /* 0044 */	0x04, 0xf0, 0x4e, 0xe2,
++ /* 0048 */	0x0e, 0xf0, 0xa0, 0xe1,
++ /* 004c */	0x0e, 0xf0, 0xa0, 0xe1,
++ /* 0050 */	0x70, 0x40, 0x2d, 0xe9,
++ /* 0054 */	0x02, 0x15, 0xa0, 0xe3,
++ /* 0058 */	0x0a, 0x2b, 0x81, 0xe2,
++ /* 005c */	0x00, 0x30, 0xa0, 0xe3,
++ /* 0060 */	0x00, 0x30, 0x82, 0xe5,
++ /* 0064 */	0x03, 0xc0, 0xa0, 0xe1,
++ /* 0068 */	0x01, 0xe0, 0xa0, 0xe1,
++ /* 006c */	0x04, 0x50, 0xa0, 0xe3,
++ /* 0070 */	0x01, 0x50, 0x85, 0xe0,
++ /* 0074 */	0x0c, 0x00, 0xa0, 0xe1,
++ /* 0078 */	0x10, 0x40, 0xa0, 0xe3,
++ /* 007c */	0x01, 0x40, 0x84, 0xe0,
++ /* 0080 */	0x24, 0x60, 0xa0, 0xe3,
++ /* 0084 */	0x02, 0x39, 0xa0, 0xe3,
++ /* 0088 */	0x8c, 0x33, 0x8e, 0xe7,
++ /* 008c */	0x8c, 0x03, 0x85, 0xe7,
++ /* 0090 */	0x08, 0x30, 0xa0, 0xe3,
++ /* 0094 */	0x02, 0x35, 0x83, 0xe2,
++ /* 0098 */	0x8c, 0x03, 0x83, 0xe7,
++ /* 009c */	0x0c, 0x20, 0xa0, 0xe3,
++ /* 00a0 */	0x02, 0x25, 0x82, 0xe2,
++ /* 00a4 */	0x8c, 0x03, 0x82, 0xe7,
++ /* 00a8 */	0x1f, 0x10, 0xa0, 0xe3,
++ /* 00ac */	0x8c, 0x13, 0x84, 0xe7,
++ /* 00b0 */	0x14, 0x30, 0xa0, 0xe3,
++ /* 00b4 */	0x02, 0x35, 0x83, 0xe2,
++ /* 00b8 */	0x8c, 0x13, 0x83, 0xe7,
++ /* 00bc */	0x18, 0x20, 0xa0, 0xe3,
++ /* 00c0 */	0x02, 0x25, 0x82, 0xe2,
++ /* 00c4 */	0x8c, 0x03, 0x82, 0xe7,
++ /* 00c8 */	0x1c, 0x30, 0xa0, 0xe3,
++ /* 00cc */	0x02, 0x35, 0x83, 0xe2,
++ /* 00d0 */	0x8c, 0x03, 0x83, 0xe7,
++ /* 00d4 */	0x20, 0x20, 0xa0, 0xe3,
++ /* 00d8 */	0x02, 0x25, 0x82, 0xe2,
++ /* 00dc */	0x8c, 0x03, 0x82, 0xe7,
++ /* 00e0 */	0x02, 0x15, 0x86, 0xe2,
++ /* 00e4 */	0x8c, 0x03, 0x81, 0xe7,
++ /* 00e8 */	0x28, 0x30, 0xa0, 0xe3,
++ /* 00ec */	0x02, 0x35, 0x83, 0xe2,
++ /* 00f0 */	0x8c, 0x63, 0x83, 0xe7,
++ /* 00f4 */	0x2c, 0x20, 0xa0, 0xe3,
++ /* 00f8 */	0x02, 0x25, 0x82, 0xe2,
++ /* 00fc */	0x8c, 0x03, 0x82, 0xe7,
++ /* 0100 */	0x30, 0x30, 0xa0, 0xe3,
++ /* 0104 */	0x02, 0x35, 0x83, 0xe2,
++ /* 0108 */	0x8c, 0x03, 0x83, 0xe7,
++ /* 010c */	0x34, 0x20, 0xa0, 0xe3,
++ /* 0110 */	0x02, 0x25, 0x82, 0xe2,
++ /* 0114 */	0x8c, 0x03, 0x82, 0xe7,
++ /* 0118 */	0x38, 0x30, 0xa0, 0xe3,
++ /* 011c */	0x02, 0x35, 0x83, 0xe2,
++ /* 0120 */	0x8c, 0x03, 0x83, 0xe7,
++ /* 0124 */	0x3c, 0x20, 0xa0, 0xe3,
++ /* 0128 */	0x02, 0x25, 0x82, 0xe2,
++ /* 012c */	0x8c, 0x03, 0x82, 0xe7,
++ /* 0130 */	0x40, 0x30, 0xa0, 0xe3,
++ /* 0134 */	0x02, 0x35, 0x83, 0xe2,
++ /* 0138 */	0x8c, 0x03, 0x83, 0xe7,
++ /* 013c */	0x44, 0x20, 0xa0, 0xe3,
++ /* 0140 */	0x02, 0x25, 0x82, 0xe2,
++ /* 0144 */	0x8c, 0x03, 0x82, 0xe7,
++ /* 0148 */	0x8c, 0x13, 0xa0, 0xe1,
++ /* 014c */	0x48, 0x30, 0x81, 0xe3,
++ /* 0150 */	0x0e, 0x00, 0x83, 0xe7,
++ /* 0154 */	0x4c, 0x20, 0x81, 0xe3,
++ /* 0158 */	0x0e, 0x00, 0x82, 0xe7,
++ /* 015c */	0x50, 0x30, 0x81, 0xe3,
++ /* 0160 */	0x0e, 0x00, 0x83, 0xe7,
++ /* 0164 */	0x54, 0x20, 0x81, 0xe3,
++ /* 0168 */	0x0e, 0x00, 0x82, 0xe7,
++ /* 016c */	0x58, 0x30, 0x81, 0xe3,
++ /* 0170 */	0x0e, 0x00, 0x83, 0xe7,
++ /* 0174 */	0x5c, 0x20, 0x81, 0xe3,
++ /* 0178 */	0x0e, 0x00, 0x82, 0xe7,
++ /* 017c */	0x60, 0x30, 0x81, 0xe3,
++ /* 0180 */	0x0e, 0x00, 0x83, 0xe7,
++ /* 0184 */	0x64, 0x20, 0x81, 0xe3,
++ /* 0188 */	0x0e, 0x00, 0x82, 0xe7,
++ /* 018c */	0x68, 0x30, 0x81, 0xe3,
++ /* 0190 */	0x0e, 0x00, 0x83, 0xe7,
++ /* 0194 */	0x6c, 0x20, 0x81, 0xe3,
++ /* 0198 */	0x0e, 0x00, 0x82, 0xe7,
++ /* 019c */	0x70, 0x30, 0x81, 0xe3,
++ /* 01a0 */	0x0e, 0x00, 0x83, 0xe7,
++ /* 01a4 */	0x74, 0x20, 0x81, 0xe3,
++ /* 01a8 */	0x0e, 0x00, 0x82, 0xe7,
++ /* 01ac */	0x78, 0x30, 0x81, 0xe3,
++ /* 01b0 */	0x0e, 0x00, 0x83, 0xe7,
++ /* 01b4 */	0x7c, 0x10, 0x81, 0xe3,
++ /* 01b8 */	0x0e, 0x00, 0x81, 0xe7,
++ /* 01bc */	0x01, 0xc0, 0x8c, 0xe2,
++ /* 01c0 */	0x3f, 0x00, 0x5c, 0xe3,
++ /* 01c4 */	0xae, 0xff, 0xff, 0xda,
++ /* 01c8 */	0x02, 0x35, 0xa0, 0xe3,
++ /* 01cc */	0x0a, 0x3b, 0x83, 0xe2,
++ /* 01d0 */	0x0f, 0x20, 0xa0, 0xe3,
++ /* 01d4 */	0x00, 0x20, 0x83, 0xe5,
++ /* 01d8 */	0x70, 0x80, 0xbd, 0xe8,
++ /* 01dc */	0x10, 0x40, 0x2d, 0xe9,
++ /* 01e0 */	0x56, 0xc8, 0xa0, 0xe3,
++ /* 01e4 */	0x22, 0xcc, 0x8c, 0xe2,
++ /* 01e8 */	0x07, 0x40, 0xa0, 0xe3,
++ /* 01ec */	0x0c, 0x00, 0x50, 0xe1,
++ /* 01f0 */	0x09, 0x00, 0x00, 0x2a,
++ /* 01f4 */	0xac, 0xc0, 0xa0, 0xe1,
++ /* 01f8 */	0x01, 0x40, 0x44, 0xe2,
++ /* 01fc */	0x08, 0x00, 0x74, 0xe3,
++ /* 0200 */	0x00, 0x30, 0xa0, 0xb3,
++ /* 0204 */	0x01, 0x30, 0xa0, 0xa3,
++ /* 0208 */	0x0c, 0x00, 0x50, 0xe1,
++ /* 020c */	0x00, 0x30, 0xa0, 0x23,
++ /* 0210 */	0x01, 0x30, 0x03, 0x32,
++ /* 0214 */	0x00, 0x00, 0x53, 0xe3,
++ /* 0218 */	0xf5, 0xff, 0xff, 0x1a,
++ /* 021c */	0x0c, 0x00, 0x50, 0xe1,
++ /* 0220 */	0x84, 0x05, 0xa0, 0x31,
++ /* 0224 */	0x3e, 0x0b, 0x00, 0x32,
++ /* 0228 */	0x10, 0x80, 0xbd, 0x38,
++ /* 022c */	0x00, 0x00, 0x6c, 0xe0,
++ /* 0230 */	0xac, 0x30, 0xa0, 0xe1,
++ /* 0234 */	0x00, 0x35, 0x83, 0xe0,
++ /* 0238 */	0x00, 0xe0, 0xa0, 0xe3,
++ /* 023c */	0x0c, 0x00, 0x53, 0xe1,
++ /* 0240 */	0x03, 0x00, 0x00, 0x3a,
++ /* 0244 */	0x03, 0x30, 0x6c, 0xe0,
++ /* 0248 */	0x01, 0xe0, 0x8e, 0xe2,
++ /* 024c */	0x0c, 0x00, 0x53, 0xe1,
++ /* 0250 */	0xfb, 0xff, 0xff, 0x2a,
++ /* 0254 */	0x01, 0x0b, 0x5e, 0xe3,
++ /* 0258 */	0x01, 0x40, 0x84, 0x02,
++ /* 025c */	0x00, 0xe0, 0xa0, 0x03,
++ /* 0260 */	0x1b, 0x00, 0x00, 0x0a,
++ /* 0264 */	0x9e, 0x0c, 0x01, 0xe0,
++ /* 0268 */	0xff, 0x2f, 0xa0, 0xe3,
++ /* 026c */	0x02, 0x20, 0x82, 0xe2,
++ /* 0270 */	0x21, 0x05, 0x50, 0xe1,
++ /* 0274 */	0x00, 0x30, 0xa0, 0x93,
++ /* 0278 */	0x01, 0x30, 0xa0, 0x83,
++ /* 027c */	0x02, 0x00, 0x5e, 0xe1,
++ /* 0280 */	0x00, 0x30, 0xa0, 0x83,
++ /* 0284 */	0x01, 0x30, 0x03, 0x92,
++ /* 0288 */	0x00, 0x00, 0x53, 0xe3,
++ /* 028c */	0x04, 0x00, 0x00, 0x0a,
++ /* 0290 */	0x01, 0x20, 0x8e, 0xe2,
++ /* 0294 */	0x92, 0x0c, 0x03, 0xe0,
++ /* 0298 */	0x23, 0x05, 0x50, 0xe1,
++ /* 029c */	0x02, 0xe0, 0xa0, 0x01,
++ /* 02a0 */	0x0b, 0x00, 0x00, 0x0a,
++ /* 02a4 */	0x21, 0x05, 0x50, 0xe1,
++ /* 02a8 */	0x00, 0x30, 0xa0, 0x23,
++ /* 02ac */	0x01, 0x30, 0xa0, 0x33,
++ /* 02b0 */	0x00, 0x00, 0x5e, 0xe3,
++ /* 02b4 */	0x00, 0x30, 0xa0, 0x03,
++ /* 02b8 */	0x01, 0x30, 0x03, 0x12,
++ /* 02bc */	0x00, 0x00, 0x53, 0xe3,
++ /* 02c0 */	0x03, 0x00, 0x00, 0x0a,
++ /* 02c4 */	0x01, 0x20, 0x4e, 0xe2,
++ /* 02c8 */	0x92, 0x0c, 0x03, 0xe0,
++ /* 02cc */	0x23, 0x05, 0x50, 0xe1,
++ /* 02d0 */	0x02, 0xe0, 0xa0, 0x01,
++ /* 02d4 */	0x84, 0x05, 0xa0, 0xe1,
++ /* 02d8 */	0x3e, 0x0b, 0x00, 0xe2,
++ /* 02dc */	0x0e, 0x00, 0x80, 0xe0,
++ /* 02e0 */	0x10, 0x80, 0xbd, 0xe8,
++ /* 02e4 */	0x0d, 0xc0, 0xa0, 0xe1,
++ /* 02e8 */	0xf0, 0xdf, 0x2d, 0xe9,
++ /* 02ec */	0x04, 0xb0, 0x4c, 0xe2,
++ /* 02f0 */	0x0c, 0xd0, 0x4d, 0xe2,
++ /* 02f4 */	0x55, 0xff, 0xff, 0xeb,
++ /* 02f8 */	0xa2, 0x3d, 0xa0, 0xe3,
++ /* 02fc */	0x34, 0x30, 0x83, 0xe2,
++ /* 0300 */	0x02, 0x35, 0x83, 0xe2,
++ /* 0304 */	0x20, 0x20, 0xa0, 0xe3,
++ /* 0308 */	0x00, 0x20, 0x83, 0xe5,
++ /* 030c */	0x00, 0xa0, 0xa0, 0xe3,
++ /* 0310 */	0x0a, 0x80, 0xa0, 0xe1,
++ /* 0314 */	0x01, 0x38, 0xa0, 0xe3,
++ /* 0318 */	0xff, 0x4c, 0xa0, 0xe3,
++ /* 031c */	0xc0, 0x10, 0x84, 0xe3,
++ /* 0320 */	0x08, 0x20, 0xa0, 0xe1,
++ /* 0324 */	0x2c, 0xa0, 0x0b, 0xe5,
++ /* 0328 */	0x00, 0x20, 0x83, 0xe5,
++ /* 032c */	0x01, 0x20, 0x83, 0xe5,
++ /* 0330 */	0x02, 0x20, 0x83, 0xe5,
++ /* 0334 */	0x03, 0x20, 0x83, 0xe5,
++ /* 0338 */	0x04, 0x30, 0x83, 0xe2,
++ /* 033c */	0x10, 0x10, 0x51, 0xe2,
++ /* 0340 */	0xf8, 0xff, 0xff, 0x1a,
++ /* 0344 */	0x02, 0x28, 0xa0, 0xe3,
++ /* 0348 */	0xff, 0x3c, 0xa0, 0xe3,
++ /* 034c */	0xc0, 0x30, 0x83, 0xe2,
++ /* 0350 */	0x00, 0x10, 0xa0, 0xe3,
++ /* 0354 */	0x00, 0x10, 0x82, 0xe5,
++ /* 0358 */	0x01, 0x10, 0x82, 0xe5,
++ /* 035c */	0x02, 0x10, 0x82, 0xe5,
++ /* 0360 */	0x03, 0x10, 0x82, 0xe5,
++ /* 0364 */	0x04, 0x20, 0x82, 0xe2,
++ /* 0368 */	0x10, 0x30, 0x53, 0xe2,
++ /* 036c */	0xf8, 0xff, 0xff, 0x1a,
++ /* 0370 */	0x00, 0x00, 0xa0, 0xe3,
++ /* 0374 */	0x00, 0x00, 0x84, 0xe5,
++ /* 0378 */	0x00, 0x20, 0x94, 0xe5,
++ /* 037c */	0x00, 0x50, 0xa0, 0xe1,
++ /* 0380 */	0x0a, 0x7b, 0xa0, 0xe3,
++ /* 0384 */	0x0d, 0x70, 0x87, 0xe2,
++ /* 0388 */	0x02, 0x75, 0x87, 0xe2,
++ /* 038c */	0x02, 0x95, 0xa0, 0xe3,
++ /* 0390 */	0x02, 0x69, 0xa0, 0xe3,
++ /* 0394 */	0x30, 0x20, 0x0b, 0xe5,
++ /* 0398 */	0x00, 0x30, 0x94, 0xe5,
++ /* 039c */	0x30, 0x20, 0x1b, 0xe5,
++ /* 03a0 */	0x03, 0x00, 0x52, 0xe1,
++ /* 03a4 */	0x04, 0x00, 0x00, 0x0a,
++ /* 03a8 */	0x00, 0x30, 0x94, 0xe5,
++ /* 03ac */	0x30, 0x30, 0x0b, 0xe5,
++ /* 03b0 */	0x04, 0x30, 0x94, 0xe5,
++ /* 03b4 */	0x04, 0x50, 0x84, 0xe5,
++ /* 03b8 */	0x00, 0x00, 0x00, 0xea,
++ /* 03bc */	0x00, 0x30, 0xa0, 0xe3,
++ /* 03c0 */	0x05, 0x00, 0x53, 0xe3,
++ /* 03c4 */	0x03, 0xf1, 0x9f, 0x97,
++ /* 03c8 */	0xcd, 0x01, 0x00, 0xea,
++ /* 03cc */	0xe4, 0x03, 0x00, 0x00,
++ /* 03d0 */	0x1c, 0x06, 0x00, 0x00,
++ /* 03d4 */	0x78, 0x07, 0x00, 0x00,
++ /* 03d8 */	0x10, 0x0a, 0x00, 0x00,
++ /* 03dc */	0xc0, 0x0a, 0x00, 0x00,
++ /* 03e0 */	0xdc, 0x0a, 0x00, 0x00,
++ /* 03e4 */	0x04, 0x00, 0x50, 0xe3,
++ /* 03e8 */	0x00, 0xf1, 0x9f, 0x97,
++ /* 03ec */	0x89, 0x00, 0x00, 0xea,
++ /* 03f0 */	0x98, 0x03, 0x00, 0x00,
++ /* 03f4 */	0x04, 0x04, 0x00, 0x00,
++ /* 03f8 */	0x40, 0x04, 0x00, 0x00,
++ /* 03fc */	0x7c, 0x04, 0x00, 0x00,
++ /* 0400 */	0x4c, 0x05, 0x00, 0x00,
++ /* 0404 */	0x00, 0x50, 0xc7, 0xe5,
++ /* 0408 */	0x0a, 0x3b, 0xa0, 0xe3,
++ /* 040c */	0x14, 0x30, 0x83, 0xe2,
++ /* 0410 */	0x02, 0x35, 0x83, 0xe2,
++ /* 0414 */	0x00, 0x20, 0x93, 0xe5,
++ /* 0418 */	0x2c, 0x30, 0x1b, 0xe5,
++ /* 041c */	0x03, 0x00, 0x52, 0xe1,
++ /* 0420 */	0xdc, 0xff, 0xff, 0x3a,
++ /* 0424 */	0xa2, 0x3d, 0xa0, 0xe3,
++ /* 0428 */	0x38, 0x30, 0x83, 0xe2,
++ /* 042c */	0x02, 0x35, 0x83, 0xe2,
++ /* 0430 */	0x20, 0x20, 0xa0, 0xe3,
++ /* 0434 */	0x00, 0x20, 0x83, 0xe5,
++ /* 0438 */	0x02, 0x00, 0xa0, 0xe3,
++ /* 043c */	0xd5, 0xff, 0xff, 0xea,
++ /* 0440 */	0x00, 0x50, 0xc7, 0xe5,
++ /* 0444 */	0x0a, 0x3b, 0xa0, 0xe3,
++ /* 0448 */	0x14, 0x30, 0x83, 0xe2,
++ /* 044c */	0x02, 0x35, 0x83, 0xe2,
++ /* 0450 */	0x00, 0x20, 0x93, 0xe5,
++ /* 0454 */	0x2c, 0x30, 0x1b, 0xe5,
++ /* 0458 */	0x03, 0x00, 0x52, 0xe1,
++ /* 045c */	0xcd, 0xff, 0xff, 0x2a,
++ /* 0460 */	0xa2, 0x3d, 0xa0, 0xe3,
++ /* 0464 */	0x38, 0x30, 0x83, 0xe2,
++ /* 0468 */	0x02, 0x35, 0x83, 0xe2,
++ /* 046c */	0x20, 0x20, 0xa0, 0xe3,
++ /* 0470 */	0x00, 0x20, 0x83, 0xe5,
++ /* 0474 */	0x01, 0x00, 0xa0, 0xe3,
++ /* 0478 */	0xc6, 0xff, 0xff, 0xea,
++ /* 047c */	0x00, 0x50, 0xc7, 0xe5,
++ /* 0480 */	0x0a, 0x3b, 0xa0, 0xe3,
++ /* 0484 */	0x14, 0x30, 0x83, 0xe2,
++ /* 0488 */	0x02, 0x35, 0x83, 0xe2,
++ /* 048c */	0x00, 0x20, 0x93, 0xe5,
++ /* 0490 */	0x2c, 0x30, 0x1b, 0xe5,
++ /* 0494 */	0x03, 0x00, 0x52, 0xe1,
++ /* 0498 */	0xbe, 0xff, 0xff, 0x3a,
++ /* 049c */	0x00, 0x60, 0x89, 0xe5,
++ /* 04a0 */	0x80, 0x30, 0xa0, 0xe3,
++ /* 04a4 */	0x02, 0x35, 0x83, 0xe2,
++ /* 04a8 */	0x00, 0x60, 0x83, 0xe5,
++ /* 04ac */	0x01, 0x28, 0xa0, 0xe3,
++ /* 04b0 */	0xff, 0x0c, 0xa0, 0xe3,
++ /* 04b4 */	0xc0, 0x00, 0x80, 0xe2,
++ /* 04b8 */	0x00, 0x30, 0xa0, 0xe3,
++ /* 04bc */	0x00, 0x30, 0x82, 0xe5,
++ /* 04c0 */	0x01, 0x30, 0x82, 0xe5,
++ /* 04c4 */	0x02, 0x30, 0x82, 0xe5,
++ /* 04c8 */	0x03, 0x30, 0x82, 0xe5,
++ /* 04cc */	0x04, 0x30, 0x82, 0xe5,
++ /* 04d0 */	0x05, 0x30, 0x82, 0xe5,
++ /* 04d4 */	0x06, 0x30, 0x82, 0xe5,
++ /* 04d8 */	0x07, 0x30, 0x82, 0xe5,
++ /* 04dc */	0x08, 0x30, 0x82, 0xe5,
++ /* 04e0 */	0x09, 0x30, 0x82, 0xe5,
++ /* 04e4 */	0x0a, 0x30, 0x82, 0xe5,
++ /* 04e8 */	0x0b, 0x30, 0x82, 0xe5,
++ /* 04ec */	0x0c, 0x20, 0x82, 0xe2,
++ /* 04f0 */	0x30, 0x00, 0x50, 0xe2,
++ /* 04f4 */	0xf0, 0xff, 0xff, 0x1a,
++ /* 04f8 */	0x02, 0x28, 0xa0, 0xe3,
++ /* 04fc */	0xff, 0x1c, 0xa0, 0xe3,
++ /* 0500 */	0xc0, 0x10, 0x81, 0xe2,
++ /* 0504 */	0x00, 0x30, 0xa0, 0xe1,
++ /* 0508 */	0x00, 0x30, 0x82, 0xe5,
++ /* 050c */	0x01, 0x30, 0x82, 0xe5,
++ /* 0510 */	0x02, 0x30, 0x82, 0xe5,
++ /* 0514 */	0x03, 0x30, 0x82, 0xe5,
++ /* 0518 */	0x04, 0x30, 0x82, 0xe5,
++ /* 051c */	0x05, 0x30, 0x82, 0xe5,
++ /* 0520 */	0x06, 0x30, 0x82, 0xe5,
++ /* 0524 */	0x07, 0x30, 0x82, 0xe5,
++ /* 0528 */	0x08, 0x30, 0x82, 0xe5,
++ /* 052c */	0x09, 0x30, 0x82, 0xe5,
++ /* 0530 */	0x0a, 0x30, 0x82, 0xe5,
++ /* 0534 */	0x0b, 0x30, 0x82, 0xe5,
++ /* 0538 */	0x0c, 0x20, 0x82, 0xe2,
++ /* 053c */	0x30, 0x10, 0x51, 0xe2,
++ /* 0540 */	0xf0, 0xff, 0xff, 0x1a,
++ /* 0544 */	0x01, 0x00, 0xa0, 0xe1,
++ /* 0548 */	0x92, 0xff, 0xff, 0xea,
++ /* 054c */	0x00, 0x50, 0xc7, 0xe5,
++ /* 0550 */	0x0a, 0x3b, 0xa0, 0xe3,
++ /* 0554 */	0x14, 0x30, 0x83, 0xe2,
++ /* 0558 */	0x02, 0x35, 0x83, 0xe2,
++ /* 055c */	0x00, 0x20, 0x93, 0xe5,
++ /* 0560 */	0x2c, 0x30, 0x1b, 0xe5,
++ /* 0564 */	0x03, 0x00, 0x52, 0xe1,
++ /* 0568 */	0x8a, 0xff, 0xff, 0x2a,
++ /* 056c */	0x00, 0x60, 0x89, 0xe5,
++ /* 0570 */	0x80, 0x30, 0xa0, 0xe3,
++ /* 0574 */	0x02, 0x35, 0x83, 0xe2,
++ /* 0578 */	0x00, 0x60, 0x83, 0xe5,
++ /* 057c */	0x01, 0x28, 0xa0, 0xe3,
++ /* 0580 */	0xff, 0x0c, 0xa0, 0xe3,
++ /* 0584 */	0xc0, 0x00, 0x80, 0xe2,
++ /* 0588 */	0x00, 0x30, 0xa0, 0xe3,
++ /* 058c */	0x00, 0x30, 0x82, 0xe5,
++ /* 0590 */	0x01, 0x30, 0x82, 0xe5,
++ /* 0594 */	0x02, 0x30, 0x82, 0xe5,
++ /* 0598 */	0x03, 0x30, 0x82, 0xe5,
++ /* 059c */	0x04, 0x30, 0x82, 0xe5,
++ /* 05a0 */	0x05, 0x30, 0x82, 0xe5,
++ /* 05a4 */	0x06, 0x30, 0x82, 0xe5,
++ /* 05a8 */	0x07, 0x30, 0x82, 0xe5,
++ /* 05ac */	0x08, 0x30, 0x82, 0xe5,
++ /* 05b0 */	0x09, 0x30, 0x82, 0xe5,
++ /* 05b4 */	0x0a, 0x30, 0x82, 0xe5,
++ /* 05b8 */	0x0b, 0x30, 0x82, 0xe5,
++ /* 05bc */	0x0c, 0x20, 0x82, 0xe2,
++ /* 05c0 */	0x30, 0x00, 0x50, 0xe2,
++ /* 05c4 */	0xf0, 0xff, 0xff, 0x1a,
++ /* 05c8 */	0x02, 0x28, 0xa0, 0xe3,
++ /* 05cc */	0xff, 0x1c, 0xa0, 0xe3,
++ /* 05d0 */	0xc0, 0x10, 0x81, 0xe2,
++ /* 05d4 */	0x00, 0x30, 0xa0, 0xe1,
++ /* 05d8 */	0x00, 0x30, 0x82, 0xe5,
++ /* 05dc */	0x01, 0x30, 0x82, 0xe5,
++ /* 05e0 */	0x02, 0x30, 0x82, 0xe5,
++ /* 05e4 */	0x03, 0x30, 0x82, 0xe5,
++ /* 05e8 */	0x04, 0x30, 0x82, 0xe5,
++ /* 05ec */	0x05, 0x30, 0x82, 0xe5,
++ /* 05f0 */	0x06, 0x30, 0x82, 0xe5,
++ /* 05f4 */	0x07, 0x30, 0x82, 0xe5,
++ /* 05f8 */	0x08, 0x30, 0x82, 0xe5,
++ /* 05fc */	0x09, 0x30, 0x82, 0xe5,
++ /* 0600 */	0x0a, 0x30, 0x82, 0xe5,
++ /* 0604 */	0x0b, 0x30, 0x82, 0xe5,
++ /* 0608 */	0x0c, 0x20, 0x82, 0xe2,
++ /* 060c */	0x30, 0x10, 0x51, 0xe2,
++ /* 0610 */	0xf0, 0xff, 0xff, 0x1a,
++ /* 0614 */	0x01, 0x00, 0xa0, 0xe1,
++ /* 0618 */	0x5e, 0xff, 0xff, 0xea,
++ /* 061c */	0x08, 0x80, 0x94, 0xe5,
++ /* 0620 */	0x00, 0x60, 0x89, 0xe5,
++ /* 0624 */	0x80, 0x30, 0xa0, 0xe3,
++ /* 0628 */	0x02, 0x35, 0x83, 0xe2,
++ /* 062c */	0x00, 0x60, 0x83, 0xe5,
++ /* 0630 */	0x14, 0x30, 0x94, 0xe5,
++ /* 0634 */	0x08, 0x00, 0x53, 0xe3,
++ /* 0638 */	0x06, 0x00, 0x00, 0x0a,
++ /* 063c */	0x02, 0x00, 0x00, 0x8a,
++ /* 0640 */	0x04, 0x00, 0x53, 0xe3,
++ /* 0644 */	0x05, 0x00, 0x00, 0x0a,
++ /* 0648 */	0x05, 0x00, 0x00, 0xea,
++ /* 064c */	0x10, 0x00, 0x53, 0xe3,
++ /* 0650 */	0x08, 0xa0, 0xa0, 0x01,
++ /* 0654 */	0x02, 0x00, 0x00, 0xea,
++ /* 0658 */	0x88, 0xa0, 0xa0, 0xe1,
++ /* 065c */	0x00, 0x00, 0x00, 0xea,
++ /* 0660 */	0x08, 0xa1, 0xa0, 0xe1,
++ /* 0664 */	0x10, 0x00, 0x94, 0xe5,
++ /* 0668 */	0xdb, 0xfe, 0xff, 0xeb,
++ /* 066c */	0x08, 0x30, 0xa0, 0xe3,
++ /* 0670 */	0x02, 0x35, 0x83, 0xe2,
++ /* 0674 */	0x00, 0x50, 0x83, 0xe5,
++ /* 0678 */	0x0c, 0x20, 0xa0, 0xe3,
++ /* 067c */	0x02, 0x25, 0x82, 0xe2,
++ /* 0680 */	0x00, 0xa0, 0x82, 0xe5,
++ /* 0684 */	0x18, 0x30, 0xa0, 0xe3,
++ /* 0688 */	0x02, 0x35, 0x83, 0xe2,
++ /* 068c */	0x00, 0x00, 0x83, 0xe5,
++ /* 0690 */	0x24, 0x10, 0xa0, 0xe3,
++ /* 0694 */	0x02, 0x15, 0x81, 0xe2,
++ /* 0698 */	0xf1, 0x3e, 0xa0, 0xe3,
++ /* 069c */	0x0f, 0x30, 0x83, 0xe2,
++ /* 06a0 */	0x00, 0x30, 0x81, 0xe5,
++ /* 06a4 */	0x88, 0x20, 0xa0, 0xe3,
++ /* 06a8 */	0x02, 0x25, 0x82, 0xe2,
++ /* 06ac */	0x00, 0x50, 0x82, 0xe5,
++ /* 06b0 */	0x8c, 0x30, 0xa0, 0xe3,
++ /* 06b4 */	0x02, 0x35, 0x83, 0xe2,
++ /* 06b8 */	0x00, 0xa0, 0x83, 0xe5,
++ /* 06bc */	0x98, 0x20, 0xa0, 0xe3,
++ /* 06c0 */	0x02, 0x25, 0x82, 0xe2,
++ /* 06c4 */	0x00, 0x00, 0x82, 0xe5,
++ /* 06c8 */	0xa4, 0x10, 0xa0, 0xe3,
++ /* 06cc */	0x02, 0x15, 0x81, 0xe2,
++ /* 06d0 */	0x0f, 0x3c, 0xa0, 0xe3,
++ /* 06d4 */	0x0f, 0x30, 0x83, 0xe2,
++ /* 06d8 */	0x00, 0x30, 0x81, 0xe5,
++ /* 06dc */	0x14, 0x20, 0x94, 0xe5,
++ /* 06e0 */	0xaa, 0x30, 0xa0, 0xe1,
++ /* 06e4 */	0x2c, 0x30, 0x0b, 0xe5,
++ /* 06e8 */	0x04, 0x00, 0x52, 0xe3,
++ /* 06ec */	0x06, 0x1d, 0xa0, 0x03,
++ /* 06f0 */	0x03, 0x00, 0x00, 0x0a,
++ /* 06f4 */	0x14, 0x30, 0x94, 0xe5,
++ /* 06f8 */	0x08, 0x00, 0x53, 0xe3,
++ /* 06fc */	0x80, 0x10, 0xa0, 0x03,
++ /* 0700 */	0x00, 0x10, 0xa0, 0x13,
++ /* 0704 */	0x0c, 0x30, 0x94, 0xe5,
++ /* 0708 */	0x01, 0x00, 0x53, 0xe3,
++ /* 070c */	0x0f, 0x00, 0x00, 0x0a,
++ /* 0710 */	0x02, 0x00, 0x53, 0xe3,
++ /* 0714 */	0x56, 0xff, 0xff, 0x1a,
++ /* 0718 */	0x04, 0x30, 0xa0, 0xe3,
++ /* 071c */	0x02, 0x35, 0x83, 0xe2,
++ /* 0720 */	0x00, 0x50, 0x83, 0xe5,
++ /* 0724 */	0x84, 0x20, 0xa0, 0xe3,
++ /* 0728 */	0x02, 0x25, 0x82, 0xe2,
++ /* 072c */	0x00, 0x50, 0x82, 0xe5,
++ /* 0730 */	0xc2, 0x3c, 0x81, 0xe3,
++ /* 0734 */	0x01, 0x30, 0x83, 0xe3,
++ /* 0738 */	0x00, 0x30, 0x89, 0xe5,
++ /* 073c */	0xc2, 0x2c, 0x81, 0xe3,
++ /* 0740 */	0x02, 0x20, 0x82, 0xe3,
++ /* 0744 */	0x80, 0x30, 0xa0, 0xe3,
++ /* 0748 */	0x02, 0x35, 0x83, 0xe2,
++ /* 074c */	0x47, 0xff, 0xff, 0xea,
++ /* 0750 */	0x24, 0x30, 0xa0, 0xe3,
++ /* 0754 */	0x02, 0x35, 0x83, 0xe2,
++ /* 0758 */	0x00, 0x50, 0xc3, 0xe5,
++ /* 075c */	0x04, 0x20, 0xa0, 0xe3,
++ /* 0760 */	0x02, 0x25, 0x82, 0xe2,
++ /* 0764 */	0x00, 0x50, 0x82, 0xe5,
++ /* 0768 */	0xc2, 0x3c, 0x81, 0xe3,
++ /* 076c */	0x01, 0x30, 0x83, 0xe3,
++ /* 0770 */	0x00, 0x30, 0x89, 0xe5,
++ /* 0774 */	0x3e, 0xff, 0xff, 0xea,
++ /* 0778 */	0x01, 0x00, 0x50, 0xe3,
++ /* 077c */	0x02, 0x00, 0x00, 0x0a,
++ /* 0780 */	0x02, 0x00, 0x50, 0xe3,
++ /* 0784 */	0x3b, 0x00, 0x00, 0x0a,
++ /* 0788 */	0x74, 0x00, 0x00, 0xea,
++ /* 078c */	0x01, 0x28, 0x88, 0xe2,
++ /* 0790 */	0x03, 0x30, 0x88, 0xe2,
++ /* 0794 */	0x03, 0x10, 0xd3, 0xe3,
++ /* 0798 */	0x03, 0xc0, 0xa0, 0xe1,
++ /* 079c */	0x02, 0xe8, 0x88, 0xe2,
++ /* 07a0 */	0x17, 0x00, 0x00, 0x0a,
++ /* 07a4 */	0x00, 0x00, 0xa0, 0xe3,
++ /* 07a8 */	0x00, 0x30, 0x61, 0xe2,
++ /* 07ac */	0x0f, 0x30, 0x13, 0xe2,
++ /* 07b0 */	0x0c, 0x00, 0x00, 0x0a,
++ /* 07b4 */	0x0c, 0x00, 0x53, 0xe3,
++ /* 07b8 */	0x07, 0x00, 0x00, 0xaa,
++ /* 07bc */	0x08, 0x00, 0x53, 0xe3,
++ /* 07c0 */	0x03, 0x00, 0x00, 0xaa,
++ /* 07c4 */	0x03, 0x00, 0x53, 0xe3,
++ /* 07c8 */	0x06, 0x00, 0x00, 0xda,
++ /* 07cc */	0x01, 0x00, 0x82, 0xe4,
++ /* 07d0 */	0x04, 0x10, 0x41, 0xe2,
++ /* 07d4 */	0x01, 0x00, 0x82, 0xe4,
++ /* 07d8 */	0x04, 0x10, 0x41, 0xe2,
++ /* 07dc */	0x01, 0x00, 0x82, 0xe4,
++ /* 07e0 */	0x04, 0x10, 0x51, 0xe2,
++ /* 07e4 */	0x06, 0x00, 0x00, 0x0a,
++ /* 07e8 */	0x00, 0x00, 0x82, 0xe5,
++ /* 07ec */	0x01, 0x00, 0x82, 0xe5,
++ /* 07f0 */	0x02, 0x00, 0x82, 0xe5,
++ /* 07f4 */	0x03, 0x00, 0x82, 0xe5,
++ /* 07f8 */	0x04, 0x20, 0x82, 0xe2,
++ /* 07fc */	0x10, 0x10, 0x51, 0xe2,
++ /* 0800 */	0xf8, 0xff, 0xff, 0x1a,
++ /* 0804 */	0x0e, 0x20, 0xa0, 0xe1,
++ /* 0808 */	0x03, 0x10, 0xdc, 0xe3,
++ /* 080c */	0x17, 0x00, 0x00, 0x0a,
++ /* 0810 */	0x00, 0x00, 0xa0, 0xe3,
++ /* 0814 */	0x00, 0x30, 0x61, 0xe2,
++ /* 0818 */	0x0f, 0x30, 0x13, 0xe2,
++ /* 081c */	0x0c, 0x00, 0x00, 0x0a,
++ /* 0820 */	0x0c, 0x00, 0x53, 0xe3,
++ /* 0824 */	0x07, 0x00, 0x00, 0xaa,
++ /* 0828 */	0x08, 0x00, 0x53, 0xe3,
++ /* 082c */	0x03, 0x00, 0x00, 0xaa,
++ /* 0830 */	0x03, 0x00, 0x53, 0xe3,
++ /* 0834 */	0x06, 0x00, 0x00, 0xda,
++ /* 0838 */	0x01, 0x00, 0x82, 0xe4,
++ /* 083c */	0x04, 0x10, 0x41, 0xe2,
++ /* 0840 */	0x01, 0x00, 0x82, 0xe4,
++ /* 0844 */	0x04, 0x10, 0x41, 0xe2,
++ /* 0848 */	0x01, 0x00, 0x82, 0xe4,
++ /* 084c */	0x04, 0x10, 0x51, 0xe2,
++ /* 0850 */	0x06, 0x00, 0x00, 0x0a,
++ /* 0854 */	0x00, 0x00, 0x82, 0xe5,
++ /* 0858 */	0x01, 0x00, 0x82, 0xe5,
++ /* 085c */	0x02, 0x00, 0x82, 0xe5,
++ /* 0860 */	0x03, 0x00, 0x82, 0xe5,
++ /* 0864 */	0x04, 0x20, 0x82, 0xe2,
++ /* 0868 */	0x10, 0x10, 0x51, 0xe2,
++ /* 086c */	0xf8, 0xff, 0xff, 0x1a,
++ /* 0870 */	0x03, 0x00, 0xa0, 0xe3,
++ /* 0874 */	0xc7, 0xfe, 0xff, 0xea,
++ /* 0878 */	0x01, 0x18, 0xa0, 0xe3,
++ /* 087c */	0x03, 0x30, 0x88, 0xe2,
++ /* 0880 */	0x03, 0x20, 0xd3, 0xe3,
++ /* 0884 */	0x17, 0x00, 0x00, 0x0a,
++ /* 0888 */	0x00, 0x00, 0xa0, 0xe3,
++ /* 088c */	0x00, 0x30, 0x62, 0xe2,
++ /* 0890 */	0x0f, 0x30, 0x13, 0xe2,
++ /* 0894 */	0x0c, 0x00, 0x00, 0x0a,
++ /* 0898 */	0x0c, 0x00, 0x53, 0xe3,
++ /* 089c */	0x07, 0x00, 0x00, 0xaa,
++ /* 08a0 */	0x08, 0x00, 0x53, 0xe3,
++ /* 08a4 */	0x03, 0x00, 0x00, 0xaa,
++ /* 08a8 */	0x03, 0x00, 0x53, 0xe3,
++ /* 08ac */	0x06, 0x00, 0x00, 0xda,
++ /* 08b0 */	0x01, 0x00, 0x81, 0xe4,
++ /* 08b4 */	0x04, 0x20, 0x42, 0xe2,
++ /* 08b8 */	0x01, 0x00, 0x81, 0xe4,
++ /* 08bc */	0x04, 0x20, 0x42, 0xe2,
++ /* 08c0 */	0x01, 0x00, 0x81, 0xe4,
++ /* 08c4 */	0x04, 0x20, 0x52, 0xe2,
++ /* 08c8 */	0x06, 0x00, 0x00, 0x0a,
++ /* 08cc */	0x00, 0x00, 0x81, 0xe5,
++ /* 08d0 */	0x01, 0x00, 0x81, 0xe5,
++ /* 08d4 */	0x02, 0x00, 0x81, 0xe5,
++ /* 08d8 */	0x03, 0x00, 0x81, 0xe5,
++ /* 08dc */	0x04, 0x10, 0x81, 0xe2,
++ /* 08e0 */	0x10, 0x20, 0x52, 0xe2,
++ /* 08e4 */	0xf8, 0xff, 0xff, 0x1a,
++ /* 08e8 */	0x02, 0x18, 0xa0, 0xe3,
++ /* 08ec */	0x03, 0x30, 0x88, 0xe2,
++ /* 08f0 */	0x03, 0x20, 0xd3, 0xe3,
++ /* 08f4 */	0x17, 0x00, 0x00, 0x0a,
++ /* 08f8 */	0x00, 0x00, 0xa0, 0xe3,
++ /* 08fc */	0x00, 0x30, 0x62, 0xe2,
++ /* 0900 */	0x0f, 0x30, 0x13, 0xe2,
++ /* 0904 */	0x0c, 0x00, 0x00, 0x0a,
++ /* 0908 */	0x0c, 0x00, 0x53, 0xe3,
++ /* 090c */	0x07, 0x00, 0x00, 0xaa,
++ /* 0910 */	0x08, 0x00, 0x53, 0xe3,
++ /* 0914 */	0x03, 0x00, 0x00, 0xaa,
++ /* 0918 */	0x03, 0x00, 0x53, 0xe3,
++ /* 091c */	0x06, 0x00, 0x00, 0xda,
++ /* 0920 */	0x01, 0x00, 0x81, 0xe4,
++ /* 0924 */	0x04, 0x20, 0x42, 0xe2,
++ /* 0928 */	0x01, 0x00, 0x81, 0xe4,
++ /* 092c */	0x04, 0x20, 0x42, 0xe2,
++ /* 0930 */	0x01, 0x00, 0x81, 0xe4,
++ /* 0934 */	0x04, 0x20, 0x52, 0xe2,
++ /* 0938 */	0x06, 0x00, 0x00, 0x0a,
++ /* 093c */	0x00, 0x00, 0x81, 0xe5,
++ /* 0940 */	0x01, 0x00, 0x81, 0xe5,
++ /* 0944 */	0x02, 0x00, 0x81, 0xe5,
++ /* 0948 */	0x03, 0x00, 0x81, 0xe5,
++ /* 094c */	0x04, 0x10, 0x81, 0xe2,
++ /* 0950 */	0x10, 0x20, 0x52, 0xe2,
++ /* 0954 */	0xf8, 0xff, 0xff, 0x1a,
++ /* 0958 */	0x04, 0x00, 0xa0, 0xe3,
++ /* 095c */	0x8d, 0xfe, 0xff, 0xea,
++ /* 0960 */	0x00, 0x60, 0x89, 0xe5,
++ /* 0964 */	0x80, 0x30, 0xa0, 0xe3,
++ /* 0968 */	0x02, 0x35, 0x83, 0xe2,
++ /* 096c */	0x00, 0x60, 0x83, 0xe5,
++ /* 0970 */	0x01, 0x28, 0xa0, 0xe3,
++ /* 0974 */	0xff, 0x0c, 0xa0, 0xe3,
++ /* 0978 */	0xc0, 0x00, 0x80, 0xe2,
++ /* 097c */	0x00, 0x30, 0xa0, 0xe3,
++ /* 0980 */	0x00, 0x30, 0x82, 0xe5,
++ /* 0984 */	0x01, 0x30, 0x82, 0xe5,
++ /* 0988 */	0x02, 0x30, 0x82, 0xe5,
++ /* 098c */	0x03, 0x30, 0x82, 0xe5,
++ /* 0990 */	0x04, 0x30, 0x82, 0xe5,
++ /* 0994 */	0x05, 0x30, 0x82, 0xe5,
++ /* 0998 */	0x06, 0x30, 0x82, 0xe5,
++ /* 099c */	0x07, 0x30, 0x82, 0xe5,
++ /* 09a0 */	0x08, 0x30, 0x82, 0xe5,
++ /* 09a4 */	0x09, 0x30, 0x82, 0xe5,
++ /* 09a8 */	0x0a, 0x30, 0x82, 0xe5,
++ /* 09ac */	0x0b, 0x30, 0x82, 0xe5,
++ /* 09b0 */	0x0c, 0x20, 0x82, 0xe2,
++ /* 09b4 */	0x30, 0x00, 0x50, 0xe2,
++ /* 09b8 */	0xf0, 0xff, 0xff, 0x1a,
++ /* 09bc */	0x02, 0x28, 0xa0, 0xe3,
++ /* 09c0 */	0xff, 0x1c, 0xa0, 0xe3,
++ /* 09c4 */	0xc0, 0x10, 0x81, 0xe2,
++ /* 09c8 */	0x00, 0x30, 0xa0, 0xe1,
++ /* 09cc */	0x00, 0x30, 0x82, 0xe5,
++ /* 09d0 */	0x01, 0x30, 0x82, 0xe5,
++ /* 09d4 */	0x02, 0x30, 0x82, 0xe5,
++ /* 09d8 */	0x03, 0x30, 0x82, 0xe5,
++ /* 09dc */	0x04, 0x30, 0x82, 0xe5,
++ /* 09e0 */	0x05, 0x30, 0x82, 0xe5,
++ /* 09e4 */	0x06, 0x30, 0x82, 0xe5,
++ /* 09e8 */	0x07, 0x30, 0x82, 0xe5,
++ /* 09ec */	0x08, 0x30, 0x82, 0xe5,
++ /* 09f0 */	0x09, 0x30, 0x82, 0xe5,
++ /* 09f4 */	0x0a, 0x30, 0x82, 0xe5,
++ /* 09f8 */	0x0b, 0x30, 0x82, 0xe5,
++ /* 09fc */	0x0c, 0x20, 0x82, 0xe2,
++ /* 0a00 */	0x30, 0x10, 0x51, 0xe2,
++ /* 0a04 */	0xf0, 0xff, 0xff, 0x1a,
++ /* 0a08 */	0x01, 0x00, 0xa0, 0xe1,
++ /* 0a0c */	0x61, 0xfe, 0xff, 0xea,
++ /* 0a10 */	0x00, 0x60, 0x89, 0xe5,
++ /* 0a14 */	0x80, 0x30, 0xa0, 0xe3,
++ /* 0a18 */	0x02, 0x35, 0x83, 0xe2,
++ /* 0a1c */	0x00, 0x60, 0x83, 0xe5,
++ /* 0a20 */	0x01, 0x28, 0xa0, 0xe3,
++ /* 0a24 */	0xff, 0x0c, 0xa0, 0xe3,
++ /* 0a28 */	0xc0, 0x00, 0x80, 0xe2,
++ /* 0a2c */	0x00, 0x30, 0xa0, 0xe3,
++ /* 0a30 */	0x00, 0x30, 0x82, 0xe5,
++ /* 0a34 */	0x01, 0x30, 0x82, 0xe5,
++ /* 0a38 */	0x02, 0x30, 0x82, 0xe5,
++ /* 0a3c */	0x03, 0x30, 0x82, 0xe5,
++ /* 0a40 */	0x04, 0x30, 0x82, 0xe5,
++ /* 0a44 */	0x05, 0x30, 0x82, 0xe5,
++ /* 0a48 */	0x06, 0x30, 0x82, 0xe5,
++ /* 0a4c */	0x07, 0x30, 0x82, 0xe5,
++ /* 0a50 */	0x08, 0x30, 0x82, 0xe5,
++ /* 0a54 */	0x09, 0x30, 0x82, 0xe5,
++ /* 0a58 */	0x0a, 0x30, 0x82, 0xe5,
++ /* 0a5c */	0x0b, 0x30, 0x82, 0xe5,
++ /* 0a60 */	0x0c, 0x20, 0x82, 0xe2,
++ /* 0a64 */	0x30, 0x00, 0x50, 0xe2,
++ /* 0a68 */	0xf0, 0xff, 0xff, 0x1a,
++ /* 0a6c */	0x02, 0x28, 0xa0, 0xe3,
++ /* 0a70 */	0xff, 0x1c, 0xa0, 0xe3,
++ /* 0a74 */	0xc0, 0x10, 0x81, 0xe2,
++ /* 0a78 */	0x00, 0x30, 0xa0, 0xe1,
++ /* 0a7c */	0x00, 0x30, 0x82, 0xe5,
++ /* 0a80 */	0x01, 0x30, 0x82, 0xe5,
++ /* 0a84 */	0x02, 0x30, 0x82, 0xe5,
++ /* 0a88 */	0x03, 0x30, 0x82, 0xe5,
++ /* 0a8c */	0x04, 0x30, 0x82, 0xe5,
++ /* 0a90 */	0x05, 0x30, 0x82, 0xe5,
++ /* 0a94 */	0x06, 0x30, 0x82, 0xe5,
++ /* 0a98 */	0x07, 0x30, 0x82, 0xe5,
++ /* 0a9c */	0x08, 0x30, 0x82, 0xe5,
++ /* 0aa0 */	0x09, 0x30, 0x82, 0xe5,
++ /* 0aa4 */	0x0a, 0x30, 0x82, 0xe5,
++ /* 0aa8 */	0x0b, 0x30, 0x82, 0xe5,
++ /* 0aac */	0x0c, 0x20, 0x82, 0xe2,
++ /* 0ab0 */	0x30, 0x10, 0x51, 0xe2,
++ /* 0ab4 */	0xf0, 0xff, 0xff, 0x1a,
++ /* 0ab8 */	0x01, 0x00, 0xa0, 0xe1,
++ /* 0abc */	0x35, 0xfe, 0xff, 0xea,
++ /* 0ac0 */	0x18, 0x30, 0x94, 0xe5,
++ /* 0ac4 */	0x02, 0x25, 0xa0, 0xe3,
++ /* 0ac8 */	0x0a, 0x2b, 0x82, 0xe2,
++ /* 0acc */	0x23, 0x32, 0xa0, 0xe1,
++ /* 0ad0 */	0x0f, 0x30, 0x03, 0xe2,
++ /* 0ad4 */	0x00, 0x30, 0x82, 0xe5,
++ /* 0ad8 */	0x2e, 0xfe, 0xff, 0xea,
++ /* 0adc */	0x18, 0x20, 0x94, 0xe5,
++ /* 0ae0 */	0x29, 0x30, 0xa0, 0xe3,
++ /* 0ae4 */	0x02, 0x35, 0x83, 0xe2,
++ /* 0ae8 */	0xff, 0x20, 0x62, 0xe2,
++ /* 0aec */	0x00, 0x20, 0xc3, 0xe5,
++ /* 0af0 */	0x1c, 0x10, 0x94, 0xe5,
++ /* 0af4 */	0xa9, 0x30, 0xa0, 0xe3,
++ /* 0af8 */	0x02, 0x35, 0x83, 0xe2,
++ /* 0afc */	0xff, 0x10, 0x61, 0xe2,
++ /* 0b00 */	0x00, 0x10, 0xc3, 0xe5,
++ /* 0b04 */	0x23, 0xfe, 0xff, 0xea,
++ /* 0b08 */	0xf0, 0xaf, 0x1b, 0xe9,
++ /* 0b0c */	0x0a, 0x2b, 0xa0, 0xe3,
++ /* 0b10 */	0x0d, 0x30, 0x82, 0xe3,
++ /* 0b14 */	0x02, 0x35, 0x83, 0xe3,
++ /* 0b18 */	0x00, 0x10, 0xa0, 0xe3,
++ /* 0b1c */	0x00, 0x10, 0xc3, 0xe5,
++ /* 0b20 */	0x14, 0x20, 0x82, 0xe3,
++ /* 0b24 */	0x02, 0x25, 0x82, 0xe3,
++ /* 0b28 */	0x00, 0x30, 0x92, 0xe5,
++ /* 0b2c */	0x00, 0x00, 0x53, 0xe1,
++ /* 0b30 */	0x00, 0x00, 0xa0, 0x23,
++ /* 0b34 */	0x01, 0x00, 0xa0, 0x33,
++ /* 0b38 */	0x0e, 0xf0, 0xa0, 0xe1,
++ /* 0b3c */	0x0a, 0x2b, 0xa0, 0xe3,
++ /* 0b40 */	0x0d, 0x30, 0x82, 0xe3,
++ /* 0b44 */	0x02, 0x35, 0x83, 0xe3,
++ /* 0b48 */	0x00, 0x10, 0xa0, 0xe3,
++ /* 0b4c */	0x00, 0x10, 0xc3, 0xe5,
++ /* 0b50 */	0x14, 0x20, 0x82, 0xe3,
++ /* 0b54 */	0x02, 0x25, 0x82, 0xe3,
++ /* 0b58 */	0x00, 0x30, 0x92, 0xe5,
++ /* 0b5c */	0x00, 0x00, 0x53, 0xe1,
++ /* 0b60 */	0x00, 0x00, 0xa0, 0x33,
++ /* 0b64 */	0x01, 0x00, 0xa0, 0x23,
++ /* 0b68 */	0x0e, 0xf0, 0xa0, 0xe1,
++ /* 0b6c */	0x03, 0x10, 0x81, 0xe2,
++ /* 0b70 */	0x03, 0x10, 0xd1, 0xe3,
++ /* 0b74 */	0x0e, 0xf0, 0xa0, 0x01,
++ /* 0b78 */	0x00, 0x20, 0xa0, 0xe3,
++ /* 0b7c */	0x00, 0x30, 0x61, 0xe2,
++ /* 0b80 */	0x0f, 0x30, 0x13, 0xe2,
++ /* 0b84 */	0x0c, 0x00, 0x00, 0x0a,
++ /* 0b88 */	0x0c, 0x00, 0x53, 0xe3,
++ /* 0b8c */	0x07, 0x00, 0x00, 0xaa,
++ /* 0b90 */	0x08, 0x00, 0x53, 0xe3,
++ /* 0b94 */	0x03, 0x00, 0x00, 0xaa,
++ /* 0b98 */	0x03, 0x00, 0x53, 0xe3,
++ /* 0b9c */	0x06, 0x00, 0x00, 0xda,
++ /* 0ba0 */	0x01, 0x20, 0x80, 0xe4,
++ /* 0ba4 */	0x04, 0x10, 0x41, 0xe2,
++ /* 0ba8 */	0x01, 0x20, 0x80, 0xe4,
++ /* 0bac */	0x04, 0x10, 0x41, 0xe2,
++ /* 0bb0 */	0x01, 0x20, 0x80, 0xe4,
++ /* 0bb4 */	0x04, 0x10, 0x51, 0xe2,
++ /* 0bb8 */	0x0e, 0xf0, 0xa0, 0x01,
++ /* 0bbc */	0x00, 0x20, 0x80, 0xe5,
++ /* 0bc0 */	0x01, 0x20, 0x80, 0xe5,
++ /* 0bc4 */	0x02, 0x20, 0x80, 0xe5,
++ /* 0bc8 */	0x03, 0x20, 0x80, 0xe5,
++ /* 0bcc */	0x04, 0x00, 0x80, 0xe2,
++ /* 0bd0 */	0x10, 0x10, 0x51, 0xe2,
++ /* 0bd4 */	0xf8, 0xff, 0xff, 0x1a,
++ /* 0bd8 */	0x0e, 0xf0, 0xa0, 0xe1,
++ /* 0bdc */	0x00, 0x30, 0x51, 0xe2,
++ /* 0be0 */	0x0e, 0xf0, 0xa0, 0x01,
++ /* 0be4 */	0x00, 0x20, 0xa0, 0xe3,
++ /* 0be8 */	0x00, 0x10, 0x61, 0xe2,
++ /* 0bec */	0x03, 0x10, 0x11, 0xe2,
++ /* 0bf0 */	0x09, 0x00, 0x00, 0x0a,
++ /* 0bf4 */	0x03, 0x00, 0x51, 0xe3,
++ /* 0bf8 */	0x04, 0x00, 0x00, 0xaa,
++ /* 0bfc */	0x02, 0x00, 0x51, 0xe3,
++ /* 0c00 */	0x01, 0x20, 0xc0, 0xb4,
++ /* 0c04 */	0x01, 0x30, 0x43, 0xb2,
++ /* 0c08 */	0x01, 0x20, 0xc0, 0xe4,
++ /* 0c0c */	0x01, 0x30, 0x43, 0xe2,
++ /* 0c10 */	0x01, 0x20, 0xc0, 0xe4,
++ /* 0c14 */	0x01, 0x30, 0x53, 0xe2,
++ /* 0c18 */	0x0e, 0xf0, 0xa0, 0x01,
++ /* 0c1c */	0x00, 0x20, 0xc0, 0xe5,
++ /* 0c20 */	0x01, 0x20, 0xc0, 0xe5,
++ /* 0c24 */	0x02, 0x20, 0xc0, 0xe5,
++ /* 0c28 */	0x03, 0x20, 0xc0, 0xe5,
++ /* 0c2c */	0x04, 0x00, 0x80, 0xe2,
++ /* 0c30 */	0x04, 0x30, 0x53, 0xe2,
++ /* 0c34 */	0xf8, 0xff, 0xff, 0x1a,
++ /* 0c38 */	0x0e, 0xf0, 0xa0, 0xe1,
++ /* 0c3c */	0x02, 0x35, 0xa0, 0xe3,
++ /* 0c40 */	0x02, 0x19, 0xa0, 0xe3,
++ /* 0c44 */	0x00, 0x10, 0x83, 0xe5,
++ /* 0c48 */	0x80, 0x20, 0xa0, 0xe3,
++ /* 0c4c */	0x03, 0x10, 0x82, 0xe7,
++ /* 0c50 */	0x01, 0x28, 0xa0, 0xe3,
++ /* 0c54 */	0xff, 0x3c, 0xa0, 0xe3,
++ /* 0c58 */	0xc0, 0x30, 0x83, 0xe2,
++ /* 0c5c */	0x02, 0x19, 0x41, 0xe2,
++ /* 0c60 */	0x00, 0x10, 0x82, 0xe5,
++ /* 0c64 */	0x01, 0x10, 0x82, 0xe5,
++ /* 0c68 */	0x02, 0x10, 0x82, 0xe5,
++ /* 0c6c */	0x03, 0x10, 0x82, 0xe5,
++ /* 0c70 */	0x04, 0x20, 0x82, 0xe2,
++ /* 0c74 */	0x10, 0x30, 0x53, 0xe2,
++ /* 0c78 */	0xf8, 0xff, 0xff, 0x1a,
++ /* 0c7c */	0x02, 0x28, 0xa0, 0xe3,
++ /* 0c80 */	0xff, 0x3c, 0xa0, 0xe3,
++ /* 0c84 */	0xc0, 0x30, 0x83, 0xe2,
++ /* 0c88 */	0x00, 0x10, 0xa0, 0xe3,
++ /* 0c8c */	0x00, 0x10, 0x82, 0xe5,
++ /* 0c90 */	0x01, 0x10, 0x82, 0xe5,
++ /* 0c94 */	0x02, 0x10, 0x82, 0xe5,
++ /* 0c98 */	0x03, 0x10, 0x82, 0xe5,
++ /* 0c9c */	0x04, 0x20, 0x82, 0xe2,
++ /* 0ca0 */	0x10, 0x30, 0x53, 0xe2,
++ /* 0ca4 */	0xf8, 0xff, 0xff, 0x1a,
++ /* 0ca8 */	0x0e, 0xf0, 0xa0, 0xe1,
++0 };
+diff -ruN src.orig/sys/arch/dreamcast/dev/g2/microcode/ldscript src/sys/arch/dreamcast/dev/g2/microcode/ldscript
+--- src.orig/sys/arch/dreamcast/dev/g2/microcode/ldscript	1970-01-01 09:00:00.000000000 +0900
++++ src/sys/arch/dreamcast/dev/g2/microcode/ldscript	2003-08-10 04:40:33.000000000 +0900
+@@ -0,0 +1,23 @@
++OUTPUT_ARCH(arm)
++SECTIONS
++{
++	.text :
++	{
++		*(.text)
++		*(.text.*)
++		*(.glue_7t) *(.glue_7)
++	}
++	. = ALIGN(16);
++	.data :
++	{
++	}
++	. = ALIGN(16);
++	.sbss :
++	{
++	}
++	. = ALIGN(16);
++	.bss :
++	{
++	}
++}
++
+>Release-Note:
+>Audit-Trail:
+>Unformatted:
+
+ diff --git a/AICA/EXES/RAW2WAV/raw2wav.exe b/AICA/EXES/RAW2WAV/raw2wav.exe new file mode 100644 index 00000000..ed2e551b Binary files /dev/null and b/AICA/EXES/RAW2WAV/raw2wav.exe differ diff --git a/AICA/SRCS/ADX2WAV/adx2wav.c b/AICA/SRCS/ADX2WAV/adx2wav.c new file mode 100644 index 00000000..aa5b76e6 --- /dev/null +++ b/AICA/SRCS/ADX2WAV/adx2wav.c @@ -0,0 +1,207 @@ +/* + adv2wav + + (c)2001 BERO + + http://www.geocities.co.jp/Playtown/2004/ + bero@geocities.co.jp + + adx info from: http://ku-www.ss.titech.ac.jp/~yatsushi/adx.html + +*/ + + +#include +#include +#include + +long read_long(unsigned char *p) +{ + return (p[0]<<24)|(p[1]<<16)|(p[2]<<8)|p[3]; +} + +int read_word(unsigned char *p) +{ + return (p[0]<<8)|p[1]; +} + +typedef struct { + int s1,s2; +} PREV; + +//#define BASEVOL 0x11e0 +#define BASEVOL 0x4000 + +int convert(short *out,unsigned char *in,PREV *prev) +{ + int scale = ((in[0]<<8)|(in[1])); + int i; + int s0,s1,s2,d; +// int over=0; + + in+=2; + s1 = prev->s1; + s2 = prev->s2; + for(i=0;i<16;i++) { + d = in[i]>>4; + if (d&8) d-=16; + s0 = (BASEVOL*d*scale + 0x7298*s1 - 0x3350*s2)>>14; + // if (abs(s0)>32767) over=1; + if (s0>32767) s0=32767; + else if (s0<-32768) s0=-32768; + *out++=s0; + s2 = s1; + s1 = s0; + + d = in[i]&15; + if (d&8) d-=16; + s0 = (BASEVOL*d*scale + 0x7298*s1 - 0x3350*s2)>>14; + // if (abs(s0)>32767) over=1; + if (s0>32767) s0=32767; + else if (s0<-32768) s0=-32768; + *out++=s0; + s2 = s1; + s1 = s0; + } + prev->s1 = s1; + prev->s2 = s2; + +// if (over) putchar('.'); +} + +int adx2wav(char *infile,char *outfile) +{ + FILE *in,*out; + unsigned char buf[18*2]; + short outbuf[32*2]; + int offset; + int channel,freq,size,wsize; + PREV prev[2]; + + static struct { + char hdr1[4]; + long totalsize; + + char hdr2[8]; + long hdrsize; + short format; + short channel; + long freq; + long byte_per_sec; + short blocksize; + short bits; + + char hdr3[4]; + long datasize; + } wavhdr = { + "RIFF",0, + "WAVEfmt ",0x10,1/* PCM */,2,44100,44100*2*2,2*2,16, + "data" + }; + + if (strcmp(infile,"-")==0) + in = stdin; + else + in = fopen(infile,"rb"); + if (in==NULL) { + printf("can't open infile %s\n",outfile); + return -1; + } + + fread(buf,1,16,in); + + channel = buf[7]; + freq = read_long(buf+8); + size = read_long(buf+12); + + offset = read_word(buf+2)-2; + fseek(in,offset,SEEK_SET); + fread(buf+1,1,6,in); + + if (buf[0]!=0x80 || memcmp(buf+1,"(c)CRI",6)) { + puts("not adx!"); + return -1; + } + + wavhdr.channel = channel; + wavhdr.freq = freq; + wavhdr.blocksize = channel*sizeof(short); + wavhdr.byte_per_sec = freq*wavhdr.blocksize; + wavhdr.datasize = size*wavhdr.blocksize; + wavhdr.totalsize = wavhdr.datasize + sizeof(wavhdr)-8; + + if (strcmp(outfile,"-")==0) + out = stdout; + else + out = fopen(outfile,"wb"); + if (out==NULL) { + printf("can't open outfile %s\n",outfile); + return -1; + } + + fwrite(&wavhdr,1,sizeof(wavhdr),out); + + prev[0].s1 = 0; + prev[0].s2 = 0; + prev[1].s1 = 0; + prev[1].s2 = 0; + + + if (channel==1) + while(size) { + fread(buf,1,18,in); + convert(outbuf,buf,prev); + if (size>32) wsize=32; else wsize = size; + size-=wsize; + fwrite(outbuf,1,wsize*2,out); + } + else if (channel==2) + while(size) { + short tmpbuf[32*2]; + int i; + + fread(buf,1,18*2,in); + convert(tmpbuf,buf,prev); + convert(tmpbuf+32,buf+18,prev+1); + for(i=0;i<32;i++) { + outbuf[i*2] = tmpbuf[i]; + outbuf[i*2+1] = tmpbuf[i+32]; + } + if (size>32) wsize=32; else wsize = size; + size-=wsize; + fwrite(outbuf,1,wsize*2*2,out); + } + fclose(in); + fclose(out); + + return 0; +} + +int main(int argc,char**argv) +{ + int i; + if (argc<2) { + puts("DC/SS adx to wav converter by bero\n adx2wav \n http://www.geocities.co.jp/Playtown/2004/"); + return -1; + } + +// _fmode = O_BINARY; + + for(i=1;i %s\n",infile,outfile); + + adx2wav(infile,outfile); + } + return 0; +} diff --git a/AICA/SRCS/ADX2WAV/adx2wav.exe b/AICA/SRCS/ADX2WAV/adx2wav.exe new file mode 100644 index 00000000..c2f8dab6 Binary files /dev/null and b/AICA/SRCS/ADX2WAV/adx2wav.exe differ diff --git a/AICA/SRCS/ADX2WAV/adx2wav.txt b/AICA/SRCS/ADX2WAV/adx2wav.txt new file mode 100644 index 00000000..5f710071 --- /dev/null +++ b/AICA/SRCS/ADX2WAV/adx2wav.txt @@ -0,0 +1,38 @@ +adx2wav : DreamCast ADX->WAV converter + + http://www.geocities.co.jp/Playtown/2004/ + bero@geocities.co.jp + +This software convert DreamCast ADX ADPCM sound (.adx) to Windows WAVE file (.wav). + + adx2wav + +convert .adx to .wav + + afs_extract + +extract packed .AFS file to each .adx file. + +IMPORTANT: + don't distruibute converted data follows copyright law in your country. + at least Japanese law, "personal use" only. "personal use" means yourself, your family, and so on. + + +DC‚ÌADX‰¹ºƒtƒ@ƒCƒ‹(.ADX)‚ðWindows WAVEŒ`Ž®(.WAV)‚É•ÏŠ·‚µ‚Ü‚·B + + adx2wav + +.adx ‚ð .wav ‚É•ÏŠ·‚µ‚Ü‚· + + afs_extract + +•¡”‚̃tƒ@ƒCƒ‹‚ª‚Ü‚Æ‚ß‚ç‚ꂽ.AFSƒtƒ@ƒCƒ‹‚ðŒÂX‚Ìadxƒtƒ@ƒCƒ‹‚É•ªŠ„‚µ‚Ü‚·B +afs‚Ì’†‚Íadx‚Æ‚ÍŒÀ‚è‚Ü‚¹‚ñB + +d—v: + •ÏŠ·‚µ‚½ƒf[ƒ^‚ð•s“Á’葽”‚É”z•z‚µ‚È‚¢‚Å‚­‚¾‚³‚¢B + ­‚È‚­‚Æ‚à“ú–{‚Ì–@—¥‚Å‚ÍA"Ž„“I—˜—p"‚ÉŒÀ‚ç‚ê‚Ü‚·B + "Ž„“I—˜—p"‚Æ‚ÍAŽ©•ªA‰Æ‘°“™‚ðŽw‚µ‚Ü‚·B + +0.2 change adx check / volume +first release diff --git a/AICA/SRCS/ADX2WAV/afs_extract.c b/AICA/SRCS/ADX2WAV/afs_extract.c new file mode 100644 index 00000000..626598fb --- /dev/null +++ b/AICA/SRCS/ADX2WAV/afs_extract.c @@ -0,0 +1,89 @@ +/* + afxcut +*/ + +#include +#include +#include + +int afs_extract(char *name) +{ + FILE *fp,*out; + int i,n; + char buf[0x8000]; + + struct { + char id[4]; + long num; + } hdr; + + struct { + long offset; + long size; + } *idx; + + char basename[256],*p; + strcpy(basename,name); + + p = strrchr(basename,'.'); + if (p) *p=0; + + fp = fopen(name,"rb"); + if (fp==NULL) return -1; + + fread(&hdr,1,8,fp); + if (memcmp(hdr.id,"AFS",4)) { + fclose(fp); + printf("not AFS\n"); + return -1; + } + n = hdr.num; + + printf("%s - %d\n",name,n); + + idx = malloc(sizeof(*idx)*n); + + fread(idx,8,n,fp); + for(i=0;i + + + + + + + + + + + + + + + Renesas Technology + + - Application Notes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +


+

+

+ + + + +

+ +
by keyword by product number

Parametric SearchDocument Library

+ + +
+ + +
+ +
+ + + + +Global Site +North America +Europe +Japan +Singapore/ASEAN +Hong Kong +China +Taiwan +Korea +Other Asian + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Home / Products / MPU and MCU / SuperH RISC engine Family / SH7750 Series / +

Application Notes


+ + + + +
 
Provide feedback
Print this page
+ + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
+ + + + +
+ + + + +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+
SH7750 Series
About SH-4
Function Comparison

+
+
Application Notes
+

+
+
Documentation

+
+
FAQs

+
+
Software and Tools

+
+
Technical Update

+
+
Purchasing Info

+
+
+ + + +
+ + +

RELATED RESOURCES


superh.com

+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+

WHAT'S NEW

01 Jul 2004

+Launch of SuperH web pages +

+
+ +
+ + +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + CPU + + | + + Software + + | + + USB + + | + + Others + + | + + APL(Application) + + | + + All + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Product nameFunctionDocument TitleIssue DateDocument NumberRevisionPDFZip
  + + + + + + + + + + + + + + + + + + + + + + + + +   
SuperH RISC engine Family
CPUSH7000 Series Block Transfer (4 Bytes Not Aligned) APPLICATION NOTENOV.10.03REJ06B0196-0100ORev.1.00- 
SuperH RISC engine Family
CPUSH7000 Series Block Transfer (4 Bytes Aligned) APPLICATION NOTENOV.10.03REJ06B0197-0100ORev.1.00- 
SuperH RISC engine Family
CPUSH7000 Series Multi-Bit Shift of 32-Bit Data (Arithmetic Right Shift) APPLICATION NOTENOV.10.03REJ06B0198-0100ORev.1.00- 
SuperH RISC engine Family
CPUSH7000 Series Multi-Bit Shift of 32-Bit Data (Logical Right Shift) APPLICATION NOTENOV.10.03REJ06B0199-0100ORev.1.00- 
SuperH RISC engine Family
CPUSH7000 Series Multi-Bit Shift of 32-Bit Data (Logical Left Shift) APPLICATION NOTENOV.10.03REJ06B0200-0100ORev.1.00- 
SuperH RISC engine Family
CPUSH7000 Series Find First 1 in 32-Bit Data APPLICATION NOTENOV.10.03REJ06B0201-0100ORev.1.00- 
SuperH RISC engine Family
CPUSH7000 Series 64 Bit + 64 Bit = 64 Bit (Unsigned) APPLICATION NOTENOV.10.03REJ06B0202-0100ORev.1.00- 
SuperH RISC engine Family
CPUSH7000 Series 64 Bit + 64 Bit = 64 Bit (Signed) APPLICATION NOTENOV.10.03REJ06B0203-0100ORev.1.00- 
SuperH RISC engine Family
CPUSH7000 Series 32 Bit × 32 Bit = 64 Bit (Unsigned) APPLICATION NOTENOV.10.03REJ06B0204-0100ORev.1.00- 
SuperH RISC engine Family
CPUSH7000 Series 32 Bit × 32 Bit = 64 Bit (Signed) APPLICATION NOTENOV.10.03REJ06B0205-0100ORev.1.00- 
SuperH RISC engine Family
CPUSH7000 Series Quotient of 32 Bit ÷ 32 Bit (Unsigned) APPLICATION NOTENOV.10.03REJ06B0206-0100ORev.1.00- 
SuperH RISC engine Family
CPUSH7000 Series Remainder of 32 Bit ÷ 32 Bit (Unsigned) APPLICATION NOTENOV.10.03REJ06B0207-0100ORev.1.00- 
SuperH RISC engine Family
CPUSH7000 Series Quotient of 32 Bit ÷ 32 Bit (Signed) APPLICATION NOTENOV.10.03REJ06B0208-0100ORev.1.00- 
SuperH RISC engine Family
CPUSH7000 Series Remainder of 32 Bit ÷ 32 Bit (Signed) APPLICATION NOTENOV.10.03REJ06B0209-0100ORev.1.00- 
SuperH RISC engine Family
CPUSH7000 Series Affine Transform APPLICATION NOTENOV.10.03REJ06B0210-0100ORev.1.00- 
SuperH RISC engine Family
SoftwareSuperH RISC Engine SH-DSP Software Application NoteSEP.21.99ADE-502-069Rev.1.0- 
SH7760
USBSH7760 Group USB Host Module Application NoteOCT.31.03REJ06B0215-0100ZRev.1.00- 
SuperH RISC engine Family
OthersHI Series OS Application NoteJUN.21.04REJ05B0364-0200ZRev.2.00- 
SH7751
SH7750S
APL(Application)SH Graphics/Speech Processing Demonstration System NAV-DS4NOV.25.99ADE-502-058Rev.1.0- 
+
+
+
+ + + + +
+ +
+ +
+ +
+ + + + + + + + + + + + + +
+ +
+
+ + © 2004. Renesas Technology Corp., All rights reserved. + Privacy | Legal +
+ +
+ + + + + + + + \ No newline at end of file diff --git a/CPU/DOCS/AN/rej05b0364_hios.pdf b/CPU/DOCS/AN/rej05b0364_hios.pdf new file mode 100644 index 00000000..a72f276f Binary files /dev/null and b/CPU/DOCS/AN/rej05b0364_hios.pdf differ diff --git a/CPU/DOCS/AN/rej06b0196_sh7000.pdf b/CPU/DOCS/AN/rej06b0196_sh7000.pdf new file mode 100644 index 00000000..f49bee61 Binary files /dev/null and b/CPU/DOCS/AN/rej06b0196_sh7000.pdf differ diff --git a/CPU/DOCS/AN/rej06b0197_sh7000.pdf b/CPU/DOCS/AN/rej06b0197_sh7000.pdf new file mode 100644 index 00000000..fc9fec57 Binary files /dev/null and b/CPU/DOCS/AN/rej06b0197_sh7000.pdf differ diff --git a/CPU/DOCS/AN/rej06b0198_sh7000.pdf b/CPU/DOCS/AN/rej06b0198_sh7000.pdf new file mode 100644 index 00000000..1d802978 Binary files /dev/null and b/CPU/DOCS/AN/rej06b0198_sh7000.pdf differ diff --git a/CPU/DOCS/AN/rej06b0199_sh7000.pdf b/CPU/DOCS/AN/rej06b0199_sh7000.pdf new file mode 100644 index 00000000..7cf238c9 Binary files /dev/null and b/CPU/DOCS/AN/rej06b0199_sh7000.pdf differ diff --git a/CPU/DOCS/AN/rej06b0200_sh7000.pdf b/CPU/DOCS/AN/rej06b0200_sh7000.pdf new file mode 100644 index 00000000..eefffa73 Binary files /dev/null and b/CPU/DOCS/AN/rej06b0200_sh7000.pdf differ diff --git a/CPU/DOCS/AN/rej06b0201_sh7000.pdf b/CPU/DOCS/AN/rej06b0201_sh7000.pdf new file mode 100644 index 00000000..e28c5feb Binary files /dev/null and b/CPU/DOCS/AN/rej06b0201_sh7000.pdf differ diff --git a/CPU/DOCS/AN/rej06b0202_sh7000.pdf b/CPU/DOCS/AN/rej06b0202_sh7000.pdf new file mode 100644 index 00000000..bccf8f04 Binary files /dev/null and b/CPU/DOCS/AN/rej06b0202_sh7000.pdf differ diff --git a/CPU/DOCS/AN/rej06b0203_sh7000.pdf b/CPU/DOCS/AN/rej06b0203_sh7000.pdf new file mode 100644 index 00000000..a9e0ce4a Binary files /dev/null and b/CPU/DOCS/AN/rej06b0203_sh7000.pdf differ diff --git a/CPU/DOCS/AN/rej06b0204_sh7000.pdf b/CPU/DOCS/AN/rej06b0204_sh7000.pdf new file mode 100644 index 00000000..e69be7ee Binary files /dev/null and b/CPU/DOCS/AN/rej06b0204_sh7000.pdf differ diff --git a/CPU/DOCS/AN/rej06b0205_sh7000.pdf b/CPU/DOCS/AN/rej06b0205_sh7000.pdf new file mode 100644 index 00000000..4adfa460 Binary files /dev/null and b/CPU/DOCS/AN/rej06b0205_sh7000.pdf differ diff --git a/CPU/DOCS/AN/rej06b0206_sh7000.pdf b/CPU/DOCS/AN/rej06b0206_sh7000.pdf new file mode 100644 index 00000000..11e23720 Binary files /dev/null and b/CPU/DOCS/AN/rej06b0206_sh7000.pdf differ diff --git a/CPU/DOCS/AN/rej06b0207_sh7000.pdf b/CPU/DOCS/AN/rej06b0207_sh7000.pdf new file mode 100644 index 00000000..3d998688 Binary files /dev/null and b/CPU/DOCS/AN/rej06b0207_sh7000.pdf differ diff --git a/CPU/DOCS/AN/rej06b0208_sh7000.pdf b/CPU/DOCS/AN/rej06b0208_sh7000.pdf new file mode 100644 index 00000000..ef9440ae Binary files /dev/null and b/CPU/DOCS/AN/rej06b0208_sh7000.pdf differ diff --git a/CPU/DOCS/AN/rej06b0209_sh7000.pdf b/CPU/DOCS/AN/rej06b0209_sh7000.pdf new file mode 100644 index 00000000..e3fb42ac Binary files /dev/null and b/CPU/DOCS/AN/rej06b0209_sh7000.pdf differ diff --git a/CPU/DOCS/AN/rej06b0210_sh7000.pdf b/CPU/DOCS/AN/rej06b0210_sh7000.pdf new file mode 100644 index 00000000..974f2b6e Binary files /dev/null and b/CPU/DOCS/AN/rej06b0210_sh7000.pdf differ diff --git a/CPU/DOCS/AN/rej06b0215_sh7760.pdf b/CPU/DOCS/AN/rej06b0215_sh7760.pdf new file mode 100644 index 00000000..c7c04514 Binary files /dev/null and b/CPU/DOCS/AN/rej06b0215_sh7760.pdf differ diff --git a/CPU/DOCS/Description_des_SH.pdf b/CPU/DOCS/Description_des_SH.pdf new file mode 100644 index 00000000..e97d1a36 Binary files /dev/null and b/CPU/DOCS/Description_des_SH.pdf differ diff --git a/CPU/DOCS/SUP/e602124_tech.pdf b/CPU/DOCS/SUP/e602124_tech.pdf new file mode 100644 index 00000000..1a107c72 Binary files /dev/null and b/CPU/DOCS/SUP/e602124_tech.pdf differ diff --git a/CPU/DOCS/SUP/esh7750_tech.pdf b/CPU/DOCS/SUP/esh7750_tech.pdf new file mode 100644 index 00000000..85c5ec17 Binary files /dev/null and b/CPU/DOCS/SUP/esh7750_tech.pdf differ diff --git a/CPU/DOCS/SUP/esh7751_tech.pdf b/CPU/DOCS/SUP/esh7751_tech.pdf new file mode 100644 index 00000000..74bd0925 Binary files /dev/null and b/CPU/DOCS/SUP/esh7751_tech.pdf differ diff --git a/CPU/DOCS/SUP/fmwk.htm b/CPU/DOCS/SUP/fmwk.htm new file mode 100644 index 00000000..974fc065 --- /dev/null +++ b/CPU/DOCS/SUP/fmwk.htm @@ -0,0 +1,836 @@ + + + + + + + + + + + + + + + + Renesas Technology + + - Technical Update + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +


+

+

+ + + + +

+ +
by keyword by product number

Parametric SearchDocument Library

+ + +
+ + +
+ +
+ + + + +Global Site +North America +Europe +Japan +Singapore/ASEAN +Hong Kong +China +Taiwan +Korea +Other Asian + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Home / Products / MPU and MCU / SuperH RISC engine Family / SH7750 Series / +

Technical Update


+ + + + +
 
Provide feedback
Print this page
+ + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
+ + + + +
+ + + + +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+
SH7750 Series
About SH-4
Function Comparison

+
+
Application Notes

+
+
Documentation

+
+
FAQs

+
+
Software and Tools

+
+
Technical Update
+

+
+
Purchasing Info

+
+
+ + + +
+ + +

RELATED RESOURCES


superh.com

+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+

WHAT'S NEW

01 Jul 2004

+Launch of SuperH web pages +

+
+ +
+ + +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 ON THIS PAGE:     
DeviceCompilerReal-time OS
EmulatorEmulator Options1(PC I/F-part)Others
+
+ + + + + + + + +
+ +   + + Top
+
+ + + + +
+ + + + +
+ + + + + + + + + + + + +
Device / Document TitleClassfication of InformationIssue DateDocument NumberRevisionVolume (KB)Page CountProduct Name
SH7750 series The revision about power-on and power-off procedureSupplement of DocumentsAUG.02.04TN-SH7-528A/EARev.1.0692List
 
SH7751 series The revision about power-on and power-off procedureSupplement of DocumentsAUG.02.04TN-SH7-529A/EARev.1.0702List
 
Data corruption in OC RAM mode in cache enhanced modeLimitation of UseMAR.25.04TN-SH7-519A/EARev.1.0212List
 
Notice about double precision FADD and FSUB instructions for SH-4Limitation of UseMAR.22.04TN-SH7-517A/EARev.1.0132List
 
Watchdog Timer may cause an illegal manual resetLimitation of UseMAR.22.04TN-SH7-518A/EARev.1.0101List
 
Notice of the DMA transmission of A/D converterLimitation of UseJAN.05.04TN-SH7-501A/EARev.1.0101List
 
Notice of Scan mode and Multi mode of A/D conversionLimitation of UseJAN.05.04TN-SH7-505A/EARev.1.0142List
 
SH7760 type number changeChange of MaskNOV.28.03TN-SH7-494A/ERev.1.02555List
 
Notice of Wait Control Register (WCR3 WCR4) setting of SH7760Limitation of UseNOV.28.03TN-SH7-495A/ERev.1.071List
 
Corrected the LCDC of SH7760 Hardware manualSupplement of DocumentsNOV.28.03TN-SH7-496A/ERev.1.081List
 
Modification of the Reset Sequence of HCAN2 of SH7760Supplement of DocumentsNOV.28.03TN-SH7-497A/ERev.1.0101List
 
Notice about The MMCIF transfer data block size in multiblock read command.Limitation of UseNOV.25.03TN-SH7-492A/ERev.1.0172List
 
Correctional specs and additional specs concerning SH7750 electric characteristic tSTDSupplement of DocumentsAPR.11.03TN-SH7-478A/ERev.1.03892List
 
Correctional specs and additional specs concerning SH7751 electric characteristic tSTDSupplement of DocumentsAPR.11.03TN-SH7-479A/ERev.1.03922List
 
Notice about the overflow flag by FIPR and FTRV instruction commandLimitation of UseAPR.08.03TN-SH7-475A/ERev.1.071List
 
Notice about the sign of the operation result by FIPR and FTRV instruction command.Limitation of UseAPR.08.03TN-SH7-476A/ERev.1.091List
 
Correctional specs and additional specs concerning SH7760 electric characteristic tSTDSupplement of DocumentsAPR.08.03TN-SH7-477A/ERev.1.03822List
 
Manual correction about the package dimensionsSupplement of DocumentsMAR.28.03TN-SH7-472A/ERev.1.061List
 
SH7760 changes of the electrical characteristics and USB module and other modules functional explanation.Supplement of DocumentsMAR.20.03TN-SH7-468A/ERev.1.0273List
 
Manual correction about the Pin FunctionsSupplement of DocumentsFEB.19.03TN-SH7-465A/ERev.1.0173List
 
Supplement of programming manuals regarding SH-4 Pipeline OperationSupplement of DocumentsFEB.19.03TN-SH7-466A/ERev.1.061List
 
The notes on use of TRAPA instruction / SLEEP instruction / Undefined instruction(HFFFD)Limitation of UseJAN.22.03TN-SH7-456A/ERev.1.0268List
 
Notice about FPU instructions issuesLimitation of UseJAN.15.03TN-SH7-448A/ERev.1.0102List
 
Notice concerning consumption currentLimitation of UseJAN.15.03TN-SH7-455A/ERev.1.081List
 
SH7751R Initial Value of Bus Control Register 3 (BCR3)Supplement of DocumentsDEC.10.02TN-SH7-445A/ERev.1.061List
 
PCIC Setup time specification changeSpec changeNOV.25.02TN-SH7-440A/ERev.1.0101List
 
SH7751/SH7751R MD pin statusSupplement of DocumentsSEP.11.02TN-SH7-424A/ERev.1.0541List
 
Usage notice in power supply of SH7751 and SH7751RLimitation of UseAUG.07.02TN-SH7-341B/ERev.2.0242List
 
SH-4 version registerSupplement of DocumentsAUG.07.02TN-SH7-361B/ERev.2.0101List
 
Power supplying in hardware standby mode of SH7750R/SH7751RSpec changeAUG.07.02TN-SH7-418A/ERev.1.081List
 
Errata in AC Characteristics of SH7751RSupplement of DocumentsAUG.07.02TN-SH7-419A/ERev.1.0111List
 
Guide concerning CKIO wiring design of SH-4Supplement of DocumentsFEB.04.02TN-SH7-395A/ERev.1.0244List
 
Change of the specification of internal power supply voltage.Spec changeDEC.19.01TN-SH7-388A/ERev.1.061List
 
Amendment of the Pin ArrangementSupplement of DocumentsNOV.08.01TN-SH7-376A/ERev.1.09914List
 
Clock wiring between SH-4 and Synchronous DRAMSupplement of DocumentsNOV.05.01TN-SH7-372A/ERev.1.0505List
 
BREQ from external device and refresh of DRAM/synchronous DRAMLimitation of UseSEP.28.01TN-SH7-360A/ERev.1.0262List
 
PCIC Target Memory Access usage noticeLimitation of UseSEP.04.01TN-SH7-350A/ERev.1.081List
 
About initial value of bypass register.Limitation of UseAUG.30.01TN-SH7-349A/ERev.1.071List
 
Limitation on Using Address Space Identifier in Single Virtual Memory Mode (1)Limitation of UseAUG.08.01TN-SH7-346A/ERev.1.071List
 
Note for Using Address Space Identifier in Single Virtual Memory Mode (2)Supplement of DocumentsAUG.08.01TN-SH7-347A/ERev.1.061List
 
PCIC specifications noticeSupplement of DocumentsJUL.18.01TN-SH7-343A/ERev.1.071List
 
Writing to ASID field of PTEH Register and Instruction Fetches after its UpdateSupplement of DocumentsJUL.04.01TN-SH7-342A/ERev.1.051List
 
Bug of a serial data reception of the multiprocessor communication function at SCILimitation of UseJAN.25.01TN-SH7-272A/ERev.1.0112List
 
SH7751 PCIC arbiter interrupt usage noticeLimitation of UseJAN.25.01TN-SH7-295A/ERev.1.03233List
 
Cache Behavior on Stopping Store Queue Clock SupplyLimitation of UseJAN.25.01TN-SH7-296A/ERev.1.061List
 
NMI usage noticeLimitation of UseJAN.25.01TN-SH7-298A/ERev.1.082List
 
SH7751 Correction of sentences concerned with specification of outside pins during the boundary-scan.Supplement of DocumentsSEP.14.00TN-SH7-260A/ERev.1.071List
 
SH7751 AC characteristics of CKIOSupplement of DocumentsSEP.04.00TN-SH7-249A/ERev.1.0191List
 
SH7750 About BSREQ# in Partial-sharing master modeLimitation of UseSEP.04.00TN-SH7-250A/ERev.1.081List
 
SH7750 Section23 Electrical Characteristics on SH7750 Series Hardware ManualSupplement of DocumentsAUG.23.00TN-SH7-246A/ERev.1.0582List
 
SH-4 Handling of Reserved Pin and CA pinSupplement of DocumentsAUG.23.00TN-SH7-247A/ERev.1.0202List
 
BSC WCR1 usage noticeSupplement of DocumentsAPR.12.00TN-SH7-224A/ERev.1.0122List
 
SH-4 SH7750 Hardware Manual usage noticeSupplement of DocumentsFEB.01.00TN-SH7-202A/ERev.1.0172List
 
Limitation on Store Queue instructions due to incapability of cancellationLimitation of UseFEB.01.00TN-SH7-203A/ERev.1.0163List
 
DMAC DDT mode usage noticeSupplement of DocumentsDEC.14.99TN-SH7-200A/ERev.1.0331List
 
Setup time specification and product code changeSpec changeSEP.27.99TN-SH7-187A/ERev.1.0291List
 
Revision of BCR1 descriptionSupplement of DocumentsAUG.09.99TN-SH7-179A/ERev.1.0181List
 
HD6417750BP200 usage notice of reflow and storage conditions.Limitation of UseJUL.05.99TN-SH7-171A/ERev.1.0341List
 
Setting Synchronous DRAM Mode registerLimitation of UseJUN.07.99TN-SH7-157A/ERev.1.0241List
 
DMAC external request modeSupplement of DocumentsMAY.20.99TN-SH7-156A/ERev.1.0271List
 
Supported DMA TransfersSupplement of DocumentsAPR.09.99TN-SH7-143A/ERev.1.0522List
 
The limitation of exception handing routine descriptionLimitation of UseJAN.04.99TN-SH7-117A/ERev.1.0582List
 
+
+
+
+ + + + + + + + +
+ +   + + Top
+
+ + + + +
+ + + + +
+ + + + + + + + + + + + +
Compiler / Document TitleClassfication of InformationIssue DateDocument NumberRevisionVolume (KB)Page CountProduct Name
SuperH RISC engine C/C++ compiler package Ver.7.1.05 UpdatesSpec changeAUG.30.04TN-CSX-081A/EARev.1.0121List
 
SuperH RISC engine C/C++ Compiler ver.7 Known Bug Report(13)Limitation of UseJUL.27.04TN-CSX-080A/EARev.1.0342List
 
Update of the Integrated Development Environment (HEW3) V.3.01.04Spec changeJUL.09.04TN-CSX-079A/EARev.1.0121List
 
SuperH RISC engine C/C++ Compiler ver.7 Known Bugs Report(12)Limitation of UseJUN.24.04TN-CSX-077A/EARev.1.0436List
 
SuperH RISC engine C/C++ Compiler Ver.8 bug information (3)Limitation of UseJUN.24.04TN-CSX-078A/EARev.1.0245List
 
SuperH RISC engine C/C++ Compiler ver.7 Known Bugs Report(11)Limitation of UseJUN.14.04TN-CSX-071A/EARev.1.0445List
 
SuperH RISC engine C/C++ compiler package V.8.00 Release 02 UpdatesSpec changeJUN.07.04TN-CSX-073A/EARev.1.0548List
 
SuperH RISC engine C/C++ Compiler Ver.8 bug information (2)Limitation of UseMAY.26.04TN-CSX-069A/EARev.1.0286List
 
Optimizing Linkage Editor Ver.8 bug informationLimitation of UseAPR.07.04TN-CSX-064A/EARev.1.0131List
 
SuperH RISC engine C/C++ compiler package Ver.8.0.01 UpdatesSpec changeFEB.04.04TN-CSX-063A/EARev.1.0162List
 
SuperH RISC engine C/C++ Compiler Ver.8 bug informationLimitation of UseJAN.27.04TN-CSX-061A/EARev.1.0142List
 
Update of the SuperH RISC engine C/C++ Compiler Package Ver. 7.1.04Spec changeDEC.10.03TN-CSX-057A/EARev.1.01383List
 
SuperH RISC engine C/C++ Compiler Ver.7 bug report (9)Limitation of UseOCT.30.03TN-CSX-054A/ERev.1.0194List
 
SuperH RISC engine C/C++ Compiler Ver.7 bug report (10)Limitation of UseOCT.30.03TN-CSX-056A/ERev.1.0288List
 
SuperH RISC engine C/C++ compiler package Ver.7.1.03 UpdatesSupplement of DocumentsAUG.11.03TN-CSX-052A/ERev.1.0329List
 
SuperH RISC engine C/C++ Compiler Ver.7 bug report (8)Limitation of UseJUN.24.03TN-CSX-051A/ERev.1.0142List
 
SuperH RISC engine C/C++ Compiler Ver.7 bug report (7)Limitation of UseAPR.24.03TN-CSX-050A/ERev.1.0324List
 
SuperH RISC engine C/C++ Compiler Ver.7 bug report (6)Limitation of UseMAR.25.03TN-CSX-049A/ERev.1.0184List
 
SuperH RISC engine C/C++ compiler package Ver.7.1.01 UpdatesSpec changeJAN.31.03TN-CSX-048A/ERev.1.0259List
 
SuperH RISC engine C/C++ Compiler Ver.6 Failure Found in This Release(When CPU=SH4 is Specified.)Limitation of UseDEC.02.02TN-CSX-046A/ERev.1.0143List
 
SuperH RISC engine C/C++ Compiler Ver.7 bug report (5)Limitation of UseNOV.06.02TN-CSX-044A/ERev.1.02410List
 
SuperH RISC engine C/C++ Compiler Ver.7.0 bug report (3)Limitation of UseSEP.09.02TN-CSX-039A/ERev.1.01303List
 
SuperH RISC engine C/C++ Compiler Ver.7.0 bug report (4)Limitation of UseSEP.09.02TN-CSX-040A/ERev.1.01296List
 
Release of patch against SuperH RISC engine C/C++ compiler Package Ver.6.0 Ver.6.0A and Ver.6.0BSpec changeSEP.09.02TN-CSX-041A/ERev.1.01637List
 
SuperH RISC engine C/C++ compiler package Ver.7.1.00 UpdatesSpec changeSEP.09.02TN-CSX-043A/ERev.1.016317List
 
SuperH RISC engine C/C++ Compiler Ver.7.0 bug report (2)Limitation of UseMAY.31.02TN-CSX-038A/ERev.1.03514List
 
SuperH RISC engine C/C++ Compiler Ver.7.0.04 bug reportLimitation of UseAPR.15.02TN-CSX-036A/ERev.1.0165List
 
SuperH RISC engine C/C++ Compiler Ver.6.0B bug reportLimitation of UseAPR.15.02TN-CSX-037A/ERev.1.0113List
 
SuperH RISC engine C/C++ compiler package Ver.7.0.02(PC version)/ Ver.7.0.03(UNIX version) UpdatesSpec changeMAR.27.02TN-CSX-035A/ERev.1.02714List
 
Note on using Optimizing Linkage Editor SuperH RISC engine C/C++ Compiler Package H8S H8/300 C/C++ Compiler PackageLimitation of UseMAR.14.02TN-CSX-033A/ERev.1.051List
 
Release of patch against SuperH RISC engine C/C++ compiler Package Ver.7.0BSpec changeMAR.14.02TN-CSX-034A/ERev.1.0156List
 
Release of patch against SuperH RISC engine C/C++ compiler Package Ver.6.0 and Ver.6.0ASpec changeFEB.05.02TN-CSX-031A/ERev.1.0104List
 
+
+
+
+ + + + + + + + +
+ +   + + Top
+
+ + + + +
+ + + + +
+ + + + + + + + + + + + +
Real-time OS / Document TitleClassfication of InformationIssue DateDocument NumberRevisionVolume (KB)Page CountProduct Name
HI7000/4, HI7700/4, HI7750/4 Correction of Manual regarding stack sizeSupplement of DocumentsJUN.17.04TN-OS*-081A/EARev.1.04411List
 
HI7750/4 UpdatesSpec changeJAN.13.04TN-OS*-080A/EARev.1.0111List
 
HI7000/4 HI7700/4 HI7750/4 Correction of error about cyclic time of cyclic handler on HI7000/4 series Users ManualSupplement of DocumentsJUL.30.03TN-OS*-075A/ERev.1.081List
 
HI7700/4 The restriction matter at the time of undefined interruptionLimitation of UseMAR.25.03TN-OS*-074B/ERev.2.0152List
 
The HI7000/4 V1.0.05 Updates and HI7750/4 V1.0.05 UpdatesSupplement of DocumentsJAN.31.03TN-OS*-071A/ERev.1.081List
 
HI7700/4 V1.2.00 UpdatesSpec changeJAN.31.03TN-OS*-072A/ERev.1.091List
 
Release of HI7750/4 V1.0.04Spec changeJAN.06.03TN-OS*-069A/ERev.1.0101List
 
HI7750 Notes on using the FPULimitation of UseNOV.20.02TN-OS*-065A/ERev.1.0206List
 
HI7750/4 Notes on using the FPULimitation of UseNOV.20.02TN-OS*-066A/ERev.1.0216List
 
HI7700/4 and HI7750/4 Bugs regarding ref_almLimitation of UseOCT.17.02TN-OS*-063A/ERev.1.081List
 
HI7700/4 V1.1.00 Revision upSpec changeJUN.14.02TN-OS*-058A/ERev.1.019411List
 
+
+
+
+ + + + + + + + +
+ +   + + Top
+
+ + + + +
+ + + + +
+ + + + + + + + + + + + +
Emulator / Document TitleClassfication of InformationIssue DateDocument NumberRevisionVolume (KB)Page CountProduct Name
Notes on Usage of Software BreaksLimitation of UseFEB.24.03TN-EML-108A/ERev.1.071List
 
Problem on Using the PCMCIA and PCI Drivers for Windows 2000 with the E10A/E10T/E6000/E8000 EmulatorLimitation of UseSEP.24.02TN-EML-096A/ERev.1.071List
 
Information on a Malfunction and Version Update of the SH7750R E10A Emulator and the SH7751R E10A EmulatorLimitation of UseMAR.28.02TN-EML-082A/ERev.1.091List
 
Information on a Malfunction when Using the E10A Emulator on the High-speed Host Computer and a CountermeasureLimitation of UseMAR.27.02TN-EML-081A/ERev.1.0112List
 
Malfunction of TELNET Connection in E8000 Emulator (HS8000EST02SR)Spec changeMAR.24.99TN-EML-040A/ERev.1.0181List
 
+
+
+
+ + + + + + + + +
+ +   + + Top
+
+ + + + +
+ + + + +
+ + + + + + + + + + + + +
Emulator Options1(PC I/F-part) / Document TitleClassfication of InformationIssue DateDocument NumberRevisionVolume (KB)Page CountProduct Name
Notes on Usage of the USB Adapter for E6000/E8000 Emulator (HS6000EIU01)Limitation of UseJUN.05.03TN-EML-110A/ERev.1.071List
 
Updating the Revision of the Firmware for the E6000/E8000 USB AdapterLimitation of UseDEC.18.02TN-EML-104A/ERev.1.061List
 
Updating the Revision of the Firmware for the E6000/E8000 LAN AdapterLimitation of UseDEC.18.02TN-EML-105A/ERev.1.051List
 
+
+
+
+ + + + + + + + +
+ +   + + Top
+
+ + + + +
+ + + + +
+ + + + + + + + + + + + +
Others / Document TitleClassfication of InformationIssue DateDocument NumberRevisionVolume (KB)Page CountProduct Name
Notification of changing over to JEDEC tray (for QFP1414)Spec changeMAY.26.03TN-PKG-080C/ERev.3.0752List
 
Notification of changing over to JEDEC tray(for QFP1420,2020 & TQFP1414)Spec changeMAY.26.03TN-PKG-086C/ERev.3.0722List
 
+
+
+
+ + +
+ + + + +
+ +
+ + + + +
+ + + +
+ +
+ +
+ +
+ + + + + + + + + + + + + +
+ +
+
+ + © 2004. Renesas Technology Corp., All rights reserved. + Privacy | Legal +
+ +
+ + + + + + + + \ No newline at end of file diff --git a/CPU/DOCS/SUP/tncsx031ae.pdf b/CPU/DOCS/SUP/tncsx031ae.pdf new file mode 100644 index 00000000..002eb9e7 Binary files /dev/null and b/CPU/DOCS/SUP/tncsx031ae.pdf differ diff --git a/CPU/DOCS/SUP/tncsx033ae.pdf b/CPU/DOCS/SUP/tncsx033ae.pdf new file mode 100644 index 00000000..3375f79e Binary files /dev/null and b/CPU/DOCS/SUP/tncsx033ae.pdf differ diff --git a/CPU/DOCS/SUP/tncsx034ae.pdf b/CPU/DOCS/SUP/tncsx034ae.pdf new file mode 100644 index 00000000..f9b20639 Binary files /dev/null and b/CPU/DOCS/SUP/tncsx034ae.pdf differ diff --git a/CPU/DOCS/SUP/tncsx035ae.pdf b/CPU/DOCS/SUP/tncsx035ae.pdf new file mode 100644 index 00000000..7e7627b4 Binary files /dev/null and b/CPU/DOCS/SUP/tncsx035ae.pdf differ diff --git a/CPU/DOCS/SUP/tncsx036ae.pdf b/CPU/DOCS/SUP/tncsx036ae.pdf new file mode 100644 index 00000000..2c6c3968 Binary files /dev/null and b/CPU/DOCS/SUP/tncsx036ae.pdf differ diff --git a/CPU/DOCS/SUP/tncsx037ae.pdf b/CPU/DOCS/SUP/tncsx037ae.pdf new file mode 100644 index 00000000..d4e98cb8 Binary files /dev/null and b/CPU/DOCS/SUP/tncsx037ae.pdf differ diff --git a/CPU/DOCS/SUP/tncsx038ae.pdf b/CPU/DOCS/SUP/tncsx038ae.pdf new file mode 100644 index 00000000..d7b0c0e5 Binary files /dev/null and b/CPU/DOCS/SUP/tncsx038ae.pdf differ diff --git a/CPU/DOCS/SUP/tncsx039ae.pdf b/CPU/DOCS/SUP/tncsx039ae.pdf new file mode 100644 index 00000000..a14fd1db Binary files /dev/null and b/CPU/DOCS/SUP/tncsx039ae.pdf differ diff --git a/CPU/DOCS/SUP/tncsx040ae.pdf b/CPU/DOCS/SUP/tncsx040ae.pdf new file mode 100644 index 00000000..c94755e5 Binary files /dev/null and b/CPU/DOCS/SUP/tncsx040ae.pdf differ diff --git a/CPU/DOCS/SUP/tncsx041ae.pdf b/CPU/DOCS/SUP/tncsx041ae.pdf new file mode 100644 index 00000000..3a4b7408 Binary files /dev/null and b/CPU/DOCS/SUP/tncsx041ae.pdf differ diff --git a/CPU/DOCS/SUP/tncsx043ae.pdf b/CPU/DOCS/SUP/tncsx043ae.pdf new file mode 100644 index 00000000..2d5f3af0 Binary files /dev/null and b/CPU/DOCS/SUP/tncsx043ae.pdf differ diff --git a/CPU/DOCS/SUP/tncsx044ae.pdf b/CPU/DOCS/SUP/tncsx044ae.pdf new file mode 100644 index 00000000..ca70f8f9 Binary files /dev/null and b/CPU/DOCS/SUP/tncsx044ae.pdf differ diff --git a/CPU/DOCS/SUP/tncsx046ae.pdf b/CPU/DOCS/SUP/tncsx046ae.pdf new file mode 100644 index 00000000..3892b711 Binary files /dev/null and b/CPU/DOCS/SUP/tncsx046ae.pdf differ diff --git a/CPU/DOCS/SUP/tncsx048ae.pdf b/CPU/DOCS/SUP/tncsx048ae.pdf new file mode 100644 index 00000000..32613965 Binary files /dev/null and b/CPU/DOCS/SUP/tncsx048ae.pdf differ diff --git a/CPU/DOCS/SUP/tncsx049ae.pdf b/CPU/DOCS/SUP/tncsx049ae.pdf new file mode 100644 index 00000000..46d508a1 Binary files /dev/null and b/CPU/DOCS/SUP/tncsx049ae.pdf differ diff --git a/CPU/DOCS/SUP/tncsx050ae.pdf b/CPU/DOCS/SUP/tncsx050ae.pdf new file mode 100644 index 00000000..3663fa6a Binary files /dev/null and b/CPU/DOCS/SUP/tncsx050ae.pdf differ diff --git a/CPU/DOCS/SUP/tncsx051ae.pdf b/CPU/DOCS/SUP/tncsx051ae.pdf new file mode 100644 index 00000000..42727c83 Binary files /dev/null and b/CPU/DOCS/SUP/tncsx051ae.pdf differ diff --git a/CPU/DOCS/SUP/tncsx052ae.pdf b/CPU/DOCS/SUP/tncsx052ae.pdf new file mode 100644 index 00000000..40823ae1 Binary files /dev/null and b/CPU/DOCS/SUP/tncsx052ae.pdf differ diff --git a/CPU/DOCS/SUP/tncsx054ae.pdf b/CPU/DOCS/SUP/tncsx054ae.pdf new file mode 100644 index 00000000..67383cd7 Binary files /dev/null and b/CPU/DOCS/SUP/tncsx054ae.pdf differ diff --git a/CPU/DOCS/SUP/tncsx056ae.pdf b/CPU/DOCS/SUP/tncsx056ae.pdf new file mode 100644 index 00000000..939a9abf Binary files /dev/null and b/CPU/DOCS/SUP/tncsx056ae.pdf differ diff --git a/CPU/DOCS/SUP/tncsx057aea.pdf b/CPU/DOCS/SUP/tncsx057aea.pdf new file mode 100644 index 00000000..7f657ebb Binary files /dev/null and b/CPU/DOCS/SUP/tncsx057aea.pdf differ diff --git a/CPU/DOCS/SUP/tncsx061aea.pdf b/CPU/DOCS/SUP/tncsx061aea.pdf new file mode 100644 index 00000000..011a8d4a Binary files /dev/null and b/CPU/DOCS/SUP/tncsx061aea.pdf differ diff --git a/CPU/DOCS/SUP/tncsx063aea.pdf b/CPU/DOCS/SUP/tncsx063aea.pdf new file mode 100644 index 00000000..da6cee26 Binary files /dev/null and b/CPU/DOCS/SUP/tncsx063aea.pdf differ diff --git a/CPU/DOCS/SUP/tncsx064aea.pdf b/CPU/DOCS/SUP/tncsx064aea.pdf new file mode 100644 index 00000000..1af25910 Binary files /dev/null and b/CPU/DOCS/SUP/tncsx064aea.pdf differ diff --git a/CPU/DOCS/SUP/tncsx069aea.pdf b/CPU/DOCS/SUP/tncsx069aea.pdf new file mode 100644 index 00000000..d7728c60 Binary files /dev/null and b/CPU/DOCS/SUP/tncsx069aea.pdf differ diff --git a/CPU/DOCS/SUP/tncsx071aea.pdf b/CPU/DOCS/SUP/tncsx071aea.pdf new file mode 100644 index 00000000..4b950885 Binary files /dev/null and b/CPU/DOCS/SUP/tncsx071aea.pdf differ diff --git a/CPU/DOCS/SUP/tncsx073aea.pdf b/CPU/DOCS/SUP/tncsx073aea.pdf new file mode 100644 index 00000000..76bde514 Binary files /dev/null and b/CPU/DOCS/SUP/tncsx073aea.pdf differ diff --git a/CPU/DOCS/SUP/tncsx077aea.pdf b/CPU/DOCS/SUP/tncsx077aea.pdf new file mode 100644 index 00000000..fe0831c6 Binary files /dev/null and b/CPU/DOCS/SUP/tncsx077aea.pdf differ diff --git a/CPU/DOCS/SUP/tncsx078aea.pdf b/CPU/DOCS/SUP/tncsx078aea.pdf new file mode 100644 index 00000000..890fec9c Binary files /dev/null and b/CPU/DOCS/SUP/tncsx078aea.pdf differ diff --git a/CPU/DOCS/SUP/tncsx079aea.pdf b/CPU/DOCS/SUP/tncsx079aea.pdf new file mode 100644 index 00000000..263c5fd5 Binary files /dev/null and b/CPU/DOCS/SUP/tncsx079aea.pdf differ diff --git a/CPU/DOCS/SUP/tncsx080aea.pdf b/CPU/DOCS/SUP/tncsx080aea.pdf new file mode 100644 index 00000000..cb92526e Binary files /dev/null and b/CPU/DOCS/SUP/tncsx080aea.pdf differ diff --git a/CPU/DOCS/SUP/tncsx081aea.pdf b/CPU/DOCS/SUP/tncsx081aea.pdf new file mode 100644 index 00000000..3b875706 Binary files /dev/null and b/CPU/DOCS/SUP/tncsx081aea.pdf differ diff --git a/CPU/DOCS/SUP/tneml040ae.pdf b/CPU/DOCS/SUP/tneml040ae.pdf new file mode 100644 index 00000000..56d5a46a Binary files /dev/null and b/CPU/DOCS/SUP/tneml040ae.pdf differ diff --git a/CPU/DOCS/SUP/tneml081ae.pdf b/CPU/DOCS/SUP/tneml081ae.pdf new file mode 100644 index 00000000..3554b224 Binary files /dev/null and b/CPU/DOCS/SUP/tneml081ae.pdf differ diff --git a/CPU/DOCS/SUP/tneml082ae.pdf b/CPU/DOCS/SUP/tneml082ae.pdf new file mode 100644 index 00000000..0c0e34d2 Binary files /dev/null and b/CPU/DOCS/SUP/tneml082ae.pdf differ diff --git a/CPU/DOCS/SUP/tneml096ae.pdf b/CPU/DOCS/SUP/tneml096ae.pdf new file mode 100644 index 00000000..30d43374 Binary files /dev/null and b/CPU/DOCS/SUP/tneml096ae.pdf differ diff --git a/CPU/DOCS/SUP/tneml104ae.pdf b/CPU/DOCS/SUP/tneml104ae.pdf new file mode 100644 index 00000000..1cfadeff Binary files /dev/null and b/CPU/DOCS/SUP/tneml104ae.pdf differ diff --git a/CPU/DOCS/SUP/tneml105ae.pdf b/CPU/DOCS/SUP/tneml105ae.pdf new file mode 100644 index 00000000..42414cd3 Binary files /dev/null and b/CPU/DOCS/SUP/tneml105ae.pdf differ diff --git a/CPU/DOCS/SUP/tneml108ae.pdf b/CPU/DOCS/SUP/tneml108ae.pdf new file mode 100644 index 00000000..1b0a04a0 Binary files /dev/null and b/CPU/DOCS/SUP/tneml108ae.pdf differ diff --git a/CPU/DOCS/SUP/tneml110ae.pdf b/CPU/DOCS/SUP/tneml110ae.pdf new file mode 100644 index 00000000..58b88748 Binary files /dev/null and b/CPU/DOCS/SUP/tneml110ae.pdf differ diff --git a/CPU/DOCS/SUP/tnos058ae.pdf b/CPU/DOCS/SUP/tnos058ae.pdf new file mode 100644 index 00000000..bb4497e0 Binary files /dev/null and b/CPU/DOCS/SUP/tnos058ae.pdf differ diff --git a/CPU/DOCS/SUP/tnos063ae.pdf b/CPU/DOCS/SUP/tnos063ae.pdf new file mode 100644 index 00000000..b2b07304 Binary files /dev/null and b/CPU/DOCS/SUP/tnos063ae.pdf differ diff --git a/CPU/DOCS/SUP/tnos065ae.pdf b/CPU/DOCS/SUP/tnos065ae.pdf new file mode 100644 index 00000000..f9c6000f Binary files /dev/null and b/CPU/DOCS/SUP/tnos065ae.pdf differ diff --git a/CPU/DOCS/SUP/tnos066ae.pdf b/CPU/DOCS/SUP/tnos066ae.pdf new file mode 100644 index 00000000..2f842b65 Binary files /dev/null and b/CPU/DOCS/SUP/tnos066ae.pdf differ diff --git a/CPU/DOCS/SUP/tnos069ae.pdf b/CPU/DOCS/SUP/tnos069ae.pdf new file mode 100644 index 00000000..d04f0a04 Binary files /dev/null and b/CPU/DOCS/SUP/tnos069ae.pdf differ diff --git a/CPU/DOCS/SUP/tnos071ae.pdf b/CPU/DOCS/SUP/tnos071ae.pdf new file mode 100644 index 00000000..978e25f9 Binary files /dev/null and b/CPU/DOCS/SUP/tnos071ae.pdf differ diff --git a/CPU/DOCS/SUP/tnos072ae.pdf b/CPU/DOCS/SUP/tnos072ae.pdf new file mode 100644 index 00000000..3c766c00 Binary files /dev/null and b/CPU/DOCS/SUP/tnos072ae.pdf differ diff --git a/CPU/DOCS/SUP/tnos074be.pdf b/CPU/DOCS/SUP/tnos074be.pdf new file mode 100644 index 00000000..2ab7932e Binary files /dev/null and b/CPU/DOCS/SUP/tnos074be.pdf differ diff --git a/CPU/DOCS/SUP/tnos075ae.pdf b/CPU/DOCS/SUP/tnos075ae.pdf new file mode 100644 index 00000000..f666a282 Binary files /dev/null and b/CPU/DOCS/SUP/tnos075ae.pdf differ diff --git a/CPU/DOCS/SUP/tnos080aea.pdf b/CPU/DOCS/SUP/tnos080aea.pdf new file mode 100644 index 00000000..baa0fa7e Binary files /dev/null and b/CPU/DOCS/SUP/tnos080aea.pdf differ diff --git a/CPU/DOCS/SUP/tnos081aea.pdf b/CPU/DOCS/SUP/tnos081aea.pdf new file mode 100644 index 00000000..ddfa8b53 Binary files /dev/null and b/CPU/DOCS/SUP/tnos081aea.pdf differ diff --git a/CPU/DOCS/SUP/tnpkg080ce.pdf b/CPU/DOCS/SUP/tnpkg080ce.pdf new file mode 100644 index 00000000..5781be79 Binary files /dev/null and b/CPU/DOCS/SUP/tnpkg080ce.pdf differ diff --git a/CPU/DOCS/SUP/tnpkg086ce.pdf b/CPU/DOCS/SUP/tnpkg086ce.pdf new file mode 100644 index 00000000..6c601765 Binary files /dev/null and b/CPU/DOCS/SUP/tnpkg086ce.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7117ae.pdf b/CPU/DOCS/SUP/tnsh7117ae.pdf new file mode 100644 index 00000000..4909f751 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7117ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7143ae.pdf b/CPU/DOCS/SUP/tnsh7143ae.pdf new file mode 100644 index 00000000..5f4161d7 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7143ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7156ae.pdf b/CPU/DOCS/SUP/tnsh7156ae.pdf new file mode 100644 index 00000000..128c77e1 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7156ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7157ae.pdf b/CPU/DOCS/SUP/tnsh7157ae.pdf new file mode 100644 index 00000000..545e180a Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7157ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7171ae.pdf b/CPU/DOCS/SUP/tnsh7171ae.pdf new file mode 100644 index 00000000..b55d48cc Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7171ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7179ae.pdf b/CPU/DOCS/SUP/tnsh7179ae.pdf new file mode 100644 index 00000000..2792303d Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7179ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7187ae.pdf b/CPU/DOCS/SUP/tnsh7187ae.pdf new file mode 100644 index 00000000..977adffd Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7187ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7200ae.pdf b/CPU/DOCS/SUP/tnsh7200ae.pdf new file mode 100644 index 00000000..26219192 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7200ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7203ae.pdf b/CPU/DOCS/SUP/tnsh7203ae.pdf new file mode 100644 index 00000000..ada4fa9e Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7203ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7224ae.pdf b/CPU/DOCS/SUP/tnsh7224ae.pdf new file mode 100644 index 00000000..c0e229d4 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7224ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7249ae.pdf b/CPU/DOCS/SUP/tnsh7249ae.pdf new file mode 100644 index 00000000..effe6686 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7249ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7250ae.pdf b/CPU/DOCS/SUP/tnsh7250ae.pdf new file mode 100644 index 00000000..8bae6d0c Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7250ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7260ae.pdf b/CPU/DOCS/SUP/tnsh7260ae.pdf new file mode 100644 index 00000000..83a9740b Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7260ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7272ae.pdf b/CPU/DOCS/SUP/tnsh7272ae.pdf new file mode 100644 index 00000000..9efe1d44 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7272ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7295ae.pdf b/CPU/DOCS/SUP/tnsh7295ae.pdf new file mode 100644 index 00000000..df617a91 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7295ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7296ae.pdf b/CPU/DOCS/SUP/tnsh7296ae.pdf new file mode 100644 index 00000000..33e9d784 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7296ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7298ae.pdf b/CPU/DOCS/SUP/tnsh7298ae.pdf new file mode 100644 index 00000000..31c6d299 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7298ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7341be.pdf b/CPU/DOCS/SUP/tnsh7341be.pdf new file mode 100644 index 00000000..0c8f5eb9 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7341be.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7342ae.pdf b/CPU/DOCS/SUP/tnsh7342ae.pdf new file mode 100644 index 00000000..c6f701c9 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7342ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7343ae.pdf b/CPU/DOCS/SUP/tnsh7343ae.pdf new file mode 100644 index 00000000..421f2443 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7343ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7346ae.pdf b/CPU/DOCS/SUP/tnsh7346ae.pdf new file mode 100644 index 00000000..3b92cf9b Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7346ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7347ae.pdf b/CPU/DOCS/SUP/tnsh7347ae.pdf new file mode 100644 index 00000000..79ba43f4 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7347ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7349ae.pdf b/CPU/DOCS/SUP/tnsh7349ae.pdf new file mode 100644 index 00000000..f66aec92 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7349ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7350ae.pdf b/CPU/DOCS/SUP/tnsh7350ae.pdf new file mode 100644 index 00000000..1292c883 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7350ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7360ae.pdf b/CPU/DOCS/SUP/tnsh7360ae.pdf new file mode 100644 index 00000000..99faca56 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7360ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7361be.pdf b/CPU/DOCS/SUP/tnsh7361be.pdf new file mode 100644 index 00000000..41c63008 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7361be.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7372ae.pdf b/CPU/DOCS/SUP/tnsh7372ae.pdf new file mode 100644 index 00000000..cbc765b6 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7372ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7376ae.pdf b/CPU/DOCS/SUP/tnsh7376ae.pdf new file mode 100644 index 00000000..ece875dd Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7376ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7388ae.pdf b/CPU/DOCS/SUP/tnsh7388ae.pdf new file mode 100644 index 00000000..a33967cd Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7388ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7395ae.pdf b/CPU/DOCS/SUP/tnsh7395ae.pdf new file mode 100644 index 00000000..8389588e Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7395ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7418ae.pdf b/CPU/DOCS/SUP/tnsh7418ae.pdf new file mode 100644 index 00000000..40abe586 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7418ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7419ae.pdf b/CPU/DOCS/SUP/tnsh7419ae.pdf new file mode 100644 index 00000000..0c14edbd Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7419ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7424ae.pdf b/CPU/DOCS/SUP/tnsh7424ae.pdf new file mode 100644 index 00000000..7e1cf202 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7424ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7440ae.pdf b/CPU/DOCS/SUP/tnsh7440ae.pdf new file mode 100644 index 00000000..ecf08cb3 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7440ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7445ae.pdf b/CPU/DOCS/SUP/tnsh7445ae.pdf new file mode 100644 index 00000000..2896e3b4 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7445ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7448ae.pdf b/CPU/DOCS/SUP/tnsh7448ae.pdf new file mode 100644 index 00000000..a54514e7 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7448ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7455ae.pdf b/CPU/DOCS/SUP/tnsh7455ae.pdf new file mode 100644 index 00000000..51dd4062 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7455ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7456ae.pdf b/CPU/DOCS/SUP/tnsh7456ae.pdf new file mode 100644 index 00000000..faae78a2 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7456ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7465ae.pdf b/CPU/DOCS/SUP/tnsh7465ae.pdf new file mode 100644 index 00000000..38d11b50 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7465ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7466ae.pdf b/CPU/DOCS/SUP/tnsh7466ae.pdf new file mode 100644 index 00000000..2ee033d6 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7466ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7468ae.pdf b/CPU/DOCS/SUP/tnsh7468ae.pdf new file mode 100644 index 00000000..bae51a37 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7468ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7472ae.pdf b/CPU/DOCS/SUP/tnsh7472ae.pdf new file mode 100644 index 00000000..50d6d7ec Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7472ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7475ae.pdf b/CPU/DOCS/SUP/tnsh7475ae.pdf new file mode 100644 index 00000000..358068be Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7475ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7476ae.pdf b/CPU/DOCS/SUP/tnsh7476ae.pdf new file mode 100644 index 00000000..e39df8b5 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7476ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7477ae.pdf b/CPU/DOCS/SUP/tnsh7477ae.pdf new file mode 100644 index 00000000..9c55d3bc Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7477ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7478ae.pdf b/CPU/DOCS/SUP/tnsh7478ae.pdf new file mode 100644 index 00000000..e43a56e3 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7478ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7479ae.pdf b/CPU/DOCS/SUP/tnsh7479ae.pdf new file mode 100644 index 00000000..967c5c57 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7479ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7492ae.pdf b/CPU/DOCS/SUP/tnsh7492ae.pdf new file mode 100644 index 00000000..0c006327 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7492ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7494ae.pdf b/CPU/DOCS/SUP/tnsh7494ae.pdf new file mode 100644 index 00000000..69ead0c9 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7494ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7495ae.pdf b/CPU/DOCS/SUP/tnsh7495ae.pdf new file mode 100644 index 00000000..3f49ae6e Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7495ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7496ae.pdf b/CPU/DOCS/SUP/tnsh7496ae.pdf new file mode 100644 index 00000000..ad6594f7 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7496ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7497ae.pdf b/CPU/DOCS/SUP/tnsh7497ae.pdf new file mode 100644 index 00000000..86419da1 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7497ae.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7501aea.pdf b/CPU/DOCS/SUP/tnsh7501aea.pdf new file mode 100644 index 00000000..e0f9a0fa Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7501aea.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7505aea.pdf b/CPU/DOCS/SUP/tnsh7505aea.pdf new file mode 100644 index 00000000..04fd2f36 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7505aea.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7517aea.pdf b/CPU/DOCS/SUP/tnsh7517aea.pdf new file mode 100644 index 00000000..940f68e2 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7517aea.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7518aea.pdf b/CPU/DOCS/SUP/tnsh7518aea.pdf new file mode 100644 index 00000000..fd87d5b9 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7518aea.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7519aea.pdf b/CPU/DOCS/SUP/tnsh7519aea.pdf new file mode 100644 index 00000000..5ca970f4 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7519aea.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7528aea.pdf b/CPU/DOCS/SUP/tnsh7528aea.pdf new file mode 100644 index 00000000..fcf90a2e Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7528aea.pdf differ diff --git a/CPU/DOCS/SUP/tnsh7529aea.pdf b/CPU/DOCS/SUP/tnsh7529aea.pdf new file mode 100644 index 00000000..9c710ad5 Binary files /dev/null and b/CPU/DOCS/SUP/tnsh7529aea.pdf differ diff --git a/CPU/DOCS/rej10b0025_sh.pdf b/CPU/DOCS/rej10b0025_sh.pdf new file mode 100644 index 00000000..786ce778 Binary files /dev/null and b/CPU/DOCS/rej10b0025_sh.pdf differ diff --git a/CPU/DOCS/rej11k0001_surface.pdf b/CPU/DOCS/rej11k0001_surface.pdf new file mode 100644 index 00000000..10f836fd Binary files /dev/null and b/CPU/DOCS/rej11k0001_surface.pdf differ diff --git a/CPU/EXES/Chankast 025/Chankast_alpha_25.exe b/CPU/EXES/Chankast 025/Chankast_alpha_25.exe new file mode 100644 index 00000000..df30fac7 Binary files /dev/null and b/CPU/EXES/Chankast 025/Chankast_alpha_25.exe differ diff --git a/CPU/EXES/Chankast 025/Lisez moi.txt b/CPU/EXES/Chankast 025/Lisez moi.txt new file mode 100644 index 00000000..e4721090 --- /dev/null +++ b/CPU/EXES/Chankast 025/Lisez moi.txt @@ -0,0 +1,16 @@ +Traduction Française de l'émulateur Chankast 0.25 +par Benjamin Siskoo + +Mise à jour le 8 Juillet 2004 + + + +CONTACT : +--------- + +Si vous trouvez des bugs dus à la traduction francaise par rapport à l'anglaise, des fautes d'orthographes ou de style, ou même remanié certaines expressions, écrivez-moi à : + +MrChakotay@hotmail.com + +http://www.tradu-france.com/ + diff --git a/CPU/EXES/Chankast 025/VMSB1.BIN b/CPU/EXES/Chankast 025/VMSB1.BIN new file mode 100644 index 00000000..e2c8fe92 Binary files /dev/null and b/CPU/EXES/Chankast 025/VMSB1.BIN differ diff --git a/CPU/EXES/Chankast 025/chankast.cfg b/CPU/EXES/Chankast 025/chankast.cfg new file mode 100644 index 00000000..1f721977 Binary files /dev/null and b/CPU/EXES/Chankast 025/chankast.cfg differ diff --git a/CPU/EXES/Chankast 025/chankast_cdrom.dll b/CPU/EXES/Chankast 025/chankast_cdrom.dll new file mode 100644 index 00000000..efe6dd9e Binary files /dev/null and b/CPU/EXES/Chankast 025/chankast_cdrom.dll differ diff --git a/CPU/EXES/Chankast 025/chankast_cdrom_aspi.dll b/CPU/EXES/Chankast 025/chankast_cdrom_aspi.dll new file mode 100644 index 00000000..5a977365 Binary files /dev/null and b/CPU/EXES/Chankast 025/chankast_cdrom_aspi.dll differ diff --git a/CPU/EXES/Chankast 025/chankast_input.dll b/CPU/EXES/Chankast 025/chankast_input.dll new file mode 100644 index 00000000..e619ac71 Binary files /dev/null and b/CPU/EXES/Chankast 025/chankast_input.dll differ diff --git a/CPU/EXES/Chankast 025/chankast_input_semi.dll b/CPU/EXES/Chankast 025/chankast_input_semi.dll new file mode 100644 index 00000000..9098ff65 Binary files /dev/null and b/CPU/EXES/Chankast 025/chankast_input_semi.dll differ diff --git a/CPU/EXES/Chankast 025/chankast_manual.chm b/CPU/EXES/Chankast 025/chankast_manual.chm new file mode 100644 index 00000000..d28242ee Binary files /dev/null and b/CPU/EXES/Chankast 025/chankast_manual.chm differ diff --git a/CPU/EXES/Chankast 025/dc_bios.bin b/CPU/EXES/Chankast 025/dc_bios.bin new file mode 100644 index 00000000..3587323a Binary files /dev/null and b/CPU/EXES/Chankast 025/dc_bios.bin differ diff --git a/CPU/EXES/Chankast 025/dc_flash.bin b/CPU/EXES/Chankast 025/dc_flash.bin new file mode 100644 index 00000000..871991c7 Binary files /dev/null and b/CPU/EXES/Chankast 025/dc_flash.bin differ diff --git a/CPU/EXES/Chankast 025/maple.cfg b/CPU/EXES/Chankast 025/maple.cfg new file mode 100644 index 00000000..205b7d54 Binary files /dev/null and b/CPU/EXES/Chankast 025/maple.cfg differ diff --git a/CPU/EXES/Chankast 025/vms.bin b/CPU/EXES/Chankast 025/vms.bin new file mode 100644 index 00000000..e2c8fe92 Binary files /dev/null and b/CPU/EXES/Chankast 025/vms.bin differ diff --git a/CPU/EXES/Chankast 025/vmsbrowser.exe b/CPU/EXES/Chankast 025/vmsbrowser.exe new file mode 100644 index 00000000..82997dc9 Binary files /dev/null and b/CPU/EXES/Chankast 025/vmsbrowser.exe differ diff --git a/CPU/SDKS/dcland.pdf b/CPU/SDKS/dcland.pdf new file mode 100644 index 00000000..cafca869 Binary files /dev/null and b/CPU/SDKS/dcland.pdf differ diff --git a/CPU/SDKS/kgl.chm b/CPU/SDKS/kgl.chm new file mode 100644 index 00000000..7df1b8e1 Binary files /dev/null and b/CPU/SDKS/kgl.chm differ diff --git a/CPU/SDKS/kos-1.1.8/doc/manual/Makefile b/CPU/SDKS/kos-1.1.8/doc/manual/Makefile new file mode 100644 index 00000000..c235dedc --- /dev/null +++ b/CPU/SDKS/kos-1.1.8/doc/manual/Makefile @@ -0,0 +1,36 @@ +# Small makefile to generate the output formats +# Probably requires Linux, BSD, or a well-stocked Cygwin + +all: archives clean + +kgl: + -rm -rf kgl_html + lyx kgl.lyx -e latex + sed -e '4d' < kgl.tex > kgl2.tex + mv kgl2.tex kgl.tex + mkdir kgl_html + latex2html -split 4 -local_icons -white -dir kgl_html kgl.tex + -rm -f kgl_html/images.* kgl_html/*.pl kgl_html/WARNINGS kgl_html/kgl.html + -rm -f kos.pdf + latex kgl.tex + latex kgl.tex + pdflatex kgl.tex + -rm -f kgl.tex kgl.toc kgl.dvi + +kos: + -rm -rf kos_html + mkdir kos_html + latex2html -split 4 -local_icons -white -dir kos_html kos.tex + -rm -f kos_html/images.* kos_html/*.pl kos_html/WARNINGS kos_html/kos.html + -rm -f kos.pdf + latex kos.tex + latex kos.tex + pdflatex kos.tex + -rm -f kos.toc kos.dvi + +archives: kgl kos + zip -r kos_html.zip kos_html/ + zip -r kgl_html.zip kgl_html/ + +clean: + -rm -rf kos_html kgl_html *.aux *.log *.toc kgl.tex diff --git a/CPU/SDKS/kos-1.1.8/doc/manual/kgl.lyx b/CPU/SDKS/kos-1.1.8/doc/manual/kgl.lyx new file mode 100644 index 00000000..19922fad --- /dev/null +++ b/CPU/SDKS/kos-1.1.8/doc/manual/kgl.lyx @@ -0,0 +1,3629 @@ +#LyX 1.1 created this file. For more info see http://www.lyx.org/ +\lyxformat 218 +\textclass report +\language english +\inputencoding latin1 +\fontscheme default +\graphics default +\float_placement h!p!b +\paperfontsize default +\spacing onehalf +\papersize Default +\paperpackage a4 +\use_geometry 1 +\use_amsmath 0 +\paperorientation portrait +\leftmargin 0.5in +\topmargin 0.5in +\rightmargin 0.5in +\bottommargin 0.5in +\secnumdepth 2 +\tocdepth 2 +\paragraph_separation indent +\defskip medskip +\quotes_language swedish +\quotes_times 2 +\papercolumns 1 +\papersides 1 +\paperpagestyle default + +\layout Title + +Cryptic Allusion KallistiGL / Programmer's Manual +\layout Author + + +\family roman +\series medium +\shape up +\emph off +\bar no +\noun off +\latex no_latex +\color none +© +\family default +\series default +\shape default +\emph default +\bar default +\noun default +\latex default +\color default +2002 Paul Boese +\layout Standard + + +\begin_inset LatexCommand \tableofcontents{} + +\end_inset + + +\layout Chapter* + +Legal +\layout Standard + + +\begin_inset Quotes eld +\end_inset + +Sega +\begin_inset Quotes erd +\end_inset + + and +\begin_inset Quotes eld +\end_inset + +Dreamcast +\begin_inset Quotes erd +\end_inset + + are registered trademarks of Sega Enterprises, Ltd. + This package has no association with Sega or any of its affiliates, besides + working on their hardware. +\layout Standard + + +\begin_inset Quotes eld +\end_inset + +Gameboy Advance +\begin_inset Quotes erd +\end_inset + + is a registered trademark of Nintendo, Inc. + This package has no association with Nintendo or any of its affiliates, + besides working on some of their hardware. +\layout Standard + + +\begin_inset Quotes eld +\end_inset + +OpenGL +\begin_inset Quotes erd +\end_inset + + is a registered trademark owned by Silicon Graphics, Inc. + This package has no association with Silicon Graphics or any of its affiliates. + This product is based on the published OpenGL +\family roman +\series medium +\shape up +\emph off +\bar no +\noun off +\latex no_latex +\color none +® +\family default +\series default +\shape default +\emph default +\bar default +\noun default +\latex default +\color default +\SpecialChar ~ +API, but is not an implementation which is certified or licensed by Silicon + Graphics, Inc. + under the OpenGL +\family roman +\series medium +\shape up +\emph off +\bar no +\noun off +\latex no_latex +\color none +® +\family default +\series default +\shape default +\emph default +\bar default +\noun default +\latex default +\color default +\SpecialChar ~ +API. +\layout Standard + +All other trademarks are owned by their respective trademark holders. +\layout Standard + +KallistiOS +\family roman +\series medium +\shape up +\emph off +\bar no +\noun off +\latex no_latex +\color none +© +\family default +\series default +\shape default +\emph default +\bar default +\noun default +\latex default +\color default +2000-2002 Dan Potter. + Other portions +\family roman +\series medium +\shape up +\emph off +\bar no +\noun off +\latex no_latex +\color none +© +\family default +\series default +\shape default +\emph default +\bar default +\noun default +\latex default +\color default + their individual authors; please contact the authors for information on + using and/or distriburing their code. +\layout Standard + +KallistiGL +\family roman +\series medium +\shape up +\emph off +\bar no +\noun off +\latex no_latex +\color none +© +\family default +\series default +\shape default +\emph default +\bar default +\noun default +\latex default +\color default +2000-2002 Dan Potter, Benoit Miller, and others. + Other portions +\family roman +\series medium +\shape up +\emph off +\bar no +\noun off +\latex no_latex +\color none +© +\family default +\series default +\shape default +\emph default +\bar default +\noun default +\latex default +\color default + their individual authors; please contact the authors for information on + using and/or distriburing their code. +\layout Standard + +Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: +\layout Enumerate + +Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +\layout Enumerate + +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. + +\layout Enumerate + +Neither the name of Cryptic Allusion nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. +\layout Standard + +THIS SOFTWARE IS PROVIDED BY THE AUTHORS 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 AUTHORS 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. +\layout Chapter + +Overview +\layout Standard + +The KallistiGL (KGL) name is not intended to infringe on the OpenGL +\family roman +\series medium +\shape up +\emph off +\bar no +\noun off +\latex no_latex +\color none +® +\family default +\series default +\shape default +\emph default +\bar default +\noun default +\latex default +\color default +\SpecialChar ~ +trademark owned by Silicon Graphics Inc. + It stands for KallistiOS Graphics Library. + Please note the following quote (in case you didn't read the legal stuff) + from the trademark.pdf published at the SGI website +\newline + +\begin_inset LatexCommand \url{http://www.sgi.com/software/opengl/license.html} + +\end_inset + + +\layout Quote + + +\begin_inset Quotes eld +\end_inset + +This product is based on the published OpenGL +\family roman +\series medium +\shape up +\emph off +\bar no +\noun off +\latex no_latex +\color none +® +\family default +\series default +\shape default +\emph default +\bar default +\noun default +\latex default +\color default +\SpecialChar ~ +API, but is not an implementation which is certified or licensed by Silicon + Graphics, Inc. + under the OpenGL +\family roman +\series medium +\shape up +\emph off +\bar no +\noun off +\latex no_latex +\color none +® +\family default +\series default +\shape default +\emph default +\bar default +\noun default +\latex default +\color default +\SpecialChar ~ +API. +\begin_inset Quotes erd +\end_inset + + +\layout Standard + +We are not making this a library that is going to be 100% OpenGL +\family roman +\series medium +\shape up +\emph off +\bar no +\noun off +\latex no_latex +\color none +® +\family default +\series default +\shape default +\emph default +\bar default +\noun default +\latex default +\color default + complient, nor are we planning get it conformance tested and licensed. + It is our goal to make a library that is fast and provides enough features + that it will be possible to port some OpenGL +\family roman +\series medium +\shape up +\emph off +\bar no +\noun off +\latex no_latex +\color none +® +\family default +\series default +\shape default +\emph default +\bar default +\noun default +\latex default +\color default + games, and also make it easier for homebrew developers to create new and + original works for the Dreamcast. + We are striving for a certain level of OpenGL +\family roman +\series medium +\shape up +\emph off +\bar no +\noun off +\latex no_latex +\color none +® +\family default +\series default +\shape default +\emph default +\bar default +\noun default +\latex default +\color default + conformance but do not intend to add features that we believe are either + incompatible with an embedded system or don't map easily to the hardware. + At the time of this writing KGL is a Dreamcast only API. +\layout Chapter + +KGL API +\layout Standard + +This is not an OpenGL +\family roman +\series medium +\shape up +\emph off +\bar no +\noun off +\latex no_latex +\color none +® +\family default +\series default +\shape default +\emph default +\bar default +\noun default +\latex default +\color default + tutorial or complete reference. + Those are available online or at a bookstore. + This section describes the KGL API currently implemented, the GL_XXX enums + supported, and any known non-conformance issues, or DC features for each + API function. + The API includes non-working stubs for some functions to ease porting. + These stubs will be clearly noted. + If you think KGL is doing something weird or wrong please refer to this + document to determine if the functions in question are supported. +\layout Standard + +Some of the glKos functions were created to support the Direct Render method + of sending polygons to the hardware. + Those functions are marker with +\begin_inset Quotes eld +\end_inset + +(DR). +\begin_inset Quotes erd +\end_inset + + +\layout Section + +KGL DC-specific APIs +\layout Subsection + +int glKosInit() +\begin_inset LatexCommand \label{subsec:glkosinit} + +\end_inset + + +\layout Standard + +The function to intialize KGL. + This must be called after KOS and the PVR are intialized. + KGL will inherit the active lists specified as parameters to pvr_init. + Currently KGL supports the +\emph on +opaque +\emph default +, +\emph on +transparent +\emph default + and +\emph on +punchthru +\emph default + polygon lists. + Returns 0 if successful, -1 if no lists are found to be active. +\layout Standard + +\begin_float alg +\layout Caption + +DC specific API exmaple +\begin_inset LatexCommand \label{code:glkosfunc} + +\end_inset + + +\layout Standard + +pvr_init_params_t params = { +\layout LyX-Code + + /* Enable opaque, translucent and punchthru polygons with size 16 */ +\layout LyX-Code + + { PVR_BINSIZE_16, +\layout LyX-Code + + PVR_BINSIZE_0, +\layout LyX-Code + + PVR_BINSIZE_16, +\layout LyX-Code + + PVR_BINSIZE_0, +\layout LyX-Code + + PVR_BINSIZE_16 }, +\layout LyX-Code + + /* Vertex buffer size 512K */ +\layout LyX-Code + + 512*1024 +\layout LyX-Code + +}; +\layout LyX-Code + +\layout LyX-Code + +extern uint8 romdisk[]; +\layout LyX-Code + +KOS_INIT_ROMDISK(romdisk); +\layout LyX-Code + +\layout LyX-Code + +int main(int argc, char **argv) { +\layout LyX-Code + +... +\layout LyX-Code + + /* Initialize PVR */ +\layout LyX-Code + + pvr_init(¶ms); +\layout LyX-Code + +\layout LyX-Code + + /* Call before using KGL */ +\layout LyX-Code + + glKosInit(); +\layout LyX-Code + +... +\layout LyX-Code + + while(foo) { +\layout LyX-Code + + ... +\layout LyX-Code + + /* Begin frame sequence */ +\layout LyX-Code + + glKosBeginFrame(); +\layout LyX-Code + + draw_op(); /* opaque polys */ +\layout LyX-Code + + glKosFinishList(); +\layout LyX-Code + + draw_tr(); /* transparent polys */ +\layout LyX-Code + + glKosFinishList(); +\layout LyX-Code + + draw_pt(); /* punchthru polys */ +\layout LyX-Code + + glKosFinishFrame(); +\layout LyX-Code + + ... +\layout LyX-Code + + } /* while */ +\layout LyX-Code + + ... +\layout LyX-Code + + glKosShutdown(); +\layout LyX-Code + + return 0; +\layout LyX-Code + +} +\end_float +\layout Subsection + +void glKosShutdown() +\layout Standard + +Call after finishing with KGL. + See code example +\begin_inset LatexCommand \ref{code:glkosfunc} + +\end_inset + +, page +\begin_inset LatexCommand \pageref{code:glkosfunc} + +\end_inset + +. +\layout Subsection + +void glKosGetScreenSize(GLfloat *x, GLfloat *y) +\layout Standard + +Get the current video screen size. +\layout Subsection + +void glKosBeginFrame(); +\layout Standard + +Begin frame sequence. + See code example +\begin_inset LatexCommand \ref{code:glkosfunc} + +\end_inset + +, page +\begin_inset LatexCommand \pageref{code:glkosfunc} + +\end_inset + +. +\layout Subsection + +void glKosFinishFrame() +\layout Standard + +Finish frame sequence. + See code example +\begin_inset LatexCommand \ref{code:glkosfunc} + +\end_inset + +, page +\begin_inset LatexCommand \pageref{code:glkosfunc} + +\end_inset + +. +\layout Subsection + +void glKosFinishList() +\layout Standard + +Finish with the current list. + See code example +\begin_inset LatexCommand \ref{code:glkosfunc} + +\end_inset + +, page +\begin_inset LatexCommand \pageref{code:glkosfunc} + +\end_inset + +. + XXX - describe lists. +\layout Subsection + +void glKosMatrixIdent() +\hfill +(DR) +\layout Standard + +Set the DC's matrix regs to identity. +\layout Subsection + +void glKosMatrixDirty() +\hfill +(DR) +\layout Standard + +Set matrix regs as dirtied. + You should do this if you've done any tinkering with the DC's matrix registers + outside of using GL calls. +\layout Subsection + +void glKosPolyHdrDirty() +\hfill +(DR) +\layout Standard + +Set poly header context as dirtied. + Similar to the matrix call above, but this one is for the case where you've + sent your own primitive headers to the DCPVR2's TA. +\layout Subsection + +void glKosMatrixApply(GLenum mode) +\hfill +(DR) +\layout Standard + +Apply one of the GL matrices to the DC's matrix regs. +\newline + +\layout Standard + + +\begin_inset Tabular + + + + + +\begin_inset Text + +\layout Standard + +mode +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_KOS_SCREENVIEW +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_MODELVIEW +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_PROJECTION +\end_inset + + + + +\end_inset + + +\layout Subsection + +void glKosSendPolyHdr() +\hfill +(DR) +\layout Standard + +This function bypasses the normal glBegin( ) / glEnd( ) paradigm and sends + the currently +\emph on +defined +\emph default + +\emph on +polygon header +\emph default + to the hardware. + Where +\emph on +defined polygon header +\emph default + is simply the current GL states encapsulated in a +\emph on +pvr_poly_hdr_t +\emph default + structure that apply to the object about to be rendered. + e.g.: fog, culling, blend functions, texture, current polygon list, etc. + Your optimized drawing function is responsible for filling and sending + the verticies (pvr_vertex_t) for the object to be rendered by the DCPVR2 + hardware. +\layout Section + +Per Fragment Operations +\layout Subsection + +void glBlendFunc(GLenum sfactor, GLenum dfactor) +\layout Standard + +Only applies when the transparent/punchthru polygon list is active. +\newline + +\layout Standard + + +\begin_inset Tabular + + + + + + + + +\begin_inset Text + +\layout Standard + +Constant +\end_inset + + +\begin_inset Text + +\layout Standard + +sfactor +\end_inset + + +\begin_inset Text + +\layout Standard + +dfactor +\end_inset + + +\begin_inset Text + +\layout Standard + +Computed Blend Factor +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_ZERO +\end_inset + + +\begin_inset Text + +\layout Standard + +X +\end_inset + + +\begin_inset Text + +\layout Standard + +X +\end_inset + + +\begin_inset Text + +\layout Standard + +(0, 0, 0, 0) +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_ONE +\end_inset + + +\begin_inset Text + +\layout Standard + +X +\end_inset + + +\begin_inset Text + +\layout Standard + +X +\end_inset + + +\begin_inset Text + +\layout Standard + +(1, 1, 1, 1) +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_DST_COLOR +\end_inset + + +\begin_inset Text + +\layout Standard + +X +\end_inset + + +\begin_inset Text + +\layout Standard + +\end_inset + + +\begin_inset Text + +\layout Standard + +(R +\begin_inset Formula \( _{d} \) +\end_inset + +, G +\begin_inset Formula \( _{d} \) +\end_inset + +, B +\begin_inset Formula \( _{d} \) +\end_inset + +, A +\begin_inset Formula \( _{d} \) +\end_inset + +) +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_SRC_COLOR +\end_inset + + +\begin_inset Text + +\layout Standard + +\end_inset + + +\begin_inset Text + +\layout Standard + +X +\end_inset + + +\begin_inset Text + +\layout Standard + +(R +\begin_inset Formula \( _{s} \) +\end_inset + +, G +\begin_inset Formula \( _{s} \) +\end_inset + +, B +\begin_inset Formula \( _{s} \) +\end_inset + +, A +\begin_inset Formula \( _{s} \) +\end_inset + +) +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_ONE_MINUS_DST_COLOR +\end_inset + + +\begin_inset Text + +\layout Standard + +X +\end_inset + + +\begin_inset Text + +\layout Standard + +\end_inset + + +\begin_inset Text + +\layout Standard + +(1, 1, 1, 1) - (R +\begin_inset Formula \( _{d} \) +\end_inset + +, G +\begin_inset Formula \( _{d} \) +\end_inset + +, B +\begin_inset Formula \( _{d} \) +\end_inset + +, A +\begin_inset Formula \( _{d} \) +\end_inset + +) +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_ONE_MINUS_SRC_COLOR +\end_inset + + +\begin_inset Text + +\layout Standard + +\end_inset + + +\begin_inset Text + +\layout Standard + +X +\end_inset + + +\begin_inset Text + +\layout Standard + +(1, 1, 1, 1) - (R +\begin_inset Formula \( _{s} \) +\end_inset + +, G +\begin_inset Formula \( _{s} \) +\end_inset + +, B +\begin_inset Formula \( _{s} \) +\end_inset + +, A +\begin_inset Formula \( _{s} \) +\end_inset + +) +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_SRC_ALPHA +\end_inset + + +\begin_inset Text + +\layout Standard + +X +\end_inset + + +\begin_inset Text + +\layout Standard + +X +\end_inset + + +\begin_inset Text + +\layout Standard + +(A +\begin_inset Formula \( _{s} \) +\end_inset + +, A +\begin_inset Formula \( _{s} \) +\end_inset + +, A +\begin_inset Formula \( _{s} \) +\end_inset + +, A +\begin_inset Formula \( _{s} \) +\end_inset + +) +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_ONE_MINUS_SRC_ALPHA +\end_inset + + +\begin_inset Text + +\layout Standard + +X +\end_inset + + +\begin_inset Text + +\layout Standard + +X +\end_inset + + +\begin_inset Text + +\layout Standard + +(1, 1, 1, 1) - (A +\begin_inset Formula \( _{s} \) +\end_inset + +, A +\begin_inset Formula \( _{s} \) +\end_inset + +, A +\begin_inset Formula \( _{s} \) +\end_inset + +, A +\begin_inset Formula \( _{s} \) +\end_inset + +) +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_DST_ALPHA +\end_inset + + +\begin_inset Text + +\layout Standard + +X +\end_inset + + +\begin_inset Text + +\layout Standard + +X +\end_inset + + +\begin_inset Text + +\layout Standard + +(A +\begin_inset Formula \( _{d} \) +\end_inset + +, A +\begin_inset Formula \( _{d} \) +\end_inset + +, A +\begin_inset Formula \( _{d} \) +\end_inset + +, A +\begin_inset Formula \( _{d} \) +\end_inset + +) +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_ONE_MINUS_DST_ALPHA +\end_inset + + +\begin_inset Text + +\layout Standard + +X +\end_inset + + +\begin_inset Text + +\layout Standard + +X +\end_inset + + +\begin_inset Text + +\layout Standard + +(1, 1, 1, 1) - (A +\begin_inset Formula \( _{d} \) +\end_inset + +, A +\begin_inset Formula \( _{d} \) +\end_inset + +, A +\begin_inset Formula \( _{d} \) +\end_inset + +, A +\begin_inset Formula \( _{d} \) +\end_inset + +) +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_SRC_ALPHA_SATURATE +\end_inset + + +\begin_inset Text + +\layout Standard + +\end_inset + + +\begin_inset Text + +\layout Standard + +\end_inset + + +\begin_inset Text + +\layout Standard + +not available +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_CONSTANT_COLOR +\end_inset + + +\begin_inset Text + +\layout Standard + +\end_inset + + +\begin_inset Text + +\layout Standard + +\end_inset + + +\begin_inset Text + +\layout Standard + +not available +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_ONE_MINUS_CONSTANT_COLOR +\end_inset + + +\begin_inset Text + +\layout Standard + +\end_inset + + +\begin_inset Text + +\layout Standard + +\end_inset + + +\begin_inset Text + +\layout Standard + +not available +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_CONSTANT_ALPHA +\end_inset + + +\begin_inset Text + +\layout Standard + +\end_inset + + +\begin_inset Text + +\layout Standard + +\end_inset + + +\begin_inset Text + +\layout Standard + +not available +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_ONE_MINUS_CONSTANT_ALPHA +\end_inset + + +\begin_inset Text + +\layout Standard + +\end_inset + + +\begin_inset Text + +\layout Standard + +\end_inset + + +\begin_inset Text + +\layout Standard + +not available +\end_inset + + + + +\end_inset + + +\layout Subsection + +void glClearDepth(GLclampd depth) +\layout Standard + + +\series bold +NOP +\series default +: non-functional. + To ease porting. +\layout Subsection + +void glDepthFunc(GLenum func) +\layout Standard + +The DC supports a number of depth functions. +\newline + +\layout Standard + + +\begin_inset Tabular + + + + + +\begin_inset Text + +\layout Standard + +Supported Depth Functions +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_NEVER +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_LESS (default) +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_EQUAL +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_LEQUAL +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_GREATER +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_NOTEQUAL +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_GEQUAL +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_ALWAYS +\end_inset + + + + +\end_inset + + +\layout Subsection + +void glDepthMask(GLboolean flag) +\layout Standard + +Valid state is GL_TRUE or GL_FALSE. + Default state is GL_TRUE. + Controls blending of opaque and transparent objects. +\layout Subsection + +glScissor(GLint x, GLint y, GLsizei width, GLsizei height) +\layout Standard + +The DC uses the PVR USER_CLIP functionality and does not allow fine-grain + per-pixel control over the scissor box width, height and placement on the + screen. + The minimum clip rectangle is a 32x32 area which corresponds with the size + of tiles used by the tile accelerator. + The PVR swithes off rendering to tiles outside or inside the defined rectangle + dependant upon the 'clipmode' bits in the polygon header. + +\layout Standard + +The specified scissor box will always have a size that is some multiple + of 32. + glScissor(0, 0, 32, 32) allows only the 'tile' in the lower left hand corner + of the screen to be modified and glScissor(0, 0, 0, 0) disallows modification + to all 'tiles' on the screen. + Enabling GL_SCISSOR_TEST or GL_KOS_USERCLIP_OUTSIDE will cause rendered + objects to be clipped to the inside or outside of the scissor box respectively. +\layout Section + +Display lists +\layout Standard + +Not available at this time. +\layout Section + +Drawing functions +\layout Standard + +Rasterization and per-fragment drawing functions. +\layout Subsection + +void glBegin(GLenum mode) +\layout Standard + +See the following table for the currently supported primatives. + The maximum GL_TRIANGLE_STRIP length is currently limited to 64 vertices. +\newline + +\layout Standard + + +\begin_inset Tabular + + + + + + +\begin_inset Text + +\layout Standard + +Mode +\end_inset + + +\begin_inset Text + +\layout Standard + +Implemented +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_POINTS +\end_inset + + +\begin_inset Text + +\layout Standard + +X +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_LINES +\end_inset + + +\begin_inset Text + +\layout Standard + +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_LINE_LOOP +\end_inset + + +\begin_inset Text + +\layout Standard + +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_LINE_STRIP +\end_inset + + +\begin_inset Text + +\layout Standard + +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_TRIANGLES +\end_inset + + +\begin_inset Text + +\layout Standard + +X +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_TRIANGLE_STRIP +\end_inset + + +\begin_inset Text + +\layout Standard + +X +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_TRIANGLE_FAN +\end_inset + + +\begin_inset Text + +\layout Standard + +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_QUADS +\end_inset + + +\begin_inset Text + +\layout Standard + +X +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_QUAD_STRIP +\end_inset + + +\begin_inset Text + +\layout Standard + +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_POLYGON +\end_inset + + +\begin_inset Text + +\layout Standard + +\end_inset + + + + +\end_inset + + +\layout Subsection + +void glColor3f(GLfloat red, GLfloat green, GLfloat blue) +\layout Subsection + +void glColor3fv(GLfloat *v) +\layout Subsection + +void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) +\layout Subsection + +void glColor4fv(GLfloat *v) +\layout Subsection + +void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) +\layout Subsection + +void glEnd(void) +\layout Subsection + +void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz) +\layout Standard + + +\series bold +NOP +\series default +: Stub only. +\layout Subsection + +void glPointSize(GLfloat size) +\layout Standard + +GL_POINTS are emulated using quads. + Points are therefore rendered square. + Default size is 1.0 which is 2 pixels square on the DC. + Maximum size is 100.0. +\layout Subsection + +void glTexCoord2f(GLfloat s, GLfloat t) +\layout Subsection + +void glTexCoord2fv(GLfloat *v) +\layout Subsection + +void glVertex3f(GLfloat x, GLfloat y, GLfloat z) +\layout Subsection + +void glVertex3fv(GLfloat *v) +\layout Section + +Fog +\layout Standard + +Uses the PVR2 hardware fog table. + Care must be taken when changing fog values because there is only one fog + table and any changes made while the PVR is rendering a scene may result + in display artifacts. + Most noteably if the changes made are large. + When vertex fog is implemented this will not be an issue, however vertex + fog will take more CPU time. +\newline + +\layout Standard + + +\begin_inset Tabular + + + + + + + +\begin_inset Text + +\layout Standard + +Parameter name +\end_inset + + +\begin_inset Text + +\layout Standard + +parameter +\end_inset + + +\begin_inset Text + +\layout Standard + +default +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_FOG_MODE +\end_inset + + +\begin_inset Text + +\layout Standard + +GL_EXP, GL_EXP2, GL_LINEAR +\end_inset + + +\begin_inset Text + +\layout Standard + +GL_EXP +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_FOG_DENSITY +\end_inset + + +\begin_inset Text + +\layout Standard + +density >= 0.0 +\end_inset + + +\begin_inset Text + +\layout Standard + +1.0 +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_FOG_COLOR +\end_inset + + +\begin_inset Text + +\layout Standard + +float [4] color = {R, G, B, A} +\end_inset + + +\begin_inset Text + +\layout Standard + +{0.5, 0.5, 0.5, 1.0} +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_FOG_INDEX +\end_inset + + +\begin_inset Text + +\layout Standard + +\end_inset + + +\begin_inset Text + +\layout Standard + +Palletted modes not supported +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_FOG_START +\end_inset + + +\begin_inset Text + +\layout Standard + +0.0 - 259.0 +\end_inset + + +\begin_inset Text + +\layout Standard + +0.0 +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_FOG_END +\end_inset + + +\begin_inset Text + +\layout Standard + +0.0 - 259.0 +\end_inset + + +\begin_inset Text + +\layout Standard + +1.0 +\end_inset + + + + +\end_inset + + +\layout LyX-Code + +\layout Subsection + +void glFogi(GLenum pname, GLint param) +\layout LyX-Code + +glFogi(GL_FOG_MODE, GL_EXP2); +\layout Subsection + +void glFogiv(GLenum pname, const GLint *params) +\layout Subsection + +void glFogf(GLenum pname, GLfloat param) +\layout LyX-Code + +glFogf(GL_FOG_DENSITY, 0.5f); +\layout Subsection + +void glFogfv(GLenum pname, const GLfloat *params) +\layout LyX-Code + +GLfloat fogcolor[4] = {0.5, 0.5, 0.5, 1.0}; +\layout LyX-Code + +glFogfv(GL_FOG_COLOR, fogcolor); +\layout Section + +Lighting +\layout Standard + +This is a decidedly lackluster section. + Hopefully lighting will be supported at some point in the future. +\layout Subsection + +void glShadeModel(GLenum mode) +\layout Standard + +The available modes are GL_FLAT, and GL_SMOOTH. + GL_FLAT is default. +\layout Section + +Miscellaneous +\layout Subsection + +void glClear(GLbitfield mask) +\layout Standard + + +\series bold +NOP +\series default +: there's nothing to clear on the PVR2. + Provided to ease porting. +\layout Subsection + +void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf + alpha) +\layout Standard + +Sets the background color. + Alpha parameter has no effect. +\layout Subsection + +void glCullFace(GLenum mode) +\layout Standard + +Set face culling mode. + Valid states are GL_FRONT and GL_BACK. + Default state is GL_BACK. +\layout Subsection + +void glDisable(GLenum cap) +\layout Standard + +Disable GL states. + See table in section +\begin_inset LatexCommand \ref{tab:kgl:enabledisablestates} + +\end_inset + +, on page +\begin_inset LatexCommand \pageref{tab:kgl:enabledisablestates} + +\end_inset + +. +\layout Subsection + +void glEnable(GLenum cap) +\layout Standard + +Enable GL states. +\newline + +\layout Standard + + +\begin_inset Tabular + + + + + + + +\begin_inset Text + +\layout Standard + +State +\end_inset + + +\begin_inset Text + +\layout Standard + +Description / Notes +\end_inset + + +\begin_inset Text + +\layout Standard + +Initial Value +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_BLEND +\end_inset + + +\begin_inset Text + +\layout Standard + + +\series bold +NOP: +\series default + will be available once the PVR scene rendering API is completed. + For now use glKosFinishList() to switch to the transparent polygon list. +\end_inset + + +\begin_inset Text + +\layout Standard + +GL_FALSE +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_CULL_FACE +\end_inset + + +\begin_inset Text + +\layout Standard + +Polygon culling +\end_inset + + +\begin_inset Text + +\layout Standard + +GL_FALSE +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_FOG +\end_inset + + +\begin_inset Text + +\layout Standard + +PVR table fog +\end_inset + + +\begin_inset Text + +\layout Standard + +GL_FALSE +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_KOS_AUTO_UV +\end_inset + + +\begin_inset Text + +\layout Standard + +Automatically assign texture coordinates to GL_QUAD primatives. +\end_inset + + +\begin_inset Text + +\layout Standard + +GL_FALSE +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_KOS_USERCLIP_OUTSIDE +\end_inset + + +\begin_inset Text + +\layout Standard + +Drawn polys are clipped to the outside of the scissor box. +\end_inset + + +\begin_inset Text + +\layout Standard + +GL_FALSE +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_SCISSIOR_TEST +\end_inset + + +\begin_inset Text + +\layout Standard + +Drawn polys are clipped to the inside of the the scissor box. +\end_inset + + +\begin_inset Text + +\layout Standard + +GL_FALSE +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_TEXTURE_2D +\end_inset + + +\begin_inset Text + +\layout Standard + +2D texturing +\end_inset + + +\begin_inset Text + +\layout Standard + +GL_FALSE +\end_inset + + + + +\end_inset + + +\begin_inset LatexCommand \label{tab:kgl:enabledisablestates} + +\end_inset + + +\layout Subsection + +void glFrontFace(GLenum mode) +\layout Standard + +Set polygon front face. + Valid modes are GL_CW and GL_CCW. + Default mode is GL_CCW. + +\emph on + Note: In KGL prior to KOS-1.1.7 the default was GL_CW and could not be changed. +\layout Subsection + +void glFlush() +\layout Standard + + +\series bold +NOP +\series default +: There is no rendering pipeline. +\layout Subsection + +void glHint(GLenum target, GLenum mode) +\layout Standard + + +\series bold +NOP +\series default +: It's our way or no way. + KGL_DONT_CARE\SpecialChar ~ +=D Provided to ease porting. +\newline + +\layout Standard + + +\begin_inset Tabular + + + + + + +\begin_inset Text + +\layout Standard + +Valid target values +\end_inset + + +\begin_inset Text + +\layout Standard + +Valid modes +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_PERSPECTIVE_CORRECTION_HINT +\end_inset + + +\begin_inset Text + +\layout Standard + +GL_DONT_CARE +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_POINT_SMOOTH_HINT +\end_inset + + +\begin_inset Text + +\layout Standard + +GL_FASTEST +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_LINE_SMOOTH_HINT +\end_inset + + +\begin_inset Text + +\layout Standard + +GL_NICEST +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_POLYGON_SMOOTH_HINT +\end_inset + + +\begin_inset Text + +\layout Standard + +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_FOG_HINT +\begin_inset Info +We may one day use this to toggle between +PVR table and vertex fog modes. Once we +figure out how vertex fog works that is! +\end_inset + + +\end_inset + + +\begin_inset Text + +\layout Standard + +\end_inset + + + + +\end_inset + + +\layout Section + +Query functions +\layout Subsection + +const GLubyte *glGetString(GLenum name) +\layout Standard + +Returns a pointer to a descriptive string. +\newline + +\layout Standard + + +\begin_inset Tabular + + + + + +\begin_inset Text + +\layout Standard + +String name +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_VENDOR +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_RENDERER +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_VERSION +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_EXTENSIONS +\end_inset + + + + +\end_inset + + +\layout Section + +Texture functions +\layout Standard + +Allowable texture size height and width in pixels are 8, 16, 32, 64, 128, + 256, 512, and 1024. + You can load a texture using any combination of the previous values. + Only 2D textures are supported. + Textures are loaded upside down in keeping with the sprit of OpenGL. + Be aware of this when mixing KGL and the PVR API. + You may have to flip the V texture coordinates (V = 1 - V) depending upon + your application. +\layout Subsection + +void glBindTexture(GLenum target, GLuint texture) +\layout Standard + +The only supported target is GL_TEXTURE_2D. +\layout Subsection + +void glDeleteTextures(GLsizei n, const GLuint *textures) +\layout Subsection + +void glGenTextures(GLsizei n, GLuint *textures) +\layout Subsection + +void glKosTex2D(GLint internal_fmt, GLsizei width, GLsizei height, pvr_ptr_t + txr_address, ) +\layout Standard + +If you have already allocated and loaded a texture you can use this shortcut + function to make it available to KGL. + The +\emph on +internal_fmt +\emph default + varies from from the OpenGL spec. + The table shows the internal formats supported by the PVR2. +\newline + +\layout Standard + + +\begin_inset Tabular + + + + + +\begin_inset Text + +\layout Standard + +internal_fmt +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_ARGB1555 +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_RGB565 +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_ARGB4444 +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_YUV422 +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_BUMP +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_ARGB1555_TWID +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_RGB565_TWID +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_ARGB4444_TWID +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_YUV422_TWID +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_BUMP_TWID +\end_inset + + + + +\end_inset + + +\begin_inset LatexCommand \label{tbl:kgl:internaltextureformat} + +\end_inset + + +\layout Subsection + +void glTexEnvi(GLenum target, GLenum pname, GLint param) +\layout Standard + +Setup the texture environment. + See the following table for valid arguments to this function. +\newline + +\layout Standard + + +\begin_inset Tabular + + + + + + + +\begin_inset Text + +\layout Standard + +target +\end_inset + + +\begin_inset Text + +\layout Standard + +pname +\end_inset + + +\begin_inset Text + +\layout Standard + +param +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_TEXTURE_2D +\end_inset + + +\begin_inset Text + +\layout Standard + +GL_TEXTURE_ENV_MODE +\end_inset + + +\begin_inset Text + +\layout Standard + +GL_REPLACE +\end_inset + + + + +\begin_inset Text + +\layout Standard + +\end_inset + + +\begin_inset Text + +\layout Standard + +\end_inset + + +\begin_inset Text + +\layout Standard + +GL_MODULATE (default) +\end_inset + + + + +\begin_inset Text + +\layout Standard + +\end_inset + + +\begin_inset Text + +\layout Standard + +\end_inset + + +\begin_inset Text + +\layout Standard + +GL_DECAL +\end_inset + + + + +\begin_inset Text + +\layout Standard + +\end_inset + + +\begin_inset Text + +\layout Standard + +\end_inset + + +\begin_inset Text + +\layout Standard + +GL_MODULATEALPHA +\end_inset + + + + +\end_inset + + +\layout Subsection + +void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei + width, GLsizei height, GLint border, GLenum format, GLenum type, const + GLvoid *pixels) +\layout Standard + +Defines a two-dimensional texture. + The only supported +\emph on +target +\emph default + is GL_TEXTURE_2D. + +\emph on +Border +\emph default +, +\emph on +level +\emph default +, and pixel conversion ( +\emph on +type +\emph default +) are not supported. + The +\emph on +internalFormat +\emph default + and +\emph on +format +\emph default + arguments must be the same. + See the table in section +\begin_inset LatexCommand \ref{tbl:kgl:internaltextureformat} + +\end_inset + +, on page +\begin_inset LatexCommand \pageref{tbl:kgl:internaltextureformat} + +\end_inset + +. +\layout Subsection + +void glTexParameteri(GLenum target, GLenum pname, GLint param) +\layout Standard + +Allows specification of additional texture attributes. +\newline + +\layout Standard + + +\begin_inset Tabular + + + + + + + +\begin_inset Text + +\layout Standard + +target +\end_inset + + +\begin_inset Text + +\layout Standard + +pname +\end_inset + + +\begin_inset Text + +\layout Standard + +param +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_TEXTURE_2D +\end_inset + + +\begin_inset Text + +\layout Standard + +GL_TEXTURE_FILTER +\end_inset + + +\begin_inset Text + +\layout Standard + + +\begin_inset Tabular + + + + + +\begin_inset Text + +\layout Standard + +GL_FILTER_NONE (default) +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_FILTER_BILINEAR +\end_inset + + + + +\end_inset + + +\end_inset + + + + +\begin_inset Text + +\layout Standard + +\end_inset + + +\begin_inset Text + +\layout Standard + +GL_TEXTURE_WRAP_S +\end_inset + + +\begin_inset Text + +\layout Standard + + +\begin_inset Tabular + + + + + +\begin_inset Text + +\layout Standard + +GL_REPEAT (default) +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_CLAMP +\end_inset + + + + +\end_inset + + +\end_inset + + + + +\begin_inset Text + +\layout Standard + +\end_inset + + +\begin_inset Text + +\layout Standard + +GL_TEXTURE_WRAP_T +\end_inset + + +\begin_inset Text + +\layout Standard + + +\begin_inset Tabular + + + + + +\begin_inset Text + +\layout Standard + +GL_REPEAT (default) +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_CLAMP +\end_inset + + + + +\end_inset + + +\end_inset + + + + +\end_inset + + +\layout Section + +Transformation functions +\layout Subsection + +void glDepthRange(GLclampf n, GLclampf f) +\layout Standard + +We can't access the PVR's depth buffer directly, but the values are used + during viewport transformation. +\layout Subsection + +void glFrustum(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, + GLfloat znear, GLfloat zfar) +\layout Subsection + +void glLoadIdentity(void) +\layout Subsection + +void glLoadMatrixf(const GLfloat *m) +\layout Standard + +Load an arbitrary matrix into the current matrix. +\layout Subsection + +void glLoadTransposeMatrixf(const GLfloat *m) +\layout Subsection + +void glMatrixMode(GLenum mode) +\layout Standard + + +\begin_inset Tabular + + + + + + +\begin_inset Text + +\layout Standard + +Stack mode +\end_inset + + +\begin_inset Text + +\layout Standard + +Stack size +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_MODELVIEW +\end_inset + + +\begin_inset Text + +\layout Standard + +32 +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_PROJECTION +\end_inset + + +\begin_inset Text + +\layout Standard + +2 +\end_inset + + + + +\begin_inset Text + +\layout Standard + +GL_TEXTURE +\end_inset + + +\begin_inset Text + +\layout Standard + +2 +\end_inset + + + + +\end_inset + + +\layout Subsection + +void glMultMatrixf(const GLfloat *m) +\layout Standard + +Mulitply the current matrix by an arbitrary matrix. +\layout Subsection + +void glMultTransposeMatrixf(const GLfloat *m) +\layout Subsection + +void glOrtho(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat + znear, GLfloat zfar) +\layout Subsection + +void glPopMatrix(void) +\layout Subsection + +void glPushMatrix(void) +\layout Subsection + +void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) +\layout Standard + +As of KOS-1.1.7 the +\emph on +angle +\emph default + is in degrees. + In prior versions the +\emph on +angle +\emph default + was expressed in radians. +\layout Subsection + +void glScalef(GLfloat x, GLfloat y, GLfloat z) +\layout Subsection + +void glTranslatef(GLfloat x, GLfloat y, GLfloat z) +\layout Subsection + +void glViewport(GLint x, GLint y, GLsizei width, GLsizei height) +\layout Standard + +The default values are automatically set during glKosInit( ) and are determined + by the current video mode. + You can of course choose your own values and KGL will render to the defined + rectangle. + The defined area will not be clipped. + To clip the defined rectangle you will need to use glScissors( ). +\layout Subsection + +void gluLookAt(GLfloat eyex, GLfloat eyey, GLfloat eyez, GLfloat centerx, + GLfloat centery, GLfloat centerz, GLfloat upx, GLfloat upy, GLfloat upz) +\layout Subsection + +void gluPerspective(GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloat + zFar) +\layout Chapter + +Direct Render +\layout Standard + +When standard KGL just isn't fast enough for your needs it's time to summon + the forces of Direct Render. + Direct Render, from this point forward referred to as DR, lets you mix + the convenience features of KGL with a number of macros and glKOS functions. + When used properly you can expect get 3 to 4 times more polys per frame + than KGL alone. +\layout Standard + +The peformace impact of DR methods are so great that the techniques have + been applied to the core KGL drawing functions for a nice performance boost. + Some benchmarks taken before and after the conversion are posted below. + GL_TRIANGLES were used since they are easy to draw and are the least efficient + way draw objects, so any improvements in terms of polygons per second (pps) + are pretty impressive. + The raw PVR benckmarks are even more impressive. +\layout Quotation + +KGL GL_TRIANGLES (trimark): Before conversion to DR +\newline +Beginning new test: 1013 polys per frame (60780 per second at 60fps) +\newline +Average Frame Rate: ~59.356900 fps (60128 pps) +\newline +Entering PHASE_FINAL +\newline +Average Frame Rate: ~60.924400 fps (61716 pps) +\newline +Average Frame Rate: ~59.356900 fps (60128 pps) +\newline +Average Frame Rate: ~61.187100 fps (61982 pps) +\newline +Average Frame Rate: ~59.875900 fps (60654 pps) +\newline +Average Frame Rate: ~61.186900 fps (61982 pps) +\newline + +\layout Quotation + +KGL GL_TRIANGLES (trimark): After conversion to DR +\newline +Beginning new test: 3125 polys per frame (187500 per second at 60fps) +\newline +Average Frame Rate: ~59.873900 fps (187106 pps) +\newline +Entering PHASE_FINAL +\newline +Average Frame Rate: ~60.928600 fps (190401 pps) +\newline +Average Frame Rate: ~60.924800 fps (190390 pps) +\newline +Average Frame Rate: ~59.349700 fps (185468 pps) +\newline +Average Frame Rate: ~59.995800 fps (187487 pps) +\newline +Average Frame Rate: ~59.875900 fps (187112 pps) +\layout Standard + +The raw PVR benchmarks for triangles are even more impressive. + These benchmarks are from the pvrmark and pvrmark_strip test programs. +\layout Quote + +PVR pvrmark test: +\newline +Beginning new test: 6466 polys per frame (387960 per second at 60fps) +\newline +Average Frame Rate: ~59.890300 fps (387251 pps) +\newline +Entering PHASE_FINAL +\newline +Average Frame Rate: ~61.187100 fps (395635 pps) +\newline +Average Frame Rate: ~59.875900 fps (387158 pps) +\newline +Average Frame Rate: ~59.873900 fps (387145 pps) +\newline +Average Frame Rate: ~60.927500 fps (393957 pps) +\newline +Average Frame Rate: ~59.414400 fps (384173 pps) +\layout Standard + +The DCPVR2 can draw long triangles strips even more efficiently. +\layout Quote + +PVR pvrmark_strips test: +\newline +Beginning new test: 12433 polys per frame (745980 per second at 60fps) +\newline +Average Frame Rate: ~57.953400 fps (720535 pps) +\newline +Entering PHASE_FINAL +\newline +Average Frame Rate: ~55.270300 fps (687176 pps) +\newline +Average Frame Rate: ~59.290100 fps (737154 pps) +\newline +Average Frame Rate: ~59.004700 fps (733606 pps) +\newline +Average Frame Rate: ~60.719300 fps (754923 pps) +\newline +Average Frame Rate: ~58.388400 fps (725943 pps) +\layout Standard + +You're probably sick of benchmarks but I have to show you the results of + the pure PVR API in action. + This is the output of the pvrmark_strips_direct program: +\layout Quote + +PVR pvrmark_strips_direct test: +\newline +Beginning new test: 40233 polys per frame (2413980 per second at 60fps) +\newline +Average Frame Rate: ~59.414300 fps (2390419 pps) +\newline +Entering PHASE_FINAL +\newline +Average Frame Rate: ~60.924800 fps (2451190 pps +\newline +Average Frame Rate: ~59.414300 fps (2390419 pps) +\newline +Average Frame Rate: ~59.348800 fps (2387782 pps) +\newline +Average Frame Rate: ~59.890300 fps (2409568 pps) +\newline +Average Frame Rate: ~59.348800 fps (2387782 pps) +\layout Standard + +These PVR benchmark test programs were used in the development of the Direct + Render methods, macros, and glKos functions described in this chapter. + We owe this all the Dan Potters' desire to put 6 transparent spheres on + the screen at once. + DR can do far more then that. + In the words of the wizard himself in response to a question about the + GL_TRIANGLE benchmarks: +\layout Quotation + +1) Every extra amount of time that you spend transmitting polygons to the + TA for rendering is less time you have available for doing things like + playing background music, updating AI, etc. + So the faster we can make this, the better. + That's why I started the whole DR thing anyway -- I could have made my + graphics stuff fast enough without it, but wouldn't have had any time left + over for anything else. + Plus if you have extra polys left over then you can go about improving + the visual quality of the effects. +\newline + +\layout Quotation + +2) It's a lot easier to rack up tons of polygons than you might think. + For example, if you have a spaceship with 100 quads in it (not very many, + let me tell you! =) and you have 10 of them on screen, that's about a fifth + of the available time there if you did nothing else. +\layout Section + +Direct Render sample code +\layout Standard + +Rather than enumerate all the DR macros and functions right away we'll toss + out a couple pieces of sample code so you can see the differences between + plain old KGL and KGL using DR. + Note these are not complete functional programs, for those I strongly urge + you to review the +\emph on +bubbles demo +\emph default + under the Dreamcast KGL examples. +\layout Standard + +XXX KGL sphere quads +\layout Standard + +XXX KGL/DR sphere DR +\layout Section + +Direct Render API +\layout Standard + +XXX stuff from matrix.h, pvr.h, gl.h XXX +\layout Chapter + +About this document +\layout Standard + +This document was written in a stock LyX 1.1.6fix4 distribution, using no + fancy add-ons (so it ought to load ok for you if you want to try it). + The PostScript, PDF, HTML, and text versions were generated using the export + options in LyX. +\the_end diff --git a/CPU/SDKS/kos-1.1.8/doc/manual/kgl.pdf b/CPU/SDKS/kos-1.1.8/doc/manual/kgl.pdf new file mode 100644 index 00000000..792474b8 Binary files /dev/null and b/CPU/SDKS/kos-1.1.8/doc/manual/kgl.pdf differ diff --git a/CPU/SDKS/kos-1.1.8/doc/manual/kgl_html.zip b/CPU/SDKS/kos-1.1.8/doc/manual/kgl_html.zip new file mode 100644 index 00000000..46a0d262 Binary files /dev/null and b/CPU/SDKS/kos-1.1.8/doc/manual/kgl_html.zip differ diff --git a/CPU/SDKS/kos-1.1.8/doc/manual/kos.pdf b/CPU/SDKS/kos-1.1.8/doc/manual/kos.pdf new file mode 100644 index 00000000..327fbc4f Binary files /dev/null and b/CPU/SDKS/kos-1.1.8/doc/manual/kos.pdf differ diff --git a/CPU/SDKS/kos-1.1.8/doc/manual/kos.tex b/CPU/SDKS/kos-1.1.8/doc/manual/kos.tex new file mode 100644 index 00000000..b5fe8a31 --- /dev/null +++ b/CPU/SDKS/kos-1.1.8/doc/manual/kos.tex @@ -0,0 +1,2391 @@ +%% KallistiOS Manual for KOS 1.1.8 +%% +%% kos.tex +%% (c)2000-2002 Dan Potter +%% +%% Built for LaTeX2e + +%% Setup some basic stuff +\documentclass[english]{report} +\usepackage{geometry} +\geometry{verbose,letterpaper,tmargin=0.5in,bmargin=0.5in,lmargin=0.5in,rmargin=0.5in} +\usepackage{setspace} +\onehalfspacing +%%\usepackage{makeidx} +%%\makeindex + +\makeatletter + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands. + \newenvironment{lyxcode} + {\begin{list}{}{ + \setlength{\rightmargin}{\leftmargin} + \raggedright + \setlength{\itemsep}{0pt} + \setlength{\parsep}{0pt} + \normalfont\ttfamily}% + \item[]} + {\end{list}} + +\makeatother + +\begin{document} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% Define some macros that we'll use to "abstract" the style in the +%% document. This way if we change our minds later, it's a lot easier +%% to fix. + +%% Function names will be in typewriter font +\newcommand{\funcname}[1]{% + \texttt{#1}% +} + +%% Program names are in bold +\newcommand{\progname}[1]{% + \textbf{#1}% +} + +%% Directory names are in bold +\newcommand{\dirname}[1]{% + \textbf{#1}% +} + +%% Paramater names are in italics +\newcommand{\paramname}[1]{% + \textit{#1}% +} + +%% Structure or data type name +\newcommand{\dtname}[1]{% + \textit{#1}% +} + +%% Library name +\newcommand{\libname}[1]{% + \textbf{#1}% +} + +%% Code snippets +\newcommand{\code}[1]{% + \texttt{#1}% +} + +%% Constants +\newcommand{\constname}[1]{% + \texttt{#1}% +} + +%% Trademark symbol +\newcommand{\tm}[0]{ (tm) } + +%% KOS Version +\newcommand{\kosversion}{ 1.1.8 } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% Title and Author +\title{Cryptic Allusion KallistiOS / Programmer's Manual} +\author{\copyright 2000-2002 Dan Potter} + +%% Insert the title page and table of contents in the output here +\maketitle +\tableofcontents{} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% Legal mumbo-jumbo +\chapter*{Legal} + +``Sega'' and ``Dreamcast'' are registered trademarks of Sega +Enterprises, Ltd. This package has no association with Sega or any +of its affiliates, besides working on their hardware. + +``Gameboy Advance'' is a registered trademark of Nintendo, Inc. +This package has no association with Nintendo or any of its affiliates, +besides working on some of their hardware. + +All other trademarks are owned by their respective trademark holders. + +KallistiOS \copyright 2000-2002 Dan Potter. Other portions \copyright their individual +authors; please contact the authors for information on using and/or +distriburing their code. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +\begin{enumerate} +\item Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. +\item 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. +\item Neither the name of Cryptic Allusion nor the names of its contributors +may be used to endorse or promote products derived from this software +without specific prior written permission. +\end{enumerate} +THIS SOFTWARE IS PROVIDED BY THE AUTHORS 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 AUTHORS 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. + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\chapter*{Version Info} + +This documentation is for KallistiOS version \kosversion. If the version +code says ``\#{}\#version\#\#'', then this is an interim in-progress copy +from CVS rather than from a numbered release. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\chapter{Overview} + +Welcome to KallistiOS! If this documentation looks familiar to users +of libdream, that's because it is -- this is basically a ``port'' +of the documentation, with new sections added as neccessary, and other +sections modified. You'll find some entire sections marked +``\textbf{\emph{UNPORTED FROM LIBDREAM}}'' +and these haven't been updated to KOS yet. Some +other sections are simply unfinished as yet. Bear with us here, this +is a \emph{lot} of documentation to write. + +The following is copied from the README file: + +\begin{quote} +KallistiOS is a pseudo-real-time operating system for gaming consoles, +licensed under the terms of the \textbf{new} BSD license (the one +without the advertising clause). It has currently been ported to the +Dreamcast\tm and Gameboy Advance\tm platforms. + +Depending on whether you wish to see the fnords, you can pronounce +it ``kallisti-o's'' (like a cereal) or ``kallisti~o~s'' (like an operating +system). We like the former since +it's silly to be so serious most of the time =). ``Kallisti'' +means ``to the fairest'' in Greek. This was the word +(so the story goes) that was inscribed on the golden apple that Eris +threw into the banquet of the gods to start the Trojan war. This somehow +landed her the title of matriarch of a silly religion called Discordianism, +which is what the name pays homage to. If you want a short abbreviation, +you can also refer to it as ``KOS'', which can be +pronounced ``k-os'' (chaos =) or just plain old ``k-o-s''. + +Note that this name is \emph{not} to be confused or associated with either +the professional development company Kalisto Software(tm) or the cracking +group ``Kalisto''. + +Now that that is cleared up... =) + +Like most embedded kernels, KallistiOS is designed to be linked directly +into a program. Unlike some simple libraries, however, KallistiOS +(abbreviated elsewhere as KOS) also includes a full thread scheduler, +virtual file system, etc. The only real difference is that your program +is linked directly into the kernel instead of being run in a {}``userland'' +state. + +\end{quote} + +Note that the only active port of KOS is for the Dreamcast(tm), so +the rest of this document will refer to that port unless otherwise +stated. + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\chapter{Getting Started} + +We assume that you have gotten a working compiler set up. The compiler +you need depends entirely on the platform you wish to use KOS with. +At the moment, only the DC platform is very well supported. The others +may or may not compile at this time. So this document will focus on +that aspect of KOS. + +The first thing you'll want to do is get a working binary image of +the KOS libraries. You may download KOS in binary or source form. + +If you downloaded KOS in binary form, then you'll still need a binary +for \progname{genromfs} if you want to use the ROMFS file system (which +will probably come in quite handy for development). Linux tends to +come with this binary, BSD users can compile one using the copy included +with the KOS sources, and Cygwin users will likewise need to compile +it or obtain a binary from the same place you got the KOS package. + +The first thing you'll want to do in either case is to customize an +``environ'' script. This script is run inside your shell to set +various environment variables so that the KOS build scripts and tools +know where to find KOS and the compiler toolchains (for DC, an SH-4 +compiler, and optionally, an ARM7 compiler). Look in the \dirname{doc} +tree for samples. If you are using \progname{bash} (the default +for Cygwin) then you should start with one ending in ``.sh'' and +if you are using \progname{tcsh} then you should start with one ending +in ``.tcsh''. Generally it shouldn't take more than changing a +few base directory variables at the top of the file, and the environ +script will be ready to go. You then need to either execute this script +before working (``\code{source environ.sh}'' or ``\code{source environ.tcsh}''), +or put the appropriate command in your shell's startup script. The +instructions on how to do basic shell things like that is beyond the +scope of this document, so look to Cygwin and/or {*}nix help groups +if you want to find it. + +Now that you think you've got your environ script setup correctly, +type \progname{set} (under \progname{bash}) or \progname{setenv} (under +\progname{tcsh}) and look at the environment variables. You should see +a whole bunch of them starting with ``KOS''. If that's true then +this step is probably complete. + +If you downloaded the source package for KOS, then you'll want to +compile it now. Just change the directory to the root of the KOS tree +(e.g., inside ``kos-\kosversion'') and type \progname{make}. After a few +minutes everything should have completed successfully. If not, then +you might need to recheck the above steps and make sure everything +is set up properly. If all else fails, try asking on the \emph{dcdev} +or \emph{cadcdev-kallistios} mailing lists. + +Well, now that that is (hopefully) out of the way, we'll proceed on +to writing a KallistiOS program. + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\chapter{A Basic KOS Program} + +A KOS program is pretty simple and straightforward. Each C module +should include \dirname{kos.h} as a system header (e.g. ``\code{\#include +}'').% +% +\footnote{Alternatively it is possible to include individual headers as you +use them; but with the speed of modern C compilers there is generally +no good reason to do this unless you have a namespace conflict. +} +% +You should have a C-standard ``main'', which is called +\funcname{main}. It is also possible to use several directives outside +your \funcname{main} function that modify the initialization and shutdown +behavior of KOS. It should be instructive to follow along in one of +the Hello World examples for your platform to see how a basic KOS +program should look. + +You can have KOS automatically initialize subsystems if you want them +to be active during your program. For example, you will probably want +IRQs to be active in your program. On the other hand, you might not +want threading active.% +% +\footnote{In KOS 1.1.6 and above, threading is \emph{always} active; it is +not a matter of threaded or not, but cooperative vs pre-emptive threading. +Cooperative threading is the equivalent of the old KOS non-threaded +mode, it just adds a little bit to the binary size. +} +% +A basic KOS init flags line looks like this: + +%%\index{KOS\_INIT\_FLAGS} +\begin{lyxcode} +KOS\_INIT\_FLAGS(INIT\_DEFAULT); +\end{lyxcode} + +The parameter is a bitmask describing what you want to be initialized +by default. The constant INIT\_DEFAULT is available on every platform +as a generic way to initialize as much of KOS at once as is feasible. +For example, on the DC, this constant enables IRQs and pre-emptive +threads. + +Another directive available to you is the romdisk directive. It looks +like this: + +%%\index{KOS\_INIT\_ROMDISK} +\begin{lyxcode} +KOS\_INIT\_ROMDISK(romdisk); +\end{lyxcode} + +The parameter is a pointer to a ROMFS image created by \progname{genromfs}. +ROMFS was taken from Linux (the specification, not any code) and the +Linux and KOS implementations are 100\% compatible, except that KOS +doesn't implement a few ROMFS features such as hard links and soft +links. You can, for example, mount the same ROMFS image in KOS and +under a loopback device in Linux. If you don't want a ROMFS, then +you should use the constant \constname{ROMDISK\_NONE}. ROMFS images are +generally included in the binary by using the KOS utility \progname{bin2o}, +which is included in the {}``utils'' tree. The Hello World Makefiles +show how to do this. + +Note that leaving out either of the above init lines will cause KOS +to use defaults. \constname{KOS\_INIT\_FLAGS} defaults to using \constname{INIT\_DEFAULT} +for its flags, and \constname{KOS\_INIT\_ROMDISK} defaults to \constname{NULL} (no romdisk). + +By the time your \funcname{main} function is called, the basic KOS systems +should be ready to go! If you want to use any of the extra/add-on +libraries that come aggregated with KOS, then you will need to initialize +them seperately. These might include 3D support, an MP3 or OGG playback +library, KGL, etc. + +For more info on the different subsystems, please see the chapter +devoted to that system. For examples, see the ``examples'' directory +off the KOS root. + +Now that you know what a basic KOS program looks like, you'll probably +want to start figuring out how to use the various parts of the library. +The following chapters are more in the way of a reference manual than +a tutorial. The next chapter describes the portable parts of KOS which +are present on every platform (though in some cases there are minor +differences). The chapters after that describe the various platform-specific +parts of KOS, and the final chapters describe the add-on libraries +which are aggregated with the KOS distribution. + + +\section{A Note on C++ Compatibility} +%%\index{C++} + +KOS supports compiling with C++ support {}``out of the box''. The +headers are guarded with \code{extern ``C''} and we have avoided +the silly new keywords in stdc++ such as ``or'' and ``and''. +So you should be able to use KOS from a C++ program exactly as if +you were using it from a C program, except that you must make sure +you include all of the headers you need. + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\chapter{The Fully Portable Subsystems} + +All of the following subsystems are written in a portable fashion +so that the code should compile on any new platform for which a hardware +abstraction layer is created. The HAL (located under \dirname{kernel/arch} for +each platform) will be discussed in the next section. + + +\section{Data Types} +%%\index{int8} +%%\index{int16} +%%\index{int32} +%%\index{int64} +%%\index{uint8} +%%\index{uint16} +%%\index{uint32} +%%\index{uint64} + +Before we get started on the individual systems, I figured a small +word about data types is in order. Almost everything in KOS uses the +following conventions for data types. KOS' architecture specific type +header (\dirname{arch/type.h}) defines types \dtname{int8}, \dtname{int16}, +\dtname{int32}, and \dtname{int64} to match signed integers of the appropriate +number of bits. \dtname{uint8}, \dtname{uint16}, \dtname{uint32}, and +\dtname{uint64} are the same, but unsigned. All of those types have +corresponding volatile versions with a 'v' prefix (\dtname{vint8}, +\dtname{vuint8}, etc). Booleans or countsare often stored as \dtname{int}, but counts +are also often \dtname{uint32}, depending on the circumstance. Functions +that can return errors generally return them as a negative \dtname{int}, and +success as a zero \dtname{int}. Strings are passed around as \dtname{const~char~*}. +Individual characters are generally \dtname{int}. Several other +misc types are defined, including some ANSI C compatibility types +(\dtname{u\_short}, etc) but those are the main ones. + + +\section{ANSI C library} + +KOS' built-in \libname{libc} supports most of the standard ANSI C functions, +ported mostly from the BSD library. KOS also includes an integrated +copy of the Newlib \libname{libm} library so that you are guaranteed +that your libraries all match up. + +The libc includes the stdio file functions as well, to wrap its native +VFS functions, so that you do not have to port that functionality. + +\funcname{memcpy2}, \funcname{memset2}, \funcname{memcpy4} and \funcname{memset4} +are hardware helper functions which work like \funcname{memset} and +\funcname{memcpy}, but they copy the specified number of bits at a time. +\funcname{memalign} is a memory helper function which assures alignment +on a certain byte boundary for hardware buffers. + +Many people have commented that KOS' libc is somewhat spartan compared +to many modern libc's such as glibc, BSD, and Newlib. However, we +feel like the KOS libc is probably more than sufficient for most console +efforts (games, demos, etc). If you want a more complete portability +layer then you might be looking in the wrong place -- perhaps DC Linux +or NetBSD would be better suited to your application. KOS makes no +bones about being pretty bare when it comes to standard POSIX style +functionality. Still, there's more than enough here to drive the console-intensive +parts of your application as long as you're willing to do a bit of +porting work. + + +\section{VFS (Virtual File System)} + +KOS contains a reasonably capable VFS (virtual file system), much +like a *nix. It provides the basic file operations which you have +come to expect as a programmer: \funcname{open} (with path translation, +thus the {}``virtual'' part of VFS), \funcname{read}, \funcname{write}, +\funcname{seek}, \funcname{tell}, \funcname{readdir}, \funcname{ioctl}, \funcname{rename}, +\funcname{unlink}, \funcname{mmap}. VFS also provides an unconventional +but very helpful function, \funcname{total}, which returns the total +file size if possible. Some of these functions may not work on all +file systems. For example, you cannot \funcname{write} to a CD or a +ROMFS image. But you can \funcname{write} to a VMU on a DC. You also +cannot \funcname{mmap} on most file systems, the notable exceptions +being fs\_romdisk and fs\_vmu. Failure in these functions is indicated +(as mentioned above) by a negative return value, except in the case +of \funcname{open}, which may eventually be changed to conform anyway. + +%% + +\subsection{file\_t fs\_open(const char * fn, int mode)} + +Opens a file on the VFS. This function searches its VFS table for +the longest match against the first of \paramname{fn}, and then passes +off the rest of the functionality to the given VFS with the remainder +of the path. The returned value should be considered opaque and will +be zero (or \constname{NULL} if you prefer) on error, or a valid file handle otherwise. +The \paramname{mode} parameter should be one of \constname{O\_RDONLY}, +\constname{O\_RDWR}, \constname{O\_APPEND}, or \constname{O\_WRONLY}, potentially +logically or'd with \constname{O\_TRUNC}, \constname{O\_DIR}, or +\constname{O\_META}. + +%% + +\subsection{void fs\_close(file\_t hnd)} + +Closes an opened VFS file. Handle values passed to this function (and +all other VFS functions below) are \emph{not} checked for validity! +If you try to pass an already closed handle (or a random value) to +this function, the result will be undefined. + +%% + +\subsection{ssize\_t fs\_read(file\_t hnd, void * buffer, size\_t cnt)} + +Reads up to \paramname{cnt} bytes from the file handle \paramname{hnd}, and +stores them into \paramname{buffer}. The actual number of read bytes will +be returned. + +%% + +\subsection{ssize\_t fs\_write(file\_t hnd, const void * buffer, size\_t cnt)} + +Writes up to \paramname{cnt} bytes from \paramname{buffer} and stores them to +the file handle \paramname{hnd}. The actual number of written bytes will +be returned. + +%% + +\subsection{off\_t fs\_seek(file\_t hnd, off\_t offset, int whence)} + +Works like the ANSI \texttt{fseek} function. The file pointed to by +\paramname{hnd} will be seeked to \paramname{offset}, where \paramname{offset} is +interpreted as specified in \paramname{whence}. The actual file position +will be returned. The \paramname{whence} parameter is one of \constname{SEEK\_SET}, +\constname{SEEK\_CUR}, or \constname{SEEK\_END}. + +%% + +\subsection{off\_t fs\_tell(file\_t hnd)} + +Returns the file position of the handle \paramname{hnd}. + +%% + +\subsection{size\_t fs\_total(file\_t hnd)} + +Returns the total byte size of the handle \paramname{hnd}, if applicable. + +%% + +\subsection{dirent\_t * fs\_readdir(file\_t hnd)} + +Reads the next directory entry from the handle \paramname{hnd}. The file +handle is assumed to have been opened using \texttt{fs\_open(..., +O\_DIR)}. The returned pointer may be queried for values unless it +is \constname{NULL}, which signifies the end of the directory listing. + +%% + +\subsection{int fs\_ioctl(file\_t hnd, void * data, size\_t size)} + +Perform a device/fs specific I/O Control message on the given file +handle. This is entirely fs dependent. The only existing fs handler +which supports this ioctl is fs\_iso9660, which uses it to hint that +the data/index cache should be flushed and the CD TOC should be rescanned. + +%% + +\subsection{int fs\_rename(const char * fn1, const char * fn2)} + +Move/rename a file, if possible. The two files \emph{must} be located +on the same file system. Returns a negative value on failure. + +%% + +\subsection{int fs\_unlink(const char * fn)} + +Delete a file, if possible. Returns a negative value on failure. + +%% + +\subsection{int fs\_chdir(const char * fn)} + +Change the working directory for the current thread. Any relative +path (i.e., a path not beginning with ``/'') will be treated as +relative to this directory. This value will be inherited by any thread +created by the thread which called this function. Returns a negative +value on failure. + +%% + +\subsection{void * fs\_mmap(file\_t hnd)} + +Returns a pointer to a buffer containing the full data of the handle +\paramname{hnd}. Depending on how the file was opened, the buffer may or +may not be writable. This call may not succeed (limited memory, inability +of the file system to perform the call, etc). In this case, the function +will return \constname{NULL}. + +%% + +\subsection{const char * fs\_getwd()} + +Returns the working directory for the current thread. + +%% + +\subsection{int fs\_handler\_add(const char * prefix, vfs\_handler * hnd)} + +Adds a new VFS handler to the VFS system. Each of the built-in file +systems performs this call on startup. The file system will be placed +on the file heirarchy at \paramname{prefix}, and will be accessed using +the functions pointed to by \paramname{hnd}. Since this is considered an +arcane and fairly internal piece of the VFS, please look at the source +code for an existing handler if you wish to write a new one. It is +fairly simple but beyond the scope of this document. + +%% + +\subsection{int fs\_handler\_remove(const vfs\_handler * hnd)} + +Removes a previously added VFS handler. Each built-in file system +performs this call on shutdown. + +%%%%%%%%%%%%%%%%%% + +\section{File System: fs\_builtin} + +This file system module is somewhat deprecated, but it is still included +and maintained because it has some interesting properties that could +be useful to a programmer. + +The basic concept of fs\_builtin is that you pass it a table of ``files'', +which really consist of pointers to data blocks and file sizes. It +then manages file handles on these files and all of the normal VFS +functions work on them. + +This used to be used for building files into program images, but that +function has been relocated to the much more able fs\_romdisk. The +interesting property of fs\_builtin is that the pointers are arbitrary +and point to blocks of data that can be changed on the fly. This could, +for example, be used to implement a /proc like filesystem. In practice, +it hasn't been used for anything like that. + +fs\_builtin mounts itself on \dirname{/bi} on the tree. + +%%%%%%%%%%%%%%%%%% + +\section{File System: fs\_romdisk} + +fs\_romdisk is the primary method by which one builds files into a +program image in KOS (faster loading, easy for debugging, etc). A +romdisk image is generated using the program \progname{genromfs}; this +image is converted to a binary object and linked with the program. +The KOS initialization sets up fs\_romdisk to point to this image. +Any number of arbitrarily structured directories and files are also +possible in fs\_romdisk. + +fs\_romdisk mounts itself on \dirname{/rd} on the tree. + +%%%%%%%%%%%%%%%%%% + +\section{Memory Allocation System} + +KOS contains a full set of ANSI-standard memory allocation functions, +implemented with the very popular \libname{dlmalloc} library. This library +is public domain and is very efficient for quickly allocating and +freeing a large number of memory blocks, such as one might do from +a C++ program. + +The KOS kernel library also contains the GCC stub functions required +for the use of the \code{new} and \code{delete} operators in C++. +Thus you may write basic C++ programs without including any extra +libraries to do so. In some cases, you may want to include libk++ +as well, which is a very minimalistic stdc++ library for KOS. This +avoids the necessity of building libstdc++ from GCC for about 99\% +of the cases. + +Finally, if you feel comfortable with building your own KOS libraries +and you are also comfortable with Makefiles, you may use the debug +mallocator included with KOS. This is done by replacing ``malloc.o'' +in \dirname{kernel/mm/Makefile} with \dirname{malloc\_debug.o} and rebuilding. +The debug mallocator never frees memory, so be aware of this if you +use a lot of memory blocks. However, it does do buffer checking to +look for overrun and underrun conditions, doubly freed blocks, leaked +pointers, and other anomalies. If you enable the debug mallocator, +you will also want to set \constname{INIT\_MALLOCSTATS} in your \constname{KOS\_INIT\_FLAGS} +line. This will tell the kernel to print out malloc stats when the +program has exited since this is where all the extra checking is performed. + +%%%%%%%%%%%%%%%%%% + +\section{Network System} + +In addition to low-level drivers on applicable platforms, KOS supports +a fully abstracted network datagram system. This system is capable +of enumerating devices attached to the system and letting the program +send and receive datagrams on those devices. Usually the network system +is attached to something more high level, such as a TCP/IP stack. +To enable networking, you must use the \constname{INIT\_NET} flag on the +\constname{KOS\_INIT\_FLAGS} line. + +The pieces of the network system which are actually functional and +well-specified are described below. + +%% + +\subsection{int net\_input(netif\_t * device, const uint8 * data, int len)} + +Low-level device drivers should call this function to register datagram +input to the network system. The low-level driver's handle should +be passed as \paramname{device}, while \paramname{data} and \paramname{len} are the +data and length of the datagram. + +%% + +\subsection{net\_input\_func net\_input\_set\_target(net\_input\_func t)} + +Sets the output port for datagram inputs. The function \paramname{t} will +be called any time a datagram is available from a call to \funcname{net\_input}. +This function returns the address of the old function. The default +target is a simple ICMP echo (ping) handler. + +%% + +\subsection{int net\_reg\_device(netif\_t * device)} + +Registers a potentially available device driver with the network system. +This should be called by any low-level driver which wants to make +itself available. Note that the device need not be physically present +on the system -- the network system will scan for available drivers +at init time. + +%% + +\subsection{int net\_unreg\_device(netif\_t * device)} + +Unregisters a previously registered network device. + +%%%%%%%%%%%%%%%%%% + +\section{Thread System} + +KOS contains a fully functional thread system, including priority +based scheduling, thread sync primitives with their own queues, zero-CPU-usage +sleeping, and the choice between cooperative and pre-emptive thread +models. + +In the cooperative thread model, a thread will only ever be interrupted +if it manually places itself on a wait queue. This can be accomplished +by calling the \funcname{thd\_sleep} function or waiting on an unavailable +thread sync primitive. Use of cooperative threading mode with multiple +threads has not really been tested very well, so use it at your own +risk. We currently recommend sticking with a single thread if you +want to use cooperative mode (this is what it was mainly designed +for). + +In pre-emptive mode, a timer interrupt is called HZ times per second +(a constant in \dirname{arch.h}) to re-schedule. The current thread is placed +back on the ready queue and another thread is pulled from it. This +may be the same thread if no other threads are running. The effect +is what you usually see in modern operating systems when running more +than one program at once -- all of the programs seem to be running +simultaneously. The very big difference between those schedulers and +the KOS pre-emptive scheduler is that KOS' scheduler does exactly +what you tell it to do. There are no temporary priority boosts or +decay, or anything of the like. This means that, like most real-time +embedded kernels, if you place a thread at a high priority, \emph{no +other thread will execute until it is sleeping, has had its priority +lowered, or quits}. I highlight the previous statement because thread +priorities may be very useful for your application, but you must be +careful not to cause a situation where your high-priority thread is +always the one running. You also have to watch for ``priority inversion'', +but discussion of these topics is beyond the scope of this document +-- go get a CS operating systems textbook. =) + +Pre-emptive thread mode is the default (for \constname{INIT\_DEFAULTS}). You can +cancel this out by using (\code{INIT\_DEFAULTS \& \~{}INIT\_THD\_PREEMPT}) +in your \constname{KOS\_INIT\_FLAGS} line, or by creating your own bitmask manually +and leaving that part out. + +On to the function reference... + +%% + +\subsection{kthread\_t * thd\_create(void (* routine)(void * param), void * param)} + +Creates a new thread and returns the \dtname{kthread\_t} structure representing +it. The thread will begin at \paramname{routine}, and its single and only +parameter will be \paramname{param}. In case of failure, \constname{NULL} will be returned. + +%% + +\subsection{int thd\_destroy(kthread\_t * thd)} + +Destroys a previously created thread. \emph{This is not recommended}. +Instead, if at all possible, a thread should quit on its own in a +graceful manner. However, if you must kill a thread which hasn't died, +then you can use this function. Any resources the thread had allocated +or locked (such as memory, thread sync primitives, etc) will not be +freed. + +%% + +\subsection{void thd\_exit()} + +Gracefully exit the current thread. This function will never return. + +%% + +\subsection{void thd\_schedule()} + +Manually re-schedule. \emph{This function is to be called only inside +an interrupt/syscall context}. It assumes that interrupts are disabled +and that we have entered the routine by saving the previous context +into the appropriate \dtname{kthread\_t}. + +%% + +\subsection{void thd\_schedule\_next(kthread\_t * thd)} + +Same basic thing as \funcname{thd\_schedule}, but you may specify a +thread to be manually scheduled next. This can be useful if, for example, +a device driver needs to pass control back to some code which was +placed on a wait queue as quickly as possible. + +%% + +\subsection{void thd\_pass()} + +The caller voluntarily gives up the rest of its timeslice. Any remaining +timeslice will be given to the next scheduled thread. Note that the +timeslice does \emph{not} start over when this happens, so used incorrectly +it could theoretically cause starvation issues. + +%% + +\subsection{void thd\_sleep(int ms)} + +The caller will sleep the requested number of milliseconds. This function +will return at a time equal to or greater than the requested delay. +This is not guaranteed to be precise, and will certainly not be more +precise than \constname{HZ} allows. While the caller is sleeping, zero CPU time +is spent (it is not scheduled at all). + +%% + +\subsection{int thd\_set\_prio(kthread\_t * thd, prio\_t prio)} + +Sets the priority of the given thread. The default priority is \constname{PRIO\_DEFAULT} +and the maximum priority is \constname{PRIO\_MAX}. A larger value means lower priority. + +%% + +\subsection{kthread\_t * thd\_get\_current()} + +Retrive the \dtname{kthread\_t} for the caller. + +%% + +\subsection{const char * thd\_get\_label(kthread\_t * thd)} + +Retrieve the ``thread label'' for the given thread. This is an +arbitrary free-form string which identifies the thread for debugging +purposes. + +%% + +\subsection{void thd\_set\_label(kthread\_t * thd, const char * label)} + +Sets the ``thread label'' for the given thread. + +%% + +\subsection{const char * thd\_get\_pwd(kthread\_t * thd)} + +Retrieve the current working directory for the given thread. This +is used by the VFS for relative paths. + +%% + +\subsection{void thd\_set\_pwd(kthread\_t * thd, const char * pwd)} + +Sets the current working directory for the given thread. + +%%%%%%%%%%%%%%%%%% + +\section{Sync Objects: Semaphore} + +Semaphores should be familiar to most computer science people and +programmers. A semaphore is a counted sync primitive. The best analogy +for this is a bank. In a bank, you have N tellers and M customers. +Each customer can either go directly to an open window, or must take +a ticket and wait until a teller is available. + +In concise terms, each semaphore contains a count value. When a thread +wants to use the limited resource represented by the semaphore, it +must call \funcname{sem\_wait} or \funcname{sem\_wait\_timed}. If the +count is greater than zero, then the count is decreased and the thread +is allowed to continue, all in an atomic and thread-safe manner. If +the count is already zero, then the thread is placed on a queue and +must sleep until another thread performs a \funcname{sem\_signal}. That +function checks to see if anyone is waiting and wakes them. In this +way, control is very efficiently passed between waiting threads. + +A very simple condition variable can be created by using a semaphore +with an initial count of zero. A mutex can be created by using an +initial count of one. For this reason, semaphores are mostly considered +to be the fundamental thread sync primitive. + +%% + +\subsection{semaphore\_t * sem\_create(int value)} + +Create and return a new semaphore with an initial value of \paramname{value}. + +%% + +\subsection{void sem\_destroy(semaphore\_t * sem)} + +Destroy a previously created semaphore. + +%% + +\subsection{void sem\_wait(semaphore\_t * sem)} + +``Wait'' on the given semaphore. The operation is described above. + +%% + +\subsection{int sem\_wait\_timed(semaphore\_t * sem, int timeout)} + +``Wait'' on the given semaphore for a maximum of \paramname{timeout} +milliseconds. If the semaphore has not been signaled in that time, +then return with an error code (negative value). + +%% + +\subsection{void sem\_signal(semaphore\_t * sem)} + +``Signal'' on the given semaphore. Any waiting thread will be +placed back on the scheduler's ready queue. + +%% + +\subsection{int sem\_count(semaphore\_t * sem)} + +Return the current count of the semaphore. Note that although this +may be used to check if it's likely that the thread will be put to +sleep, this is not an entirely reliable way to check this because +of race condition issues. + +%%%%%%%%%%%%%%%%%% + +\section{Sync Objects: Condition Variable} + +Condition variables are like a pulsed one-count semaphore. N threads +may wait on a condition variable. When a thread calls signal, one +waiting thread is released. This is like a Win32 ``Event'' sync +primitive. + +Note however, that there is no function to release all waiting threads +simultaneously, so this is not really very useful above a semaphore +at the moment. Will be documented in more detail later. + +%% + +\subsection{condvar\_t * cond\_create()} + +%% + +\subsection{void cond\_destroy(condvar\_t * cv)} + +%% + +\subsection{void cond\_wait(condvar\_t * cv)} + +%% + +\subsection{void cond\_signal(condvar\_t * cv)} + +%%%%%%%%%%%%%%%%%% + +\section{Platform-Independent Images} + +Most people would argue that this has no business in the main kernel +library, and they may very well be right. However, I wanted this to +be a standard part of KOS on any platform it got ported to so that +you're guaranteed some platform-independet, device-dependent representation +of images. This way, any image loader library that is ported to KOS +can convert to this data format and it can be used by anything in +the kernel that understands it (drivers, etc). + +KOS doesn't try to put any limitations on what format the image may +take; instead it tries to encapsulate most of the common formats you'd +want to use in writing a game or demo and then provides an ``out'' +for platform-specific things that are just too strange to be used +elsewhere. A good example of this (though one which isn't actually +used currently) would be the PVR2's ``twiddled'' textures. Some +somewhat strange things that it \emph{does} cover are inverted axis +textures (e.g., for GL) and YUV formats for MPEG\tm. + +The majority of the PII system is just format specifications so that +pieces have a common language to talk about the images. This includes +a structure (\dtname{kos\_img\_t}) that contains a pointer to the raw data, +width and height in pixels, and a format descriptor. The first three +pieces are pretty self-explanatory, so I won't waste any time on those. +However, the format descriptor deserves some attention. + +The format descriptor is composed of two parts: the platform independent +part, and the platform dependent part. Each of these parts is 16 bits +wide. The platform independent part is further divided into a format +specifier and standard flags. The format specifier may be one of: + +\begin{itemize} +\item \constname{KOS\_IMG\_FMT\_NONE} -- Undefined / Unknown +\item \constname{KOS\_IMG\_FMT\_RGB888} -- Interleaved r/g/b/ bytes (24-bit) +\item \constname{KOS\_IMG\_FMT\_ARGB8888} -- Interleaved a/r/g/b bytes (32-bit) +\item \constname{KOS\_IMG\_FMT\_RGB565} -- r/g/b 5/6/5 (16-bit) +\item \constname{KOS\_IMG\_FMT\_ARGB4444} -- a/r/g/b 4/4/4/4 (16-bit) +\item \constname{KOS\_IMG\_FMT\_ARGB1555} -- a/r/g/b 1/5/5/5 (16-bit) +\item \constname{KOS\_IMG\_FMT\_PAL4BPP} -- Paletted (4-bits per pixel) +\item \constname{KOS\_IMG\_FMT\_PAL8BPP} -- Paletted (8-bits per pixel) +\item \constname{KOS\_IMG\_FMT\_YUV422} -- y/u/v 4/2/2 (8-bit) +\item \constname{KOS\_IMG\_FMT\_BGR565} -- b/g/r 5/6/5 (16-bit) +\item \constname{KOS\_IMG\_FMT\_RGBA8888} -- r/g/b/a bytes (32-bit) +\end{itemize} + +The attributes will be a bitmask with the following: + +\begin{itemize} +\item \constname{KOS\_IMG\_INVERTED\_X} -- The image is flipped along the X axis +\item \constname{KOS\_IMG\_INVERTED\_Y} -- The image is flipped along the Y axis (usually used with GL) +\end{itemize} + +There is one function associated with the PII system currently: + +\begin{itemize} +\item void kos\_img\_free(kos\_img\_t * img, int struct\_also) + +Frees the image pointed to by \paramname{img}. If \paramname{struct\_also} is +non-zero, then the \dtname{kos\_img\_t} struct itself will also be freed. This +function is to ensure future compatibility in code that calls libraries +to allocate images and then needs to free them later itself. + +\end{itemize} + +Several macros are also available for tearing apart and putting together +the format descriptor: + +\begin{itemize} +\item \constname{KOS\_IMG\_FMT\_I(x)} -- given a format descriptor \emph{x}, return +the platform independent part +\item \constname{KOS\_IMG\_FMT\_D(x)} -- given \emph{x}, return the platform dependent +part +\item \constname{KOS\_IMG\_FMT(i,d)} -- given an independent part \emph{i} and a dependent +part \emph{d}, return a full format descriptor +\end{itemize} +Note that \code{KOS\_IMG\_FMT(KOS\_IMG\_FMT\_I(x), KOS\_IMG\_FMT\_D(x))} +=== x. + +In the future, the PII system may also include functions to convert +between image formats, but this hasn't been done yet. + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\chapter{Hardware Abstraction Layer: Portable Parts} + +Underneath the platform independent pieces of KOS is a comprehensive +hardware abstraction layer (HAL). This piece of code implements a +standard API (plus a number of other things that provide ways to get +directly to hardware functionality when necessary) which may be used +by the platform independent pieces and also by user programs. The +HAL includes the following pieces (and maybe more, depending on the +needs of the platform): + +\begin{itemize} +\item C runtime startup / shutdown, including \funcname{atexit} +\item C++ runtime setup / shutdown, \emph{not} including RTTI and exceptions +\item A basic ``bootstrap'' debug I/O system (e.g., serial port) +\item Setup of various KOS systems and hardware drivers from the init bitmasks +\item Misc program control calls +\item IRQ management / Context management (for threading) +\item Realtime Clock (RTC) management +\item Basic memory management (free pool for the system dlmalloc) +\item MMU management if applicable/desired +\item Timer management +\item Cache coherency management (O/I-Cache flushing/writeback/invalidation, ITLB flushing, etc) +\item Program image replacement (aka \funcname{exec}) +\item Kernel/Interrupt mode-User mode transitioning (syscall) +\item Low-level contention prevention (spinlocks) +\item Platform-independent API for streaming sound and playing sound effects (optional) +\item Platform-independent API for basic device input (optional, not yet specified) +\item Platform-independent API for basic frame-buffer access (optional, not yet specified) +\item Platform-specific file systems (e.g., for memory cards) * +\item Platform-specific hardware drivers / APIs (3D, SPU, etc) * +\item Misc platform-specific utility functions * +\end{itemize} + +The three items above marked with a star (*) are part of the non-portable +section of the HAL, and thus will be covered in the next chapter. +However, they are listed here for completeness. The parts marked ``not +yet specified'' have been potentially planned, but not yet designed +or implemented, so they will not be specified here at all. + +Note also that while we try to keep fairly generic pieces (like timer +handling) either to a generic interface, or providing a generic interface, +there are many cases where it's simply not possible. For example, +every CPU has different sets of exceptions you can catch in software. +Some are similar across CPUs, some aren't. This is a low-level enough +thing, though, where making it portable would have probably caused +more trouble than it would have saved. In the sections below where +that is the case, this document will not expound further upon the +subject in a platform-specific manner. You will need to refer to the +headers and source code for the platform in question when writing +something that uses these low-level interfaces. + +Most users of KOS who are simply writing programs to use it will never +need to look through most of this chapter of the manual. You will +be much more interested in the next chapter. + +But now, without further delay... + +%%%%%%%%%%%%%%%%%% + +\section{C/C++ Runtime} + +All of this stuff is completely under the covers for the vast majority +of programs out there (and/or conforms to the ANSI C spec, such as +\funcname{atexit}). If you need to know more about this part, then +please visit your friendly local source code. Other sections which +have no visible interface (or which have already been described, like +\constname{KOS\_INIT\_FLAGS}) will also not be discussed in this document. + +%%%%%%%%%%%%%%%%%% + +\section{Misc Program Control Calls} + +These pieces are part of the HAL but don't really fit anywhere else. +They are just generic, and mainly related to startup/shutdown. + +%%%%%%%%%%%%%%%%%% + +\section{Bootstrap Debug Input/Output} + +Every architecture supported by KOS supports the concept of a debug +I/O console. Sometimes this may not be connected to anything (especially +in the really embedded ports like GBA) but this is where all debug +and printf output goes by default, and this is where any pieces (such +as DC's libconio) will grab their key input if configured to do so +from the dbgio channel. + +%% + +\subsection{dbgio\_printk\_func dbgio\_set\_printk(dbgio\_printk\_func func)} + +Set a function to capture all debug output that comes through \funcname{dbgio\_printf}, +and return the old function. This is used by, e.g., dc-tool. The type for +the function is: + +\begin{lyxcode} +typedef void (* dbgio\_printk\_func)(const char *); +\end{lyxcode} + +%% + +\subsection{void dbgio\_set\_parameters(int baud, int fifo)} + +Set serial parameters; this is not as platform independent as I want +it to be, but it should be generic enough to be useful. The +baud rate will be set to \paramname{baud} and if \paramname{fifo} +is non-zero, the serial FIFO will be enabled. + +%% + +\subsection{void dbgio\_write(int c)} + +Write one char to the debug port. You must call \funcname{dbgio\_flush()} +to actually ensure that the output was sent. + +%% + +\subsection{void dbgio\_flush()} + +Flush all buffered bytes out of the port buffer, if any. + +%% + +\subsection{void dbgio\_write\_buffer(const uint8 * data, int len)} + +Send an entire buffer of data. This is just a shortcut for sending +each byte of data with \funcname{dbgio\_write}. + +%% + +\subsection{void dbgio\_read\_buffer(uint8 * data, int len)} + +Read an entire block of data. This is just a shortcut for reading +each byte of data with \funcname{dbgio\_read}. Note that this +function will block until it has \paramname{len} bytes of data. + +%% + +\subsection{void dbgio\_write\_str(const char * str)} + +Send a C string (null-terminated). + +%% + +\subsection{int dbgio\_read()} + +Read one char from the debug port (-1 if nothing to read). + +%% + +\subsection{void dbgio\_disable()} + +Disable debug I/O globally; all debug output will be discarded and +debug input will always return failure. This can be used as a quick +way to disable all of your debug output before burning a final +copy of your game/demo, etc. + +%% + +\subsection{void dbgio\_enable()} + +Enable debug I/O globally (after calling \funcname{dbgio\_disable}). + +%% + +\subsection{int dbgio\_printf(const char * fmt, ...)} + +Works like \funcname{dbgio\_write\_str}, but provides formatting +capabilities. There is a limit to the number of characters that +can be in the resulting string, so don't pass arbitrarily long +strings to this function. + +%%%%%%%%%%%%%%%%%% + +\section{IRQ/Context Management} + +IRQ management requires a few data structures and macros which are +portable across platforms, and which will be described up front: + +\begin{itemize} +\item \dtname{irq\_context\_t} -- the basic structure describing an IRQ context; + this is used both for saving the state of a program during IRQs and + for switching contexts during threading +\item \dtname{irq\_t} -- the type used to uniquely identify an interrupt/exception +\item \dtname{irq\_handler} -- the function type for an interrupt/exception handler +\item \constname{REG\_BYTE\_CNT} -- the number of bytes required to store the context on this platform +\item \constname{CONTEXT\_PC(x)} -- macro to retrieve the current ``program counter'' + or ``instruction pointer'' from a context +\item \constname{CONTEXT\_FP(x)} -- macro to retrieve the current ``frame pointer'' from a context +\item \constname{CONTEXT\_SP(x)} -- macro to retrieve the current ``stack pointer'' from a context +\item \constname{TIMER\_IRQ} -- the interrupt/execption identifier (of type \dtname{irq\_t}) + to be used to hook the timer interrupt +\item Various other values of type \dtname{irq\_t} for interrupts/exceptions available + on this platform +\end{itemize} + +The rest is handled through the function interface. + +%% + +\subsection{int irq\_inside\_int()} + +Returns non-zero if the caller is executing inside an interrupt handler. + +%% + +\subsection{void irq\_force\_return()} + +This is kind of a weird one. This assumes that you have interrupts +disabled, but are not actually running inside an interrupt handler, +and you want to pretend that you were in fact inside an interrupt +handler and return from that interrupt. This can be used to, for example, +force a context switch without actually switching into ``kernel'' +mode. We don't really use this anymore (deprecated in favor of the +syscall interface). + +%% + +\subsection{int irq\_set\_handler(irq\_t source, irq\_handler hnd)} + +Set a handler for the given interrupt. The definition of \dtname{irq\_handler} +may platform dependent, but is generally: + +\begin{lyxcode} +typedef void (*irq\_handler)(irq\_t source, irq\_context\_t * context); +\end{lyxcode} + +%% + +\subsection{int irq\_set\_global\_handler(irq\_handler hnd)} + +Set a global interrupt handler. This routine will receive all interrupts +and exceptions in favor of any individual handlers. Use with caution. + +%% + +\subsection{void irq\_set\_context(irq\_context\_t *regbank)} + +Change our ``IRQ context''. This should \textbf{never} be done +with interrupts enabled. Basically whenever an interrupt occurs, the +program context is saved into the current IRQ context. This is usually +part of the \dtname{kthread\_t} structure. When the interrupt handler returns, +the IRQ context is re-established and the program continues. You can +use this function to swap contexts in an interrupt handler (the thread +system does this). + +%% + +\subsection{irq\_context\_t * irq\_get\_context()} + +Return a pointer to the current IRQ context. Note that it's not valid +behavior to get this pointer and then use \constname{CURRENT\_xx()} from above +on it because the values aren't valid until an interrupt occurs. Thus +it is mainly used inside an interrupt handler to see who got interrupted. + +%% + +\subsection{void irq\_create\_context(irq\_context\_t * context, uint32 stack\_pointer, + uint32 routine, uint32 * args, int usermode)} + +Creates an \dtname{irq\_context\_t} from scratch. This is used mainly for creating +new threads. The new values will be written to \paramname{context}, which +must be pre-allocated. The initialo stack location will be \paramname{stack\_pointer}, +the initial PC will be \paramname{routine}, and \paramname{args} will be available +as arguments to the routine (though the number of arguments is platform +dependent). The \paramname{usermode} flag is a leftover from an earlier +adaptation of KOS and may be removed later, but if non-zero it essentially +tells us to create a context which will run with reduced privelges +and in a user-capable address space. + +%% + +\subsection{int irq\_disable()} + +Disable all IRQs and return the original IRQ state. + +%% + +\subsection{void irq\_enable()} + +Enable all IRQs. + +%% + +\subsection{void irq\_restore(int v)} + +Restore an old IRQ state from what was returned from \funcname{irq\_disable}. + +%%%%%%%%%%%%%%%%%% + +\section{Realtime Clock (RTC) Management} + +Most systems contain a realtime clock of some sort which keeps track +of the date and time in the outside world. This set of functions is +designed to access that. + +%%%%%%%%%%%%%%%%%% + +\section{Basic Memory Management} + +On most systems, you simply have a flat chunk of RAM available which +dlmalloc and other higher level pieces will manage. This very basic +low-level memory management simply tracks that and provides a standard +Unix(tm) style sbrk() function call. This effectively abstracts the +address space. + +Eventually we'll probably have functions for both getting and setting +the time, but for now there's just one to retrieve it. + +\subsection{time\_t rtc\_unix\_secs()} + +Returns the current day/time in *nix "seconds since 1970" format. + +%%%%%%%%%%%%%%%%%% + +\section{MMU Management} + +Most users of KOS will have no need of a memory management/mapping +unit, but in case you do, this set of functions should provide for +it. This is mostly abstracted as much as possible so as to not be +platform-dependent, but there are limitations. + +Nothing currently uses this and it probably doesn't even fully work, +so this part isn't filled in right now. See \dirname{mmu.h} under the arch +of your choice if you want more info. + +%%%%%%%%%%%%%%%%%% + +\section{Timer Management} + +Every platform should contain at least one available timer interrupt. +These functions manage that timer interrupt and any others that may +be available. + +The DC part is relevant enough here that I'm going to go ahead and +document it as well for this part. + +%% + +\subsection{Totally Portable Parts} + +\subsubsection{void timer\_ms\_gettime(uint32 * secs, uint32 * msecs)} + +Returns the number of seconds and milliseconds since the program was +started. This is for fine timing where the time of day doesn't really +matter. + +\subsubsection{int timer\_ints\_enabled(int which)} + +Returns non-zero if the requested timer is enabled. The value of +\paramname{which} is entirely platform dependent, but you can always +use the constant \constname{TIMER\_ID} to refer to the primary +timer that is used for threading and such. + +\subsubsection{void timer\_disable\_ints(int which)} + +Disables interrupts for the requested timer. + +\subsubsection{void timer\_enable\_ints(int which)} + +Enables interrupts for the requested timer. + +\subsubsection{void timer\_spin\_sleep(int ms)} + +Precise spin-loop sleep function. On the DC, this function does +not interfere in any way with threading or other timer usage because +it uses TMU1. On other platforms, this may be different. + +\subsubsection{void timer\_primary\_enable()} + +Enable the "primary" timer -- start it counting and enable any +associated interrupts. This is generally the timer used by +pre-emptive threading. + +\subsubsection{void timer\_primary\_disable()} + +Disable the "primary" timer. + +%% + +\subsection{DC Parts} + +The SH-4 contains four usable timers, and we support three. These are +\constname{TMU0}, \constname{TMU1}, and \constname{TMU2}. \constname{TMU0} +is the "primary" timer, \constname{TMU1} is used by \funcname{timer\_spin\_sleep}, +and the other is available for programmer usage. + +\subsubsection{int timer\_prime(int which, uint32 speed, int interrupts)} + +Pre-initialize a timer; setup the values but don't actually start it running. +Timer \paramname{which} will be set to expire in \paramname{speed} milliseconds, +and if \paramname{interrupts} is non-zero, interrupts will be enabled for it. + +\subsubsection{int timer\_start(int which)} + +Starts the requested timer actually running. + +\subsubsection{int timer\_stop(int which)} + +Stops the requested timer from running. + +\subsubsection{uint32 timer\_count(int which)} + +Returns the count value of the requested timer. + +\subsubsection{int timer\_clear(int which)} + +Clears the underflow bit of the requested timer and returns what +its count value was. + + +%%%%%%%%%%%%%%%%%% + +\section{Cache Coherency Management} + +Some processors have very good interal cache coherency, while some +processors (notably embedded RISC chips) force you to be more careful +about cache coherency. These functions are provided to ensure that +you can maintain that coherency when doing things like loading new +code into RAM. + +\subsection{void icache\_flush\_range(uint32 start, uint32 count)} + +Flush a range of instruction cache starting at the physical address +\paramname{start} and going for \paramname{count} bytes. The value +of \paramname{count} may be rounded up to the next closest possible +size. + +\subsection{void dcache\_inval\_range(uint32 start, uint32 count)} + +Invalidate a range of data/operand cache starting at the given +physical address and going for the given number of bytes. If the +processor is using write-back cache, then the contents of the +write-back cache will be \emph{lost}. + +\subsection{void dcache\_flush\_range(uint32 start, uint32 count)} + +Flush a range of data/operand cache starting at the given +physical address and going for the given number of bytes. If the +processor is using write-back cache, then the contents of the +cache will be written out to RAM before being invalidated. + +%%%%%%%%%%%%%%%%%% + +\section{Program Image Replacement} + +Kiosk/menu type programs (and others) often have the need to load +a new image in place of the running image. This isn't the same as +loading and executing a userland program, but instead replaces the +running KOS image with an entirely new image (which may or may not +be KOS based). This set of functions helps you with that task. + +\subsection{void arch\_exec\_at(const void * image, uint32 length, uint32 address)} + +Loads the program image located at \paramname{image} with a length +of \paramname{length} bytes to the physical address \paramname{address}, +and executes it. Note that \paramname{address} may overlap the existing +program, and this is just fine. If necessary, this function will build +a trampoline to copy and run the new image. + +This function will never return. + +\subsection{void arch\_exec(const void * image, uint32 length)} + +Same as \funcname{arch\_exec\_at}, but it loads the program at the +default program location for the platform before running it. + +This function will never return. + +%%%%%%%%%%%%%%%%%% + +\section{Syscall} + +There are times when you want to transition into a ``kernel mode'' +state as if an interrupt had occured, but you don't want to have to +wait for one. Most processors have a ``trap'' or ``int'' instruction +which will manually cause this processor state. These functions wrap +that functionality. + +\subsection{void syscall\_set\_return(irq\_context\_t * context, int value)} + +Sets the ``return value'' for \paramname{context} to \paramname{value}. +If a user performed a syscall, then the target routine might call this +function to set the value that the program will think it was returned. + +This generally just pokes a value into one of the registers in the context, +but it's platform dependent. + +\subsection{SET\_RETURN(thread, value)} + +Macro that sets a return value for the named thread. This is just a wrapper +for \funcname{syscall\_set\_return}. + +\subsection{SET\_MY\_RETURN(value)} + +Like \constname{SET\_RETURN}, but it sets the value on the ``current'' +thread, which would generally be the one who invoked the syscall target. + +\subsection{RETURN(value} + +Sets the return value on the current thread and then causes a thread +schedule. + +\subsection{SYSCALL(routine)} + +Use this macro to insert the platform-dependent code for invoking a syscall +at the given address. \paramname{routine} is generally a function pointer. + + +%%%%%%%%%%%%%%%%%% + +\section{Spinlocks} + +Spinlocks are a much lighter weight (though less efficient) way to +prevent contention between threads. In KOS they can also allow you +to prevent contention between interrupt handlers and normal user code +while still providing performance by allowing critical sections that +still allow interrupts to happen. + +The data type for a spinlock is \dtname{spinlock\_t}. This value can either +be initialized statically with \constname{SPINLOCK\_INITIALIZER}, or it +can be initialized programmatically with \funcname{spinlock\_init}. + +These are usually implemented as macros for speed. + +\subsection{void spinlock\_init(spinlock\_t * lock)} + +Initializes the given spinlock. It will be unlocked initially. + +\subsection{void spinlock\_lock(spinlock\_t * lock)} + +Attempts to lock the spinlock. If it is already locked then the function +will not return until the caller owns the lock. + +\subsection{void spinlock\_unlock(spinlock\_t * lock)} + +Unlocks the given spinlock, if it's locked. Note that any thread +can unlock any spinlock -- there is no lock ownership. + +\subsection{int spinlock\_is\_locked(spinlock\_t * lock)} + +Returns non-zero if the given lock is locked. This is helpful for, +e.g., allocating memory inside an interrupt. + +%%%%%%%%%%%%%%%%%% + +\section{PI API for Sound} + +The output of streaming sound and sound effects is one of the basic +pieces that you will want for any demo/game program you write, and +basically every target platform of KOS will have some method of doing +that. This set of functions helps you interact with that hardware +without necessarily knowing how it works underneath. Note that initializing +and using this API will usually prevent lower-level access (or will +contend with it in bad ways), though this is usually reversable by +shutting it down. + +Note that although this API is designed to be platform independent +eventually, it is currently only implemented on the DC and its +headers are located with the DC headers. This may change in the +future, though, and if you include \dirname{kos.h} then you +shouldn't have troubles. + +\subsection{int snd\_mem\_init(uint32 reserve)} + +Setup the sound allocation system. Generally allocates a buffer for +sound usage and reserves \paramname{reserve} bytes at the front for +system overhead. The value for \paramname{reserve} should never +be zero because this would allow for valid sound mem handles to +indicate an error condition in \funcname{snd\_mem\_malloc}. + +\subsection{void snd\_mem\_shutdown()} + +Shut down the sound allocation system, and free any structures +related to it. + +\subsection{uint32 snd\_mem\_malloc(size\_t size)} + +Allocate a chunk of sound RAM and return a handle to it. This will generally +be an offset into a pre-allocated sound buffer (or in the case of the DC, +the SPU RAM). A zero return value signifies failure. + +\subsection{void snd\_mem\_free(uint32 addr)} + +Frees a previously allocated chunk of sound RAM. + +\subsection{uint32 snd\_mem\_available()} + +Returns the largest chunk of sound RAM available. + +\subsection{int snd\_init()} + +Initialize the overall sound system. This is generally preferred to calling +\funcname{snd\_mem\_init} directly. + +\subsection{void snd\_shutdown()} + +Shut down the overall sound system. This is generally preferred to calling +\funcname{snd\_mem\_shutdown} directly. + +\subsection{int snd\_sfx\_load(const char * fn)} + +Load the sound sample located on the VFS at \paramname{fn}. Currently this +function only knows about RIFF WAV files, but this may change later. Returns +a handle to the loaded effect. + +\subsection{void snd\_sfx\_unload(int idx)} + +Unload a single loaded sample. Call with the handle you got back above. + +\subsection{void snd\_sfx\_unload\_all()} + +Unload all samples loaded with \funcname{snd\_sfx\_load}. This function +is deprecated in favor of freeing individual samples. + +\subsection{void snd\_sfx\_play(int idx, int vol, int pan)} + +Play the given sound effect at volume \paramname{vol} (0-255) and with +panning \paramname{pan} (0 - 255, 128 is center). + +\subsection{int snd\_stream\_init(void* (* callback)(int, int *))} + +Setup the sound system for streaming sound data. \paramname{callback} will be +called whenever the system needs more data for output (see below for more +info about the callback). + +This function calls \funcname{snd\_init} implicitly, so there is no need +to call it beforehand. + +\subsection{void snd\_stream\_shutdown()} + +Shuts down the sound streaming system. + +This function calls \funcname{snd\_shutdown} implicitly, so there is no need +to call it afterwards. + +\subsection{void snd\_stream\_set\_callback(void *(*func)(int req, int *ret))} + +Sets the callback function for the streaming mechanism. When we are running low on +data in the circular output buffers, \paramname{func} will be called. It will +receive a request for the number of samples we'd like to get. The function +should return a pointer to where those samples are located and return +via \paramname{ret} how many we actually got back. If +the return value is NULL, then the stream is considered finished. + +\subsection{void snd\_stream\_queue\_enable()} + +Enable sound stream queueing. This allows you to very finely tune when the +playback will start in relation to other events in your program (for example, +if you need music exactly timed to the graphics). + +\subsection{void snd\_stream\_queue\_disable()} + +Disable queueing. + +\subsection{void snd\_stream\_queue\_go()} + +If queueing is enabled, calling this function will make it actually start +playing instantly. + +\subsection{void snd\_stream\_start(uint32 freq, int st)} + +Start stream playback with the given frequency. If \paramname{st} is +non-zero, then we are playing a stereo stream. If queueing is enabled, +then the stream will not actually start but will just fill its buffers +and get ready. + +\subsection{void snd\_stream\_stop()} + +Stops any playing stream. + +\subsection{int snd\_stream\_poll()} + +Polls the stream driver to see if we need more data. This may not be +required on all platforms; on the DC it is currently required. + +If the return value is -1, then there was an internal error (including +a \constname{NULL} callback. If -3, then the stream has ended. If zero, +then everything is hunky dory. + +\subsection{void snd\_stream\_volume(int vol)} + +Set the volume of the streaming output (0-255). + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\chapter{Hardware Abstraction Layer: DC Parts; OUT OF DATE} + +\textbf{\emph{UNCONVERTED FROM LIBDREAM}} + + +\section{Basic Video (video.c)} + +The basic video subsystem of libdream is designed to facilitate frame +buffer setup and access. It does not handle 3D acceleration, that +is handled in the ``TA'' module. The basic usage of the video +system is to call vid\_init with the desired parameters, and then +use one of the ``vram'' pointers to access video memory. + +The following variables and functions are available in basic video: + + +\subsection{uint32 *vram\_l} + +Pointer to video memory (0xa5000000) as a 32-bit unsigned integer +array. Use this to access video memory when in RGB888 mode, or when +copying large regions (not recommended =). + + +\subsection{uint32 *vram\_s} + +Similar to vram\_l, but accesses as a 16-bit unsigned integer array. +Use this to access video memory when in RGB555 or RGB565 mode. + + +\subsection{int vram\_config} + +Stores the first parameter to vid\_init, which is the pixel format. + + +\subsection{int vram\_size} + +Stores the total size (in pixels) of one page of video frame buffer. + + +\subsection{int vid\_cable\_type} + +Stores the cable\_type parameter to the video init function below. + + +\subsection{int vid\_check\_cable()} + +Checks and returns the attached video cable type; the three constants +matching the return values are CT\_VGA, CT\_RGB, and CT\_COMPOSITE. + + +\subsection{int vid\_init(int cable\_type, int disp\_mode, int pixel\_mode)} + +Does full frame buffer initialization with the requested cable type, +display mode, and pixel mode. You should pass the return value from +vid\_check\_cable() as the first parameter. dc\_setup() does this +for you. disp\_mode constants are DM\_320x240, DM\_640x480 and DM\_800x608. +pixel\_mode constants are PM\_RGB555, PM\_RGB565, and PM\_RGB888. + + +\subsection{void vid\_set\_start(uint32 start)} + +Set the ``start address'' register, which governs where in the +frame buffer the output picture comes from. This can be used for ``double +buffering'', but it will most commonly be used during 3D acceleration. + + +\subsection{void vid\_border\_color(int r, int g, int b)} + +Set the border color. The border is the area outside the standard +viewing area. On NTSC this is mostly above and below the picture. +I'm not sure what it is on PAL. Generally unless you're doing some +odd debugging you'll want to set this to black (vid\_init does this +for you). + + +\subsection{void vid\_clear(int r, int g, int b)} + +Clears the first page of frame buffer based on the current video mode, +with the given color. This is most useful when using frame buffer +access, not 3D access. + + +\subsection{void vid\_empty()} + +Clear the entirety of video memory using zeros. This is done using +longwords so it's fairly quick. Once again, mainly used with 3D setup. + + +\subsection{void vid\_waitvbl()} + +Wait for a vertical blank period. Vertical blank is the period between +the time that the scan beam reaches the bottom of the screen and the +time that it reaches the top and starts drawing again. This is relevant +because this is the best time to draw to the frame buffer without +causing ``tearing'' or other artifacts. It's also generally when +you want to switch start addresses. + + +\section{BIOS Fonts (biosfont.c)} + +BIOS fonts are the ones you see in the boot manager on the Dreamcast. +These are stored in ROM and so are available to any program. You will +probably recognize them immidiately since they are used all over the +place in official productions. The BIOS font contains European Latin-1 +characters (which we support) and Kanji (which we don't support yet +but will eventually). The Latin-1 characters are bit masks of size +12x24, so each character uses 36 bytes. I suspect that the Kanji characters +are 24x24, but I haven't tested this yet. These functions are frame-buffer +agnostic except that they expect a 16-bit pixel size. + +The following functions are available: + + +\subsection{void* bfont\_find\_char(int ch)} + +Returns the address in ROM of the given character, after being mapped +to the BIOS font. + + +\subsection{void bfont\_draw(uint16 *buffer, int bufwidth, int c)} + +Draws Latin-1 character 'c' at the given location in 'buffer', and +assumes that 'buffer' is 'bufwidth' pixels wide. For example, to draw +an 'a' at 20,20 in a 640x480 framebuffer, you'd use bfont\_draw(vram\_s+20*640+20, +640, 'a'). + + +\subsection{void bfont\_draw\_str(uint16 *buffer, int bufwidth, char *str)} + +Exactly like bfont\_draw, but it takes a string and draws each character +in turn. + + +\section{PC Fonts (font.c)} + +The PC font system handles bitmapped fonts that are 8 pixels wide, +and any number of pixels tall. The module is being deprecated in favor +of the BIOS font module, so I won't describe it here. If you want +more information, please reference font.c itself. + + +\section{Sound Processor Unit (spu.c)} + +The sound processor unit (as mentioned in the README) is a Yamaha(tm) +AICA sound system. To use the processor you will need to write a seperate +program that runs on the ARM7 RISC core and uses the AICA's own registers. +This isn't covered in this document (or anywhere, to my knowledge). +For some decent examples, though, take a look at ``s3mplay'' on +the Cryptic Allusion DCDev site (see README). + +The following defines and functions are available to assist in using +the sound processor: + + +\subsection{SMP\_BASE} + +All samples loaded to the AICA should proceed from this location relative +to sound RAM (which maps to 0xa0810000 in the SH-4). This is mainly +used in the S3M player but it's a good guideline to follow in general +since it gives you 64k of space for the sound program (which is generally +plenty). + + +\subsection{void snd\_ram\_write\_wait()} + +The AICA's RAM is attached to the chip itself rather than the SH-4, +and so access proceeds through an ASIC. You must call this function +every 8 long-words of written sound memory so that the ASIC's FIFO +can catch up. If you don't, the data won't be written accurately. + + +\subsection{void snd\_load\_arm(void *src, int size)} + +Loads an ARM7 program and starts it executing. The program will be +loaded at offset 0, so it needs to begin with reset/exception vectors. + + +\subsection{void snd\_stop\_arm()} + +Stops execution in the ARM7, and disables all AICA synthesizer channels. +This insures that whatever was going on in the SPU is stopped completely. + + +\subsection{void snd\_init()} + +Initialize the SPU: disable the ARM7 and clear sound memory. + + +\subsection{void snd\_load(void *src, int dest, int len)} + +Load miscellaneous data into the SPU's RAM. 'src' is where to load +from, and 'dest' is relative to the SPU based (so you could pass, +e.g., SMP\_BASE here). 'len' is in bytes but will be rounded up to +long-words. + + +\section{CD-Rom Access (cdfs.c)} + +Libdream provides the capability to use CD and CDR discs in the GD-Rom +drive using this module. + +Note that this file has been specifically crippled (or rather, we +just never wrote it in) so that it can't access Sega's GD discs. This +means that you can't access the data on any commercial game. There +are really only a few legitimate reasons for doing this so we've disabled +the feature to avoid coming under fire for assisting with copyright +infringement. If you really want to know how, I'm sure you can figure +it out =). + +The following functions are available: + + +\subsection{uint32 iso\_open(const char *path, int oflag)} + +Open a file on the CD, using absolute path ``path'', with open +flags ``oflag''. Note that in the current system, ``path'' +must use forward slashes for path seperators (but can mix upper and +lower case freely with no troubles), and ``oflag'' must be O\_RDONLY +or (O\_RDONLY | O\_DIR). A file descriptor will be returned, or a +zero on error. + + +\subsection{void iso\_close(uint32 fd)} + +Close the file referenced by the given file descriptor. + + +\subsection{int iso\_read(uint32 fd, void *buf, int count)} + +Read ``nbyte'' bytes from the file referenced by ``fd'', into +buffer ``buf''. Note that this function will always read the surrounding +2048 byte sector before extracting the parts you want, so you should +never read less than 2048 bytes unless that's all you want. Reading +more than 2048 does work. The number of bytes read will be returned. + + +\subsection{long iso\_lseek(uint32 fd, long offset, int whence)} + +Seek in file ``fd'' by ``offset'' bytes, relative to ``whence''. +``whence'' is one of the standard STDIO constants: SEEK\_SET, +SEEK\_CUR, SEEK\_END. ``offset'' may be positive or negative depending +on the usage. The new file location will be returned. + + +\subsection{long iso\_tell(uint32 fd)} + +Returns the current file pointer within ``fd''. + + +\subsection{dirent\_t *iso\_readdir(uint32 dirfd)} + +Read the next entry (if any) from the opened directory. Returns a +pointer to a dirent\_t on success (see fs\_iso9660.h for more info +on dirent\_t) or \constname{NULL} if nothing is left. + + +\subsection{int cdrom\_init() int iso\_init()} + +Initialize the GD-Rom drive for reading CD/CDR media, and initialize +the file system driver. + + +\section{Timer Counters (timer.c)} + +This module supports the SH-4's internal timer perhipherals. Support +is provided for TMU0 through TMU2. WDT (watchdog) is defined but not +supported yet. TMU0 through TMU2 may all be used independently and +count at different rates. + +The following defines and functions are available: + + +\subsection{TMU0, TMU1, TMU2, WDT} + +These are constants used to identify which timer you wish to operate +on. + + +\subsection{int timer\_prime(int which, uint32 speed)} + +Primes a timer, but does not start it. ``which'' is one of the +timer constants, and ``speed'' is a times per second rate which +the counter will bottom out. So if you set speed to ``1'', then +the timer will hit bottom after one second, and start counting again. +Returns 0 for success. + + +\subsection{int timer\_start(int which)} + +Starts the requested timer counting (after priming it). + + +\subsection{int timer\_stop(int which)} + +Stops the requested timer. + + +\subsection{uint32 timer\_count(int which)} + +Returns the current timer count. The only way you can really make +use of this externally is to get the timer count after priming but +before starting, and scale the real-time results. + + +\subsection{int timer\_clear(int which)} + +Clears the timer underflow bit and returns what its value was. Underflow +is set when the timer counts down. So for example, you could start +a timer on a 1HZ cycle and poll this function until it returns true. +At that point you'd have waited for a second, and the timer is already +counting down again. + + +\subsection{void timer\_sleep(int ms)} + +Uses TMU0 to sleep for the given number of milliseconds. + + +\subsection{int timer\_init()} + +Setup timers (enable and stop all). + + +\section{Maple Access (maple.c)} + +Libdream 0.7 includes Jordan DeLong's rewritten maple access code. +This is a lot more modular and it is setup for future expansion with +queueing multiple frames and DMA completion interrupts. For now it +basically does the same as Marcus' old maple routines but with cleaner +code. + +In general using the maple bus consists of finding your peripheral +(using DEVINFO queries), and storing this address; when you want to +use the peripheral, you send it a condition query message and get +a frame back describing the state of the peripheral. Most of the exported +functions in maple.c won't be useful to mere mortals =) but that's +a good thing since there are specific support modules for each of +the major peripherals we have had access to. + +The following functions are available: + + +\subsection{void maple\_init(int quiet)} + +Initialize the maple bus; if ``quiet'' is non-zero, then the bus +scan will not produce any output. + + +\subsection{void maple\_shutdown()} + +Shut down all maple bus operations. + + +\subsection{uint8 maple\_create\_addr(uint8 port, uint8 unit)} + +Create a maple address for the given port and unit. + + +\subsection{int maple\_docmd\_block(...)} + +Parameters omitted for topic brevity: int8 cmd, uint8 addr, uint8 +datalen, void *data, maple\_frame\_t retframe. This is the main +``work horse'' of the maple system. ``cmd'' should be one +of the maple command constants in maple.h; ``addr'' should be +created with maple\_create\_addr (or one of the maple\_*\_addr functions +below); ``datalen'' is the length of the extra data (beyond what's +in the frame header), ``data'' is a pointer to extra data (if +any) that goes after the frame header; and ``retframe'' is a maple\_frame\_t +that you should pass in to be filled in with return data. Zero is +returned on success, and -1 returned on error. For some examples of +using docmd\_block directly, please check one of the maple peripheral +modules. + + +\subsection{int maple\_rescan\_bus(int quiet)} + +Rescans the maple bus. This will be neccessary if the user swaps out +any controllers or memory cards. It also determines what is where +and stores that info for later usage. If ``quiet'' is non-zero, +it produces no output. + + +\subsection{uint8 maple\_device\_addr(int code)} + +Pass a maple function code, and it returns the address of the first +one that matches it. + + +\subsection{uint8 maple\_*\_addr()} + +These include controller, mouse, kb, lcd, and vmu currently. Each +one searches the maple bus to find the first matching type of peripheral +and returns an address. + + +\section{Maple Peripheral Support Modules} + +Support modules are included for standard controllers, keyboards, +VMUs, and mice. Most peripherals fit into these molds. Eventually +we'll probably add support for more things like the purupuru pack +(force feedback) but we don't have one yet, so we can't. =) Notable +among this list is the mouse since it just came out. Wow your friends +by writing software that uses it before Sega gets a chance! =) + +Since these are mostly the same (except for names and structure values) +I won't go over them in detail. Each module generally contains a poll +function that checks the state of the peripheral and fills in a device-specific +structure. See the header files for the specific structure information. +I'll list out the poll functions here for convienence though. + + +\subsection{int cont\_get\_cond(uint8 addr, cont\_cond\_t *cond)} + +Check controller status. Returns which buttons are pressed and the +state of the various analog controls. + + +\subsection{int kbd\_get\_cond(uint8 addr, kbd\_cond\_t *cond)} + +Check keyboard status. Returns up to six keys being pressed at once. +There are other support functions for the keyboard that you should +look up in keyboard.h if you want to use it seriously. These do queueing +and buffering for you. If you want this functionality, you should +use kbd\_poll(uint8 addr) and then kbd\_get\_key() to get key presses. + + +\subsection{int vmu\_draw\_lcd(uint8 addr, void *bitmap)} + +Draws the given bitmap to the LCD screen. Generally these are on VMUs +(which is why it's part of vmu.c) but it's not required. The bitmap +should be a 48x32 bit array. The picture will show up right side up +on the VMU itself, so when it's inserted in a controller you'll need +to flip it in each direction. + + +\subsection{int vmu\_block\_read(uint8 addr, uint16 blocknum, uint8 *buffer)} + +Read the requested block of the VMU's flash ram and put it in ``buffer''. + + +\subsection{int vmu\_block\_write(uint8 addr, uint16 blocknum, uint8 *buffer)} + +Take what's in ``buffer'' and write it to the requested block +of the VMU's flash ram. + + +\subsection{int mouse\_get\_cond(uint8 addr, mouse\_cond\_t *cond)} + +Gets the condition of the mouse peripheral specified. Returns button +states and delta x, y, and z (roller). + + +\section{Tile Accelerator (ta.c)} + +The Tile Accelerator (3D acceleration) really deserves its own book, +but for completeness (and my hands are getting tired =) I'm just going +to go over the basics of setting it up and the functions you use to +do so. For more specific information, look around on the web for various +documents describing the TA, and look in the examples. Hopefully this +section can be more fleshed out in future versions. + +The TA is exactly what it says: the screen in the PVR 3D chip is broken +up into 32x32 pixel tiles. So in 640x480, you'd really have a 20x15 +tile field, not a 640x480 pixel field. The PVR's 3D magic happens +by taking each of these tiles along with a ``display list'' describing +what is to be displayed on the screen, and doing internal z-buffering. +This means that each polygon is drawn only once, so even though there +is not a standard z-buffer present, the end result looks like there +is one. Opaque polygons, opaque volume modifiers (fog, etc), translucent +polygons, translucent modifiers, and punch-through polygons (which +can ``cut'' pieces of other polygons out, I think) must be sent +to the TA, in that order. Each list is rendered in that order as well, +for each tile, and so the more lists you send, the slower the rendering +process gets. Opaque polygons are the fastest obviously, followed +by punch-throughs, translucent polygons, and then the volume modifiers. + +Because of the tile system, there is no user clipping neccessary: +the TA works backwards by intersecting polygons and volumes with each +tile before rendering. The end result of all of this is that all you +have to do as a user is cull out the completely useless polygons (if +you feel like it), arrange things in polygon ``strips'' as much +as possible, and then throw the various lists to the TA. Then sit +back and wait for it to do its work. + +The PVR chip is not magic: it is powerful and can accelerate the drawing +process to an amazing degree, but it still draws in terms of screen +coordinates. So it is really a fancy 2D accelerator with perspective +correction support for textures, and z-buffering. + +Coordinates in the PVR start at 0,0 (all coordinates are floating +point numbers) and go to 640,480, in the normal mode. Any coordinates +outside this will work but will be clipped. Z coordinates start at +0 and move out of the screen towards the viewer. As far as I can tell, +in normal mode, it wants Z and not 1/Z (W). I may be wrong of course. +I'm no 3D hardware expert. + +All that being said, the basic operation goes something like this: + +\begin{enumerate} +\item Setup the TA (ta\_init); initialize the background plane structure +\item Load any textures you may want to use +\item For each frame: +\end{enumerate} +\begin{itemize} +\item Call ta\_begin\_render to initialize the rendering process. +\item Construct and send one or more polygon headers for opaque polygons, +each followed by zero or more verteces; each vertex strip must end +with an ``end of list'' marker. +\item Call ta\_commit\_eol to finish the opaque list. +\item Construct and send one or more polygon headers for translucent polygons +(same process as above). +\item Call ta\_commit\_eol to finish the translucent list. +\item Call ta\_finish\_frame to finish the rendering process and wait for +a vertical blank to flip pages. +\end{itemize} +Here are the structures and functions needed to do these things: + + +\subsection{struct pv\_str ta\_page\_values{[}2{]}} + +Holds all the internal rendering data for the page flipper and renderer. +This is useful mainly if you want to do something like take a screen +shot (you can find the current frame buffer). + + +\subsection{bkg\_poly ta\_bkg} + +The background plane polygon. The background plane is currently automatically +a 640x480, three-point opaque polygon. I'm not even sure if you can +change this. For the values to load into this, take a look at one +of the 3D example programs. If you want to do color shifting you can +change this on the fly. + + +\subsection{poly\_hdr\_t} + +A polygon header; this is always four flag long-words and four dummy +words. The four dummy words are actually used with different types +of shading and volume modifiers, but these are not supported yet in +libdream. You should fill this structure directly (if you know what +you're doing) or use ta\_build\_poly\_hdr. + + +\subsection{vertex\_oc\_t} + +Represents a single opaque/colored vertex with floating point coordinates +and ARGB values. Actually it works fine for translucent polygons also +but the naming convention stuck. + + +\subsection{vertex\_ot\_t} + +Represents a single opaque/textured vertex with floating point coordinates +and ARGB values. Actually it works fine for translucent polygons also. + + +\subsection{int ta\_curpage} + +The current working page (out of ta\_page\_values above). + + +\subsection{void ta\_init()} + +Initializes the TA and prepares for page flipped 3D. + + +\subsection{void ta\_send\_queue(void *sql, int size)} + +Sends one (or two) store queue(s) full of data to the TA. + + +\subsection{void ta\_begin\_render()} + +Call before you start drawing a frame. + + +\subsection{void ta\_commit\_poly\_hdr(poly\_hdr\_t *polyhdr)} + +Sends one polygon header to the TA. This needs to be done when you +want to change drawing modes; e.g., opaque color, opaque textured, +translucent color, translucent textured. + + +\subsection{void ta\_commit\_vertex(void *vertex, int size)} + +Sends one vertex to the TA; this can be a vertex\_oc\_t or vertex\_ot\_t. +Pass along the result of sizeof() on the vertex. + + +\subsection{void ta\_commit\_eol()} + +Sends the ``end of list'' marker to the TA. This ought to be used +after all opaque polygons are sent, and again after all translucent +polygons are sent. + + +\subsection{void ta\_finish\_frame()} + +Call after you've finished sending all data. This completes the rendering +process in the alternate screen buffer and then waits for a vertical +blank to switch to the new page. + + +\subsection{void ta\_build\_poly\_hdr(poly\_hdr\_t *target, ...)} + +Parameters omitted for brevity: int translucent, int textureformat, +int tw, int th, uint32 textureaddr, int filtering. This builds a polygon +header for you so you don't have to diddle with bitfields. Translucent +should be one of TA\_OPAQUE or TA\_TRANSLUCENT. Textureformat needs +to be one of the texture format constants or TA\_NO\_TEXTURE. This +includes whether it's twiddled or not (for info on twiddled textures, +look for the PVR E3 presentation online). The rest of the parameters +are only relevant if textureformat is not TA\_NO\_TEXTURE. tw and +th are the texture width and height, and must be powers of two between +8 and 1024. Textureaddr is the address within the PVR RAM that you +loaded the texture, and it must be aligned on an 8-byte boundary. +Filtering should be TA\_NO\_FILTER or TA\_BILINEAR\_FILTER. Note that +bi-linear filtering is a fairly expensive operation unless you store +your textures in the PVR RAM in twiddled format, in which case it's +free. + + +\subsection{void ta\_load\_texture(uint32 dest, void *src, int size)} + +Loads a texture into PVR ram at the given offset. ``size'' must +be a multiple of 4 and will be rounded up if it's not already. A seperate +function is required because the PVR requires you to send all texture +data to 0xa4000000, not 0xa5000000. This must also be done after ta\_init. + + +\subsection{void *ta\_texture\_map(uint32 loc)} + +Maps a given PVR offset to a texture space. You should use this if +you want to write directly into texture ram. Once again, it must be +done after ta\_init. + + +\chapter{DC Add-On Libraries} + + +\section{libconio -- console} + + +\section{libdcplib -- fonts for PVR} + + +\section{libdcutils -- misc utility functions} + + +\section{libimageload -- image loader / ditherer} + + +\section{libjpeg (KOS specific parts)} + + +\section{libmodplug (KOS specific parts)} + + +\section{libmp3 -- mp3 playback lib} + + +\section{liboggvorbisplay -- ogg playback lib} + + +\section{libpcx -- PCX loader} + + +\section{libpng (KOS specific parts)} + + +\section{libtga -- TGA loader} + + +\section{lua (KOS specific parts)} + + +\section{lwip (KOS specific parts)} + + +%% \chapter{Index} +%%\printindex{} + +\chapter{About this document} +This document was originally written in a stock LyX 1.1.6fix4 distribution, +and has since been converted to raw LaTeX2e. + +\end{document} diff --git a/CPU/SDKS/kos-1.1.8/doc/manual/kos_html.zip b/CPU/SDKS/kos-1.1.8/doc/manual/kos_html.zip new file mode 100644 index 00000000..acd8accc Binary files /dev/null and b/CPU/SDKS/kos-1.1.8/doc/manual/kos_html.zip differ diff --git a/G2BUS/SCHS/BITMASTER/1.php b/G2BUS/SCHS/BITMASTER/1.php new file mode 100644 index 00000000..6424a07b --- /dev/null +++ b/G2BUS/SCHS/BITMASTER/1.php @@ -0,0 +1,26 @@ + + + + + because ISA (and PCI) are big components I use now a PCMCIA +Ethernet Card + + + + +

dc-ethernet.jpg

+

+

+
+

+

because ISA (and PCI) are big components I use now a PCMCIA Ethernet +Card

+

pcmcia.jpg

+ + diff --git a/G2BUS/SCHS/BITMASTER/2.php b/G2BUS/SCHS/BITMASTER/2.php new file mode 100644 index 00000000..f965687a --- /dev/null +++ b/G2BUS/SCHS/BITMASTER/2.php @@ -0,0 +1,25 @@ + + + + + DC IDE-HD Interface + + + + +

DC IDE-HD Interface

+

This is the first try of developing an IDE-HD Interface (and perhaps +an ISA-Slot
+for Ethernet Card)

+

circuit +diagram (Warning, this is a prerelease !!)
+Kiyoshi +IKEHARA has built the interface and released a driver for NetBSD

+

dc-ide.gif

+ + diff --git a/G2BUS/SCHS/BITMASTER/3.php b/G2BUS/SCHS/BITMASTER/3.php new file mode 100644 index 00000000..87952ed2 --- /dev/null +++ b/G2BUS/SCHS/BITMASTER/3.php @@ -0,0 +1,25 @@ + + + + + Untitled + + + + +

The DC Boot ROM Replacement

+

You can replace the original ROM with a pin compatible Flash-ROM:

+

+

At the moment, this ROM contains a little loader (through the serial +port) and a very simple hexdump:

+

+

I'am working on an improvement....................

+

 

+ + diff --git a/G2BUS/SCHS/BITMASTER/4.php b/G2BUS/SCHS/BITMASTER/4.php new file mode 100644 index 00000000..ab8da785 --- /dev/null +++ b/G2BUS/SCHS/BITMASTER/4.php @@ -0,0 +1,22 @@ + + +Dreamcast Memory Layout + + + + +

Memory Layout:

+

0x8c000000     16 Mbytes RAM +
0x8d000000

+

0xa0000000     2 Mbyte Boot ROM +
0xa0200000     256 kByte Flash ROM +
0xa0400000

+

0xa05f8000     Hardware Register (Video)

+

0xa0700000     SPU Register +
0xa0800000     2 Mbyte Sound RAM +
0xa0a00000

+

0xa1000000     Parallel Port +
0xa2000000     CD-ROM Port

+

0xa5000000     8 Mbytes Video RAM +
0xa5800000

+

(c) by bITmASTER
 

diff --git a/G2BUS/SCHS/BITMASTER/5.php b/G2BUS/SCHS/BITMASTER/5.php new file mode 100644 index 00000000..a1438708 --- /dev/null +++ b/G2BUS/SCHS/BITMASTER/5.php @@ -0,0 +1,21 @@ + + + + + Dreamcast Hardware Reset + + + + + +

Hardware Reset:

+

+

connect a key to GND and the /RESET-Pad.

+

(c) by bITmASTER

+ + diff --git a/G2BUS/SCHS/BITMASTER/6.php b/G2BUS/SCHS/BITMASTER/6.php new file mode 100644 index 00000000..029fc584 --- /dev/null +++ b/G2BUS/SCHS/BITMASTER/6.php @@ -0,0 +1,27 @@ + + +Dreamcast Serial Port + + + + +

DC serial port:

+

back-side:

+

-------------------------------------------------------------- +
|                                                            +| +
|                                 +video          +serial      | +
|                              +|          |    +|       |     | +
|                                             +B1       B10   | +
|                                                            +| +
-------------------------------------------------------------- +
 

+

b1  +5V
b2
b3  GND
b4  RX2
b5  TX2 +
b6  RTS
b7  CTS
b8
b9
b10  +3,3V

+

(c) by bITmASTER
 

diff --git a/G2BUS/SCHS/BITMASTER/7.php b/G2BUS/SCHS/BITMASTER/7.php new file mode 100644 index 00000000..ab6e0dca --- /dev/null +++ b/G2BUS/SCHS/BITMASTER/7.php @@ -0,0 +1,24 @@ + + +Dreamcast Parallel Port + + + + +

Dreamcast Parallel Port:

+

Addr: 0xb4000000 -> Area5
 

+

 1  5V
 2  5V +
 3  5V
 4  5V
 5  ?
 6  +?
 7  ?
 8  ?
 9  ?
10  GND +
11  GND
12  GND
13  ?
14  /CE? /RD-/FRAME? +
15  /RDY
16  /CS?
17  3,3V
18  3,3V +
19  3,3V
20  ?
21  /BS  ; /AEN
22  ? +
23  GND
24  GND
25  AD15
26  AD14 +
27  AD13
28  AD12
29  AD11
30  AD10 +
31  AD9
32  AD8
33  AD7
34  AD6
35  +AD5
36  AD4
37  AD3
38  AD2
39  AD1 +
40  D0
41  AGND ?
42  AGND ?
43  CLK +
44  GND
45  GND
46  ?
47  GND
48  +GND
49  ?
50  free ?

+

(c) by bITmASTER
 

diff --git a/G2BUS/SCHS/BITMASTER/8.php b/G2BUS/SCHS/BITMASTER/8.php new file mode 100644 index 00000000..77aec499 --- /dev/null +++ b/G2BUS/SCHS/BITMASTER/8.php @@ -0,0 +1,60 @@ + + +Dreamcast CD ROM Port + + + + +

Dreamcast CD-ROM-Port
Addr: 0xa2000000
 

+

A1  +3,5V                        +B1  3,5V
A2  +3,5V                        +B2  GND
A3  +5V                          +B3  5V
A4  +D7                          +B4   D6
A5  +A0                          +B5   A1
A6  +D5                          +B6   D4
A7  +A2                          +B7   A3
A8  +GND                         +B8
A9  +D3                          +B9   D2
A10 +A4                          +B10  A5
A11 +D1                          +B11  D0
A12 +A6                          +B12  A7 +
A13                             +B13 +
A14                             +B14  /WR
A15 +/RD                         +B15 +
A16                             +B16
A17 +5V                          +B17
A18 +GND                         +B18 +
A19                             +B19 +
A20                             +B20 +
A21                             +B21 +
A22                             +B22 +
A23                             +B23
A24 +GND                         +B24
A25 +12V                         +B25

+

(c) by bITmASTER

diff --git a/G2BUS/SCHS/BITMASTER/boot-screen.gif b/G2BUS/SCHS/BITMASTER/boot-screen.gif new file mode 100644 index 00000000..3fa81ed6 Binary files /dev/null and b/G2BUS/SCHS/BITMASTER/boot-screen.gif differ diff --git a/G2BUS/SCHS/BITMASTER/dc-ethernet.jpg b/G2BUS/SCHS/BITMASTER/dc-ethernet.jpg new file mode 100644 index 00000000..f353a807 Binary files /dev/null and b/G2BUS/SCHS/BITMASTER/dc-ethernet.jpg differ diff --git a/G2BUS/SCHS/BITMASTER/dc-flash-rom.gif b/G2BUS/SCHS/BITMASTER/dc-flash-rom.gif new file mode 100644 index 00000000..15dd484c Binary files /dev/null and b/G2BUS/SCHS/BITMASTER/dc-flash-rom.gif differ diff --git a/G2BUS/SCHS/BITMASTER/dc-ide.gif b/G2BUS/SCHS/BITMASTER/dc-ide.gif new file mode 100644 index 00000000..2f86af05 Binary files /dev/null and b/G2BUS/SCHS/BITMASTER/dc-ide.gif differ diff --git a/G2BUS/SCHS/BITMASTER/dc-ide.pdf b/G2BUS/SCHS/BITMASTER/dc-ide.pdf new file mode 100644 index 00000000..3028ee09 Binary files /dev/null and b/G2BUS/SCHS/BITMASTER/dc-ide.pdf differ diff --git a/G2BUS/SCHS/BITMASTER/dc-reset.gif b/G2BUS/SCHS/BITMASTER/dc-reset.gif new file mode 100644 index 00000000..ebd5d3d1 Binary files /dev/null and b/G2BUS/SCHS/BITMASTER/dc-reset.gif differ diff --git a/G2BUS/SCHS/BITMASTER/dc-video.ps b/G2BUS/SCHS/BITMASTER/dc-video.ps new file mode 100644 index 00000000..8f3e94ce Binary files /dev/null and b/G2BUS/SCHS/BITMASTER/dc-video.ps differ diff --git a/G2BUS/SCHS/BITMASTER/indexold.php b/G2BUS/SCHS/BITMASTER/indexold.php new file mode 100644 index 00000000..bc2d8dd4 --- /dev/null +++ b/G2BUS/SCHS/BITMASTER/indexold.php @@ -0,0 +1,47 @@ + + + + + bITmASTER´s dCdeV + + + + + +

 

+

 DREAMCAST DEVELOPMENT PAGE
+(miroir, merci à Diwee)
+

+

maintained by bITmASTER
+last update: 07/06/2001
+

+

SPU +DMA
+first +ethernet +tries (new, now as PCMCIA)
+DC +IDE-HD Interface
+DC +Boot ROM +Replacement
+DC +Video Register +
+Memory +Layout
+Hardware +Reset
+Serial +Port
+Parallel +Port +
+CD +ROM Port

+

 

+ + diff --git a/G2BUS/SCHS/BITMASTER/main2.c b/G2BUS/SCHS/BITMASTER/main2.c new file mode 100644 index 00000000..a510061d --- /dev/null +++ b/G2BUS/SCHS/BITMASTER/main2.c @@ -0,0 +1,118 @@ +#include "terminal.h" +#include "sio.h" + + +// SPU DMA +// by bITmASTER (bITmASTER@bigfoot.com) + +void printf (char *fmt, ...); + +char buffer[1024] __attribute__ ((aligned(32))); + + +typedef unsigned int UINT; + + +typedef struct { + UINT ext_addr; // external address (SPU-RAM or parallel port) + UINT cpu_addr; // CPU address + UINT size; // size in bytes, all addr & size must be mod 32 !!! + UINT dir; // 0: cpu->ext, 1: ext->cpu + UINT mode; // 5 for SPU transfer + UINT ctrl1; // b0 + UINT ctrl2; // b0 + UINT u1; // ?? +} DMA; + +typedef struct { + UINT ext_addr; + UINT cpu_addr; + UINT size; + UINT status; +} EXTDMASTAT; + +typedef struct { + DMA dma[4]; + UINT u1[4]; // function unknown + UINT wait_state; + UINT u2[10]; // function unknown + UINT magic; + EXTDMASTAT extdmastat[4]; +} EXTDMAREGISTER; + + + + +void main2( void ) +{ + volatile int *spu_ram = (int *)0xa0800000; + volatile int *xxy = (int *) 0xa05f6884; + volatile int *qacr = (int *) 0xff000038; + volatile int *shdma = (int *) 0xFFA00000; + volatile EXTDMAREGISTER *extdmareg = (EXTDMAREGISTER *) 0xa05f7800; + + int i; + int chn = 0; // 0: SPU; 1,2,3 for ext (parallel port) + int dest; + + + dest = 0xa0800000; // SPU memory + + extdmareg->wait_state = 0x0; // wait states (for non-dma access) + extdmareg->magic = 0x4659404f; // magic number for release the ext DMA + + for ( i = 0; i < 64; i++ ) // fill SPU RAM + spu_ram[i] = 0x12345678; + + for ( i = 0; i < 1024; i++ ) // test pattern + buffer[i] = i; + printf( "buffer: %p\n", buffer ); + +// yeah, the extern dma is a very complex thing +// it uses the sh dma with On-demand data transfer mode (DDT mode) + + + shdma[0x20/4] = 0; // SAR2 = 0 + shdma[0x24/4] = 0; // DAR2 = 0 + shdma[0x28/4] = 0; // DMATCR2 = 0 + shdma[0x2c/4] = 0x12c0; // CHCR2 = 0x12c0, 32-byte block transfer, burst mode, External request, single address mode, Source address incremented + shdma[0x40/4] = 0x8201; // DMAOR = 0x8201, 0—DMAC Master Enable, CH2 > CH0 > CH1 > CH3, On-Demand Data Transfer + *xxy = 0; + + qacr[0] = 0x10; + qacr[1] = 0x10; + + +// reset all dma channels + + for ( i = 0; i < 4; i++ ) { + extdmareg->dma[i].ctrl1 = 0; + extdmareg->dma[i].ext_addr = 0; + extdmareg->dma[i].cpu_addr = 0; + extdmareg->dma[i].size = 0; + extdmareg->dma[i].dir = 0; + extdmareg->dma[i].mode = 0; + extdmareg->dma[i].ctrl1 = 0; + extdmareg->dma[i].ctrl2 = 0; + } + + + + +// start dma +// dont forget flush cache before start dma + + extdmareg->dma[chn].ctrl1 = 0; + extdmareg->dma[chn].ctrl2 = 0; + extdmareg->dma[chn].ext_addr = dest & 0x1fffffe0; + extdmareg->dma[chn].cpu_addr = (int) buffer & 0x1fffffe0; + extdmareg->dma[chn].size = 64 | 0x80000000; + extdmareg->dma[chn].dir = 0; + extdmareg->dma[chn].mode = 5; // SPU: 5, ext: 0 + extdmareg->dma[chn].ctrl1 = 1; + extdmareg->dma[chn].ctrl2 = 1; + + + terminal(); // yep, this is my terminal hexdump + +} diff --git a/G2BUS/SCHS/dd-lan/dcext020616.patch b/G2BUS/SCHS/dd-lan/dcext020616.patch new file mode 100644 index 00000000..87e73a4d --- /dev/null +++ b/G2BUS/SCHS/dd-lan/dcext020616.patch @@ -0,0 +1,2392 @@ +--- /dev/null Sat Jun 15 12:20:06 2002 ++++ sys/arch/dreamcast/conf/DCEXT Sun Jun 9 02:36:31 2002 +@@ -0,0 +1,164 @@ ++# $NetBSD: GENERIC,v 1.24 2002/05/03 01:36:02 thorpej Exp $ ++# ++# GENERIC machine description file ++# ++# This machine description file is used to generate the default NetBSD ++# kernel. The generic kernel does not include all options, subsystems ++# and device drivers, but should be useful for most applications. ++# ++# The machine description file can be customised for your specific ++# machine to reduce the kernel size and improve its performance. ++# ++# For further information on compiling NetBSD kernels, see the config(8) ++# man page. ++# ++# For further information on hardware support for this architecture, see ++# the intro(4) man page. For further information about kernel options ++# for this architecture, see the options(4) man page. For an explanation ++# of each device driver in this file see the section 4 man page for the ++# device. ++ ++include "arch/dreamcast/conf/std.dreamcast" ++ ++options INCLUDE_CONFIG_FILE # embed config file in kernel binary ++ ++maxusers 16 # estimated number of users ++ ++# Enable the hooks used for initializing the root memory-disk. ++#options MEMORY_DISK_HOOKS ++#options MEMORY_DISK_IS_ROOT # force root on memory disk ++#options MEMORY_DISK_SERVER=0 # no userspace memory disk support ++#options MEMORY_DISK_ROOT_SIZE=2880 # size of memory disk, in blocks ++#options MEMORY_DISK_ROOT_SIZE=6000 ++ ++# Standard system options ++#options UCONSOLE # users can use TIOCCONS (for xconsole) ++#options INSECURE # disable kernel security levels ++ ++#options RTC_OFFSET=-540 ++options HZ=100 # clock interrupt generates every 1/HZ sec ++#options NTP # NTP phase/frequency locked loop ++ ++#options KTRACE # system call tracing via ktrace(1) ++ ++#options USERCONF # userconf(4) support ++#options PIPE_SOCKETPAIR # smaller, but slower pipe(2) ++ ++#options SYSVMSG # System V-like message queues ++#options SYSVSEM # System V-like semaphores ++#options SEMMNI=10 # number of semaphore identifiers ++#options SEMMNS=60 # number of semaphores in system ++#options SEMUME=10 # max number of undo entries per process ++#options SEMMNU=30 # number of undo structures in system ++#options SYSVSHM # System V-like memory sharing ++#options SHMMAXPGS=1024 # 1024 pages is the default ++ ++# Diagnostic/debugging support options ++#options DIAGNOSTIC # cheap kernel consistency checks ++#options DEBUG # expensive debugging checks/support ++#options DDB # in-kernel debugger ++#options KGDB # remote debugger ++#options "KGDB_DEVNAME=\"scif\"",KGDB_DEVRATE=57600 ++#makeoptions DEBUG="-g" # compile full symbol table ++#options SYSCALL_DEBUG ++#options UVMHIST ++#options UVMHIST_PRINT ++ ++# Compatibility options ++options COMPAT_43 # and 4.3BSD ++ ++# Executable format options ++options EXEC_COFF # COFF executables ++options EXEC_ELF32 # 32-bit ELF executables ++ ++# File systems ++file-system FFS # UFS ++file-system MFS # memory file system ++file-system NFS # Network File System client ++file-system PROCFS # /proc ++file-system KERNFS # /kern ++#file-system NULLFS # loopback file system ++#file-system UMAPFS # NULLFS + uid and gid remapping ++file-system CD9660 # CD-ROM file system ++ ++# File system options ++#options QUOTA # UFS quotas ++#options NFSSERVER # Network File System server ++ ++# Networking options ++options INET # IP + ICMP + TCP + UDP ++options NFS_BOOT_DHCP # Support DHCP NFS root ++ ++#options PCIVERBOSE # verbose PCI device autoconfig messages ++#options PCI_CONFIG_DUMP # verbosely dump PCI config space ++ ++# Kernel root file system and dump configuration. ++#config netbsd root on ? type nfs ++#config netbsd root on wd0a type ffs ++config netbsd root on ? type ? ++ ++ ++# wscons options ++options WSEMUL_VT100 # VT100 / VT220 emulation ++options FONT_BOLD8x16 ++ ++# ++# Device configuration ++# ++ ++mainbus0 at root ++ ++cpu* at mainbus? ++shb* at mainbus? ++ ++# Serial Devices ++#options SCIFCONSOLE ++options SCIFCN_SPEED=57600 ++scif0 at shb? ++ ++pvr0 at shb? ++wsdisplay* at pvr? console ? ++ ++maple0 at shb? ++mkbd* at maple? port ? subunit ? ++wskbd* at mkbd? console ? ++ ++gdrom0 at shb? ++ ++#g2bus0 at shb? ++#gapspci* at g2bus? # GAPS PCI bridge ++#pci* at gapspci? ++#rtk* at pci? dev ? function ? # SEGA Broadband Adapter ++#ukphy* at mii? phy ? ++ ++# DC-PP bus ++dppbus0 at shb? ++#wdc0 at dppbus? port 0x05c0 irq 0x0100 ++wdc0 at dppbus? port 0x1000 irq 0x0010 ++wd* at wdc? drive? ++ne0 at dppbus? port 0x0a00 irq 0x0004 ++ne1 at dppbus? port 0x0b00 irq 0x0001 ++#com0 at dppbus? port 0x0be0 irq 0x8000 ++ ++#include "std.slhc" ++ ++# ATAPI bus support ++atapibus* at wdc? channel ? ++ ++# ATAPI devices ++# flags have the same meaning as for IDE drives. ++cd* at atapibus? drive ? flags 0x0000 # ATAPI CD-ROM drives ++#sd* at atapibus? drive ? flags 0x0000 # ATAPI disk drives ++#uk* at atapibus? drive ? flags 0x0000 # ATAPI unknown ++ ++#pseudo-device vnd 4 # disk-like interface to files ++#pseudo-device bpfilter 8 # Berkeley packet filter ++#pseudo-device bridge # simple inter-network bridging ++#pseudo-device ipfilter # IP filter (firewall) and NAT ++pseudo-device loop # network loopback ++pseudo-device pty # pseudo-terminals ++#pseudo-device ppp 2 # Point-to-Point Protocol ++#pseudo-device pppoe # PPP over Ethernet (RFC 2516) ++#pseudo-device tun 2 # network tunneling over tty ++pseudo-device rnd # /dev/random and in-kernel generator ++pseudo-device md 1 # memory disk device (ramdisk) +--- /dev/null Sat Jun 15 12:20:06 2002 ++++ sys/arch/dreamcast/dev/dpp/wdc_dppbus.c Sun Jun 16 22:51:52 2002 +@@ -0,0 +1,173 @@ ++/* $NetBSD: wdc_isa.c,v 1.19 2000/04/02 02:07:52 itojun Exp $ */ ++ ++/*- ++ * Copyright (c) 1998 The NetBSD Foundation, Inc. ++ * All rights reserved. ++ * ++ * This code is derived from software contributed to The NetBSD Foundation ++ * by Charles M. Hannum and by Onno van der Linden. ++ * ++ * 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. All advertising materials mentioning features or use of this software ++ * must display the following acknowledgement: ++ * This product includes software developed by the NetBSD ++ * Foundation, Inc. and its contributors. ++ * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++ ++#include ++ ++#include ++#include ++ ++#define WDC_DPPBUS_REG_NPORTS 8 ++#define WDC_DPPBUS_AUXREG_OFFSET 0x818 ++#define WDC_DPPBUS_AUXREG_NPORTS 1 ++#define WDC_DPPBUS_IRQADDR 0xb400c000 ++ ++struct wdc_dppbus_softc { ++ struct wdc_softc sc_wdcdev; ++ struct channel_softc *wdc_chanptr; ++ struct channel_softc wdc_channel; ++ struct callout sc_intremu; ++ int sc_irq; ++ void *sc_ih; ++}; ++ ++int wdc_dppbus_match __P((struct device *, struct cfdata *, void *)); ++void wdc_dppbus_attach __P((struct device *, struct device *, void *)); ++void wdc_dppbus_intr __P((void *)); ++ ++struct cfattach wdc_dppbus_ca = { ++ sizeof(struct wdc_dppbus_softc), wdc_dppbus_match, wdc_dppbus_attach ++}; ++ ++ ++void ++wdc_dppbus_intr(v) ++ void *v; ++{ ++ struct wdc_dppbus_softc *sc = v; ++ int s; ++ u_int16_t irqs; ++ ++ irqs = (*(__volatile u_int16_t *)WDC_DPPBUS_IRQADDR); ++ if((irqs & sc->sc_irq) == sc->sc_irq) { ++ s = splbio(); ++ wdcintr(&sc->wdc_channel); ++ splx(s); ++ } ++ ++ callout_reset(&sc->sc_intremu, 1, wdc_dppbus_intr, sc); ++} ++ ++int ++wdc_dppbus_match(parent, match, aux) ++ struct device *parent; ++ struct cfdata *match; ++ void *aux; ++{ ++ struct channel_softc ch; ++ struct dppbus_attach_args *da = aux; ++ int result = 0; ++ int auxoff = WDC_DPPBUS_AUXREG_OFFSET; ++ ++ memset(&ch, 0, sizeof(ch)); ++ ++ ch.cmd_iot = da->da_iot; ++ if (bus_space_map(ch.cmd_iot, da->da_iobase, WDC_DPPBUS_REG_NPORTS, 0, ++ &ch.cmd_ioh)) ++ goto out; ++ ++ ch.ctl_iot = da->da_iot; ++ if (bus_space_map(ch.ctl_iot, da->da_iobase+auxoff, ++ WDC_DPPBUS_AUXREG_NPORTS, 0, &ch.ctl_ioh)) ++ goto outunmap; ++ ++ result = wdcprobe(&ch); ++ ++ bus_space_unmap(ch.ctl_iot, ch.ctl_ioh, WDC_DPPBUS_AUXREG_NPORTS); ++outunmap: ++ bus_space_unmap(ch.cmd_iot, ch.cmd_ioh, WDC_DPPBUS_REG_NPORTS); ++out: ++ return (result); ++} ++ ++void ++wdc_dppbus_attach(parent, self, aux) ++ struct device *parent, *self; ++ void *aux; ++{ ++ struct wdc_dppbus_softc *sc = (void *)self; ++ struct dppbus_attach_args *da = aux; ++ ++ printf("\n"); ++ ++ sc->sc_irq = da->da_irq; ++ sc->wdc_channel.cmd_iot = da->da_iot; ++ sc->wdc_channel.ctl_iot = da->da_iot; ++ if (bus_space_map(sc->wdc_channel.cmd_iot, da->da_iobase, ++ WDC_DPPBUS_REG_NPORTS, 0, &sc->wdc_channel.cmd_ioh) || ++ bus_space_map(sc->wdc_channel.ctl_iot, ++ da->da_iobase+WDC_DPPBUS_AUXREG_OFFSET, WDC_DPPBUS_AUXREG_NPORTS, ++ 0, &sc->wdc_channel.ctl_ioh)) { ++ printf("%s: couldn't map registers\n", ++ sc->sc_wdcdev.sc_dev.dv_xname); ++ } ++ sc->wdc_channel.data32iot = sc->wdc_channel.cmd_iot; ++ sc->wdc_channel.data32ioh = sc->wdc_channel.cmd_ioh; ++ ++ callout_init(&sc->sc_intremu); ++ callout_reset(&sc->sc_intremu, 1, ++ wdc_dppbus_intr, sc); ++ ++ sc->sc_wdcdev.cap |= WDC_CAPABILITY_DATA16 | WDC_CAPABILITY_PREATA; ++ sc->sc_wdcdev.PIO_cap = 0; ++ sc->wdc_chanptr = &sc->wdc_channel; ++ sc->sc_wdcdev.channels = &sc->wdc_chanptr; ++ sc->sc_wdcdev.nchannels = 1; ++ sc->wdc_channel.channel = 0; ++ sc->wdc_channel.wdc = &sc->sc_wdcdev; ++ sc->wdc_channel.ch_queue = malloc(sizeof(struct channel_queue), ++ M_DEVBUF, M_NOWAIT); ++ if (sc->wdc_channel.ch_queue == NULL) { ++ printf("%s: can't allocate memory for command queue", ++ sc->sc_wdcdev.sc_dev.dv_xname); ++ return; ++ } ++ wdcattach(&sc->wdc_channel); ++} ++ +--- /dev/null Sat Jun 15 12:20:06 2002 ++++ sys/arch/dreamcast/dev/dpp/if_ne_dppbus.c Sun Jun 16 22:51:31 2002 +@@ -0,0 +1,273 @@ ++/* $NetBSD: if_ne_isa.c,v 1.10 2001/02/12 18:49:04 thorpej Exp $ */ ++ ++/*- ++ * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. ++ * All rights reserved. ++ * ++ * This code is derived from software contributed to The NetBSD Foundation ++ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, ++ * NASA Ames Research Center. ++ * ++ * 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. All advertising materials mentioning features or use of this software ++ * must display the following acknowledgement: ++ * This product includes software developed by the NetBSD ++ * Foundation, Inc. and its contributors. ++ * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 "opt_inet.h" ++#include "opt_ns.h" ++#include "bpfilter.h" ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++ ++#ifdef INET ++#include ++#include ++#include ++#include ++#include ++#endif ++ ++#ifdef NS ++#include ++#include ++#endif ++ ++#if NBPFILTER > 0 ++#include ++#include ++#endif ++ ++#include ++#include ++ ++#include ++#include ++ ++#include ++#include ++ ++#include ++#include ++ ++#include ++#include ++ ++#define NE_DPPBUS_IRQADDR 0xb400c000 ++ ++int ne_dppbus_match __P((struct device *, struct cfdata *, void *)); ++void ne_dppbus_attach __P((struct device *, struct device *, void *)); ++void ne_dppbus_intr __P((void *)); ++ ++static ++void ne_dppbus_test __P((int)); ++ ++struct ne_dppbus_softc { ++ struct ne2000_softc sc_ne2000; /* real "ne2000" softc */ ++ struct callout sc_intremu; ++ ++ /* DPPBUS-specific goo. */ ++ int sc_irq; ++}; ++ ++struct cfattach ne_dppbus_ca = { ++ sizeof(struct ne_dppbus_softc), ne_dppbus_match, ne_dppbus_attach ++}; ++ ++ ++void ++ne_dppbus_intr(v) ++ void *v; ++{ ++ struct ne_dppbus_softc *sc = v; ++ struct ne2000_softc *nsc = &sc->sc_ne2000; ++ struct dp8390_softc *dsc = &nsc->sc_dp8390; ++ int s; ++ u_int16_t irqs; ++ ++ irqs = (*(__volatile u_int16_t *)NE_DPPBUS_IRQADDR); ++ if((irqs & sc->sc_irq) == sc->sc_irq) { ++ s = splnet(); ++ dp8390_intr(dsc); ++ splx(s); ++ } ++ ++ callout_reset(&sc->sc_intremu, 1, ne_dppbus_intr, sc); ++} ++ ++int ++ne_dppbus_match(parent, match, aux) ++ struct device *parent; ++ struct cfdata *match; ++ void *aux; ++{ ++ struct dppbus_attach_args *da = aux; ++ bus_space_tag_t nict = da->da_iot; ++ bus_space_handle_t nich; ++ bus_space_tag_t asict; ++ bus_space_handle_t asich; ++ int rv = 0; ++ ++ /* Disallow wildcarded values. */ ++ if (da->da_irq == DPPBUSCF_IRQ_DEFAULT) ++ return (0); ++ if (da->da_iobase == DPPBUSCF_PORT_DEFAULT) ++ return (0); ++ ++ /* Map i/o space. */ ++ if (bus_space_map(nict, da->da_iobase, NE2000_NPORTS, 0, &nich)) ++ return (0); ++ ++ asict = nict; ++ if (bus_space_subregion(nict, nich, NE2000_ASIC_OFFSET, ++ NE2000_ASIC_NPORTS, &asich)) ++ goto out; ++ ++ /* Look for an NE2000-compatible card. */ ++ rv = ne2000_detect(nict, nich, asict, asich); ++/// if (rv) ++/// ia->ia_iosize = NE2000_NPORTS; ++ ++ out: ++ bus_space_unmap(nict, nich, NE2000_NPORTS); ++ return (rv); ++} ++ ++void ++ne_dppbus_attach(parent, self, aux) ++ struct device *parent, *self; ++ void *aux; ++{ ++ struct ne_dppbus_softc *isc = (struct ne_dppbus_softc *)self; ++ struct ne2000_softc *nsc = &isc->sc_ne2000; ++ struct dp8390_softc *dsc = &nsc->sc_dp8390; ++ struct dppbus_attach_args *da = aux; ++ bus_space_tag_t nict = da->da_iot; ++ bus_space_handle_t nich; ++ bus_space_tag_t asict = nict; ++ bus_space_handle_t asich; ++ const char *typestr; ++ int netype; ++ ++ printf("\n"); ++ ++ /* Map i/o space. */ ++ if (bus_space_map(nict, da->da_iobase, NE2000_NPORTS, 0, &nich)) { ++ printf("%s: can't map i/o space\n", dsc->sc_dev.dv_xname); ++ return; ++ } ++ ++ if (bus_space_subregion(nict, nich, NE2000_ASIC_OFFSET, ++ NE2000_ASIC_NPORTS, &asich)) { ++ printf("%s: can't subregion i/o space\n", dsc->sc_dev.dv_xname); ++ return; ++ } ++ ++ isc->sc_irq = da->da_irq; ++ ++ dsc->sc_regt = nict; ++ dsc->sc_regh = nich; ++ ++ nsc->sc_asict = asict; ++ nsc->sc_asich = asich; ++ ++ /* ++ * Detect it again, so we can print some information about the ++ * interface. ++ */ ++ netype = ne2000_detect(nict, nich, asict, asich); ++ switch (netype) { ++ case NE2000_TYPE_NE1000: ++ typestr = "NE1000"; ++ break; ++ ++ case NE2000_TYPE_NE2000: ++ typestr = "NE2000"; ++ /* ++ * Check for a RealTek 8019. ++ */ ++ bus_space_write_1(nict, nich, ED_P0_CR, ++ ED_CR_PAGE_0 | ED_CR_STP); ++ if (bus_space_read_1(nict, nich, NERTL_RTL0_8019ID0) == ++ RTL0_8019ID0 && ++ bus_space_read_1(nict, nich, NERTL_RTL0_8019ID1) == ++ RTL0_8019ID1) { ++ typestr = "NE2000 (RTL8019)"; ++ dsc->sc_mediachange = rtl80x9_mediachange; ++ dsc->sc_mediastatus = rtl80x9_mediastatus; ++ dsc->init_card = rtl80x9_init_card; ++ dsc->sc_media_init = rtl80x9_media_init; ++ } ++ break; ++ ++ default: ++ printf("%s: where did the card go?!\n", dsc->sc_dev.dv_xname); ++ return; ++ } ++ ++ printf("%s: %s Ethernet\n", dsc->sc_dev.dv_xname, typestr); ++ ++ /* This interface is always enabled. */ ++ dsc->sc_enabled = 1; ++ ++ /* ++ * Do generic NE2000 attach. This will read the station address ++ * from the EEPROM. ++ */ ++ ne2000_attach(nsc, NULL); ++ ++ /* Establish the interrupt handler. */ ++ callout_init(&isc->sc_intremu); ++ callout_reset(&isc->sc_intremu, 1, ne_dppbus_intr, isc); ++/// isc->sc_ih = dppbus_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, ++/// IPL_NET, dp8390_intr, dsc); ++/// if (isc->sc_ih == NULL) ++/// printf("%s: couldn't establish interrupt handler\n", ++/// dsc->sc_dev.dv_xname); ++} ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +--- /dev/null Sat Jun 15 12:20:06 2002 ++++ sys/arch/dreamcast/dev/dpp/wdc_dppbus.c Sun Jun 16 22:51:52 2002 +@@ -0,0 +1,173 @@ ++/* $NetBSD: wdc_isa.c,v 1.19 2000/04/02 02:07:52 itojun Exp $ */ ++ ++/*- ++ * Copyright (c) 1998 The NetBSD Foundation, Inc. ++ * All rights reserved. ++ * ++ * This code is derived from software contributed to The NetBSD Foundation ++ * by Charles M. Hannum and by Onno van der Linden. ++ * ++ * 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. All advertising materials mentioning features or use of this software ++ * must display the following acknowledgement: ++ * This product includes software developed by the NetBSD ++ * Foundation, Inc. and its contributors. ++ * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++ ++#include ++ ++#include ++#include ++ ++#define WDC_DPPBUS_REG_NPORTS 8 ++#define WDC_DPPBUS_AUXREG_OFFSET 0x818 ++#define WDC_DPPBUS_AUXREG_NPORTS 1 ++#define WDC_DPPBUS_IRQADDR 0xb400c000 ++ ++struct wdc_dppbus_softc { ++ struct wdc_softc sc_wdcdev; ++ struct channel_softc *wdc_chanptr; ++ struct channel_softc wdc_channel; ++ struct callout sc_intremu; ++ int sc_irq; ++ void *sc_ih; ++}; ++ ++int wdc_dppbus_match __P((struct device *, struct cfdata *, void *)); ++void wdc_dppbus_attach __P((struct device *, struct device *, void *)); ++void wdc_dppbus_intr __P((void *)); ++ ++struct cfattach wdc_dppbus_ca = { ++ sizeof(struct wdc_dppbus_softc), wdc_dppbus_match, wdc_dppbus_attach ++}; ++ ++ ++void ++wdc_dppbus_intr(v) ++ void *v; ++{ ++ struct wdc_dppbus_softc *sc = v; ++ int s; ++ u_int16_t irqs; ++ ++ irqs = (*(__volatile u_int16_t *)WDC_DPPBUS_IRQADDR); ++ if((irqs & sc->sc_irq) == sc->sc_irq) { ++ s = splbio(); ++ wdcintr(&sc->wdc_channel); ++ splx(s); ++ } ++ ++ callout_reset(&sc->sc_intremu, 1, wdc_dppbus_intr, sc); ++} ++ ++int ++wdc_dppbus_match(parent, match, aux) ++ struct device *parent; ++ struct cfdata *match; ++ void *aux; ++{ ++ struct channel_softc ch; ++ struct dppbus_attach_args *da = aux; ++ int result = 0; ++ int auxoff = WDC_DPPBUS_AUXREG_OFFSET; ++ ++ memset(&ch, 0, sizeof(ch)); ++ ++ ch.cmd_iot = da->da_iot; ++ if (bus_space_map(ch.cmd_iot, da->da_iobase, WDC_DPPBUS_REG_NPORTS, 0, ++ &ch.cmd_ioh)) ++ goto out; ++ ++ ch.ctl_iot = da->da_iot; ++ if (bus_space_map(ch.ctl_iot, da->da_iobase+auxoff, ++ WDC_DPPBUS_AUXREG_NPORTS, 0, &ch.ctl_ioh)) ++ goto outunmap; ++ ++ result = wdcprobe(&ch); ++ ++ bus_space_unmap(ch.ctl_iot, ch.ctl_ioh, WDC_DPPBUS_AUXREG_NPORTS); ++outunmap: ++ bus_space_unmap(ch.cmd_iot, ch.cmd_ioh, WDC_DPPBUS_REG_NPORTS); ++out: ++ return (result); ++} ++ ++void ++wdc_dppbus_attach(parent, self, aux) ++ struct device *parent, *self; ++ void *aux; ++{ ++ struct wdc_dppbus_softc *sc = (void *)self; ++ struct dppbus_attach_args *da = aux; ++ ++ printf("\n"); ++ ++ sc->sc_irq = da->da_irq; ++ sc->wdc_channel.cmd_iot = da->da_iot; ++ sc->wdc_channel.ctl_iot = da->da_iot; ++ if (bus_space_map(sc->wdc_channel.cmd_iot, da->da_iobase, ++ WDC_DPPBUS_REG_NPORTS, 0, &sc->wdc_channel.cmd_ioh) || ++ bus_space_map(sc->wdc_channel.ctl_iot, ++ da->da_iobase+WDC_DPPBUS_AUXREG_OFFSET, WDC_DPPBUS_AUXREG_NPORTS, ++ 0, &sc->wdc_channel.ctl_ioh)) { ++ printf("%s: couldn't map registers\n", ++ sc->sc_wdcdev.sc_dev.dv_xname); ++ } ++ sc->wdc_channel.data32iot = sc->wdc_channel.cmd_iot; ++ sc->wdc_channel.data32ioh = sc->wdc_channel.cmd_ioh; ++ ++ callout_init(&sc->sc_intremu); ++ callout_reset(&sc->sc_intremu, 1, ++ wdc_dppbus_intr, sc); ++ ++ sc->sc_wdcdev.cap |= WDC_CAPABILITY_DATA16 | WDC_CAPABILITY_PREATA; ++ sc->sc_wdcdev.PIO_cap = 0; ++ sc->wdc_chanptr = &sc->wdc_channel; ++ sc->sc_wdcdev.channels = &sc->wdc_chanptr; ++ sc->sc_wdcdev.nchannels = 1; ++ sc->wdc_channel.channel = 0; ++ sc->wdc_channel.wdc = &sc->sc_wdcdev; ++ sc->wdc_channel.ch_queue = malloc(sizeof(struct channel_queue), ++ M_DEVBUF, M_NOWAIT); ++ if (sc->wdc_channel.ch_queue == NULL) { ++ printf("%s: can't allocate memory for command queue", ++ sc->sc_wdcdev.sc_dev.dv_xname); ++ return; ++ } ++ wdcattach(&sc->wdc_channel); ++} ++ +--- /dev/null Sat Jun 15 12:20:06 2002 ++++ sys/arch/dreamcast/dev/dpp/dppbus_bus_mem.c Fri May 17 17:50:22 2002 +@@ -0,0 +1,325 @@ ++/* $NetBSD: g2bus_bus_mem.c,v 1.3 2001/02/01 01:01:50 thorpej Exp $ */ ++ ++/*- ++ * Copyright (c) 2001 The NetBSD Foundation, Inc. ++ * All rights reserved. ++ * ++ * This code is derived from software contributed to The NetBSD Foundation ++ * by Jason R. Thorpe. ++ * ++ * 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. All advertising materials mentioning features or use of this software ++ * must display the following acknowledgement: ++ * This product includes software developed by the NetBSD ++ * Foundation, Inc. and its contributors. ++ * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. ++ */ ++ ++/* ++ * Bus space implementation for the SEGA G2 bus. ++ * ++ * NOTE: We only implement a small subset of what the bus_space(9) ++ * API specifies. Right now, the GAPS PCI bridge is only used for ++ * the Dreamcast Broadband Adatper, so we only provide what the ++ * pci(4) and rtk(4) drivers need. ++ */ ++ ++#include /* RCS ID & Copyright macro defns */ ++ ++#include ++#include ++#include ++ ++#include ++#include ++ ++#include ++ ++#define DPPBUS_STRIDE 2 ++ ++int dppbus_bus_mem_map(void *, bus_addr_t, bus_size_t, int, ++ bus_space_handle_t *); ++void dppbus_bus_mem_unmap(void *, bus_space_handle_t, bus_size_t); ++ ++u_int8_t dppbus_bus_mem_read_1(void *, bus_space_handle_t, bus_size_t); ++u_int16_t dppbus_bus_mem_read_2(void *, bus_space_handle_t, bus_size_t); ++u_int32_t dppbus_bus_mem_read_4(void *, bus_space_handle_t, bus_size_t); ++ ++void dppbus_bus_mem_write_1(void *, bus_space_handle_t, bus_size_t, ++ u_int8_t); ++void dppbus_bus_mem_write_2(void *, bus_space_handle_t, bus_size_t, ++ u_int16_t); ++void dppbus_bus_mem_write_4(void *, bus_space_handle_t, bus_size_t, ++ u_int32_t); ++ ++void dppbus_bus_mem_read_region_1(void *, bus_space_handle_t, bus_size_t, ++ u_int8_t *, bus_size_t); ++ ++void dppbus_bus_mem_read_multi_1(void *, bus_space_handle_t, bus_size_t, ++ u_int8_t *, bus_size_t); ++ ++void dppbus_bus_mem_read_multi_2(void *, bus_space_handle_t, bus_size_t, ++ u_int16_t *, bus_size_t); ++ ++void dppbus_bus_mem_write_region_1(void *, bus_space_handle_t, bus_size_t, ++ const u_int8_t *, bus_size_t); ++ ++void dppbus_bus_mem_write_multi_1(void *, bus_space_handle_t, bus_size_t, ++ const u_int8_t *, bus_size_t); ++ ++void dppbus_bus_mem_write_multi_2(void *, bus_space_handle_t, bus_size_t, ++ const u_int16_t *, bus_size_t); ++ ++int dppbus_space_subregion(void *, bus_space_handle_t, bus_size_t, ++ bus_size_t, bus_space_handle_t *); ++ ++ ++void ++dppbus_bus_mem_init(struct dppbus_softc *sc) ++{ ++ bus_space_tag_t t = &sc->sc_memt; ++ ++ memset(t, 0, sizeof(*t)); ++ ++ t->dbs_map = dppbus_bus_mem_map; ++ t->dbs_unmap = dppbus_bus_mem_unmap; ++ ++ t->dbs_r_1 = dppbus_bus_mem_read_1; ++ t->dbs_r_2 = dppbus_bus_mem_read_2; ++// t->dbs_r_4 = dppbus_bus_mem_read_4; ++ ++ t->dbs_w_1 = dppbus_bus_mem_write_1; ++ t->dbs_w_2 = dppbus_bus_mem_write_2; ++// t->dbs_w_4 = dppbus_bus_mem_write_4; ++ ++ t->dbs_rr_1 = dppbus_bus_mem_read_region_1; ++ ++ t->dbs_wr_1 = dppbus_bus_mem_write_region_1; ++ ++ t->dbs_rm_1 = dppbus_bus_mem_read_multi_1; ++ t->dbs_rm_2 = dppbus_bus_mem_read_multi_2; ++ ++ t->dbs_wm_1 = dppbus_bus_mem_write_multi_1; ++ t->dbs_wm_2 = dppbus_bus_mem_write_multi_2; ++ ++ t->dbs_subregion = dppbus_space_subregion; ++} ++ ++int ++dppbus_bus_mem_map(void *v, bus_addr_t addr, bus_size_t size, int flags, ++ bus_space_handle_t *shp) ++{ ++ addr |= 0xb4000000; ++ ++ KASSERT((addr & SH3_PHYS_MASK) == addr); ++ *shp = SH3_PHYS_TO_P2SEG(addr); ++ ++ return (0); ++} ++ ++void ++dppbus_bus_mem_unmap(void *v, bus_space_handle_t sh, bus_size_t size) ++{ ++ ++ KASSERT(sh >= SH3_P2SEG_BASE && sh <= SH3_P2SEG_END); ++ /* Nothing to do. */ ++} ++ ++int ++dppbus_space_subregion(void *v, bus_space_handle_t handle, ++ bus_size_t offset, bus_size_t size, bus_space_handle_t *nhandlep) ++{ ++ *nhandlep = handle + (offset< ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#include "locators.h" ++ ++int dppbusmatch(struct device *, struct cfdata *, void *); ++void dppbusattach(struct device *, struct device *, void *); ++int dppbusprint(void *, const char *); ++ ++struct cfattach dppbus_ca = { ++ sizeof(struct dppbus_softc), dppbusmatch, dppbusattach ++}; ++ ++int dppbussearch(struct device *, struct cfdata *, void *); ++ ++int ++dppbusmatch(struct device *parent, struct cfdata *cf, void *aux) ++{ ++ if (strcmp("dppbus", cf->cf_driver->cd_name)) ++ return (0); ++ ++ return (1); ++} ++ ++void ++dppbusattach(struct device *parent, struct device *self, void *aux) ++{ ++ struct dppbus_softc *sc = (void *) self; ++ ++ printf("\n"); ++ ++ TAILQ_INIT(&sc->sc_subdevs); ++ ++ (*(__volatile u_int16_t *)0xb400f000) = 0x0000; ++ delay(10); ++ (*(__volatile u_int16_t *)0xb400f000) = 0x0001; ++ delay(10); ++ (*(__volatile u_int16_t *)0xb400f000) = 0x0000; ++ ++ dppbus_bus_mem_init(sc); ++ ++ config_search(dppbussearch, self, NULL); ++} ++ ++int ++dppbusprint(void *aux, const char *pnp) ++{ ++ ++ return (UNCONF); ++} ++ ++int ++dppbussearch(struct device *parent, struct cfdata *cf, void *aux) ++{ ++ struct dppbus_attach_args da; ++ struct dppbus_softc *sc = (struct dppbus_softc *)parent; ++ ++ da.da_iot = &sc->sc_memt; ++ da.da_iobase = cf->cf_loc[DPPBUSCF_PORT]; ++ da.da_irq = cf->cf_loc[DPPBUSCF_IRQ]; ++ ++ if ((*cf->cf_attach->ca_match)(parent, cf, &da) > 0) ++ config_attach(parent, cf, &da, dppbusprint); ++ ++ return (0); ++} ++ ++ +--- /dev/null Sat Jun 15 12:20:06 2002 ++++ sys/arch/dreamcast/dev/dpp/dppbusvar.h Fri May 17 17:59:00 2002 +@@ -0,0 +1,72 @@ ++/* $NetBSD: g2busvar.h,v 1.1 2001/01/31 18:33:24 thorpej Exp $ */ ++ ++/*- ++ * Copyright (c) 2001 Marcus Comstedt ++ * 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. All advertising materials mentioning features or use of this software ++ * must display the following acknowledgement: ++ * This product includes software developed by Marcus Comstedt. ++ * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 _DREAMCAST_DPPBUSVAR_H_ ++#define _DREAMCAST_DPPBUSVAR_H_ ++ ++#include ++ ++/* ++ * DC-PP driver attach arguments ++ */ ++struct dppbus_attach_args { ++ bus_space_tag_t da_iot; ++ int da_iobase; /* base i/o address */ ++ int da_irq; /* interrupt request */ ++}; ++ ++/* ++ * Per-device DC-PP variables ++ */ ++struct dppbusdev { ++ struct device *dd_dev; /* back pointer to generic */ ++ TAILQ_ENTRY(dppbusdev) ++ dd_bchain; /* bus chain */ ++}; ++ ++/* ++ * master bus ++ */ ++struct dppbus_softc { ++ struct device sc_dev; /* base device */ ++ struct dreamcast_bus_space sc_memt; ++ TAILQ_HEAD(, dppbusdev) ++ sc_subdevs; /* list of all children */ ++}; ++ ++void dppbus_bus_mem_init(struct dppbus_softc *); ++ ++#endif /* _DREAMCAST_DPPBUSVAR_H_ */ ++ ++ +--- /dev/null Sat Jun 15 12:20:06 2002 ++++ sys/arch/dreamcast/dev/dpp/if_ne_dppbus.c Sun Jun 16 22:51:31 2002 +@@ -0,0 +1,273 @@ ++/* $NetBSD: if_ne_isa.c,v 1.10 2001/02/12 18:49:04 thorpej Exp $ */ ++ ++/*- ++ * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. ++ * All rights reserved. ++ * ++ * This code is derived from software contributed to The NetBSD Foundation ++ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, ++ * NASA Ames Research Center. ++ * ++ * 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. All advertising materials mentioning features or use of this software ++ * must display the following acknowledgement: ++ * This product includes software developed by the NetBSD ++ * Foundation, Inc. and its contributors. ++ * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 "opt_inet.h" ++#include "opt_ns.h" ++#include "bpfilter.h" ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++ ++#ifdef INET ++#include ++#include ++#include ++#include ++#include ++#endif ++ ++#ifdef NS ++#include ++#include ++#endif ++ ++#if NBPFILTER > 0 ++#include ++#include ++#endif ++ ++#include ++#include ++ ++#include ++#include ++ ++#include ++#include ++ ++#include ++#include ++ ++#include ++#include ++ ++#define NE_DPPBUS_IRQADDR 0xb400c000 ++ ++int ne_dppbus_match __P((struct device *, struct cfdata *, void *)); ++void ne_dppbus_attach __P((struct device *, struct device *, void *)); ++void ne_dppbus_intr __P((void *)); ++ ++static ++void ne_dppbus_test __P((int)); ++ ++struct ne_dppbus_softc { ++ struct ne2000_softc sc_ne2000; /* real "ne2000" softc */ ++ struct callout sc_intremu; ++ ++ /* DPPBUS-specific goo. */ ++ int sc_irq; ++}; ++ ++struct cfattach ne_dppbus_ca = { ++ sizeof(struct ne_dppbus_softc), ne_dppbus_match, ne_dppbus_attach ++}; ++ ++ ++void ++ne_dppbus_intr(v) ++ void *v; ++{ ++ struct ne_dppbus_softc *sc = v; ++ struct ne2000_softc *nsc = &sc->sc_ne2000; ++ struct dp8390_softc *dsc = &nsc->sc_dp8390; ++ int s; ++ u_int16_t irqs; ++ ++ irqs = (*(__volatile u_int16_t *)NE_DPPBUS_IRQADDR); ++ if((irqs & sc->sc_irq) == sc->sc_irq) { ++ s = splnet(); ++ dp8390_intr(dsc); ++ splx(s); ++ } ++ ++ callout_reset(&sc->sc_intremu, 1, ne_dppbus_intr, sc); ++} ++ ++int ++ne_dppbus_match(parent, match, aux) ++ struct device *parent; ++ struct cfdata *match; ++ void *aux; ++{ ++ struct dppbus_attach_args *da = aux; ++ bus_space_tag_t nict = da->da_iot; ++ bus_space_handle_t nich; ++ bus_space_tag_t asict; ++ bus_space_handle_t asich; ++ int rv = 0; ++ ++ /* Disallow wildcarded values. */ ++ if (da->da_irq == DPPBUSCF_IRQ_DEFAULT) ++ return (0); ++ if (da->da_iobase == DPPBUSCF_PORT_DEFAULT) ++ return (0); ++ ++ /* Map i/o space. */ ++ if (bus_space_map(nict, da->da_iobase, NE2000_NPORTS, 0, &nich)) ++ return (0); ++ ++ asict = nict; ++ if (bus_space_subregion(nict, nich, NE2000_ASIC_OFFSET, ++ NE2000_ASIC_NPORTS, &asich)) ++ goto out; ++ ++ /* Look for an NE2000-compatible card. */ ++ rv = ne2000_detect(nict, nich, asict, asich); ++/// if (rv) ++/// ia->ia_iosize = NE2000_NPORTS; ++ ++ out: ++ bus_space_unmap(nict, nich, NE2000_NPORTS); ++ return (rv); ++} ++ ++void ++ne_dppbus_attach(parent, self, aux) ++ struct device *parent, *self; ++ void *aux; ++{ ++ struct ne_dppbus_softc *isc = (struct ne_dppbus_softc *)self; ++ struct ne2000_softc *nsc = &isc->sc_ne2000; ++ struct dp8390_softc *dsc = &nsc->sc_dp8390; ++ struct dppbus_attach_args *da = aux; ++ bus_space_tag_t nict = da->da_iot; ++ bus_space_handle_t nich; ++ bus_space_tag_t asict = nict; ++ bus_space_handle_t asich; ++ const char *typestr; ++ int netype; ++ ++ printf("\n"); ++ ++ /* Map i/o space. */ ++ if (bus_space_map(nict, da->da_iobase, NE2000_NPORTS, 0, &nich)) { ++ printf("%s: can't map i/o space\n", dsc->sc_dev.dv_xname); ++ return; ++ } ++ ++ if (bus_space_subregion(nict, nich, NE2000_ASIC_OFFSET, ++ NE2000_ASIC_NPORTS, &asich)) { ++ printf("%s: can't subregion i/o space\n", dsc->sc_dev.dv_xname); ++ return; ++ } ++ ++ isc->sc_irq = da->da_irq; ++ ++ dsc->sc_regt = nict; ++ dsc->sc_regh = nich; ++ ++ nsc->sc_asict = asict; ++ nsc->sc_asich = asich; ++ ++ /* ++ * Detect it again, so we can print some information about the ++ * interface. ++ */ ++ netype = ne2000_detect(nict, nich, asict, asich); ++ switch (netype) { ++ case NE2000_TYPE_NE1000: ++ typestr = "NE1000"; ++ break; ++ ++ case NE2000_TYPE_NE2000: ++ typestr = "NE2000"; ++ /* ++ * Check for a RealTek 8019. ++ */ ++ bus_space_write_1(nict, nich, ED_P0_CR, ++ ED_CR_PAGE_0 | ED_CR_STP); ++ if (bus_space_read_1(nict, nich, NERTL_RTL0_8019ID0) == ++ RTL0_8019ID0 && ++ bus_space_read_1(nict, nich, NERTL_RTL0_8019ID1) == ++ RTL0_8019ID1) { ++ typestr = "NE2000 (RTL8019)"; ++ dsc->sc_mediachange = rtl80x9_mediachange; ++ dsc->sc_mediastatus = rtl80x9_mediastatus; ++ dsc->init_card = rtl80x9_init_card; ++ dsc->sc_media_init = rtl80x9_media_init; ++ } ++ break; ++ ++ default: ++ printf("%s: where did the card go?!\n", dsc->sc_dev.dv_xname); ++ return; ++ } ++ ++ printf("%s: %s Ethernet\n", dsc->sc_dev.dv_xname, typestr); ++ ++ /* This interface is always enabled. */ ++ dsc->sc_enabled = 1; ++ ++ /* ++ * Do generic NE2000 attach. This will read the station address ++ * from the EEPROM. ++ */ ++ ne2000_attach(nsc, NULL); ++ ++ /* Establish the interrupt handler. */ ++ callout_init(&isc->sc_intremu); ++ callout_reset(&isc->sc_intremu, 1, ne_dppbus_intr, isc); ++/// isc->sc_ih = dppbus_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, ++/// IPL_NET, dp8390_intr, dsc); ++/// if (isc->sc_ih == NULL) ++/// printf("%s: couldn't establish interrupt handler\n", ++/// dsc->sc_dev.dv_xname); ++} ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +--- /dev/null Sat Jun 15 12:20:06 2002 ++++ sys/arch/dreamcast/dev/dpp/if_ne_dppbus.c.dev Fri May 17 17:08:09 2002 +@@ -0,0 +1,234 @@ ++/* $NetBSD: if_ne_isa.c,v 1.10 2001/02/12 18:49:04 thorpej Exp $ */ ++ ++/*- ++ * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. ++ * All rights reserved. ++ * ++ * This code is derived from software contributed to The NetBSD Foundation ++ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, ++ * NASA Ames Research Center. ++ * ++ * 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. All advertising materials mentioning features or use of this software ++ * must display the following acknowledgement: ++ * This product includes software developed by the NetBSD ++ * Foundation, Inc. and its contributors. ++ * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 "opt_inet.h" ++#include "opt_ns.h" ++#include "bpfilter.h" ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++ ++#ifdef INET ++#include ++#include ++#include ++#include ++#include ++#endif ++ ++#ifdef NS ++#include ++#include ++#endif ++ ++#if NBPFILTER > 0 ++#include ++#include ++#endif ++ ++#include ++#include ++ ++#include ++#include ++ ++#include ++#include ++ ++#include ++#include ++ ++#include ++ ++int ne_dppbus_match __P((struct device *, struct cfdata *, void *)); ++void ne_dppbus_attach __P((struct device *, struct device *, void *)); ++ ++struct ne_dppbus_softc { ++ struct ne2000_softc sc_ne2000; /* real "ne2000" softc */ ++ ++ /* DPPBUS-specific goo. */ ++// void *sc_ih; /* interrupt cookie */ ++}; ++ ++struct cfattach ne_dppbus_ca = { ++ sizeof(struct ne_dppbus_softc), ne_dppbus_match, ne_dppbus_attach ++}; ++ ++int ++ne_dppbus_match(parent, match, aux) ++ struct device *parent; ++ struct cfdata *match; ++ void *aux; ++{ ++ struct dppbus_attach_args *da = aux; ++ bus_space_tag_t nict = da->da_memt; ++ bus_space_handle_t nich; ++ bus_space_tag_t asict; ++ bus_space_handle_t asich; ++ int rv = 0; ++ /* Map i/o space. */ ++ if (bus_space_map(nict, 0x01000c00, NE2000_NPORTS, 0, &nich)) ++ return (0); ++ ++ asict = nict; ++ if (bus_space_subregion(nict, nich, NE2000_ASIC_OFFSET, ++ NE2000_ASIC_NPORTS, &asich)) ++ goto out; ++ ++ /* Look for an NE2000-compatible card. */ ++ rv = ne2000_detect(nict, nich, asict, asich); ++ ++/// if (rv) ++/// ia->ia_iosize = NE2000_NPORTS; ++ ++ out: ++ bus_space_unmap(nict, nich, NE2000_NPORTS); ++ return (rv); ++} ++ ++void ++ne_dppbus_attach(parent, self, aux) ++ struct device *parent, *self; ++ void *aux; ++{ ++ struct ne_dppbus_softc *isc = (struct ne_dppbus_softc *)self; ++ struct ne2000_softc *nsc = &isc->sc_ne2000; ++ struct dp8390_softc *dsc = &nsc->sc_dp8390; ++ struct dppbus_attach_args *da = aux; ++ bus_space_tag_t nict = da->da_memt; ++ bus_space_handle_t nich; ++ bus_space_tag_t asict = nict; ++ bus_space_handle_t asich; ++ const char *typestr; ++ int netype; ++ ++ printf("\n"); ++ ++ /* Map i/o space. */ ++ if (bus_space_map(nict, 0x01000c00, NE2000_NPORTS, 0, &nich)) { ++ printf("%s: can't map i/o space\n", dsc->sc_dev.dv_xname); ++ return; ++ } ++ ++ if (bus_space_subregion(nict, nich, NE2000_ASIC_OFFSET, ++ NE2000_ASIC_NPORTS, &asich)) { ++ printf("%s: can't subregion i/o space\n", dsc->sc_dev.dv_xname); ++ return; ++ } ++ ++ dsc->sc_regt = nict; ++ dsc->sc_regh = nich; ++ ++ nsc->sc_asict = asict; ++ nsc->sc_asich = asich; ++ ++ /* ++ * Detect it again, so we can print some information about the ++ * interface. ++ */ ++ netype = ne2000_detect(nict, nich, asict, asich); ++ switch (netype) { ++ case NE2000_TYPE_NE1000: ++ typestr = "NE1000"; ++ break; ++ ++ case NE2000_TYPE_NE2000: ++ typestr = "NE2000"; ++ /* ++ * Check for a RealTek 8019. ++ */ ++ bus_space_write_1(nict, nich, ED_P0_CR, ++ ED_CR_PAGE_0 | ED_CR_STP); ++ if (bus_space_read_1(nict, nich, NERTL_RTL0_8019ID0) == ++ RTL0_8019ID0 && ++ bus_space_read_1(nict, nich, NERTL_RTL0_8019ID1) == ++ RTL0_8019ID1) { ++ typestr = "NE2000 (RTL8019)"; ++ dsc->sc_mediachange = rtl80x9_mediachange; ++ dsc->sc_mediastatus = rtl80x9_mediastatus; ++ dsc->init_card = rtl80x9_init_card; ++ dsc->sc_media_init = rtl80x9_media_init; ++ } ++ break; ++ ++ default: ++ printf("%s: where did the card go?!\n", dsc->sc_dev.dv_xname); ++ return; ++ } ++ ++ printf("%s: %s Ethernet\n", dsc->sc_dev.dv_xname, typestr); ++ ++ /* This interface is always enabled. */ ++ dsc->sc_enabled = 1; ++ ++ /* ++ * Do generic NE2000 attach. This will read the station address ++ * from the EEPROM. ++ */ ++ ne2000_attach(nsc, NULL); ++ ++ /* Establish the interrupt handler. */ ++/// isc->sc_ih = dppbus_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, ++/// IPL_NET, dp8390_intr, dsc); ++/// if (isc->sc_ih == NULL) ++/// printf("%s: couldn't establish interrupt handler\n", ++/// dsc->sc_dev.dv_xname); ++} ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +--- /dev/null Sat Jun 15 12:20:06 2002 ++++ sys/arch/dreamcast/dreamcast/disksubr.c Fri May 17 17:40:38 2002 +@@ -0,0 +1,518 @@ ++/* $NetBSD: disksubr.c,v 1.44 2001/11/15 07:03:29 lukem Exp $ */ ++ ++/* ++ * Copyright (c) 1982, 1986, 1988 Regents of the University of California. ++ * 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. All advertising materials mentioning features or use of this software ++ * must display the following acknowledgement: ++ * This product includes software developed by the University of ++ * California, Berkeley and its contributors. ++ * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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. ++ * ++ * @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91 ++ */ ++ ++#include ++__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.44 2001/11/15 07:03:29 lukem Exp $"); ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "opt_mbr.h" ++ ++int fat_types[] = { MBR_PTYPE_FAT12, MBR_PTYPE_FAT16S, ++ MBR_PTYPE_FAT16B, MBR_PTYPE_FAT32, ++ MBR_PTYPE_FAT32L, MBR_PTYPE_FAT16L, ++ -1 }; ++ ++#define NO_MBR_SIGNATURE ((struct mbr_partition *) -1) ++ ++static struct mbr_partition * ++mbr_findslice __P((struct mbr_partition* dp, struct buf *bp)); ++ ++/* ++ * Scan MBR for NetBSD partittion. Return NO_MBR_SIGNATURE if no MBR found ++ * Otherwise, copy valid MBR partition-table into dp, and if a NetBSD ++ * partition is found, return a pointer to it; else return NULL. ++ */ ++static ++struct mbr_partition * ++mbr_findslice(dp, bp) ++ struct mbr_partition *dp; ++ struct buf *bp; ++{ ++ struct mbr_partition *ourdp = NULL; ++ u_int16_t *mbrmagicp; ++ int i; ++ ++ /* Note: Magic number is little-endian. */ ++ mbrmagicp = (u_int16_t *)(bp->b_data + MBR_MAGICOFF); ++ if (*mbrmagicp != MBR_MAGIC) ++ return (NO_MBR_SIGNATURE); ++ ++ /* XXX how do we check veracity/bounds of this? */ ++ memcpy(dp, bp->b_data + MBR_PARTOFF, NMBRPART * sizeof(*dp)); ++ ++ /* look for NetBSD partition */ ++ for (i = 0; i < NMBRPART; i++) { ++ if (dp[i].mbrp_typ == MBR_PTYPE_NETBSD) { ++ ourdp = &dp[i]; ++ break; ++ } ++ } ++ ++#ifdef COMPAT_386BSD_MBRPART ++ /* didn't find it -- look for 386BSD partition */ ++ if (!ourdp) { ++ for (i = 0; i < NMBRPART; i++) { ++ if (dp[i].mbrp_typ == MBR_PTYPE_386BSD) { ++ printf("WARNING: old BSD partition ID!\n"); ++ ourdp = &dp[i]; ++ /* ++ * If more than one matches, take last, ++ * as NetBSD install tool does. ++ */ ++#if 0 ++ break; ++#endif ++ } ++ } ++ } ++#endif /* COMPAT_386BSD_MBRPART */ ++ ++ return (ourdp); ++} ++ ++ ++/* ++ * Attempt to read a disk label from a device ++ * using the indicated stategy routine. ++ * The label must be partly set up before this: ++ * secpercyl, secsize and anything required for a block i/o read ++ * operation in the driver's strategy/start routines ++ * must be filled in before calling us. ++ * ++ * If dos partition table requested, attempt to load it and ++ * find disklabel inside a DOS partition. Also, if bad block ++ * table needed, attempt to extract it as well. Return buffer ++ * for use in signalling errors if requested. ++ * ++ * Returns null on success and an error string on failure. ++ */ ++char * ++readdisklabel(dev, strat, lp, osdep) ++ dev_t dev; ++ void (*strat) __P((struct buf *)); ++ struct disklabel *lp; ++ struct cpu_disklabel *osdep; ++{ ++ struct mbr_partition *dp; ++ struct partition *pp; ++ struct dkbad *bdp; ++ struct buf *bp; ++ struct disklabel *dlp; ++ char *msg = NULL; ++ int dospartoff, cyl, i, *ip; ++ ++ /* minimal requirements for archtypal disk label */ ++ if (lp->d_secsize == 0) ++ lp->d_secsize = DEV_BSIZE; ++ if (lp->d_secperunit == 0) ++ lp->d_secperunit = 0x1fffffff; ++#if 0 ++ if (lp->d_ncylinders == 16383) { ++ printf("disklabel: Disk > 8G ... readjusting chs %d/%d/%d to ", ++ lp->d_ncylinders, lp->d_ntracks, lp->d_nsectors); ++ lp->d_ncylinders = lp->d_secperunit / lp->d_ntracks / lp->d_nsectors; ++ printf("%d/%d/%d\n", ++ lp->d_ncylinders, lp->d_ntracks, lp->d_nsectors); ++ } ++#endif ++ lp->d_npartitions = RAW_PART + 1; ++ for (i = 0; i < RAW_PART; i++) { ++ lp->d_partitions[i].p_size = 0; ++ lp->d_partitions[i].p_offset = 0; ++ } ++ if (lp->d_partitions[i].p_size == 0) ++ lp->d_partitions[i].p_size = 0x1fffffff; ++ lp->d_partitions[i].p_offset = 0; ++ ++ /* get a buffer and initialize it */ ++ bp = geteblk((int)lp->d_secsize); ++ bp->b_dev = dev; ++ ++ /* do dos partitions in the process of getting disklabel? */ ++ dospartoff = 0; ++ cyl = LABELSECTOR / lp->d_secpercyl; ++ if (!osdep) ++ goto nombrpart; ++ dp = osdep->dosparts; ++ ++ /* read master boot record */ ++ bp->b_blkno = MBR_BBSECTOR; ++ bp->b_bcount = lp->d_secsize; ++ bp->b_flags |= B_READ; ++ bp->b_cylinder = MBR_BBSECTOR / lp->d_secpercyl; ++ (*strat)(bp); ++ ++ /* if successful, wander through dos partition table */ ++ if (biowait(bp)) { ++ msg = "dos partition I/O error"; ++ goto done; ++ } else { ++ struct mbr_partition *ourdp = NULL; ++ ++ ourdp = mbr_findslice(dp, bp); ++ if (ourdp == NO_MBR_SIGNATURE) ++ goto nombrpart; ++ ++ for (i = 0; i < NMBRPART; i++, dp++) { ++ /* Install in partition e, f, g, or h. */ ++ pp = &lp->d_partitions[RAW_PART + 1 + i]; ++ pp->p_offset = dp->mbrp_start; ++ pp->p_size = dp->mbrp_size; ++ for (ip = fat_types; *ip != -1; ip++) { ++ if (dp->mbrp_typ == *ip) ++ pp->p_fstype = FS_MSDOS; ++ } ++ if (dp->mbrp_typ == MBR_PTYPE_LNXEXT2) ++ pp->p_fstype = FS_EX2FS; ++ ++ if (dp->mbrp_typ == MBR_PTYPE_NTFS) ++ pp->p_fstype = FS_NTFS; ++ ++ /* is this ours? */ ++ if (dp == ourdp) { ++ /* need sector address for SCSI/IDE, ++ cylinder for ESDI/ST506/RLL */ ++ dospartoff = dp->mbrp_start; ++ cyl = MBR_PCYL(dp->mbrp_scyl, dp->mbrp_ssect); ++ ++ /* update disklabel with details */ ++ lp->d_partitions[2].p_size = ++ dp->mbrp_size; ++ lp->d_partitions[2].p_offset = ++ dp->mbrp_start; ++#if 0 ++ if (lp->d_ntracks != dp->mbrp_ehd + 1 || ++ lp->d_nsectors != DPSECT(dp->mbrp_esect)) { ++ printf("disklabel: BIOS sees chs %d/%d/%d as ", ++ lp->d_ncylinders, lp->d_ntracks, ++ lp->d_nsectors); ++ lp->d_ntracks = dp->mbrp_ehd + 1; ++ lp->d_nsectors = DPSECT(dp->mbrp_esect); ++ lp->d_secpercyl = lp->d_ntracks * lp->d_nsectors; ++ lp->d_ncylinders = lp->d_secperunit / lp->d_secpercyl; ++ if (! lp->d_ncylinders) ++ lp->d_ncylinders = 1; ++ printf("%d/%d/%d\n", ++ lp->d_ncylinders, lp->d_ntracks, ++ lp->d_nsectors); ++ } ++#endif ++ } ++ } ++ lp->d_npartitions = RAW_PART + 1 + i; ++ } ++ ++nombrpart: ++ /* next, dig out disk label */ ++ bp->b_blkno = dospartoff + LABELSECTOR; ++ bp->b_cylinder = cyl; ++ bp->b_bcount = lp->d_secsize; ++ bp->b_flags &= ~(B_DONE); ++ bp->b_flags |= B_READ; ++ (*strat)(bp); ++ ++ /* if successful, locate disk label within block and validate */ ++ if (biowait(bp)) { ++ msg = "disk label I/O error"; ++ goto done; ++ } ++ for (dlp = (struct disklabel *)bp->b_data; ++ dlp <= (struct disklabel *)(bp->b_data + lp->d_secsize - sizeof(*dlp)); ++ dlp = (struct disklabel *)((char *)dlp + sizeof(long))) { ++ if (dlp->d_magic != DISKMAGIC || dlp->d_magic2 != DISKMAGIC) { ++ if (msg == NULL) ++ msg = "no disk label"; ++ } else if (dlp->d_npartitions > MAXPARTITIONS || ++ dkcksum(dlp) != 0) ++ msg = "disk label corrupted"; ++ else { ++ *lp = *dlp; ++ msg = NULL; ++ break; ++ } ++ } ++ ++ if (msg) ++ goto done; ++ ++ /* obtain bad sector table if requested and present */ ++ if (osdep && (lp->d_flags & D_BADSECT)) { ++ struct dkbad *db; ++ ++ bdp = &osdep->bad; ++ i = 0; ++ do { ++ /* read a bad sector table */ ++ bp->b_flags &= ~(B_DONE); ++ bp->b_flags |= B_READ; ++ bp->b_blkno = lp->d_secperunit - lp->d_nsectors + i; ++ if (lp->d_secsize > DEV_BSIZE) ++ bp->b_blkno *= lp->d_secsize / DEV_BSIZE; ++ else ++ bp->b_blkno /= DEV_BSIZE / lp->d_secsize; ++ bp->b_bcount = lp->d_secsize; ++ bp->b_cylinder = lp->d_ncylinders - 1; ++ (*strat)(bp); ++ ++ /* if successful, validate, otherwise try another */ ++ if (biowait(bp)) { ++ msg = "bad sector table I/O error"; ++ } else { ++ db = (struct dkbad *)(bp->b_data); ++#define DKBAD_MAGIC 0x4321 ++ if (db->bt_mbz == 0 ++ && db->bt_flag == DKBAD_MAGIC) { ++ msg = NULL; ++ *bdp = *db; ++ break; ++ } else ++ msg = "bad sector table corrupted"; ++ } ++ } while ((bp->b_flags & B_ERROR) && (i += 2) < 10 && ++ i < lp->d_nsectors); ++ } ++ ++done: ++ brelse(bp); ++ return (msg); ++} ++ ++/* ++ * Check new disk label for sensibility ++ * before setting it. ++ */ ++int ++setdisklabel(olp, nlp, openmask, osdep) ++ struct disklabel *olp, *nlp; ++ u_long openmask; ++ struct cpu_disklabel *osdep; ++{ ++ int i; ++ struct partition *opp, *npp; ++ ++ /* sanity clause */ ++ if (nlp->d_secpercyl == 0 || nlp->d_secsize == 0 ++ || (nlp->d_secsize % DEV_BSIZE) != 0) ++ return(EINVAL); ++ ++ /* special case to allow disklabel to be invalidated */ ++ if (nlp->d_magic == 0xffffffff) { ++ *olp = *nlp; ++ return (0); ++ } ++ ++ if (nlp->d_magic != DISKMAGIC || nlp->d_magic2 != DISKMAGIC || ++ dkcksum(nlp) != 0) ++ return (EINVAL); ++ ++ /* XXX missing check if other dos partitions will be overwritten */ ++ ++ while (openmask != 0) { ++ i = ffs(openmask) - 1; ++ openmask &= ~(1 << i); ++ if (nlp->d_npartitions <= i) ++ return (EBUSY); ++ opp = &olp->d_partitions[i]; ++ npp = &nlp->d_partitions[i]; ++ if (npp->p_offset != opp->p_offset || npp->p_size < opp->p_size) ++ return (EBUSY); ++ /* ++ * Copy internally-set partition information ++ * if new label doesn't include it. XXX ++ */ ++ if (npp->p_fstype == FS_UNUSED && opp->p_fstype != FS_UNUSED) { ++ npp->p_fstype = opp->p_fstype; ++ npp->p_fsize = opp->p_fsize; ++ npp->p_frag = opp->p_frag; ++ npp->p_cpg = opp->p_cpg; ++ } ++ } ++ nlp->d_checksum = 0; ++ nlp->d_checksum = dkcksum(nlp); ++ *olp = *nlp; ++ return (0); ++} ++ ++ ++/* ++ * Write disk label back to device after modification. ++ */ ++int ++writedisklabel(dev, strat, lp, osdep) ++ dev_t dev; ++ void (*strat) __P((struct buf *)); ++ struct disklabel *lp; ++ struct cpu_disklabel *osdep; ++{ ++ struct mbr_partition *dp; ++ struct buf *bp; ++ struct disklabel *dlp; ++ int error, dospartoff, cyl; ++ ++ /* get a buffer and initialize it */ ++ bp = geteblk((int)lp->d_secsize); ++ bp->b_dev = dev; ++ ++ /* do dos partitions in the process of getting disklabel? */ ++ dospartoff = 0; ++ cyl = LABELSECTOR / lp->d_secpercyl; ++ if (!osdep) ++ goto nombrpart; ++ dp = osdep->dosparts; ++ ++ /* read master boot record */ ++ bp->b_blkno = MBR_BBSECTOR; ++ bp->b_bcount = lp->d_secsize; ++ bp->b_flags |= B_READ; ++ bp->b_cylinder = MBR_BBSECTOR / lp->d_secpercyl; ++ (*strat)(bp); ++ ++ if ((error = biowait(bp)) == 0) { ++ struct mbr_partition *ourdp = NULL; ++ ++ ourdp = mbr_findslice(dp, bp); ++ if (ourdp == NO_MBR_SIGNATURE) ++ goto nombrpart; ++ ++ if (ourdp) { ++ /* need sector address for SCSI/IDE, ++ cylinder for ESDI/ST506/RLL */ ++ dospartoff = ourdp->mbrp_start; ++ cyl = MBR_PCYL(ourdp->mbrp_scyl, ourdp->mbrp_ssect); ++ } ++ } ++ ++nombrpart: ++#ifdef maybe ++ /* disklabel in appropriate location? */ ++ if (lp->d_partitions[2].p_offset != 0 ++ && lp->d_partitions[2].p_offset != dospartoff) { ++ error = EXDEV; ++ goto done; ++ } ++#endif ++ ++ /* next, dig out disk label */ ++ bp->b_blkno = dospartoff + LABELSECTOR; ++ bp->b_cylinder = cyl; ++ bp->b_bcount = lp->d_secsize; ++ bp->b_flags &= ~(B_DONE); ++ bp->b_flags |= B_READ; ++ (*strat)(bp); ++ ++ /* if successful, locate disk label within block and validate */ ++ if ((error = biowait(bp)) != 0) ++ goto done; ++ for (dlp = (struct disklabel *)bp->b_data; ++ dlp <= (struct disklabel *)(bp->b_data + lp->d_secsize - sizeof(*dlp)); ++ dlp = (struct disklabel *)((char *)dlp + sizeof(long))) { ++ if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC && ++ dkcksum(dlp) == 0) { ++ *dlp = *lp; ++ bp->b_flags &= ~(B_READ|B_DONE); ++ bp->b_flags |= B_WRITE; ++ (*strat)(bp); ++ error = biowait(bp); ++ goto done; ++ } ++ } ++ error = ESRCH; ++ ++done: ++ brelse(bp); ++ return (error); ++} ++ ++/* ++ * Determine the size of the transfer, and make sure it is ++ * within the boundaries of the partition. Adjust transfer ++ * if needed, and signal errors or early completion. ++ */ ++int ++bounds_check_with_label(bp, lp, wlabel) ++ struct buf *bp; ++ struct disklabel *lp; ++ int wlabel; ++{ ++ struct partition *p = lp->d_partitions + DISKPART(bp->b_dev); ++ int labelsector = lp->d_partitions[2].p_offset + LABELSECTOR; ++ int sz; ++ ++ sz = howmany(bp->b_bcount, lp->d_secsize); ++ ++ if (bp->b_blkno + sz > p->p_size) { ++ sz = p->p_size - bp->b_blkno; ++ if (sz == 0) { ++ /* If exactly at end of disk, return EOF. */ ++ bp->b_resid = bp->b_bcount; ++ goto done; ++ } ++ if (sz < 0) { ++ /* If past end of disk, return EINVAL. */ ++ bp->b_error = EINVAL; ++ goto bad; ++ } ++ /* Otherwise, truncate request. */ ++ bp->b_bcount = sz << DEV_BSHIFT; ++ } ++ ++ /* Overwriting disk label? */ ++ if (bp->b_blkno + p->p_offset <= labelsector && ++#if LABELSECTOR != 0 ++ bp->b_blkno + p->p_offset + sz > labelsector && ++#endif ++ (bp->b_flags & B_READ) == 0 && !wlabel) { ++ bp->b_error = EROFS; ++ goto bad; ++ } ++ ++ /* calculate cylinder for disksort to order transfers with */ ++ bp->b_cylinder = (bp->b_blkno + p->p_offset) / ++ (lp->d_secsize / DEV_BSIZE) / lp->d_secpercyl; ++ return (1); ++ ++bad: ++ bp->b_flags |= B_ERROR; ++done: ++ return (0); ++} +--- sys/arch/dreamcast.orig/conf/files.dreamcast Thu Apr 18 20:39:29 2002 ++++ sys/arch/dreamcast/conf/files.dreamcast Fri May 17 17:34:31 2002 +@@ -16,7 +16,7 @@ + file arch/dreamcast/dreamcast/machdep.c + file arch/dreamcast/dreamcast/autoconf.c + file arch/dreamcast/dreamcast/clock_machdep.c +-file arch/sh3/sh3/disksubr.c disk ++file arch/dreamcast/dreamcast/disksubr.c disk + + defparam opt_memsize.h IOM_ROM_BEGIN IOM_ROM_SIZE IOM_RAM_BEGIN IOM_RAM_SIZE + +@@ -88,3 +88,25 @@ + file arch/dreamcast/dev/g2/gapspci.c gapspci + file arch/dreamcast/dev/g2/gapspci_dma.c gapspci + file arch/dreamcast/dev/g2/gapspci_pci.c gapspci ++ ++device dppbus { [port = -1], [irq = -1] } ++attach dppbus at shb ++file arch/dreamcast/dev/dpp/dppbus.c dppbus ++file arch/dreamcast/dev/dpp/dppbus_bus_mem.c dppbus ++ ++attach wdc at dppbus with wdc_dppbus ++file arch/dreamcast/dev/dpp/wdc_dppbus.c wdc_dppbus ++ ++attach ne at dppbus with ne_dppbus: rtl80x9 ++file arch/dreamcast/dev/dpp/if_ne_dppbus.c ne_dppbus ++ ++attach com at dppbus with com_dppbus ++file arch/dreamcast/dev/dpp/com_dppbus.c com_dppbus ++ ++include "dev/usb/files.usb" ++ ++device slhc: usbus ++file /home/ikehara/dev/usb/slhc.c slhc needs-flag ++attach slhc at dppbus with slhc_dppbus ++file /home/ikehara/dev/dppbus/slhc_dppbus.c slhc_dppbus ++ +--- sys/arch/dreamcast.orig/conf/shl.x Fri Apr 26 20:27:21 2002 ++++ sys/arch/dreamcast/conf/shl.x Sat May 18 12:01:10 2002 +@@ -1,6 +1,7 @@ + /* $NetBSD: shl.x,v 1.7 2002/04/25 17:02:41 uch Exp $ */ + +-OUTPUT_FORMAT("elf32-shl-nbsd") ++/*OUTPUT_FORMAT("elf32-shl-nbsd")*/ ++OUTPUT_FORMAT("coff-shl") + OUTPUT_ARCH(sh) + ENTRY(start) + diff --git a/G2BUS/SCHS/dd-lan/dcext020616.vhd b/G2BUS/SCHS/dd-lan/dcext020616.vhd new file mode 100644 index 00000000..1f8293c9 --- /dev/null +++ b/G2BUS/SCHS/dd-lan/dcext020616.vhd @@ -0,0 +1,203 @@ +-- +-- Copyright (c) 2002 Kiyoshi Ikehara, Nagoya University Amateur Raido Club. +-- 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. All advertising materials mentioning features or use of this software +-- must display the following acknowledgement: +-- This product includes software developed by Nagoya University +-- Amateur Raido Club and its contributors. +-- 4. Neither the name of the Club nor the names of its contributors +-- may be used to endorse or promote products derived from this software +-- without specific prior written permission. +-- + +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; + +entity DCEXT is + port( + DC_AD: inout std_logic_vector(15 downto 0); + DC_nEN: in std_logic; + DC_nDATEN: in std_logic; + DC_DIR: in std_logic; + DC_CLK: in std_logic; + DC_nINT: out std_logic; + ISA_A: out std_logic_vector(9 downto 0); + ISA_IRQ: in std_logic_vector(3 downto 0); + ISA_RST: out std_logic; + ISA_nRD: out std_logic; + ISA_nWD: out std_logic; + ISA_nG: out std_logic; + bufdir: out std_logic; + nRD: out std_logic; + nWD: out std_logic; + IDE_CS0: out std_logic; + IDE_CS1: out std_logic; + IDE_IRQ: in std_logic; + IDE_nRD: out std_logic; + IDE_nWD: out std_logic; + IDE_nG: out std_logic; + IDE_D: inout std_logic_vector(15 downto 0); + NC: out std_logic_vector(4 downto 0) + ); +end DCEXT; + + +architecture RTL of DCEXT is + +signal A: std_logic_vector(31 downto 0); +signal IRQ_CS: std_logic; +signal ACS: std_logic_vector(3 downto 0); +signal IRQSET: std_logic_vector(4 downto 0); +signal ISA_CS: std_logic; +signal IDE_CS: std_logic; +signal TEST_CS0: std_logic; +signal TEST_CS1: std_logic; +signal RD, WD: std_logic; +signal RD2, WD2: std_logic; +signal DIR: std_logic; +signal DATAEN: std_logic; +signal DCD: std_logic_vector(15 downto 0); +signal MODE: std_logic_vector(3 downto 0); +signal DRIVE: std_logic; +signal ACTIVE: std_logic; + +constant ADDR_ISA: std_logic_vector(3 downto 0) := "0000"; +constant ADDR_IDE: std_logic_vector(3 downto 0) := "0001"; +constant ADDR_IRQ: std_logic_vector(3 downto 0) := "1100"; +constant ADDR_MODE: std_logic_vector(3 downto 0) := "1111"; + +signal STATE: std_logic_vector(1 downto 0); +signal NEXTSTATE: std_logic_vector(1 downto 0); +signal IN_ADDRLOW: std_logic; +signal IN_ADDRHIGH: std_logic; +signal IN_DATALOW: std_logic; +signal IN_DATAHIGH: std_logic; +constant ADDRLOW: std_logic_vector(1 downto 0) := "00"; +constant ADDRHIGH: std_logic_vector(1 downto 0) := "01"; +constant DATALOW: std_logic_vector(1 downto 0) := "11"; +constant DATAHIGH: std_logic_vector(1 downto 0) := "10"; + +begin + + -- tri-state + ACTIVE <= '1' when A(31 downto 16) = X"1400" else '0'; + DRIVE <= DIR and IN_DATALOW and ACTIVE and (not ISA_CS); + DC_AD <= DCD when DRIVE = '1' else (others => 'Z'); + + -- "A" latch -> ISA address + ISA_A <= A(11 downto 2); + ACS <= A(15 downto 12); + + -- + IN_ADDRLOW <= '1' when STATE = ADDRLOW else '0'; + IN_ADDRHIGH <= '1' when STATE = ADDRHIGH else '0'; + IN_DATALOW <= '1' when STATE = DATALOW else '0'; + IN_DATAHIGH <= '1' when STATE = DATAHIGH else '0'; + + -- irqs + IRQSET <= (IDE_IRQ) & ISA_IRQ; + + -- interrupt + DC_nINT <= '1' when (IRQSET = "00000") else '0'; + + -- read / write + RD <= DIR and (IN_ADDRHIGH or IN_DATALOW); + WD <= (not DIR) and (IN_ADDRHIGH or IN_DATALOW); + nRD <= not RD; + nWD <= not WD; + IDE_nRD <= not RD; + IDE_nWD <= not WD; + + RD2 <= DIR and (IN_ADDRHIGH or IN_DATALOW); + WD2 <= (not DIR) and (IN_ADDRHIGH or IN_DATALOW); + ISA_nRD <= not (RD2 and ISA_CS); -- ISA_RD <= RD and ISA_CS + ISA_nWD <= not (WD2 and ISA_CS); -- ISA_WD <= WD and ISA_CS + + -- bus EN + DATAEN <= IN_DATALOW or IN_DATAHIGH; + ISA_nG <= not (ISA_CS and DATAEN); + bufdir <= not DIR; + IDE_nG <= not (IDE_CS and IN_DATALOW); -- obsolete + + -- IDE data + process(WD, ACS, DC_AD) begin + if(WD = '1' and IN_DATALOW = '1') then + case ACS is + when ADDR_IDE => IDE_D <= DC_AD; + when others => IDE_D <= (others => 'Z'); -- not selected + end case; + else + IDE_D <= (others => 'Z'); + end if; + end process; + + -- Clock + process(DC_CLK) begin + if(DC_CLK'event and DC_CLK='1') then + STATE <= NEXTSTATE; + end if; + end process; + + -- State + process(STATE, DC_CLK, ACS, DC_nEN, ACTIVE, IDE_D, IRQSET, MODE) begin + case STATE is + when ADDRLOW => + if((DC_CLK'event and DC_CLK='0') and DC_nEN='0') then + A(15 downto 0) <= DC_AD; + DIR <= DC_DIR; + end if; + if(DC_nEN='0') then + NEXTSTATE <= ADDRHIGH; + else + NEXTSTATE <= ADDRLOW; + end if; + when ADDRHIGH => + if(DC_CLK'event and DC_CLK='0') then + A(31 downto 16) <= DC_AD; + end if; + NEXTSTATE <= DATALOW; + when DATALOW => + if(ACTIVE = '1') then + case ACS is + when ADDR_IDE => DCD <= IDE_D; + when ADDR_IRQ => DCD <= X"00" & "000" & IRQSET; -- IRQ_CS + when ADDR_MODE => + DCD <= X"000" & MODE; + if((DC_CLK'event and DC_CLK='0') and DIR='0') then + MODE <= DC_AD(3 downto 0); + end if; + when others => DCD <= X"0000"; -- not selected + end case; + end if; + NEXTSTATE <= DATAHIGH; + when DATAHIGH => + NEXTSTATE <= ADDRLOW; + when others => NEXTSTATE <= ADDRLOW; + end case; + end process; + + -- CS -> each CS + IDE_CS0 <= '0' when (ACS&A(11) = ADDR_IDE&'0') else '1'; + IDE_CS1 <= '0' when (ACS&A(11) = ADDR_IDE&'1') else '1'; + IDE_CS <= '1' when ACS = ADDR_IDE else '0'; + ISA_CS <= '1' when ACS = ADDR_ISA else '0'; + IRQ_CS <= '1' when ACS = ADDR_IRQ else '0'; + + ISA_RST <= MODE(0); + + NC <= (others => 'Z'); + +end RTL; + + diff --git a/G2BUS/SCHS/dd-lan/dcext11.pcb b/G2BUS/SCHS/dd-lan/dcext11.pcb new file mode 100644 index 00000000..15cacd9a --- /dev/null +++ b/G2BUS/SCHS/dd-lan/dcext11.pcb @@ -0,0 +1,2846 @@ +# release: pcb 1.7.1.ALPHA +# date: Wed Nov 27 20:17:47 2002 +# user: fbk (Masaki Satake (JH3FBK),,,) +# host: echo + +PCB("" 4000 6100) + +Grid(5 0 0 1) +Cursor(1215 2365 1) +Flags(0x000000d0) +Groups("1,3,4,s:2,c:5:6:7:8:") +Styles("Signal,10,40,20:Power,25,60,35:Fat,40,60,35:Skinny,8,36,20") + +Symbol(' ' 18) +( +) +Symbol('!' 12) +( + SymbolLine(0 35 0 40 8) + SymbolLine(0 0 0 25 8) +) +Symbol('"' 12) +( + SymbolLine(0 0 0 10 8) + SymbolLine(10 0 10 10 8) +) +Symbol('#' 12) +( + SymbolLine(0 25 20 25 8) + SymbolLine(0 15 20 15 8) + SymbolLine(15 10 15 30 8) + SymbolLine(5 10 5 30 8) +) +Symbol('$' 12) +( + SymbolLine(15 5 20 10 8) + SymbolLine(5 5 15 5 8) + SymbolLine(0 10 5 5 8) + SymbolLine(0 10 0 15 8) + SymbolLine(0 15 5 20 8) + SymbolLine(5 20 15 20 8) + SymbolLine(15 20 20 25 8) + SymbolLine(20 25 20 30 8) + SymbolLine(15 35 20 30 8) + SymbolLine(5 35 15 35 8) + SymbolLine(0 30 5 35 8) + SymbolLine(10 0 10 40 8) +) +Symbol('%' 12) +( + SymbolLine(0 5 0 10 8) + SymbolLine(0 5 5 0 8) + SymbolLine(5 0 10 0 8) + SymbolLine(10 0 15 5 8) + SymbolLine(15 5 15 10 8) + SymbolLine(10 15 15 10 8) + SymbolLine(5 15 10 15 8) + SymbolLine(0 10 5 15 8) + SymbolLine(0 40 40 0 8) + SymbolLine(35 40 40 35 8) + SymbolLine(40 30 40 35 8) + SymbolLine(35 25 40 30 8) + SymbolLine(30 25 35 25 8) + SymbolLine(25 30 30 25 8) + SymbolLine(25 30 25 35 8) + SymbolLine(25 35 30 40 8) + SymbolLine(30 40 35 40 8) +) +Symbol('&' 12) +( + SymbolLine(0 35 5 40 8) + SymbolLine(0 5 0 15 8) + SymbolLine(0 5 5 0 8) + SymbolLine(0 25 15 10 8) + SymbolLine(5 40 10 40 8) + SymbolLine(10 40 20 30 8) + SymbolLine(0 15 25 40 8) + SymbolLine(5 0 10 0 8) + SymbolLine(10 0 15 5 8) + SymbolLine(15 5 15 10 8) + SymbolLine(0 25 0 35 8) +) +Symbol(''' 12) +( + SymbolLine(0 10 10 0 8) +) +Symbol('(' 12) +( + SymbolLine(0 35 5 40 8) + SymbolLine(0 5 5 0 8) + SymbolLine(0 5 0 35 8) +) +Symbol(')' 12) +( + SymbolLine(0 0 5 5 8) + SymbolLine(5 5 5 35 8) + SymbolLine(0 40 5 35 8) +) +Symbol('*' 12) +( + SymbolLine(0 10 20 30 8) + SymbolLine(0 30 20 10 8) + SymbolLine(0 20 20 20 8) + SymbolLine(10 10 10 30 8) +) +Symbol('+' 12) +( + SymbolLine(0 20 20 20 8) + SymbolLine(10 10 10 30 8) +) +Symbol(',' 12) +( + SymbolLine(0 50 10 40 8) +) +Symbol('-' 12) +( + SymbolLine(0 20 20 20 8) +) +Symbol('.' 12) +( + SymbolLine(0 40 5 40 8) +) +Symbol('/' 12) +( + SymbolLine(0 35 30 5 8) +) +Symbol('0' 12) +( + SymbolLine(0 35 5 40 8) + SymbolLine(0 5 0 35 8) + SymbolLine(0 5 5 0 8) + SymbolLine(5 0 15 0 8) + SymbolLine(15 0 20 5 8) + SymbolLine(20 5 20 35 8) + SymbolLine(15 40 20 35 8) + SymbolLine(5 40 15 40 8) + SymbolLine(0 30 20 10 8) +) +Symbol('1' 12) +( + SymbolLine(5 40 15 40 8) + SymbolLine(10 0 10 40 8) + SymbolLine(0 10 10 0 8) +) +Symbol('2' 12) +( + SymbolLine(0 5 5 0 8) + SymbolLine(5 0 20 0 8) + SymbolLine(20 0 25 5 8) + SymbolLine(25 5 25 15 8) + SymbolLine(0 40 25 15 8) + SymbolLine(0 40 25 40 8) +) +Symbol('3' 12) +( + SymbolLine(0 5 5 0 8) + SymbolLine(5 0 15 0 8) + SymbolLine(15 0 20 5 8) + SymbolLine(20 5 20 35 8) + SymbolLine(15 40 20 35 8) + SymbolLine(5 40 15 40 8) + SymbolLine(0 35 5 40 8) + SymbolLine(5 20 20 20 8) +) +Symbol('4' 12) +( + SymbolLine(0 20 20 0 8) + SymbolLine(0 20 25 20 8) + SymbolLine(20 0 20 40 8) +) +Symbol('5' 12) +( + SymbolLine(0 0 20 0 8) + SymbolLine(0 0 0 20 8) + SymbolLine(0 20 5 15 8) + SymbolLine(5 15 15 15 8) + SymbolLine(15 15 20 20 8) + SymbolLine(20 20 20 35 8) + SymbolLine(15 40 20 35 8) + SymbolLine(5 40 15 40 8) + SymbolLine(0 35 5 40 8) +) +Symbol('6' 12) +( + SymbolLine(15 0 20 5 8) + SymbolLine(5 0 15 0 8) + SymbolLine(0 5 5 0 8) + SymbolLine(0 5 0 35 8) + SymbolLine(0 35 5 40 8) + SymbolLine(15 20 20 25 8) + SymbolLine(0 20 15 20 8) + SymbolLine(5 40 15 40 8) + SymbolLine(15 40 20 35 8) + SymbolLine(20 25 20 35 8) +) +Symbol('7' 12) +( + SymbolLine(0 40 25 15 8) + SymbolLine(25 0 25 15 8) + SymbolLine(0 0 25 0 8) +) +Symbol('8' 12) +( + SymbolLine(0 35 5 40 8) + SymbolLine(0 25 0 35 8) + SymbolLine(0 25 5 20 8) + SymbolLine(5 20 15 20 8) + SymbolLine(15 20 20 25 8) + SymbolLine(20 25 20 35 8) + SymbolLine(15 40 20 35 8) + SymbolLine(5 40 15 40 8) + SymbolLine(0 15 5 20 8) + SymbolLine(0 5 0 15 8) + SymbolLine(0 5 5 0 8) + SymbolLine(5 0 15 0 8) + SymbolLine(15 0 20 5 8) + SymbolLine(20 5 20 15 8) + SymbolLine(15 20 20 15 8) +) +Symbol('9' 12) +( + SymbolLine(0 40 20 20 8) + SymbolLine(20 5 20 20 8) + SymbolLine(15 0 20 5 8) + SymbolLine(5 0 15 0 8) + SymbolLine(0 5 5 0 8) + SymbolLine(0 5 0 15 8) + SymbolLine(0 15 5 20 8) + SymbolLine(5 20 20 20 8) +) +Symbol(':' 12) +( + SymbolLine(0 15 5 15 8) + SymbolLine(0 25 5 25 8) +) +Symbol(';' 12) +( + SymbolLine(0 40 10 30 8) + SymbolLine(10 15 10 20 8) +) +Symbol('<' 12) +( + SymbolLine(0 20 10 10 8) + SymbolLine(0 20 10 30 8) +) +Symbol('=' 12) +( + SymbolLine(0 15 20 15 8) + SymbolLine(0 25 20 25 8) +) +Symbol('>' 12) +( + SymbolLine(0 10 10 20 8) + SymbolLine(0 30 10 20 8) +) +Symbol('?' 12) +( + SymbolLine(10 20 10 25 8) + SymbolLine(10 35 10 40 8) + SymbolLine(0 5 0 10 8) + SymbolLine(0 5 5 0 8) + SymbolLine(5 0 15 0 8) + SymbolLine(15 0 20 5 8) + SymbolLine(20 5 20 10 8) + SymbolLine(10 20 20 10 8) +) +Symbol('A' 12) +( + SymbolLine(0 5 0 40 8) + SymbolLine(0 5 5 0 8) + SymbolLine(5 0 20 0 8) + SymbolLine(20 0 25 5 8) + SymbolLine(25 5 25 40 8) + SymbolLine(0 20 25 20 8) +) +Symbol('B' 12) +( + SymbolLine(0 40 20 40 8) + SymbolLine(20 40 25 35 8) + SymbolLine(25 25 25 35 8) + SymbolLine(20 20 25 25 8) + SymbolLine(5 20 20 20 8) + SymbolLine(5 0 5 40 8) + SymbolLine(0 0 20 0 8) + SymbolLine(20 0 25 5 8) + SymbolLine(25 5 25 15 8) + SymbolLine(20 20 25 15 8) +) +Symbol('C' 12) +( + SymbolLine(5 40 20 40 8) + SymbolLine(0 35 5 40 8) + SymbolLine(0 5 0 35 8) + SymbolLine(0 5 5 0 8) + SymbolLine(5 0 20 0 8) +) +Symbol('D' 12) +( + SymbolLine(5 0 5 40 8) + SymbolLine(20 0 25 5 8) + SymbolLine(25 5 25 35 8) + SymbolLine(20 40 25 35 8) + SymbolLine(0 40 20 40 8) + SymbolLine(0 0 20 0 8) +) +Symbol('E' 12) +( + SymbolLine(0 20 15 20 8) + SymbolLine(0 40 20 40 8) + SymbolLine(0 0 0 40 8) + SymbolLine(0 0 20 0 8) +) +Symbol('F' 12) +( + SymbolLine(0 0 0 40 8) + SymbolLine(0 0 20 0 8) + SymbolLine(0 20 15 20 8) +) +Symbol('G' 12) +( + SymbolLine(20 0 25 5 8) + SymbolLine(5 0 20 0 8) + SymbolLine(0 5 5 0 8) + SymbolLine(0 5 0 35 8) + SymbolLine(0 35 5 40 8) + SymbolLine(5 40 20 40 8) + SymbolLine(20 40 25 35 8) + SymbolLine(25 25 25 35 8) + SymbolLine(20 20 25 25 8) + SymbolLine(10 20 20 20 8) +) +Symbol('H' 12) +( + SymbolLine(0 0 0 40 8) + SymbolLine(25 0 25 40 8) + SymbolLine(0 20 25 20 8) +) +Symbol('I' 12) +( + SymbolLine(0 0 10 0 8) + SymbolLine(5 0 5 40 8) + SymbolLine(0 40 10 40 8) +) +Symbol('J' 12) +( + SymbolLine(0 0 15 0 8) + SymbolLine(15 0 15 35 8) + SymbolLine(10 40 15 35 8) + SymbolLine(5 40 10 40 8) + SymbolLine(0 35 5 40 8) +) +Symbol('K' 12) +( + SymbolLine(0 0 0 40 8) + SymbolLine(0 20 20 0 8) + SymbolLine(0 20 20 40 8) +) +Symbol('L' 12) +( + SymbolLine(0 0 0 40 8) + SymbolLine(0 40 20 40 8) +) +Symbol('M' 12) +( + SymbolLine(0 0 0 40 8) + SymbolLine(0 0 15 15 8) + SymbolLine(15 15 30 0 8) + SymbolLine(30 0 30 40 8) +) +Symbol('N' 12) +( + SymbolLine(0 0 0 40 8) + SymbolLine(0 0 0 5 8) + SymbolLine(0 5 25 30 8) + SymbolLine(25 0 25 40 8) +) +Symbol('O' 12) +( + SymbolLine(0 5 0 35 8) + SymbolLine(0 5 5 0 8) + SymbolLine(5 0 15 0 8) + SymbolLine(15 0 20 5 8) + SymbolLine(20 5 20 35 8) + SymbolLine(15 40 20 35 8) + SymbolLine(5 40 15 40 8) + SymbolLine(0 35 5 40 8) +) +Symbol('P' 12) +( + SymbolLine(5 0 5 40 8) + SymbolLine(0 0 20 0 8) + SymbolLine(20 0 25 5 8) + SymbolLine(25 5 25 15 8) + SymbolLine(20 20 25 15 8) + SymbolLine(5 20 20 20 8) +) +Symbol('Q' 12) +( + SymbolLine(0 5 0 35 8) + SymbolLine(0 5 5 0 8) + SymbolLine(5 0 15 0 8) + SymbolLine(15 0 20 5 8) + SymbolLine(20 5 20 35 8) + SymbolLine(15 40 20 35 8) + SymbolLine(5 40 15 40 8) + SymbolLine(0 35 5 40 8) + SymbolLine(10 30 20 40 8) +) +Symbol('R' 12) +( + SymbolLine(0 0 20 0 8) + SymbolLine(20 0 25 5 8) + SymbolLine(25 5 25 15 8) + SymbolLine(20 20 25 15 8) + SymbolLine(5 20 20 20 8) + SymbolLine(5 0 5 40 8) + SymbolLine(5 20 25 40 8) +) +Symbol('S' 12) +( + SymbolLine(20 0 25 5 8) + SymbolLine(5 0 20 0 8) + SymbolLine(0 5 5 0 8) + SymbolLine(0 5 0 15 8) + SymbolLine(0 15 5 20 8) + SymbolLine(5 20 20 20 8) + SymbolLine(20 20 25 25 8) + SymbolLine(25 25 25 35 8) + SymbolLine(20 40 25 35 8) + SymbolLine(5 40 20 40 8) + SymbolLine(0 35 5 40 8) +) +Symbol('T' 12) +( + SymbolLine(0 0 20 0 8) + SymbolLine(10 0 10 40 8) +) +Symbol('U' 12) +( + SymbolLine(0 0 0 35 8) + SymbolLine(0 35 5 40 8) + SymbolLine(5 40 15 40 8) + SymbolLine(15 40 20 35 8) + SymbolLine(20 0 20 35 8) +) +Symbol('V' 12) +( + SymbolLine(0 0 0 30 8) + SymbolLine(0 30 10 40 8) + SymbolLine(10 40 20 30 8) + SymbolLine(20 0 20 30 8) +) +Symbol('W' 12) +( + SymbolLine(0 0 0 40 8) + SymbolLine(0 40 15 25 8) + SymbolLine(15 25 30 40 8) + SymbolLine(30 0 30 40 8) +) +Symbol('X' 12) +( + SymbolLine(0 0 0 5 8) + SymbolLine(0 5 25 30 8) + SymbolLine(25 30 25 40 8) + SymbolLine(0 30 0 40 8) + SymbolLine(0 30 25 5 8) + SymbolLine(25 0 25 5 8) +) +Symbol('Y' 12) +( + SymbolLine(0 0 0 5 8) + SymbolLine(0 5 10 15 8) + SymbolLine(10 15 20 5 8) + SymbolLine(20 0 20 5 8) + SymbolLine(10 15 10 40 8) +) +Symbol('Z' 12) +( + SymbolLine(0 0 25 0 8) + SymbolLine(25 0 25 5 8) + SymbolLine(0 30 25 5 8) + SymbolLine(0 30 0 40 8) + SymbolLine(0 40 25 40 8) +) +Symbol('[' 12) +( + SymbolLine(0 0 5 0 8) + SymbolLine(0 0 0 40 8) + SymbolLine(0 40 5 40 8) +) +Symbol('\' 12) +( + SymbolLine(0 5 30 35 8) +) +Symbol(']' 12) +( + SymbolLine(0 0 5 0 8) + SymbolLine(5 0 5 40 8) + SymbolLine(0 40 5 40 8) +) +Symbol('^' 12) +( + SymbolLine(0 5 5 0 8) + SymbolLine(5 0 10 5 8) +) +Symbol('_' 12) +( + SymbolLine(0 40 20 40 8) +) +Symbol('a' 12) +( + SymbolLine(15 20 20 25 8) + SymbolLine(5 20 15 20 8) + SymbolLine(0 25 5 20 8) + SymbolLine(0 25 0 35 8) + SymbolLine(0 35 5 40 8) + SymbolLine(20 20 20 35 8) + SymbolLine(20 35 25 40 8) + SymbolLine(5 40 15 40 8) + SymbolLine(15 40 20 35 8) +) +Symbol('b' 12) +( + SymbolLine(0 0 0 40 8) + SymbolLine(0 35 5 40 8) + SymbolLine(5 40 15 40 8) + SymbolLine(15 40 20 35 8) + SymbolLine(20 25 20 35 8) + SymbolLine(15 20 20 25 8) + SymbolLine(5 20 15 20 8) + SymbolLine(0 25 5 20 8) +) +Symbol('c' 12) +( + SymbolLine(5 20 20 20 8) + SymbolLine(0 25 5 20 8) + SymbolLine(0 25 0 35 8) + SymbolLine(0 35 5 40 8) + SymbolLine(5 40 20 40 8) +) +Symbol('d' 12) +( + SymbolLine(20 0 20 40 8) + SymbolLine(15 40 20 35 8) + SymbolLine(5 40 15 40 8) + SymbolLine(0 35 5 40 8) + SymbolLine(0 25 0 35 8) + SymbolLine(0 25 5 20 8) + SymbolLine(5 20 15 20 8) + SymbolLine(15 20 20 25 8) +) +Symbol('e' 12) +( + SymbolLine(5 40 20 40 8) + SymbolLine(0 35 5 40 8) + SymbolLine(0 25 0 35 8) + SymbolLine(0 25 5 20 8) + SymbolLine(5 20 15 20 8) + SymbolLine(15 20 20 25 8) + SymbolLine(0 30 20 30 8) + SymbolLine(20 30 20 25 8) +) +Symbol('f' 10) +( + SymbolLine(5 5 5 40 8) + SymbolLine(5 5 10 0 8) + SymbolLine(10 0 15 0 8) + SymbolLine(0 20 10 20 8) +) +Symbol('g' 12) +( + SymbolLine(15 20 20 25 8) + SymbolLine(5 20 15 20 8) + SymbolLine(0 25 5 20 8) + SymbolLine(0 25 0 35 8) + SymbolLine(0 35 5 40 8) + SymbolLine(5 40 15 40 8) + SymbolLine(15 40 20 35 8) + SymbolLine(0 50 5 55 8) + SymbolLine(5 55 15 55 8) + SymbolLine(15 55 20 50 8) + SymbolLine(20 20 20 50 8) +) +Symbol('h' 12) +( + SymbolLine(0 0 0 40 8) + SymbolLine(0 25 5 20 8) + SymbolLine(5 20 15 20 8) + SymbolLine(15 20 20 25 8) + SymbolLine(20 25 20 40 8) +) +Symbol('i' 10) +( + SymbolLine(0 10 0 15 8) + SymbolLine(0 25 0 40 8) +) +Symbol('j' 10) +( + SymbolLine(5 10 5 15 8) + SymbolLine(5 25 5 50 8) + SymbolLine(0 55 5 50 8) +) +Symbol('k' 12) +( + SymbolLine(0 0 0 40 8) + SymbolLine(0 25 15 40 8) + SymbolLine(0 25 10 15 8) +) +Symbol('l' 10) +( + SymbolLine(0 0 0 35 8) + SymbolLine(0 35 5 40 8) +) +Symbol('m' 12) +( + SymbolLine(5 25 5 40 8) + SymbolLine(5 25 10 20 8) + SymbolLine(10 20 15 20 8) + SymbolLine(15 20 20 25 8) + SymbolLine(20 25 20 40 8) + SymbolLine(20 25 25 20 8) + SymbolLine(25 20 30 20 8) + SymbolLine(30 20 35 25 8) + SymbolLine(35 25 35 40 8) + SymbolLine(0 20 5 25 8) +) +Symbol('n' 12) +( + SymbolLine(5 25 5 40 8) + SymbolLine(5 25 10 20 8) + SymbolLine(10 20 15 20 8) + SymbolLine(15 20 20 25 8) + SymbolLine(20 25 20 40 8) + SymbolLine(0 20 5 25 8) +) +Symbol('o' 12) +( + SymbolLine(0 25 0 35 8) + SymbolLine(0 25 5 20 8) + SymbolLine(5 20 15 20 8) + SymbolLine(15 20 20 25 8) + SymbolLine(20 25 20 35 8) + SymbolLine(15 40 20 35 8) + SymbolLine(5 40 15 40 8) + SymbolLine(0 35 5 40 8) +) +Symbol('p' 12) +( + SymbolLine(5 25 5 55 8) + SymbolLine(0 20 5 25 8) + SymbolLine(5 25 10 20 8) + SymbolLine(10 20 20 20 8) + SymbolLine(20 20 25 25 8) + SymbolLine(25 25 25 35 8) + SymbolLine(20 40 25 35 8) + SymbolLine(10 40 20 40 8) + SymbolLine(5 35 10 40 8) +) +Symbol('q' 12) +( + SymbolLine(20 25 20 55 8) + SymbolLine(15 20 20 25 8) + SymbolLine(5 20 15 20 8) + SymbolLine(0 25 5 20 8) + SymbolLine(0 25 0 35 8) + SymbolLine(0 35 5 40 8) + SymbolLine(5 40 15 40 8) + SymbolLine(15 40 20 35 8) +) +Symbol('r' 12) +( + SymbolLine(5 25 5 40 8) + SymbolLine(5 25 10 20 8) + SymbolLine(10 20 20 20 8) + SymbolLine(0 20 5 25 8) +) +Symbol('s' 12) +( + SymbolLine(5 40 20 40 8) + SymbolLine(20 40 25 35 8) + SymbolLine(20 30 25 35 8) + SymbolLine(5 30 20 30 8) + SymbolLine(0 25 5 30 8) + SymbolLine(0 25 5 20 8) + SymbolLine(5 20 20 20 8) + SymbolLine(20 20 25 25 8) + SymbolLine(0 35 5 40 8) +) +Symbol('t' 10) +( + SymbolLine(5 0 5 35 8) + SymbolLine(5 35 10 40 8) + SymbolLine(0 15 10 15 8) +) +Symbol('u' 12) +( + SymbolLine(0 20 0 35 8) + SymbolLine(0 35 5 40 8) + SymbolLine(5 40 15 40 8) + SymbolLine(15 40 20 35 8) + SymbolLine(20 20 20 35 8) +) +Symbol('v' 12) +( + SymbolLine(0 20 0 30 8) + SymbolLine(0 30 10 40 8) + SymbolLine(10 40 20 30 8) + SymbolLine(20 20 20 30 8) +) +Symbol('w' 12) +( + SymbolLine(0 20 0 35 8) + SymbolLine(0 35 5 40 8) + SymbolLine(5 40 10 40 8) + SymbolLine(10 40 15 35 8) + SymbolLine(15 20 15 35 8) + SymbolLine(15 35 20 40 8) + SymbolLine(20 40 25 40 8) + SymbolLine(25 40 30 35 8) + SymbolLine(30 20 30 35 8) +) +Symbol('x' 12) +( + SymbolLine(0 20 20 40 8) + SymbolLine(0 40 20 20 8) +) +Symbol('y' 12) +( + SymbolLine(0 20 0 35 8) + SymbolLine(0 35 5 40 8) + SymbolLine(20 20 20 50 8) + SymbolLine(15 55 20 50 8) + SymbolLine(5 55 15 55 8) + SymbolLine(0 50 5 55 8) + SymbolLine(5 40 15 40 8) + SymbolLine(15 40 20 35 8) +) +Symbol('z' 12) +( + SymbolLine(0 20 20 20 8) + SymbolLine(0 40 20 20 8) + SymbolLine(0 40 20 40 8) +) +Symbol('{' 12) +( + SymbolLine(5 5 10 0 8) + SymbolLine(5 5 5 15 8) + SymbolLine(0 20 5 15 8) + SymbolLine(0 20 5 25 8) + SymbolLine(5 25 5 35 8) + SymbolLine(5 35 10 40 8) +) +Symbol('|' 12) +( + SymbolLine(0 0 0 40 8) +) +Symbol('}' 12) +( + SymbolLine(0 0 5 5 8) + SymbolLine(5 5 5 15 8) + SymbolLine(5 15 10 20 8) + SymbolLine(5 25 10 20 8) + SymbolLine(5 25 5 35 8) + SymbolLine(0 40 5 35 8) +) +Symbol('~' 12) +( + SymbolLine(0 25 5 20 8) + SymbolLine(5 20 10 20 8) + SymbolLine(10 20 15 25 8) + SymbolLine(15 25 20 25 8) + SymbolLine(20 25 25 20 8) +) +Via(3640 3860 60 30 28 "" 0x00000002) +Via(3640 3660 60 30 28 "" 0x00000002) +Via(3640 4960 60 30 28 "" 0x00000002) +Via(3640 3760 60 30 28 "" 0x00000002) +Via(3640 5060 60 30 28 "" 0x00000002) +Via(3640 5260 60 30 28 "" 0x00000002) +Via(3640 4860 60 30 28 "" 0x00000002) +Via(3640 5160 60 30 28 "" 0x00000002) +Via(3640 5360 60 30 28 "" 0x00000002) +Via(3640 5460 60 30 28 "" 0x00000002) +Via(3440 5460 60 30 28 "" 0x00000002) +Via(3440 5360 60 30 28 "" 0x00000002) +Via(580 3630 60 30 28 "" 0x00000002) +Via(3440 5260 60 30 28 "" 0x00000002) +Via(3440 5160 60 30 28 "" 0x00000002) +Via(3440 5060 60 30 28 "" 0x00000002) +Via(3440 4960 60 30 28 "" 0x00000002) +Via(3640 3560 60 30 28 "" 0x00000002) +Via(460 4090 60 30 28 "" 0x00000002) +Via(1610 2070 60 30 28 "" 0x00000002) +Via(950 2170 60 30 28 "" 0x00000002) +Via(3640 1860 60 30 28 "" 0x00000002) +Via(3640 1760 60 30 28 "" 0x00000002) +Via(3640 1960 60 30 28 "" 0x00000002) +Via(3640 1660 60 30 28 "" 0x00000002) +Via(3640 2060 60 30 28 "" 0x00000002) +Via(2640 560 60 30 28 "" 0x00000002) +Via(3440 3860 60 30 28 "" 0x00000002) +Via(3440 3760 60 30 28 "" 0x00000002) +Via(3440 3660 60 30 28 "" 0x00000002) +Via(3440 3560 60 30 28 "" 0x00000002) +Via(2840 1760 60 30 28 "" 0x00000002) +Via(2840 1660 60 30 28 "" 0x00000002) +Via(2840 2060 60 30 28 "" 0x00000002) +Via(2840 1960 60 30 28 "" 0x00000002) +Via(1290 1735 60 30 28 "" 0x00000002) +Via(1570 3080 60 30 28 "" 0x00000002) +Via(960 2900 60 30 28 "" 0x00000002) +Via(1480 2900 60 30 28 "" 0x00000002) +Via(3740 5460 60 30 28 "" 0x00000002) +Via(3740 5560 60 30 28 "" 0x00000002) +Via(3440 5560 60 30 28 "" 0x00000002) +Via(3440 3960 60 30 28 "" 0x00000002) +Via(3440 4060 60 30 28 "" 0x00000002) +Via(3440 4160 60 30 28 "" 0x00000002) +Via(3440 4260 60 30 28 "" 0x00000002) +Via(3440 4360 60 30 28 "" 0x00000002) +Via(3440 4460 60 30 28 "" 0x00000002) +Via(3440 4560 60 30 28 "" 0x00000002) +Via(3440 4860 60 30 28 "" 0x00000002) +Via(3440 4660 60 30 28 "" 0x00000002) +Via(3640 3960 60 30 28 "" 0x00000002) +Via(3640 4060 60 30 28 "" 0x00000002) +Via(3640 4160 60 30 28 "" 0x00000002) +Via(3640 4260 60 30 28 "" 0x00000002) +Via(3640 4360 60 30 28 "" 0x00000002) +Via(3640 4560 60 30 28 "" 0x00000002) +Via(3640 4460 60 30 28 "" 0x00000002) +Via(3640 4660 60 30 28 "" 0x00000002) +Via(3640 4760 60 30 28 "" 0x00000002) +Via(2840 3560 60 30 28 "" 0x00000002) +Via(2840 3460 60 30 28 "" 0x00000002) +Via(2840 3760 60 30 28 "" 0x00000002) +Via(2840 3660 60 30 28 "" 0x00000002) +Via(2840 3860 60 30 28 "" 0x00000002) +Via(2840 3960 60 30 28 "" 0x00000002) +Via(2840 4060 60 30 28 "" 0x00000002) +Via(2840 4160 60 30 28 "" 0x00000002) +Via(2840 4260 60 30 28 "" 0x00000002) +Via(2840 4360 60 30 28 "" 0x00000002) +Via(2840 4560 60 30 28 "" 0x00000002) +Via(2840 4460 60 30 28 "" 0x00000002) +Via(2840 4660 60 30 28 "" 0x00000002) +Via(2840 2560 60 30 28 "" 0x00000002) +Via(2840 2660 60 30 28 "" 0x00000002) +Via(2840 2760 60 30 28 "" 0x00000002) +Via(2840 2860 60 30 28 "" 0x00000002) +Via(2840 2960 60 30 28 "" 0x00000002) +Via(2840 3060 60 30 28 "" 0x00000002) +Via(2840 3160 60 30 28 "" 0x00000002) +Via(2840 3360 60 30 28 "" 0x00000002) +Via(2840 3260 60 30 28 "" 0x00000002) +Via(2640 3560 60 30 28 "" 0x00000002) +Via(2640 3660 60 30 28 "" 0x00000002) +Via(2640 3760 60 30 28 "" 0x00000002) +Via(2640 3060 60 30 28 "" 0x00000002) +Via(2640 3160 60 30 28 "" 0x00000002) +Via(2640 3260 60 30 28 "" 0x00000002) +Via(2640 3360 60 30 28 "" 0x00000002) +Via(2640 3460 60 30 28 "" 0x00000002) +Via(2640 2960 60 30 28 "" 0x00000002) +Via(2640 2760 60 30 28 "" 0x00000002) +Via(2640 2560 60 30 28 "" 0x00000002) +Via(2640 2660 60 30 28 "" 0x00000002) +Via(2640 2860 60 30 28 "" 0x00000002) +Via(2840 5560 60 30 28 "" 0x00000002) +Via(2840 5460 60 30 28 "" 0x00000002) +Via(2840 5260 60 30 28 "" 0x00000002) +Via(2840 5360 60 30 28 "" 0x00000002) +Via(2840 5160 60 30 28 "" 0x00000002) +Via(2840 5060 60 30 28 "" 0x00000002) +Via(2840 4960 60 30 28 "" 0x00000002) +Via(2840 4860 60 30 28 "" 0x00000002) +Via(2840 4760 60 30 28 "" 0x00000002) +Via(2640 5560 60 30 28 "" 0x00000002) +Via(2640 5460 60 30 28 "" 0x00000002) +Via(2640 5360 60 30 28 "" 0x00000002) +Via(2640 5260 60 30 28 "" 0x00000002) +Via(2640 5160 60 30 28 "" 0x00000002) +Via(2640 4860 60 30 28 "" 0x00000002) +Via(2640 5060 60 30 28 "" 0x00000002) +Via(2640 4960 60 30 28 "" 0x00000002) +Via(3640 5560 60 30 28 "" 0x00000002) +Via(2640 4760 60 30 28 "" 0x00000002) +Via(2640 4660 60 30 28 "" 0x00000002) +Via(2640 4560 60 30 28 "" 0x00000002) +Via(2640 4460 60 30 28 "" 0x00000002) +Via(2640 4360 60 30 28 "" 0x00000002) +Via(2640 4260 60 30 28 "" 0x00000002) +Via(2640 4160 60 30 28 "" 0x00000002) +Via(2640 4060 60 30 28 "" 0x00000002) +Via(2640 3960 60 30 28 "" 0x00000002) +Via(2640 3860 60 30 28 "" 0x00000002) +Via(3440 2860 60 30 28 "" 0x00000002) +Via(2640 1060 60 30 28 "" 0x00000002) +Via(630 4710 60 30 20 "" 0x00000002) +Via(780 1590 60 30 28 "" 0x00000002) +Via(3440 4760 60 30 28 "" 0x00000002) +Via(1380 1500 60 30 28 "" 0x00000002) +Via(1380 1400 60 30 28 "" 0x00000002) +Via(1570 2760 60 30 28 "" 0x00000002) +Via(1740 3500 60 30 28 "" 0x00000002) +Via(1220 3500 60 30 28 "" 0x00000002) +Via(1220 2730 60 30 28 "" 0x00000002) +Via(3640 560 60 30 28 "" 0x00000002) +Via(1570 2930 60 30 28 "" 0x00000002) +Via(2140 3910 60 30 28 "" 0x00000002) +Via(2390 3920 60 30 28 "" 0x00000002) +Via(2020 3970 60 30 28 "" 0x00000002) +Via(900 1085 60 30 28 "" 0x00000002) +Via(900 940 60 30 28 "" 0x00000002) +Via(3740 4965 60 30 28 "" 0x00000002) +Via(3740 5360 60 30 28 "" 0x00000002) +Via(630 2050 60 30 28 "" 0x00000002) +Via(630 2335 60 30 28 "" 0x00000002) +Via(1800 2140 60 30 28 "" 0x00000002) +Via(1370 2140 60 30 28 "" 0x00000002) +Via(2530 2200 60 30 28 "" 0x00000002) +Via(2530 3600 60 30 28 "" 0x00000002) +Via(2445 3420 60 30 28 "" 0x00000002) +Via(970 1590 60 30 28 "" 0x00000002) +Via(1110 1400 60 30 28 "" 0x00000002) +Via(960 1400 60 30 28 "" 0x00000002) +Via(1110 1490 60 30 28 "" 0x00000002) +Via(2390 620 60 30 28 "" 0x00000002) +Via(1320 2220 60 30 28 "" 0x00000002) +Via(1570 2220 60 30 28 "" 0x00000002) +Via(2265 3550 60 30 28 "" 0x00000002) +Via(2265 3130 60 30 28 "" 0x00000002) +Via(2430 2860 60 30 28 "" 0x00000002) +Via(2445 3550 60 30 28 "" 0x00000002) +Via(2640 960 60 30 28 "" 0x00000002) +Via(2640 2160 60 30 28 "" 0x00000002) +Via(2020 3740 60 30 28 "" 0x00000002) +Via(1625 3500 60 30 28 "" 0x00000002) +Via(1570 3210 60 30 28 "" 0x00000002) +Via(1445 1735 60 30 28 "" 0x00000002) +Via(1780 1400 60 30 28 "" 0x00000002) +Via(1880 1400 60 30 28 "" 0x00000002) +Via(1980 1400 60 30 28 "" 0x00000002) +Via(2080 1400 60 30 28 "" 0x00000002) +Via(2180 1400 60 30 28 "" 0x00000002) +Via(2280 1400 60 30 28 "" 0x00000002) +Via(2200 2150 60 30 28 "" 0x00000002) +Via(2310 2150 60 30 28 "" 0x00000002) +Via(2205 2530 60 30 28 "" 0x00000002) +Via(2310 2530 60 30 28 "" 0x00000002) +Via(780 1490 60 30 28 "" 0x00000002) +Via(2430 2530 60 30 28 "" 0x00000002) +Via(2350 3120 60 30 28 "" 0x00000002) +Via(2350 2930 60 30 28 "" 0x00000002) +Via(2640 1160 60 30 28 "" 0x00000002) +Via(2640 1260 60 30 28 "" 0x00000002) +Via(2640 1360 60 30 28 "" 0x00000002) +Via(2640 1460 60 30 28 "" 0x00000002) +Via(2640 1560 60 30 28 "" 0x00000002) +Via(2640 1660 60 30 28 "" 0x00000002) +Via(2640 1760 60 30 28 "" 0x00000002) +Via(2640 1860 60 30 28 "" 0x00000002) +Via(2640 1960 60 30 28 "" 0x00000002) +Via(2640 2060 60 30 28 "" 0x00000002) +Via(2840 2160 60 30 28 "" 0x00000002) +Via(3440 2160 60 30 28 "" 0x00000002) +Via(3640 2160 60 30 28 "" 0x00000002) +Via(3440 2060 60 30 28 "" 0x00000002) +Via(3440 1960 60 30 28 "" 0x00000002) +Via(3440 1860 60 30 28 "" 0x00000002) +Via(3440 1760 60 30 28 "" 0x00000002) +Via(3440 1660 60 30 28 "" 0x00000002) +Via(3440 1560 60 30 28 "" 0x00000002) +Via(3440 1460 60 30 28 "" 0x00000002) +Via(3440 1360 60 30 28 "" 0x00000002) +Via(2640 860 60 30 28 "" 0x00000002) +Via(3440 1260 60 30 28 "" 0x00000002) +Via(3440 1160 60 30 28 "" 0x00000002) +Via(3440 1060 60 30 28 "" 0x00000002) +Via(3440 960 60 30 28 "" 0x00000002) +Via(3440 860 60 30 28 "" 0x00000002) +Via(3440 760 60 30 28 "" 0x00000002) +Via(3440 660 60 30 28 "" 0x00000002) +Via(3440 560 60 30 28 "" 0x00000002) +Via(3440 460 60 30 28 "" 0x00000002) +Via(3640 460 60 30 28 "" 0x00000002) +Via(3640 760 60 30 28 "" 0x00000002) +Via(3640 660 60 30 28 "" 0x00000002) +Via(3640 1060 60 30 28 "" 0x00000002) +Via(3640 860 60 30 28 "" 0x00000002) +Via(3640 960 60 30 28 "" 0x00000002) +Via(2640 760 60 30 28 "" 0x00000002) +Via(2640 660 60 30 28 "" 0x00000002) +Via(3640 1160 60 30 28 "" 0x00000002) +Via(2640 460 60 30 28 "" 0x00000002) +Via(2840 460 60 30 28 "" 0x00000002) +Via(2840 560 60 30 28 "" 0x00000002) +Via(2840 760 60 30 28 "" 0x00000002) +Via(2840 660 60 30 28 "" 0x00000002) +Via(2840 1060 60 30 28 "" 0x00000002) +Via(2840 860 60 30 28 "" 0x00000002) +Via(2840 960 60 30 28 "" 0x00000002) +Via(2840 1160 60 30 28 "" 0x00000002) +Via(2840 1260 60 30 28 "" 0x00000002) +Via(2840 1560 60 30 28 "" 0x00000002) +Via(2840 1360 60 30 28 "" 0x00000002) +Via(2840 1460 60 30 28 "" 0x00000002) +Via(2840 1860 60 30 28 "" 0x00000002) +Via(3640 1260 60 30 28 "" 0x00000002) +Via(3640 1560 60 30 28 "" 0x00000002) +Via(3640 1360 60 30 28 "" 0x00000002) +Via(3640 1460 60 30 28 "" 0x00000002) +Via(2350 4280 60 30 28 "" 0x00000002) +Via(2350 2780 60 30 28 "" 0x00000002) +Via(2350 2660 60 30 28 "" 0x00000002) +Via(1090 2170 60 30 28 "" 0x00000002) +Via(2320 4920 60 30 28 "" 0x00000002) +Via(2080 4140 60 30 28 "" 0x00000002) +Via(2160 4060 60 30 28 "" 0x00000002) +Via(2180 4920 60 30 28 "" 0x00000002) +Via(2430 2950 60 30 28 "" 0x00000002) +Via(460 4270 60 30 28 "" 0x00000002) +Via(2570 4040 60 30 28 "" 0x00000002) +Via(2330 4040 60 30 28 "" 0x00000002) +Via(3640 3460 60 30 28 "" 0x00000002) +Via(3640 2560 60 30 28 "" 0x00000002) +Via(3640 2660 60 30 28 "" 0x00000002) +Via(3640 2760 60 30 28 "" 0x00000002) +Via(3640 2860 60 30 28 "" 0x00000002) +Via(3640 2960 60 30 28 "" 0x00000002) +Via(3640 3060 60 30 28 "" 0x00000002) +Via(3640 3160 60 30 28 "" 0x00000002) +Via(3640 3360 60 30 28 "" 0x00000002) +Via(3640 3260 60 30 28 "" 0x00000002) +Via(3440 3060 60 30 28 "" 0x00000002) +Via(3440 3160 60 30 28 "" 0x00000002) +Via(3440 3260 60 30 28 "" 0x00000002) +Via(3440 3360 60 30 28 "" 0x00000002) +Via(3440 3460 60 30 28 "" 0x00000002) +Via(3440 2960 60 30 28 "" 0x00000002) +Via(3440 2760 60 30 28 "" 0x00000002) +Via(3440 2560 60 30 28 "" 0x00000002) +Via(3440 2660 60 30 28 "" 0x00000002) +Via(1500 1490 60 30 28 "" 0x00000002) +Via(1210 350 60 30 28 "" 0x00000002) +Via(1550 690 60 30 28 "" 0x00000002) +Via(1610 990 60 30 28 "" 0x00000002) +Via(2110 1000 60 30 28 "" 0x00000002) +Via(2270 620 60 30 28 "" 0x00000002) +Via(1970 620 60 30 28 "" 0x00000002) +Via(1610 1490 60 30 28 "" 0x00000002) +Via(2110 1120 60 30 28 "" 0x00000002) +Via(2390 380 60 30 28 "" 0x00000002) +Via(380 4710 60 30 20 "" 0x00000002) +Via(470 4780 60 30 28 "" 0x00000002) +Via(475 5170 60 30 28 "" 0x00000002) + +Element(0x00000000 "generic" "" "PLCC 84 socket" 1380 3690 400 -600 2 100 0x00000000) +( + Pin(0 0 50 30 80 20 "1" "1" 0x00000101) + Pin(0 -100 50 30 80 20 "2" "2" 0x00000001) + Pin(100 0 50 30 80 20 "3" "3" 0x00000001) + Pin(100 -100 50 30 80 20 "4" "4" 0x00000001) + Pin(200 0 50 30 80 20 "5" "5" 0x00000001) + Pin(200 -100 50 30 80 20 "6" "6" 0x00000001) + Pin(300 0 50 30 80 20 "7" "7" 0x00000001) + Pin(300 -100 50 30 80 20 "8" "8" 0x00000001) + Pin(400 0 50 30 80 20 "9" "9" 0x00000001) + Pin(400 -100 50 30 80 20 "10" "10" 0x00000001) + Pin(500 0 50 30 80 20 "11" "11" 0x00000001) + Pin(600 -100 50 30 80 20 "12" "12" 0x00000001) + Pin(500 -100 50 30 80 20 "13" "13" 0x00000001) + Pin(600 -200 50 30 80 20 "14" "14" 0x00000001) + Pin(500 -200 50 30 80 20 "15" "15" 0x00000001) + Pin(600 -300 50 30 80 20 "16" "16" 0x00000001) + Pin(500 -300 50 30 80 20 "17" "17" 0x00000001) + Pin(600 -400 50 30 80 20 "18" "18" 0x00000001) + Pin(500 -400 50 30 80 20 "19" "19" 0x00000001) + Pin(600 -500 50 30 80 20 "20" "20" 0x00000001) + Pin(500 -500 50 30 80 20 "21" "21" 0x00000001) + Pin(600 -600 50 30 80 20 "22" "22" 0x00000001) + Pin(500 -600 50 30 80 20 "23" "23" 0x00000001) + Pin(600 -700 50 30 80 20 "24" "24" 0x00000001) + Pin(500 -700 50 30 80 20 "25" "25" 0x00000001) + Pin(600 -800 50 30 80 20 "26" "26" 0x00000001) + Pin(500 -800 50 30 80 20 "27" "27" 0x00000001) + Pin(600 -900 50 30 80 20 "28" "28" 0x00000001) + Pin(500 -900 50 30 80 20 "29" "29" 0x00000001) + Pin(600 -1000 50 30 80 20 "30" "30" 0x00000001) + Pin(500 -1000 50 30 80 20 "31" "31" 0x00000001) + Pin(600 -1100 50 30 80 20 "32" "32" 0x00000001) + Pin(500 -1200 50 30 80 20 "33" "33" 0x00000001) + Pin(500 -1100 50 30 80 20 "34" "34" 0x00000001) + Pin(400 -1200 50 30 80 20 "35" "35" 0x00000001) + Pin(400 -1100 50 30 80 20 "36" "36" 0x00000001) + Pin(300 -1200 50 30 80 20 "37" "37" 0x00000001) + Pin(300 -1100 50 30 80 20 "38" "38" 0x00000001) + Pin(200 -1200 50 30 80 20 "39" "39" 0x00000001) + Pin(200 -1100 50 30 80 20 "40" "40" 0x00000001) + Pin(100 -1200 50 30 80 20 "41" "41" 0x00000001) + Pin(100 -1100 50 30 80 20 "42" "42" 0x00000001) + Pin(0 -1200 50 30 80 20 "43" "43" 0x00000001) + Pin(0 -1100 50 30 80 20 "44" "44" 0x00000001) + Pin(-100 -1200 50 30 80 20 "45" "45" 0x00000001) + Pin(-100 -1100 50 30 80 20 "46" "46" 0x00000001) + Pin(-200 -1200 50 30 80 20 "47" "47" 0x00000001) + Pin(-200 -1100 50 30 80 20 "48" "48" 0x00000001) + Pin(-300 -1200 50 30 80 20 "49" "49" 0x00000001) + Pin(-300 -1100 50 30 80 20 "50" "50" 0x00000001) + Pin(-400 -1200 50 30 80 20 "51" "51" 0x00000001) + Pin(-400 -1100 50 30 80 20 "52" "52" 0x00000001) + Pin(-500 -1200 50 30 80 20 "53" "53" 0x00000001) + Pin(-600 -1100 50 30 80 20 "54" "54" 0x00000001) + Pin(-500 -1100 50 30 80 20 "55" "55" 0x00000001) + Pin(-600 -1000 50 30 80 20 "56" "56" 0x00000001) + Pin(-500 -1000 50 30 80 20 "57" "57" 0x00000001) + Pin(-600 -900 50 30 80 20 "58" "58" 0x00000001) + Pin(-500 -900 50 30 80 20 "59" "59" 0x00000001) + Pin(-600 -800 50 30 80 20 "60" "60" 0x00000001) + Pin(-500 -800 50 30 80 20 "61" "61" 0x00000001) + Pin(-600 -700 50 30 80 20 "62" "62" 0x00000001) + Pin(-500 -700 50 30 80 20 "63" "63" 0x00000001) + Pin(-600 -600 50 30 80 20 "64" "64" 0x00000001) + Pin(-500 -600 50 30 80 20 "65" "65" 0x00000001) + Pin(-600 -500 50 30 80 20 "66" "66" 0x00000001) + Pin(-500 -500 50 30 80 20 "67" "67" 0x00000001) + Pin(-600 -400 50 30 80 20 "68" "68" 0x00000001) + Pin(-500 -400 50 30 80 20 "69" "69" 0x00000001) + Pin(-600 -300 50 30 80 20 "70" "70" 0x00000001) + Pin(-500 -300 50 30 80 20 "71" "71" 0x00000001) + Pin(-600 -200 50 30 80 20 "72" "72" 0x00000001) + Pin(-500 -200 50 30 80 20 "73" "73" 0x00000001) + Pin(-600 -100 50 30 80 20 "74" "74" 0x00000001) + Pin(-500 0 50 30 80 20 "75" "75" 0x00000001) + Pin(-500 -100 50 30 80 20 "76" "76" 0x00000001) + Pin(-400 0 50 30 80 20 "77" "77" 0x00000001) + Pin(-400 -100 50 30 80 20 "78" "78" 0x00000001) + Pin(-300 0 50 30 80 20 "79" "79" 0x00000001) + Pin(-300 -100 50 30 80 20 "80" "80" 0x00000001) + Pin(-200 0 50 30 80 20 "81" "81" 0x00000001) + Pin(-200 -100 50 30 80 20 "82" "82" 0x00000001) + Pin(-100 0 50 30 80 20 "83" "83" 0x00000001) + Pin(-100 -100 50 30 80 20 "84" "84" 0x00000001) + ElementLine (0 100 -50 150 10) + ElementLine (50 150 0 100 10) + ElementLine (750 50 650 150 10) + ElementLine (750 -1350 750 150 20) + ElementLine (-750 -1350 750 -1350 20) + ElementLine (-750 150 -750 -1350 20) + ElementLine (750 150 -750 150 20) + ) + +Element(0x00000000 "8 bus tranceiver 3-state" "" "74245" 2100 4675 170 50 3 100 0x00000000) +( + Pin(0 0 60 30 90 28 "Dir" "1" 0x00000101) + Pin(0 100 60 30 90 28 "A1" "2" 0x00000001) + Pin(0 200 60 30 90 28 "A2" "3" 0x00000001) + Pin(0 300 60 30 90 28 "A3" "4" 0x00000001) + Pin(0 400 60 30 90 28 "A4" "5" 0x00000001) + Pin(0 500 60 30 90 28 "A5" "6" 0x00000001) + Pin(0 600 60 30 90 28 "A6" "7" 0x00000001) + Pin(0 700 60 30 90 28 "A7" "8" 0x00000001) + Pin(0 800 60 30 90 28 "A8" "9" 0x00000001) + Pin(0 900 60 30 90 28 "Gnd" "10" 0x00000001) + Pin(300 900 60 30 90 28 "B8" "11" 0x00000001) + Pin(300 800 60 30 90 28 "B7" "12" 0x00000001) + Pin(300 700 60 30 90 28 "B6" "13" 0x00000001) + Pin(300 600 60 30 90 28 "B5" "14" 0x00000001) + Pin(300 500 60 30 90 28 "B4" "15" 0x00000001) + Pin(300 400 60 30 90 28 "B3" "16" 0x00000001) + Pin(300 300 60 30 90 28 "B2" "17" 0x00000001) + Pin(300 200 60 30 90 28 "B1" "18" 0x00000001) + Pin(300 100 60 30 90 28 "/G" "19" 0x00000001) + Pin(300 0 60 30 90 28 "Vcc" "20" 0x00000001) + ElementLine (200 -50 350 -50 10) + ElementLine (-50 -50 100 -50 10) + ElementLine (350 950 350 -50 10) + ElementLine (-50 950 350 950 10) + ElementLine (-50 -50 -50 950 10) + ElementArc (150 -50 50 50 0 180 10) + ) + +Element(0x00000000 "8 bus tranceiver 3-state" "" "74245" 800 355 170 50 3 100 0x00000000) +( + Pin(0 0 60 30 90 28 "Dir" "1" 0x00000101) + Pin(0 100 60 30 90 28 "A1" "2" 0x00000001) + Pin(0 200 60 30 90 28 "A2" "3" 0x00000001) + Pin(0 300 60 30 90 28 "A3" "4" 0x00000001) + Pin(0 400 60 30 90 28 "A4" "5" 0x00000001) + Pin(0 500 60 30 90 28 "A5" "6" 0x00000001) + Pin(0 600 60 30 90 28 "A6" "7" 0x00000001) + Pin(0 700 60 30 90 28 "A7" "8" 0x00000001) + Pin(0 800 60 30 90 28 "A8" "9" 0x00000001) + Pin(0 900 60 30 90 28 "Gnd" "10" 0x00000001) + Pin(300 900 60 30 90 28 "B8" "11" 0x00000001) + Pin(300 800 60 30 90 28 "B7" "12" 0x00000001) + Pin(300 700 60 30 90 28 "B6" "13" 0x00000001) + Pin(300 600 60 30 90 28 "B5" "14" 0x00000001) + Pin(300 500 60 30 90 28 "B4" "15" 0x00000001) + Pin(300 400 60 30 90 28 "B3" "16" 0x00000001) + Pin(300 300 60 30 90 28 "B2" "17" 0x00000001) + Pin(300 200 60 30 90 28 "B1" "18" 0x00000001) + Pin(300 100 60 30 90 28 "/G" "19" 0x00000001) + Pin(300 0 60 30 90 28 "Vcc" "20" 0x00000001) + ElementLine (200 -50 350 -50 10) + ElementLine (-50 -50 100 -50 10) + ElementLine (350 950 350 -50 10) + ElementLine (-50 950 350 950 10) + ElementLine (-50 -50 -50 950 10) + ElementArc (150 -50 50 50 0 180 10) + ) + +Element(0x00000000 "single-ended SCSI 2x25 pins" "" "single-ended SCSI" 380 1590 210 -50 3 100 0x00000000) +( + Pin(0 0 60 30 90 30 "Gnd" "1" 0x00000101) + Pin(100 0 60 30 90 30 "/DB0" "2" 0x00000001) + Pin(0 100 60 30 90 30 "Gnd" "3" 0x00000001) + Pin(100 100 60 30 90 30 "/DB1" "4" 0x00000001) + Pin(0 200 60 30 90 30 "Gnd" "5" 0x00000001) + Pin(100 200 60 30 90 30 "/DB2" "6" 0x00000001) + Pin(0 300 60 30 90 30 "Gnd" "7" 0x00000001) + Pin(100 300 60 30 90 30 "/DB3" "8" 0x00000001) + Pin(0 400 60 30 90 30 "Gnd" "9" 0x00000001) + Pin(100 400 60 30 90 30 "/DB4" "10" 0x00000001) + Pin(0 500 60 30 90 30 "Gnd" "11" 0x00000001) + Pin(100 500 60 30 90 30 "/DB5" "12" 0x00000001) + Pin(0 600 60 30 90 30 "Gnd" "13" 0x00000001) + Pin(100 600 60 30 90 30 "/DB6" "14" 0x00000001) + Pin(0 700 60 30 90 30 "Gnd" "15" 0x00000001) + Pin(100 700 60 30 90 30 "/DB7" "16" 0x00000001) + Pin(0 800 60 30 90 30 "Gnd" "17" 0x00000001) + Pin(100 800 60 30 90 30 "/DBP" "18" 0x00000001) + Pin(0 900 60 30 90 30 "Gnd" "19" 0x00000001) + Pin(100 900 60 30 90 30 "NC" "20" 0x00000001) + Pin(0 1000 60 30 90 30 "Gnd" "21" 0x00000001) + Pin(100 1000 60 30 90 30 "NC" "22" 0x00000001) + Pin(0 1100 60 30 90 30 "Gnd" "23" 0x00000001) + Pin(100 1100 60 30 90 30 "NC" "24" 0x00000001) + Pin(0 1200 60 30 90 30 "NC" "25" 0x00000001) + Pin(100 1200 60 30 90 30 "TermPwr" "26" 0x00000001) + Pin(0 1300 60 30 90 30 "Gnd" "27" 0x00000001) + Pin(100 1300 60 30 90 30 "NC" "28" 0x00000001) + Pin(0 1400 60 30 90 30 "Gnd" "29" 0x00000001) + Pin(100 1400 60 30 90 30 "NC" "30" 0x00000001) + Pin(0 1500 60 30 90 30 "Gnd" "31" 0x00000001) + Pin(100 1500 60 30 90 30 "/Atn" "32" 0x00000001) + Pin(0 1600 60 30 90 30 "Gnd" "33" 0x00000001) + Pin(100 1600 60 30 90 30 "NC" "34" 0x00000001) + Pin(0 1700 60 30 90 30 "Gnd" "35" 0x00000001) + Pin(100 1700 60 30 90 30 "/Bsy" "36" 0x00000001) + Pin(0 1800 60 30 90 30 "Gnd" "37" 0x00000001) + Pin(100 1800 60 30 90 30 "/Ack" "38" 0x00000001) + Pin(0 1900 60 30 90 30 "Gnd" "39" 0x00000001) + Pin(100 1900 60 30 90 30 "/Rst" "40" 0x00000001) + Pin(0 2000 60 30 90 30 "Gnd" "41" 0x00000001) + Pin(100 2000 60 30 90 30 "/Msg" "42" 0x00000001) + Pin(0 2100 60 30 90 30 "Gnd" "43" 0x00000001) + Pin(100 2100 60 30 90 30 "/Sel" "44" 0x00000001) + Pin(0 2200 60 30 90 30 "Gnd" "45" 0x00000001) + Pin(100 2200 60 30 90 30 "/CD" "46" 0x00000001) + Pin(0 2300 60 30 90 30 "Gnd" "47" 0x00000001) + Pin(100 2300 60 30 90 30 "/Req" "48" 0x00000001) + Pin(0 2400 60 30 90 30 "Gnd" "49" 0x00000001) + Pin(100 2400 60 30 90 30 "/IO" "50" 0x00000001) + ElementLine (50 50 50 -50 10) + ElementLine (-50 50 50 50 10) + ElementLine (150 -50 -50 -50 20) + ElementLine (150 2450 150 -50 20) + ElementLine (-50 2450 150 2450 20) + ElementLine (-50 -50 -50 2450 20) + ) + +Element(0x00000000 "DIN41.651 standing 40 pins" "" "40s" 470 4480 -400 150 0 200 0x00000000) +( + Pin(0 0 60 30 90 20 "1" "1" 0x00000101) + Pin(0 -100 60 30 90 20 "2" "2" 0x00000001) + Pin(100 0 60 30 90 20 "3" "3" 0x00000001) + Pin(100 -100 60 30 90 20 "4" "4" 0x00000001) + Pin(200 0 60 30 90 20 "5" "5" 0x00000001) + Pin(200 -100 60 30 90 20 "6" "6" 0x00000001) + Pin(300 0 60 30 90 20 "7" "7" 0x00000001) + Pin(300 -100 60 30 90 20 "8" "8" 0x00000001) + Pin(400 0 60 30 90 20 "9" "9" 0x00000001) + Pin(400 -100 60 30 90 20 "10" "10" 0x00000001) + Pin(500 0 60 30 90 20 "11" "11" 0x00000001) + Pin(500 -100 60 30 90 20 "12" "12" 0x00000001) + Pin(600 0 60 30 90 20 "13" "13" 0x00000001) + Pin(600 -100 60 30 90 20 "14" "14" 0x00000001) + Pin(700 0 60 30 90 20 "15" "15" 0x00000001) + Pin(700 -100 60 30 90 20 "16" "16" 0x00000001) + Pin(800 0 60 30 90 20 "17" "17" 0x00000001) + Pin(800 -100 60 30 90 20 "18" "18" 0x00000001) + Pin(900 0 60 30 90 20 "19" "19" 0x00000001) + Pin(900 -100 60 30 90 20 "20" "20" 0x00000001) + Pin(1000 0 60 30 90 20 "21" "21" 0x00000001) + Pin(1000 -100 60 30 90 20 "22" "22" 0x00000001) + Pin(1100 0 60 30 90 20 "23" "23" 0x00000001) + Pin(1100 -100 60 30 90 20 "24" "24" 0x00000001) + Pin(1200 0 60 30 90 20 "25" "25" 0x00000001) + Pin(1200 -100 60 30 90 20 "26" "26" 0x00000001) + Pin(1300 0 60 30 90 20 "27" "27" 0x00000001) + Pin(1300 -100 60 30 90 20 "28" "28" 0x00000001) + Pin(1400 0 60 30 90 20 "29" "29" 0x00000001) + Pin(1400 -100 60 30 90 20 "30" "30" 0x00000001) + Pin(1500 0 60 30 90 20 "31" "31" 0x00000001) + Pin(1500 -100 60 30 90 20 "32" "32" 0x00000001) + Pin(1600 0 60 30 90 20 "33" "33" 0x00000001) + Pin(1600 -100 60 30 90 20 "34" "34" 0x00000001) + Pin(1700 0 60 30 90 20 "35" "35" 0x00000001) + Pin(1700 -100 60 30 90 20 "36" "36" 0x00000001) + Pin(1800 0 60 30 90 20 "37" "37" 0x00000001) + Pin(1800 -100 60 30 90 20 "38" "38" 0x00000001) + Pin(1900 0 60 30 90 20 "39" "39" 0x00000001) + Pin(1900 -100 60 30 90 20 "40" "40" 0x00000001) + ElementLine (-430 110 -430 -210 20) + ElementLine (-430 -210 2330 -210 20) + ElementLine (2330 -210 2330 110 20) + ElementLine (2330 110 -430 110 20) + ElementLine (-150 90 -150 -190 5) + ElementLine (-150 -190 2050 -190 5) + ElementLine (2050 -190 2050 90 5) + ElementLine (2050 90 1025 90 5) + ElementLine (1025 90 1025 110 5) + ElementLine (875 110 875 90 5) + ElementLine (875 90 -150 90 5) + ElementLine (-110 90 -150 50 5) + ElementLine (-430 0 -150 0 5) + ElementLine (-430 -100 -150 -100 5) + ElementLine (2050 0 2330 0 5) + ElementLine (2050 -100 2330 -100 5) + ) +Layer(1 "solder") +( + Line(415 4755 435 4735 20 30 0x00000020) + Line(415 4825 415 4755 20 30 0x00000020) + Line(450 4830 415 4825 20 30 0x00000020) + Line(520 2140 520 2150 20 30 0x00000020) + Line(430 2140 520 2140 20 30 0x00000020) + Line(380 2190 430 2140 20 30 0x00000020) + Line(1190 1160 2110 1160 20 30 0x00000020) + Line(2110 460 2110 990 20 30 0x00000020) + Line(2700 460 2110 460 20 30 0x00000020) + Line(1190 1060 2190 1060 20 30 0x00000020) + Line(2690 1160 2630 1160 20 30 0x00000020) + Line(2700 1060 2640 1060 20 30 0x00000020) + Line(2700 960 2640 960 20 30 0x00000020) + Line(2700 860 2640 860 20 30 0x00000020) + Line(2700 760 2640 760 20 30 0x00000020) + Line(2700 660 2640 660 20 30 0x00000020) + Line(2190 1060 2190 560 20 30 0x00000020) + Line(1100 650 1600 150 20 30 0x00000020) + Line(3780 910 3560 910 20 30 0x00000020) + Line(3560 1010 3510 960 20 30 0x00000020) + Line(3820 1010 3560 1010 20 30 0x00000020) + Line(3560 1110 3510 1060 20 30 0x00000020) + Line(3860 1110 3560 1110 20 30 0x00000020) + Line(3560 1210 3510 1160 20 30 0x00000020) + Line(3900 1210 3560 1210 20 30 0x00000020) + Line(3820 190 3820 1010 20 30 0x00000020) + Line(1660 190 3820 190 20 30 0x00000020) + Line(3860 150 3860 1110 20 30 0x00000020) + Line(3780 230 3780 910 20 30 0x00000020) + Line(1720 230 3780 230 20 30 0x00000020) + Line(1600 150 3860 150 20 30 0x00000020) + Line(3740 270 3740 810 20 30 0x00000020) + Line(1780 270 3740 270 20 30 0x00000020) + Line(3700 710 3560 710 20 30 0x00000020) + Line(1540 110 3900 110 20 30 0x00000020) + Line(3700 310 3700 710 20 30 0x00000020) + Line(1840 310 3700 310 20 30 0x00000020) + Line(1100 1050 1840 310 20 30 0x00000020) + Line(1100 950 1780 270 20 30 0x00000020) + Line(1100 850 1720 230 20 30 0x00000020) + Line(1100 750 1660 190 20 30 0x00000020) + Line(1100 550 1540 110 20 30 0x00000020) + Line(3540 460 3520 460 20 30 0x00000020) + Line(3740 810 3560 810 20 30 0x00000020) + Line(3560 710 3510 660 20 30 0x00000020) + Line(3560 810 3510 760 20 30 0x00000020) + Line(3560 910 3510 860 20 30 0x00000020) + Line(3460 2960 3455 2955 20 30 0x00000020) + Line(3560 3260 3640 3260 20 30 0x00000020) + Line(3500 2960 3460 2960 20 30 0x00000020) + Line(3505 2560 3445 2560 20 30 0x00000020) + Line(3540 2655 3620 2655 20 30 0x00000020) + Line(2950 2710 3500 2710 20 30 0x00000020) + Line(3495 2610 3540 2655 20 30 0x00000220) + Line(3495 2860 3450 2860 20 30 0x00000020) + Line(3515 3115 3560 3160 20 30 0x00000220) + Line(2950 2815 3495 2815 20 30 0x00000020) + Line(2955 3215 3505 3215 20 30 0x00000020) + Line(3505 3360 3445 3360 20 30 0x00000020) + Line(3435 3175 3430 3170 20 30 0x00000020) + Line(3440 2770 3445 2765 20 30 0x00000020) + Line(3510 3015 3555 3060 20 30 0x00000220) + Line(3780 3210 3780 3360 20 30 0x00000020) + Line(3820 3405 3820 3460 20 30 0x00000020) + Line(3505 3060 3440 3060 20 30 0x00000020) + Line(3445 2660 3440 2665 20 30 0x00000020) + Line(3500 2660 3445 2660 20 30 0x00000020) + Line(3560 3160 3640 3160 20 30 0x00000020) + Line(3505 3260 3445 3260 20 30 0x00000020) + Line(3740 2430 3740 3260 20 30 0x00000020) + Line(2950 3015 3500 3015 20 30 0x00000020) + Line(2170 4380 2170 4060 20 30 0x00000020) + Line(2120 4180 2080 4140 20 30 0x00000020) + Line(2120 4430 2120 4180 20 30 0x00000020) + Line(2070 4480 2120 4430 20 30 0x00000020) + Line(1530 3640 1530 3860 20 30 0x00000020) + Line(3550 2960 3630 2960 20 30 0x00000020) + Line(3545 2855 3505 2815 20 30 0x00000020) + Line(3555 3060 3635 3060 20 30 0x00000020) + Line(3505 2915 3550 2960 20 30 0x00000220) + Line(2230 4540 2320 4540 20 30 0x00000020) + Line(2320 4300 2350 4270 20 30 0x00000020) + Line(2320 4540 2320 4300 20 30 0x00000020) + Line(2170 4480 2230 4540 20 30 0x00000020) + Line(2500 2220 1800 2220 20 30 0x00000020) + Line(2520 2200 2500 2220 20 30 0x00000020) + Line(2530 2200 2520 2200 20 30 0x00000020) + Line(2550 3610 2530 3590 20 30 0x00000020) + Line(2905 2010 2955 1960 20 30 0x00000020) + Line(2510 4730 2570 4730 20 30 0x00000020) + Line(2640 5160 2500 5160 20 30 0x00000020) + Line(1380 1615 1380 2490 20 30 0x00000020) + Line(1030 1615 1380 1615 20 30 0x00000020) + Line(1030 530 1030 1615 20 30 0x00000020) + Line(2020 4535 2070 4635 20 30 0x00000020) + Line(1960 3440 2350 3440 20 30 0x00000020) + Line(2965 2660 3440 2660 20 30 0x00000020) + Line(3550 2760 3500 2710 20 30 0x00000020) + Line(3650 4560 3650 4470 20 30 0x00000020) + Line(3860 4040 3860 2310 20 30 0x00000020) + Line(1100 460 1030 530 20 30 0x00000020) + Line(1430 1850 1880 1400 20 30 0x00000020) + Line(1430 2630 1430 1850 20 30 0x00000020) + Line(1730 2620 1730 1650 20 30 0x00000020) + Line(2200 2150 2200 1520 20 30 0x00000020) + Line(2310 1530 2180 1400 20 30 0x00000020) + Line(2310 2150 2310 1530 20 30 0x00000020) + Line(1730 1650 1980 1400 20 30 0x00000020) + Line(1270 2790 1430 2630 20 30 0x00000020) + Line(880 2790 1270 2790 20 30 0x00000020) + Line(2200 1520 2080 1400 20 30 0x00000020) + Line(1880 2770 1730 2620 20 30 0x00000020) + Line(1880 2790 1880 2770 20 30 0x00000020) + Line(2040 2790 2310 2520 20 30 0x00000020) + Line(1980 2790 2040 2790 20 30 0x00000020) + Line(2035 2690 2205 2520 20 30 0x00000020) + Line(1985 2690 2035 2690 20 30 0x00000020) + Line(2085 2470 2430 2470 20 30 0x00000020) + Line(2045 2510 2085 2470 20 30 0x00000020) + Line(2045 2600 2045 2510 20 30 0x00000020) + Line(2005 2640 2045 2600 20 30 0x00000020) + Line(1930 2640 2005 2640 20 30 0x00000020) + Line(3740 2430 2050 2430 20 30 0x00000020) + Line(2530 5525 2250 5525 20 30 0x00000020) + Line(2350 2780 2380 2810 20 30 0x00000020) + Line(1130 2360 1020 2250 20 30 0x00000020) + Line(2050 3665 1985 3600 20 30 0x00000020) + Line(1780 2440 1950 2270 20 30 0x00000020) + Line(1780 2490 1780 2440 20 30 0x00000020) + Line(1830 2540 1780 2590 20 30 0x00000020) + Line(1830 2460 1830 2540 20 30 0x00000020) + Line(1980 2310 1830 2460 20 30 0x00000020) + Line(3860 2310 1980 2310 20 30 0x00000020) + Line(3900 4100 3900 2270 20 30 0x00000020) + Line(3900 2270 1960 2270 20 30 0x00000020) + Line(2700 2310 3000 2310 20 30 0x00000020) + Line(3640 4360 3900 4100 20 30 0x00000020) + Line(3640 4260 3860 4040 20 30 0x00000020) + Line(2640 2770 2645 2765 20 30 0x00000020) + Line(2050 3190 2095 3235 20 30 0x00000020) + Line(1980 3190 2050 3190 20 30 0x00000020) + Line(2570 3250 2610 3210 20 30 0x00000020) + Line(2570 3275 2570 3250 20 30 0x00000020) + Line(3515 5115 3560 5160 20 30 0x00000220) + Line(2950 5115 2905 5160 20 30 0x00000020) + Line(2955 4915 3505 4915 20 30 0x00000020) + Line(3515 4915 3560 4960 20 30 0x00000220) + Line(2950 4915 2905 4960 20 30 0x00000020) + Line(2955 4715 3505 4715 20 30 0x00000020) + Line(3515 4715 3560 4760 20 30 0x00000220) + Line(2950 4715 2905 4760 20 30 0x00000020) + Line(2955 4515 3505 4515 20 30 0x00000020) + Line(3515 4515 3560 4560 20 30 0x00000220) + Line(2950 4515 2905 4560 20 30 0x00000020) + Line(415 3040 220 3040 20 30 0x00000020) + Line(130 3130 130 450 20 30 0x00000020) + Line(380 2990 250 2990 20 30 0x00000020) + Line(170 3080 170 555 20 30 0x00000020) + Line(415 3540 385 3510 20 30 0x00000020) + Line(215 3030 215 655 20 30 0x00000020) + Line(295 2935 295 855 20 30 0x00000020) + Line(250 2980 255 755 20 30 0x00000020) + Line(330 2885 330 955 20 30 0x00000020) + Line(2390 4010 2390 4060 20 30 0x00000020) + Line(800 755 260 755 20 30 0x00000020) + Line(2210 3660 2220 3660 20 30 0x00000020) + Line(2070 3275 2570 3275 20 30 0x00000020) + Line(2035 3240 2070 3275 20 30 0x00000020) + Line(1930 3240 2035 3240 20 30 0x00000020) + Line(2015 3290 2045 3320 20 30 0x00000020) + Line(1980 3290 2015 3290 20 30 0x00000020) + Line(1930 3340 2000 3340 20 30 0x00000020) + Line(1910 3490 1960 3440 20 30 0x00000020) + Line(1330 2425 1330 2540 20 30 0x00000020) + Line(1330 2540 1380 2590 20 30 0x00000020) + Line(2950 2710 2905 2755 20 30 0x00000020) + Line(1720 4075 1780 4015 20 30 0x00000020) + Line(2060 4830 455 4830 20 30 0x00000020) + Line(800 955 330 955 20 30 0x00000020) + Line(855 2590 805 2640 20 30 0x00000020) + Line(1800 2220 1800 2140 20 30 0x00000020) + Line(1830 3860 1830 3640 20 30 0x00000020) + Line(780 2485 840 2540 20 30 0x00000020) + Line(840 2540 890 2590 20 30 0x00000020) + Line(810 2690 860 2640 20 30 0x00000020) + Line(860 2640 1130 2640 20 30 0x00000020) + Line(2955 3115 3505 3115 20 30 0x00000020) + Line(800 855 295 855 20 30 0x00000020) + Line(2700 3460 2640 3460 20 30 0x00000020) + Line(1120 4070 1120 4195 20 30 0x00000020) + Line(1170 4195 1170 4090 20 30 0x00000020) + Line(2955 4310 3505 4310 20 30 0x00000020) + Line(570 4245 620 4195 20 30 0x00000020) + Line(1020 4030 1020 4195 20 30 0x00000020) + Line(1620 4005 1670 3955 20 30 0x00000020) + Line(1670 3955 1670 3875 20 30 0x00000020) + Line(1020 2250 1020 1930 20 30 0x00000020) + Line(1780 3695 1780 4015 20 30 0x00000020) + Line(2100 5165 1915 4965 20 30 0x00000020) + Line(1320 4140 1320 4195 20 30 0x00000020) + Line(1030 2465 750 2175 20 30 0x00000020) + Line(1880 3690 1880 3805 20 30 0x00000020) + Line(2700 1260 2640 1260 20 30 0x00000020) + Line(880 2690 860 2690 20 30 0x00000020) + Line(2600 5420 2570 5450 20 30 0x00000020) + Line(850 1055 795 1050 20 30 0x00000020) + Line(3560 960 3640 960 20 30 0x00000020) + Line(2110 1160 2110 1130 20 30 0x00000020) + Line(2955 1010 2910 1055 20 30 0x00000020) + Line(1100 555 1105 555 20 30 0x00000020) + Line(3515 4310 3560 4355 20 30 0x00000220) + Line(3550 2760 3640 2760 20 30 0x00000020) + Line(2905 860 2840 860 20 30 0x00000020) + Line(3560 1560 3640 1560 20 30 0x00000020) + Line(3560 1460 3640 1460 20 30 0x00000020) + Line(2955 915 2910 960 20 30 0x00000020) + Line(2965 3160 3440 3160 20 30 0x00000020) + Line(1830 3640 1880 3590 20 30 0x00000020) + Line(3500 3415 3545 3460 20 30 0x00000220) + Line(2950 4310 2905 4355 20 30 0x00000020) + Line(2700 2710 2570 2710 20 30 0x00000020) + Line(2955 4115 3505 4115 20 30 0x00000020) + Line(2610 3005 2640 3005 20 30 0x00000020) + Line(3515 4115 3560 4160 20 30 0x00000220) + Line(3510 3310 3555 3355 20 30 0x00000220) + Line(1670 3875 1730 3815 20 30 0x00000020) + Line(1730 3640 1730 3815 20 30 0x00000020) + Line(1780 3590 1730 3640 20 30 0x00000020) + Line(905 1090 905 1825 20 30 0x00000020) + Line(1920 4430 1920 3960 20 30 0x00000020) + Line(1970 4480 1920 4430 20 30 0x00000020) + Line(2140 3910 2140 3895 20 30 0x00000020) + Line(1240 2335 1330 2425 20 30 0x00000020) + Line(1880 3490 1910 3490 20 30 0x00000020) + Line(880 2990 850 2990 20 30 0x00000020) + Line(1240 1825 1240 2335 20 30 0x00000020) + Line(2350 3440 2395 3490 20 30 0x00000020) + Line(2610 3490 2630 3470 20 30 0x00000020) + Line(3740 4560 3740 4965 20 30 0x00000020) + Line(2640 3005 2640 2965 20 30 0x00000020) + Line(135 5110 1760 5110 20 30 0x00000020) + Line(2955 2960 3430 2960 20 30 0x00000020) + Line(175 5060 1810 5060 20 30 0x00000020) + Line(2950 2910 3500 2910 20 30 0x00000020) + Line(205 5010 1850 5010 20 30 0x00000020) + Line(2955 2860 3430 2860 20 30 0x00000020) + Line(470 4480 470 4780 20 30 0x00000020) + Line(255 4965 1910 4965 20 30 0x00000020) + Line(2905 2960 2950 2915 20 30 0x00000020) + Line(295 4920 1955 4920 20 30 0x00000020) + Line(2950 2760 3425 2760 20 30 0x00000020) + Line(3505 2760 3445 2760 20 30 0x00000020) + Line(330 4875 2005 4875 20 30 0x00000020) + Line(3515 3215 3560 3260 20 30 0x00000220) + Line(3650 4470 3640 4460 20 30 0x00000020) + Line(330 3450 325 4870 20 30 0x00000020) + Line(1370 4160 1370 4195 20 30 0x00000020) + Line(1280 3690 1280 3770 20 30 0x00000020) + Line(2100 5465 1765 5110 20 30 0x00000020) + Line(570 4480 620 4430 20 30 0x00000020) + Line(1280 3770 1020 4030 20 30 0x00000020) + Line(1380 3590 1380 3600 20 30 0x00000020) + Line(2630 5360 2590 5360 20 30 0x00000020) + Line(570 4380 570 4245 20 30 0x00000020) + Line(520 4655 520 4775 20 30 0x00000020) + Line(1380 3690 1380 3810 20 30 0x00000020) + Line(2700 5460 2640 5460 20 30 0x00000020) + Line(1230 3750 970 4010 20 30 0x00000020) + Line(1280 3590 1230 3640 20 30 0x00000020) + Line(2100 5365 1815 5060 20 30 0x00000020) + Line(1180 3730 920 3990 20 30 0x00000020) + Line(1180 3690 1180 3730 20 30 0x00000020) + Line(1330 3650 1330 3790 20 30 0x00000020) + Line(1380 3600 1330 3650 20 30 0x00000020) + Line(1330 3790 1070 4050 20 30 0x00000020) + Line(2700 5060 2510 5060 20 30 0x00000020) + Line(1230 3640 1230 3750 20 30 0x00000020) + Line(1130 3640 1130 3720 20 30 0x00000020) + Line(1180 3590 1130 3640 20 30 0x00000020) + Line(2100 5265 1855 5010 20 30 0x00000020) + Line(1130 3720 870 3980 20 30 0x00000020) + Line(670 4380 670 4245 20 30 0x00000020) + Line(2640 5460 2580 5520 20 30 0x00000020) + Line(970 3810 820 3960 20 30 0x00000020) + Line(2965 3360 3440 3360 20 30 0x00000020) + Line(990 3810 970 3810 20 30 0x00000020) + Line(810 1150 630 1150 20 30 0x00000020) + Line(2905 5460 2750 5460 20 30 0x00000020) + Line(1080 3720 990 3810 20 30 0x00000020) + Line(410 4645 435 4675 20 30 0x00000020) + Line(630 1150 630 2050 20 30 0x00000020) + Line(2750 5460 2705 5415 20 30 0x00000020) + Line(3645 4560 3740 4560 20 30 0x00000020) + Line(2580 5575 2410 5575 20 30 0x00000020) + Line(2105 4875 2080 4875 20 30 0x00000020) + Line(1630 3740 1630 3900 20 30 0x00000020) + Line(2640 4960 2510 4960 20 30 0x00000020) + Line(2510 4960 2410 5060 20 30 0x00000020) + Line(2510 5060 2410 5160 20 30 0x00000020) + Line(2500 5160 2400 5260 20 30 0x00000020) + Line(2520 5260 2420 5360 20 30 0x00000020) + Line(2590 5360 2490 5475 20 30 0x00000020) + Line(2250 4620 2250 5525 20 30 0x00000020) + Line(2635 3175 2630 3170 20 30 0x00000020) + Line(520 2150 540 2170 20 30 0x00000020) + Line(1380 3810 1120 4070 20 30 0x00000020) + Line(580 4170 520 4240 20 30 0x00000020) + Line(670 3490 485 3490 20 30 0x00000020) + Line(530 4150 410 4190 20 30 0x00000020) + Line(2700 5410 2600 5410 20 30 0x00000020) + Line(1680 3690 1630 3740 20 30 0x00000020) + Line(1320 4430 1320 4245 20 30 0x00000020) + Line(1630 3900 1370 4160 20 30 0x00000020) + Line(520 4595 520 4655 20 30 0x00000020) + Line(1220 4100 1220 4195 20 30 0x00000020) + Line(1270 4120 1270 4195 20 30 0x00000020) + Line(2960 3260 3435 3260 20 30 0x00000020) + Line(1580 3880 1320 4140 20 30 0x00000020) + Line(1580 3690 1580 3880 20 30 0x00000020) + Line(2100 4770 520 4775 20 30 0x00000020) + Line(1100 1150 1190 1060 20 30 0x00000020) + Line(1530 3860 1270 4120 20 30 0x00000020) + Line(2390 4060 2480 4295 20 30 0x00000020) + Line(1580 3590 1530 3640 20 30 0x00000020) + Line(3700 3095 3700 3160 20 30 0x00000020) + Line(1480 3840 1220 4100 20 30 0x00000020) + Line(1480 3690 1480 3840 20 30 0x00000020) + Line(2640 2860 2610 2860 20 30 0x00000020) + Line(410 4190 410 4645 20 30 0x00000020) + Line(2950 3310 3500 3310 20 30 0x00000020) + Line(1430 3830 1170 4090 20 30 0x00000020) + Line(1430 3640 1430 3830 20 30 0x00000020) + Line(1480 3590 1430 3640 20 30 0x00000020) + Line(3545 2855 3625 2855 20 30 0x00000020) + Line(2600 5410 2600 5420 20 30 0x00000020) + Line(620 4430 620 4245 20 30 0x00000020) + Line(2100 5065 1965 4920 20 30 0x00000020) + Line(970 3750 770 3950 20 30 0x00000020) + Line(1000 3750 970 3750 20 30 0x00000020) + Line(1030 3720 1000 3750 20 30 0x00000020) + Line(1030 3640 1030 3720 20 30 0x00000020) + Line(1080 3590 1030 3640 20 30 0x00000020) + Line(520 4240 520 4595 20 30 0x00000020) + Line(930 3720 720 3930 20 30 0x00000020) + Line(980 3690 930 3720 20 30 0x00000020) + Line(620 4245 670 4195 20 30 0x00000020) + Line(670 3900 670 4195 20 30 0x00000020) + Line(880 3690 670 3900 20 30 0x00000020) + Line(620 3820 620 4195 20 30 0x00000020) + Line(850 3590 620 3820 20 30 0x00000020) + Line(880 3590 850 3590 20 30 0x00000020) + Line(2950 4115 2905 4160 20 30 0x00000020) + Line(2950 3915 3500 3915 20 30 0x00000020) + Line(3510 3915 3555 3960 20 30 0x00000220) + Line(2945 3915 2900 3960 20 30 0x00000020) + Line(2950 3615 3495 3615 20 30 0x00000020) + Line(2955 3715 3505 3715 20 30 0x00000020) + Line(2950 3715 2905 3760 20 30 0x00000020) + Line(2960 2560 3435 2560 20 30 0x00000020) + Line(2955 3510 3505 3510 20 30 0x00000020) + Line(2950 3510 2905 3555 20 30 0x00000020) + Line(860 2690 810 2740 20 30 0x00000020) + Line(3780 3360 3650 3360 20 30 0x00000020) + Line(2950 3310 2905 3355 20 30 0x00000020) + Line(1720 4430 1720 4075 20 30 0x00000020) + Line(2950 2015 3495 2015 20 30 0x00000020) + Line(2950 3115 2905 3160 20 30 0x00000020) + Line(1920 3960 1970 3910 20 30 0x00000020) + Line(3580 400 3640 460 20 30 0x00000020) + Line(3495 2610 2955 2610 20 30 0x00000020) + Line(2480 4620 2480 4290 20 30 0x00000020) + Line(2110 3595 2215 3595 20 30 0x00000020) + Line(3560 3760 3640 3760 20 30 0x00000020) + Line(1130 2640 1130 2360 20 30 0x00000020) + Line(2500 4030 2500 3640 20 30 0x00000020) + Line(2950 2515 2905 2560 20 30 0x00000020) + Line(2705 5360 2645 5360 20 30 0x00000020) + Line(290 2940 405 2940 20 30 0x00000020) + Line(3560 5160 3640 5160 20 30 0x00000020) + Line(3560 5260 3640 5260 20 30 0x00000020) + Line(2905 5210 2955 5160 20 30 0x00000020) + Line(3500 5215 3515 5215 20 30 0x00000020) + Line(2700 5160 2750 5210 20 30 0x00000020) + Line(2750 5210 2900 5210 20 30 0x00000020) + Line(2955 5160 3510 5160 20 30 0x00000020) + Line(1570 4480 1570 4455 20 30 0x00000020) + Line(2100 4965 2010 4875 20 30 0x00000020) + Line(2950 5215 3495 5215 20 30 0x00000020) + Line(2905 5310 2955 5260 20 30 0x00000020) + Line(3515 5215 3560 5260 20 30 0x00000020) + Line(2700 5260 2750 5310 20 30 0x00000020) + Line(2750 5310 2900 5310 20 30 0x00000020) + Line(2955 5260 3510 5260 20 30 0x00000020) + Line(1570 4455 1620 4405 20 30 0x00000020) + Line(1880 2690 1930 2640 20 30 0x00000020) + Line(2950 5215 2905 5260 20 30 0x00000020) + Line(2705 5160 2645 5160 20 30 0x00000020) + Line(2905 5260 2840 5260 20 30 0x00000020) + Line(3560 4960 3640 4960 20 30 0x00000020) + Line(3560 5060 3640 5060 20 30 0x00000020) + Line(2905 5010 2955 4960 20 30 0x00000020) + Line(3500 5015 3515 5015 20 30 0x00000020) + Line(2700 4960 2750 5010 20 30 0x00000020) + Line(2750 5010 2900 5010 20 30 0x00000020) + Line(2955 4960 3510 4960 20 30 0x00000020) + Line(920 3990 920 4195 20 30 0x00000020) + Line(2555 5480 2530 5525 20 30 0x00000020) + Line(1020 1930 850 1925 20 30 0x00000020) + Line(2905 5110 2955 5060 20 30 0x00000020) + Line(3515 5015 3560 5060 20 30 0x00000020) + Line(2700 5060 2750 5110 20 30 0x00000020) + Line(2750 5110 2900 5110 20 30 0x00000020) + Line(2955 5060 3510 5060 20 30 0x00000020) + Line(970 4010 970 4195 20 30 0x00000020) + Line(2700 5260 2520 5260 20 30 0x00000020) + Line(2950 5015 2905 5060 20 30 0x00000020) + Line(2705 4960 2645 4960 20 30 0x00000020) + Line(2905 5060 2840 5060 20 30 0x00000020) + Line(3560 4760 3640 4760 20 30 0x00000020) + Line(3560 4860 3640 4860 20 30 0x00000020) + Line(2905 4810 2955 4760 20 30 0x00000020) + Line(3500 4815 3515 4815 20 30 0x00000020) + Line(2700 4760 2750 4810 20 30 0x00000020) + Line(2750 4810 2900 4810 20 30 0x00000020) + Line(2955 4760 3510 4760 20 30 0x00000020) + Line(820 3960 820 4195 20 30 0x00000020) + Line(2580 5520 2580 5575 20 30 0x00000020) + Line(2950 4815 3495 4815 20 30 0x00000020) + Line(2905 4910 2955 4860 20 30 0x00000020) + Line(3515 4815 3560 4860 20 30 0x00000020) + Line(2700 4860 2750 4910 20 30 0x00000020) + Line(2750 4910 2900 4910 20 30 0x00000020) + Line(2955 4860 3510 4860 20 30 0x00000020) + Line(870 3980 870 4195 20 30 0x00000020) + Line(2400 5475 2500 5475 20 30 0x00000020) + Line(2950 4815 2905 4860 20 30 0x00000020) + Line(2705 4760 2645 4760 20 30 0x00000020) + Line(2905 4860 2840 4860 20 30 0x00000020) + Line(3560 4560 3640 4560 20 30 0x00000020) + Line(3560 4660 3640 4660 20 30 0x00000020) + Line(2905 4610 2955 4560 20 30 0x00000020) + Line(3500 4615 3515 4615 20 30 0x00000020) + Line(2700 4560 2750 4610 20 30 0x00000020) + Line(2750 4610 2900 4610 20 30 0x00000020) + Line(2955 4560 3510 4560 20 30 0x00000020) + Line(1320 4245 1370 4195 20 30 0x00000020) + Line(2700 4860 2510 4860 20 30 0x00000020) + Line(2950 4615 3495 4615 20 30 0x00000020) + Line(2905 4710 2955 4660 20 30 0x00000020) + Line(3515 4615 3560 4660 20 30 0x00000020) + Line(2700 4660 2750 4710 20 30 0x00000020) + Line(2750 4710 2900 4710 20 30 0x00000020) + Line(2955 4660 3510 4660 20 30 0x00000020) + Line(720 3930 720 4195 20 30 0x00000020) + Line(2215 3595 2390 3770 20 30 0x00000020) + Line(2950 4615 2905 4660 20 30 0x00000020) + Line(2705 4560 2645 4560 20 30 0x00000020) + Line(2700 4660 2640 4660 20 30 0x00000020) + Line(2905 4560 2840 4560 20 30 0x00000020) + Line(2905 4660 2840 4660 20 30 0x00000020) + Line(3560 4360 3640 4360 20 30 0x00000020) + Line(3560 4460 3640 4460 20 30 0x00000020) + Line(2905 4410 2955 4360 20 30 0x00000020) + Line(3500 4415 3515 4415 20 30 0x00000020) + Line(2700 4360 2750 4410 20 30 0x00000020) + Line(2750 4410 2900 4410 20 30 0x00000020) + Line(2955 4360 3510 4360 20 30 0x00000020) + Line(1270 4245 1320 4195 20 30 0x00000020) + Line(2410 4760 2510 4730 20 30 0x00000020) + Line(2950 4415 3495 4415 20 30 0x00000020) + Line(2905 4510 2955 4460 20 30 0x00000020) + Line(3515 4415 3560 4460 20 30 0x00000020) + Line(2700 4460 2750 4510 20 30 0x00000020) + Line(2750 4510 2900 4510 20 30 0x00000020) + Line(2955 4460 3510 4460 20 30 0x00000020) + Line(1270 4480 1320 4430 20 30 0x00000020) + Line(2570 5450 2555 5480 20 30 0x00000020) + Line(2950 4415 2905 4460 20 30 0x00000020) + Line(2705 4360 2645 4360 20 30 0x00000020) + Line(2700 4460 2640 4460 20 30 0x00000020) + Line(2905 4360 2840 4360 20 30 0x00000020) + Line(2905 4460 2840 4460 20 30 0x00000020) + Line(3560 4160 3640 4160 20 30 0x00000020) + Line(3560 4260 3640 4260 20 30 0x00000020) + Line(2905 4210 2955 4160 20 30 0x00000020) + Line(3500 4215 3515 4215 20 30 0x00000020) + Line(2700 4160 2750 4210 20 30 0x00000020) + Line(2750 4210 2900 4210 20 30 0x00000020) + Line(2955 4160 3510 4160 20 30 0x00000020) + Line(1220 4430 1220 4245 20 30 0x00000020) + Line(2520 4800 2410 4860 20 30 0x00000020) + Line(2950 4215 3495 4215 20 30 0x00000020) + Line(2905 4310 2955 4260 20 30 0x00000020) + Line(3515 4215 3560 4260 20 30 0x00000020) + Line(2700 4260 2750 4310 20 30 0x00000020) + Line(2750 4310 2900 4310 20 30 0x00000020) + Line(2955 4260 3510 4260 20 30 0x00000020) + Line(1220 4245 1270 4195 20 30 0x00000020) + Line(2640 4760 2520 4800 20 30 0x00000020) + Line(2950 4215 2905 4260 20 30 0x00000020) + Line(2705 4160 2645 4160 20 30 0x00000020) + Line(2700 4260 2640 4260 20 30 0x00000020) + Line(2905 4160 2840 4160 20 30 0x00000020) + Line(2905 4260 2840 4260 20 30 0x00000020) + Line(3555 3960 3635 3960 20 30 0x00000020) + Line(3555 4060 3635 4060 20 30 0x00000020) + Line(2900 4010 2950 3960 20 30 0x00000020) + Line(3495 4015 3510 4015 20 30 0x00000020) + Line(2695 3960 2745 4010 20 30 0x00000020) + Line(2745 4010 2895 4010 20 30 0x00000020) + Line(2950 3960 3505 3960 20 30 0x00000020) + Line(1170 4480 1220 4430 20 30 0x00000020) + Line(2510 4860 2410 4960 20 30 0x00000020) + Line(2945 4015 3490 4015 20 30 0x00000020) + Line(2900 4110 2950 4060 20 30 0x00000020) + Line(3510 4015 3555 4060 20 30 0x00000020) + Line(2695 4060 2745 4110 20 30 0x00000020) + Line(2745 4110 2895 4110 20 30 0x00000020) + Line(2950 4060 3505 4060 20 30 0x00000020) + Line(1270 4380 1270 4245 20 30 0x00000020) + Line(2695 5560 2650 5560 20 30 0x00000020) + Line(2945 4015 2900 4060 20 30 0x00000020) + Line(2700 3960 2640 3960 20 30 0x00000020) + Line(2695 4060 2635 4060 20 30 0x00000020) + Line(2900 3960 2835 3960 20 30 0x00000020) + Line(2900 4060 2835 4060 20 30 0x00000020) + Line(3515 3715 3560 3760 20 30 0x00000220) + Line(3560 3860 3640 3860 20 30 0x00000020) + Line(2905 3810 2955 3760 20 30 0x00000020) + Line(3500 3815 3515 3815 20 30 0x00000020) + Line(2700 3760 2750 3810 20 30 0x00000020) + Line(2750 3810 2900 3810 20 30 0x00000020) + Line(2955 3760 3510 3760 20 30 0x00000020) + Line(1120 4245 1170 4195 20 30 0x00000020) + Line(3820 2360 3820 3280 20 30 0x00000020) + Line(2950 3815 3495 3815 20 30 0x00000020) + Line(2905 3910 2955 3860 20 30 0x00000020) + Line(3515 3815 3560 3860 20 30 0x00000020) + Line(2700 3860 2750 3910 20 30 0x00000020) + Line(2750 3910 2900 3910 20 30 0x00000020) + Line(2955 3860 3510 3860 20 30 0x00000020) + Line(1170 4245 1220 4195 20 30 0x00000020) + Line(415 2940 455 2900 20 30 0x00000020) + Line(2950 3815 2905 3860 20 30 0x00000020) + Line(2705 3760 2645 3760 20 30 0x00000020) + Line(2700 3860 2640 3860 20 30 0x00000020) + Line(2905 3760 2840 3760 20 30 0x00000020) + Line(2905 3860 2840 3860 20 30 0x00000020) + Line(3515 3510 3560 3555 20 30 0x00000220) + Line(3560 3560 3640 3560 20 30 0x00000020) + Line(2905 3610 2955 3560 20 30 0x00000020) + Line(3500 3615 3515 3615 20 30 0x00000020) + Line(2700 3560 2750 3610 20 30 0x00000020) + Line(2750 3610 2900 3610 20 30 0x00000020) + Line(2955 3560 3510 3560 20 30 0x00000020) + Line(1070 4245 1120 4195 20 30 0x00000020) + Line(3510 5515 3555 5560 20 30 0x00000220) + Line(3515 3615 3560 3660 20 30 0x00000020) + Line(2905 3710 2955 3660 20 30 0x00000020) + Line(3560 3660 3640 3660 20 30 0x00000020) + Line(2700 3660 2750 3710 20 30 0x00000020) + Line(2750 3710 2900 3710 20 30 0x00000020) + Line(2955 3660 3510 3660 20 30 0x00000020) + Line(1170 4380 1170 4245 20 30 0x00000020) + Line(1120 4430 1120 4245 20 30 0x00000020) + Line(2950 3615 2905 3660 20 30 0x00000020) + Line(2705 3560 2645 3560 20 30 0x00000020) + Line(2700 3660 2640 3660 20 30 0x00000020) + Line(2905 3560 2840 3560 20 30 0x00000020) + Line(2905 3660 2840 3660 20 30 0x00000020) + Line(3585 2560 3580 2560 20 30 0x00000020) + Line(2955 3410 3495 3410 20 30 0x00000020) + Line(2905 3410 2955 3360 20 30 0x00000020) + Line(3510 3160 3450 3160 20 30 0x00000020) + Line(2700 3360 2750 3410 20 30 0x00000020) + Line(2750 3410 2900 3410 20 30 0x00000020) + Line(2030 3735 1930 3730 20 30 0x00000020) + Line(970 4480 1020 4430 20 30 0x00000020) + Line(1070 4380 1070 4245 20 30 0x00000020) + Line(3580 2560 3530 2510 20 30 0x00000020) + Line(2905 3510 2955 3460 20 30 0x00000020) + Line(2480 4620 2250 4620 20 30 0x00000020) + Line(2700 3460 2750 3510 20 30 0x00000020) + Line(2750 3510 2900 3510 20 30 0x00000020) + Line(2220 4435 2220 3860 20 30 0x00000020) + Line(1020 4245 1070 4195 20 30 0x00000020) + Line(2950 3415 2905 3460 20 30 0x00000020) + Line(2705 3360 2645 3360 20 30 0x00000020) + Line(2905 3460 2840 3460 20 30 0x00000020) + Line(2270 4480 2220 4435 20 30 0x00000020) + Line(2070 4635 2100 4665 20 30 0x00000020) + Line(2910 3210 2960 3160 20 30 0x00000020) + Line(905 480 905 950 20 30 0x00000020) + Line(2705 3160 2755 3210 20 30 0x00000020) + Line(2755 3210 2905 3210 20 30 0x00000020) + Line(1020 4430 1020 4245 20 30 0x00000020) + Line(970 4380 970 4245 20 30 0x00000020) + Line(920 4430 920 4245 20 30 0x00000020) + Line(800 375 905 480 20 30 0x00000020) + Line(2910 3310 2960 3260 20 30 0x00000020) + Line(800 350 800 375 20 30 0x00000020) + Line(2705 3260 2755 3310 20 30 0x00000020) + Line(2755 3310 2905 3310 20 30 0x00000020) + Line(2390 3770 2390 3920 20 30 0x00000020) + Line(920 4245 970 4195 20 30 0x00000020) + Line(970 4245 1020 4195 20 30 0x00000020) + Line(2955 3215 2910 3260 20 30 0x00000020) + Line(2710 3160 2650 3160 20 30 0x00000020) + Line(2705 3260 2645 3260 20 30 0x00000020) + Line(2910 3160 2845 3160 20 30 0x00000020) + Line(2910 3260 2845 3260 20 30 0x00000020) + Line(2270 3800 1880 3800 20 30 0x00000020) + Line(2220 3660 2330 3770 20 30 0x00000020) + Line(2905 3010 2955 2960 20 30 0x00000020) + Line(1805 3540 1930 3540 20 30 0x00000020) + Line(2700 2960 2750 3010 20 30 0x00000020) + Line(2750 3010 2900 3010 20 30 0x00000020) + Line(2140 3910 1970 3910 20 30 0x00000020) + Line(820 4430 820 4245 20 30 0x00000020) + Line(820 4245 870 4195 20 30 0x00000020) + Line(1930 3540 1930 3735 20 30 0x00000220) + Line(2905 3110 2955 3060 20 30 0x00000020) + Line(2220 3860 1830 3860 20 30 0x00000020) + Line(2700 3060 2750 3110 20 30 0x00000020) + Line(2750 3110 2900 3110 20 30 0x00000020) + Line(1670 4480 1720 4430 20 30 0x00000020) + Line(870 4245 920 4195 20 30 0x00000020) + Line(870 4480 920 4430 20 30 0x00000020) + Line(2950 3015 2905 3060 20 30 0x00000020) + Line(2705 2960 2645 2960 20 30 0x00000020) + Line(2905 3060 2840 3060 20 30 0x00000020) + Line(2005 3490 2110 3595 20 30 0x00000020) + Line(2215 3665 2050 3665 20 30 0x00000020) + Line(2905 2810 2955 2760 20 30 0x00000020) + Line(2950 5415 2905 5460 20 30 0x00000020) + Line(2700 2760 2750 2810 20 30 0x00000020) + Line(2750 2810 2900 2810 20 30 0x00000020) + Line(535 3540 415 3540 20 30 0x00000020) + Line(770 4245 820 4195 20 30 0x00000020) + Line(720 4245 770 4195 20 30 0x00000020) + Line(1680 2130 1620 2070 20 30 0x00000020) + Line(2905 2910 2955 2860 20 30 0x00000020) + Line(2950 2815 2905 2860 20 30 0x00000020) + Line(2700 2860 2750 2910 20 30 0x00000020) + Line(2750 2910 2900 2910 20 30 0x00000020) + Line(380 3190 130 3190 20 30 0x00000020) + Line(770 4480 820 4430 20 30 0x00000020) + Line(870 4380 870 4245 20 30 0x00000020) + Line(2705 2760 2645 2760 20 30 0x00000020) + Line(2750 2760 2700 2710 20 30 0x00000020) + Line(2610 2860 2430 3040 20 30 0x00000020) + Line(2905 2860 2840 2860 20 30 0x00000020) + Line(2955 1960 3510 1960 20 30 0x00000020) + Line(2750 2010 2900 2010 20 30 0x00000020) + Line(2905 2610 2955 2560 20 30 0x00000020) + Line(3530 2510 2950 2510 20 30 0x00000020) + Line(2700 2560 2750 2610 20 30 0x00000020) + Line(2750 2610 2900 2610 20 30 0x00000020) + Line(2020 4540 2020 3970 20 30 0x00000020) + Line(670 4480 720 4430 20 30 0x00000020) + Line(670 4245 720 4195 20 30 0x00000020) + Line(2500 3640 2530 3610 20 30 0x00000020) + Line(2905 2710 2955 2660 20 30 0x00000020) + Line(3560 2160 3640 2160 20 30 0x00000020) + Line(2700 2660 2750 2710 20 30 0x00000020) + Line(2750 2710 2900 2710 20 30 0x00000020) + Line(415 3390 295 3390 20 30 0x00000020) + Line(770 4380 770 4245 20 30 0x00000020) + Line(720 4430 720 4245 20 30 0x00000020) + Line(2950 2615 2905 2660 20 30 0x00000020) + Line(2705 2560 2645 2560 20 30 0x00000020) + Line(2905 2660 2840 2660 20 30 0x00000020) + Line(3555 5560 3635 5560 20 30 0x00000020) + Line(2950 5415 3495 5415 20 30 0x00000020) + Line(2905 5510 2955 5460 20 30 0x00000020) + Line(2695 5560 2745 5610 20 30 0x00000020) + Line(2745 5610 2895 5610 20 30 0x00000020) + Line(1680 2490 1680 2130 20 30 0x00000020) + Line(3820 3460 3640 3460 20 30 0x00000020) + Line(3740 4965 3745 4970 20 30 0x00000020) + Line(3515 5415 3560 5460 20 30 0x00000020) + Line(2900 5560 2835 5560 20 30 0x00000020) + Line(2900 5610 2950 5560 20 30 0x00000020) + Line(2700 5460 2750 5510 20 30 0x00000020) + Line(3560 5460 3640 5460 20 30 0x00000020) + Line(3560 5360 3640 5360 20 30 0x00000020) + Line(1980 3490 2005 3490 20 30 0x00000020) + Line(2750 5510 2900 5510 20 30 0x00000020) + Line(3500 5415 3515 5415 20 30 0x00000020) + Line(2905 5410 2955 5360 20 30 0x00000020) + Line(2955 5460 3510 5460 20 30 0x00000020) + Line(2700 5360 2750 5410 20 30 0x00000020) + Line(2270 3800 2270 4380 20 30 0x00000020) + Line(2905 2960 2840 2960 20 30 0x00000020) + Line(2905 2560 2840 2560 20 30 0x00000020) + Line(2695 2860 2650 2860 20 30 0x00000020) + Line(1070 4480 1120 4430 20 30 0x00000020) + Line(2955 5360 3510 5360 20 30 0x00000020) + Line(2905 3360 2840 3360 20 30 0x00000020) + Line(2950 5515 3500 5515 20 30 0x00000020) + Line(1980 2890 2250 2890 20 30 0x00000020) + Line(2950 5015 3495 5015 20 30 0x00000020) + Line(2750 5410 2900 5410 20 30 0x00000020) + Line(1620 4405 1620 4005 20 30 0x00000020) + Line(2905 5360 2840 5360 20 30 0x00000020) + Line(2945 5515 2900 5560 20 30 0x00000020) + Line(2905 5160 2840 5160 20 30 0x00000020) + Line(2905 4960 2840 4960 20 30 0x00000020) + Line(2905 4760 2840 4760 20 30 0x00000020) + Line(2955 5315 3505 5315 20 30 0x00000020) + Line(2580 3145 2620 3105 20 30 0x00000020) + Line(1930 2940 2005 2940 20 30 0x00000020) + Line(905 1825 1240 1825 20 30 0x00000020) + Line(2000 2940 2260 2940 20 30 0x00000020) + Line(3820 3410 3820 3270 20 30 0x00000020) + Line(2260 2940 2540 2660 20 30 0x00000020) + Line(2100 4865 2060 4830 20 30 0x00000020) + Line(1880 2990 1930 2940 20 30 0x00000020) + Line(3650 3260 3645 3255 20 30 0x00000020) + Line(930 2440 715 2225 20 30 0x00000020) + Line(2905 2760 2750 2760 20 30 0x00000020) + Line(1890 2590 1940 2540 20 30 0x00000020) + Line(2580 3035 2610 3005 20 30 0x00000020) + Line(880 3390 830 3440 20 30 0x00000020) + Line(2020 3360 2630 3360 20 30 0x00000020) + Line(430 2540 730 2540 20 30 0x00000020) + Line(480 2290 505 2275 20 30 0x00000020) + Line(380 2590 430 2540 20 30 0x00000020) + Line(1220 3500 1625 3500 20 30 0x00000020) + Line(410 3190 460 3140 20 30 0x00000220) + Line(2610 3210 2635 3210 20 30 0x00000020) + Line(400 2770 430 2740 20 30 0x00000020) + Line(1915 3190 1965 3140 20 30 0x00000020) + Line(2950 5315 2905 5360 20 30 0x00000020) + Line(2590 3315 2640 3265 20 30 0x00000020) + Line(1880 3290 1930 3240 20 30 0x00000020) + Line(2700 560 2190 560 20 30 0x00000020) + Line(460 3190 410 3240 20 30 0x00000020) + Line(550 2740 650 2640 20 30 0x00000020) + Line(545 2175 530 2165 20 30 0x00000020) + Line(650 2640 750 2640 20 30 0x00000020) + Line(380 2770 400 2770 20 30 0x00000020) + Line(2635 3210 2635 3175 20 30 0x00000020) + Line(655 3040 460 3040 20 30 0x00000020) + Line(830 3240 880 3190 20 30 0x00000020) + Line(2955 2115 3505 2115 20 30 0x00000020) + Line(655 2990 480 2990 20 30 0x00000020) + Line(680 2890 725 2845 20 30 0x00000020) + Line(3555 3355 3635 3355 20 30 0x00000020) + Line(3560 560 3640 560 20 30 0x00000020) + Line(1880 3190 1915 3190 20 30 0x00000020) + Line(830 2940 880 2890 20 30 0x00000020) + Line(680 3090 480 3090 20 30 0x00000020) + Line(680 3190 480 3190 20 30 0x00000020) + Line(830 3140 875 3095 20 30 0x00000020) + Line(780 3290 775 3295 20 30 0x00000020) + Line(830 3340 880 3290 20 30 0x00000020) + Line(485 3490 480 3485 20 30 0x00000020) + Line(730 3440 685 3395 20 30 0x00000020) + Line(460 3090 410 3140 20 30 0x00000020) + Line(770 3590 670 3490 20 30 0x00000020) + Line(1380 2595 1235 2740 20 30 0x00000020) + Line(730 3390 685 3345 20 30 0x00000020) + Line(130 3195 130 5100 20 30 0x00000020) + Line(780 3390 730 3390 20 30 0x00000020) + Line(730 3340 680 3290 20 30 0x00000020) + Line(680 3440 730 3490 20 30 0x00000020) + Line(410 3340 250 3340 20 30 0x00000020) + Line(830 3340 730 3340 20 30 0x00000020) + Line(730 3290 685 3245 20 30 0x00000020) + Line(680 3390 505 3390 20 30 0x00000020) + Line(780 3290 730 3290 20 30 0x00000020) + Line(730 3240 680 3190 20 30 0x00000020) + Line(680 3340 460 3340 20 30 0x00000020) + Line(730 3490 780 3490 20 30 0x00000020) + Line(830 3240 730 3240 20 30 0x00000020) + Line(730 3190 680 3140 20 30 0x00000020) + Line(680 3290 480 3290 20 30 0x00000020) + Line(780 3190 730 3190 20 30 0x00000020) + Line(730 3140 685 3095 20 30 0x00000020) + Line(680 3240 460 3240 20 30 0x00000020) + Line(830 3440 730 3440 20 30 0x00000020) + Line(830 3140 730 3140 20 30 0x00000020) + Line(1805 3540 1760 3495 20 30 0x00000020) + Line(805 3040 640 3040 20 30 0x00000020) + Line(750 2990 650 2990 20 30 0x00000020) + Line(410 2890 460 2840 20 30 0x00000220) + Line(430 2740 555 2740 20 30 0x00000020) + Line(680 3140 460 3140 20 30 0x00000020) + Line(780 2990 755 2990 20 30 0x00000020) + Line(830 2940 460 2940 20 30 0x00000020) + Line(380 2790 380 2770 20 30 0x00000020) + Line(480 2890 680 2890 20 30 0x00000020) + Line(780 2790 730 2840 20 30 0x00000020) + Line(460 2840 650 2840 20 30 0x00000020) + Line(650 2840 680 2810 20 30 0x00000020) + Line(810 2740 755 2740 20 30 0x00000020) + Line(755 2740 680 2815 20 30 0x00000020) + Line(480 2790 640 2790 20 30 0x00000020) + Line(640 2790 740 2690 20 30 0x00000020) + Line(740 2690 750 2690 20 30 0x00000020) + Line(850 2990 800 3040 20 30 0x00000020) + Line(1080 2590 1030 2540 20 30 0x00000020) + Line(2050 2430 1980 2500 20 30 0x00000020) + Line(1030 2540 1030 2465 20 30 0x00000020) + Line(750 2175 545 2175 20 30 0x00000020) + Line(2045 3320 2590 3320 20 30 0x00000020) + Line(2590 3320 2590 3315 20 30 0x00000020) + Line(3700 3160 3655 3160 20 30 0x00000020) + Line(690 2275 880 2490 20 30 0x00000020) + Line(2290 2850 2250 2890 20 30 0x00000020) + Line(805 2640 755 2640 20 30 0x00000020) + Line(730 2540 780 2590 20 30 0x00000020) + Line(2620 3105 2635 3105 20 30 0x00000020) + Line(505 2275 690 2275 20 30 0x00000020) + Line(515 2225 480 2190 20 30 0x00000020) + Line(850 1930 850 1060 20 30 0x00000020) + Line(930 2540 930 2440 20 30 0x00000020) + Line(1880 3390 1930 3340 20 30 0x00000020) + Line(2630 3360 2560 3360 20 30 0x00000020) + Line(2395 3490 2610 3490 20 30 0x00000020) + Line(2640 2785 2640 2770 20 30 0x00000020) + Line(2000 3340 2020 3360 20 30 0x00000020) + Line(3700 3100 3700 2470 20 30 0x00000020) + Line(2640 3100 2640 3065 20 30 0x00000020) + Line(2705 3060 2640 3060 20 30 0x00000020) + Line(980 2590 930 2540 20 30 0x00000020) + Line(715 2225 515 2225 20 30 0x00000020) + Line(1980 2500 1980 2590 20 30 0x00000020) + Line(410 3490 460 3440 20 30 0x00000220) + Line(2645 2660 2640 2665 20 30 0x00000020) + Line(2960 3460 3435 3460 20 30 0x00000020) + Line(2905 2110 2955 2060 20 30 0x00000020) + Line(410 3290 460 3240 20 30 0x00000220) + Line(385 2890 335 2890 20 30 0x00000020) + Line(460 3290 410 3340 20 30 0x00000020) + Line(680 3440 460 3440 20 30 0x00000020) + Line(410 3390 460 3340 20 30 0x00000220) + Line(780 3590 770 3590 20 30 0x00000020) + Line(2950 1115 2905 1160 20 30 0x00000020) + Line(1100 1250 1190 1160 20 30 0x00000020) + Line(460 3390 410 3440 20 30 0x00000020) + Line(2700 2660 2645 2660 20 30 0x00000020) + Line(2635 3105 2640 3100 20 30 0x00000020) + Line(380 2890 410 2890 20 30 0x00000020) + Line(410 3090 460 3040 20 30 0x00000220) + Line(410 2990 460 2940 20 30 0x00000220) + Line(1880 3090 1930 3040 20 30 0x00000020) + Line(2540 2660 2630 2660 20 30 0x00000020) + Line(460 2990 410 3040 20 30 0x00000020) + Line(380 3090 170 3090 20 30 0x00000020) + Line(3780 2390 3780 3220 20 30 0x00000020) + Line(2950 5560 3505 5560 20 30 0x00000020) + Line(1380 2590 1380 2595 20 30 0x00000020) + Line(3545 3460 3625 3460 20 30 0x00000020) + Line(410 3440 330 3440 20 30 0x00000020) + Line(170 3245 170 5055 20 30 0x00000020) + Line(410 3290 210 3290 20 30 0x00000020) + Line(290 3395 290 4910 20 30 0x00000020) + Line(410 3240 170 3240 20 30 0x00000020) + Line(250 3345 250 4955 20 30 0x00000020) + Line(2700 1960 2750 2010 20 30 0x00000020) + Line(210 3295 210 5005 20 30 0x00000020) + Line(410 3140 135 3140 20 30 0x00000020) + Line(3810 2350 3820 2360 20 30 0x00000020) + Line(1080 3690 1080 3720 20 30 0x00000020) + Line(1070 4195 1070 4050 20 30 0x00000020) + Line(800 455 130 455 20 30 0x00000020) + Line(2650 5560 2645 5565 20 30 0x00000020) + Line(770 3950 770 4195 20 30 0x00000020) + Line(2010 2350 1885 2475 20 30 0x00000020) + Line(800 655 215 655 20 30 0x00000020) + Line(800 555 170 555 20 30 0x00000020) + Line(755 2690 805 2690 20 30 0x00000020) + Line(780 2485 630 2335 20 30 0x00000020) + Line(2640 2760 2410 2990 20 30 0x00000020) + Line(3810 2350 2010 2350 20 30 0x00000020) + Line(1980 2990 2410 2990 20 30 0x00000020) + Line(3700 2470 2420 2470 20 30 0x00000020) + Line(1880 2590 1890 2590 20 30 0x00000020) + Line(2030 2390 1940 2480 20 30 0x00000020) + Line(1940 2480 1940 2535 20 30 0x00000020) + Line(3780 2390 2030 2390 20 30 0x00000020) + Line(3740 3260 3650 3260 20 30 0x00000020) + Line(2430 3040 1935 3040 20 30 0x00000020) + Line(3515 5315 3560 5360 20 30 0x00000220) + Line(2580 3075 2580 3035 20 30 0x00000020) + Line(2535 3120 2580 3075 20 30 0x00000020) + Line(2535 3160 2535 3120 20 30 0x00000020) + Line(2505 3190 2535 3160 20 30 0x00000020) + Line(2115 3190 2505 3190 20 30 0x00000020) + Line(2065 3140 2115 3190 20 30 0x00000020) + Line(1965 3140 2065 3140 20 30 0x00000020) + Line(2580 3180 2580 3145 20 30 0x00000020) + Line(2525 3235 2580 3180 20 30 0x00000020) + Line(2955 5115 3505 5115 20 30 0x00000020) + Line(2095 3235 2525 3235 20 30 0x00000020) + Line(2905 2060 2840 2060 20 30 0x00000020) + Line(3500 1115 3515 1115 20 30 0x00000020) + Line(2955 1215 2910 1260 20 30 0x00000020) + Line(3515 1315 3560 1360 20 30 0x00000020) + Line(2950 1310 2905 1355 20 30 0x00000020) + Line(2905 960 2840 960 20 30 0x00000020) + Line(2955 615 2910 660 20 30 0x00000020) + Line(2950 1420 2905 1465 20 30 0x00000020) + Line(2905 2160 2840 2160 20 30 0x00000020) + Line(2950 1515 2905 1560 20 30 0x00000020) + Line(2955 1610 2910 1655 20 30 0x00000020) + Line(2955 1710 2910 1755 20 30 0x00000020) + Line(3500 1315 3515 1315 20 30 0x00000020) + Line(2945 1815 2900 1860 20 30 0x00000020) + Line(2950 1915 2905 1960 20 30 0x00000020) + Line(2700 1360 2640 1360 20 30 0x00000020) + Line(2950 2015 2905 2060 20 30 0x00000020) + Line(3500 515 3515 515 20 30 0x00000020) + Line(3515 515 3560 560 20 30 0x00000020) + Line(2955 460 3510 460 20 30 0x00000020) + Line(3560 660 3640 660 20 30 0x00000020) + Line(3500 615 3515 615 20 30 0x00000020) + Line(3515 615 3560 660 20 30 0x00000020) + Line(3560 760 3640 760 20 30 0x00000020) + Line(3500 715 3515 715 20 30 0x00000020) + Line(3515 715 3560 760 20 30 0x00000020) + Line(3560 860 3640 860 20 30 0x00000020) + Line(3500 815 3515 815 20 30 0x00000020) + Line(2950 710 2905 755 20 30 0x00000020) + Line(3515 815 3560 860 20 30 0x00000020) + Line(3900 110 3900 1210 20 30 0x00000020) + Line(3500 915 3515 915 20 30 0x00000020) + Line(3515 915 3560 960 20 30 0x00000020) + Line(3560 1360 3640 1360 20 30 0x00000020) + Line(3560 1060 3640 1060 20 30 0x00000020) + Line(3515 1115 3560 1160 20 30 0x00000020) + Line(2955 810 2910 855 20 30 0x00000020) + Line(2905 510 2955 460 20 30 0x00000020) + Line(3515 1415 3560 1460 20 30 0x00000020) + Line(3560 1260 3640 1260 20 30 0x00000020) + Line(3515 1215 3560 1260 20 30 0x00000020) + Line(3500 1215 3515 1215 20 30 0x00000020) + Line(3560 1160 3640 1160 20 30 0x00000020) + Line(2750 510 2900 510 20 30 0x00000020) + Line(3500 1015 3515 1015 20 30 0x00000020) + Line(2950 515 2905 560 20 30 0x00000020) + Line(3500 1515 3515 1515 20 30 0x00000020) + Line(2950 515 3495 515 20 30 0x00000020) + Line(3515 1015 3560 1060 20 30 0x00000020) + Line(2905 1060 2840 1060 20 30 0x00000020) + Line(3500 1415 3515 1415 20 30 0x00000020) + Line(2905 1160 2840 1160 20 30 0x00000020) + Line(2905 1260 2840 1260 20 30 0x00000020) + Line(2910 1360 2845 1360 20 30 0x00000020) + Line(2905 1460 2840 1460 20 30 0x00000020) + Line(2910 1560 2845 1560 20 30 0x00000020) + Line(2910 1660 2845 1660 20 30 0x00000020) + Line(2905 1760 2840 1760 20 30 0x00000020) + Line(2905 1860 2840 1860 20 30 0x00000020) + Line(2905 1960 2840 1960 20 30 0x00000020) + Line(2700 460 2750 510 20 30 0x00000020) + Line(2905 610 2955 560 20 30 0x00000020) + Line(3500 1615 3515 1615 20 30 0x00000020) + Line(2700 560 2750 610 20 30 0x00000020) + Line(2750 610 2900 610 20 30 0x00000020) + Line(2955 560 3510 560 20 30 0x00000020) + Line(2700 2060 2750 2110 20 30 0x00000020) + Line(2700 1460 2640 1460 20 30 0x00000020) + Line(2950 615 3495 615 20 30 0x00000020) + Line(2905 710 2955 660 20 30 0x00000020) + Line(3515 1615 3560 1660 20 30 0x00000020) + Line(2700 660 2750 710 20 30 0x00000020) + Line(2750 710 2900 710 20 30 0x00000020) + Line(2955 660 3510 660 20 30 0x00000020) + Line(2750 2110 2900 2110 20 30 0x00000020) + Line(2700 1560 2640 1560 20 30 0x00000020) + Line(2950 715 3495 715 20 30 0x00000020) + Line(2905 810 2955 760 20 30 0x00000020) + Line(3560 1760 3640 1760 20 30 0x00000020) + Line(2700 760 2750 810 20 30 0x00000020) + Line(2750 810 2900 810 20 30 0x00000020) + Line(2955 760 3510 760 20 30 0x00000020) + Line(2955 2060 3510 2060 20 30 0x00000020) + Line(2700 1660 2640 1660 20 30 0x00000020) + Line(2950 815 3495 815 20 30 0x00000020) + Line(2905 910 2955 860 20 30 0x00000020) + Line(3500 1715 3515 1715 20 30 0x00000020) + Line(2700 860 2750 910 20 30 0x00000020) + Line(2750 910 2900 910 20 30 0x00000020) + Line(2955 860 3510 860 20 30 0x00000020) + Line(2900 460 2960 400 20 30 0x00000020) + Line(2705 1760 2645 1760 20 30 0x00000020) + Line(2950 915 3495 915 20 30 0x00000020) + Line(2905 1010 2955 960 20 30 0x00000020) + Line(3515 1715 3560 1760 20 30 0x00000020) + Line(2700 960 2750 1010 20 30 0x00000020) + Line(2750 1010 2900 1010 20 30 0x00000020) + Line(2955 960 3510 960 20 30 0x00000020) + Line(2960 400 3580 400 20 30 0x00000020) + Line(2700 1860 2640 1860 20 30 0x00000020) + Line(2950 1015 3495 1015 20 30 0x00000020) + Line(2905 1110 2955 1060 20 30 0x00000020) + Line(3560 1860 3640 1860 20 30 0x00000020) + Line(2700 1060 2750 1110 20 30 0x00000020) + Line(2750 1110 2900 1110 20 30 0x00000020) + Line(2955 1060 3510 1060 20 30 0x00000020) + Line(3515 1515 3560 1560 20 30 0x00000020) + Line(2905 560 2840 560 20 30 0x00000020) + Line(2950 1115 3495 1115 20 30 0x00000020) + Line(2905 1210 2955 1160 20 30 0x00000020) + Line(3500 1815 3515 1815 20 30 0x00000020) + Line(2700 1160 2750 1210 20 30 0x00000020) + Line(2750 1210 2900 1210 20 30 0x00000020) + Line(2955 1160 3510 1160 20 30 0x00000020) + Line(2905 2210 2955 2160 20 30 0x00000020) + Line(2705 2060 2645 2060 20 30 0x00000020) + Line(2950 1215 3495 1215 20 30 0x00000020) + Line(2905 1310 2955 1260 20 30 0x00000020) + Line(3515 1815 3560 1860 20 30 0x00000020) + Line(2700 1260 2750 1310 20 30 0x00000020) + Line(2750 1310 2900 1310 20 30 0x00000020) + Line(2955 1260 3510 1260 20 30 0x00000020) + Line(3515 2115 3560 2160 20 30 0x00000220) + Line(3560 1660 3640 1660 20 30 0x00000020) + Line(2950 1315 3495 1315 20 30 0x00000020) + Line(2905 1410 2955 1360 20 30 0x00000020) + Line(3560 1960 3640 1960 20 30 0x00000020) + Line(2700 1360 2750 1410 20 30 0x00000020) + Line(2750 1410 2900 1410 20 30 0x00000020) + Line(2955 1360 3510 1360 20 30 0x00000020) + Line(2700 2160 2750 2210 20 30 0x00000020) + Line(2700 2160 2640 2160 20 30 0x00000020) + Line(2950 1415 3495 1415 20 30 0x00000020) + Line(2905 1510 2955 1460 20 30 0x00000020) + Line(3500 1915 3515 1915 20 30 0x00000020) + Line(2700 1460 2750 1510 20 30 0x00000020) + Line(2750 1510 2900 1510 20 30 0x00000020) + Line(2955 1460 3510 1460 20 30 0x00000020) + Line(2750 2210 2900 2210 20 30 0x00000020) + Line(2950 1515 3495 1515 20 30 0x00000020) + Line(2905 1610 2955 1560 20 30 0x00000020) + Line(3515 1915 3560 1960 20 30 0x00000020) + Line(2700 1560 2750 1610 20 30 0x00000020) + Line(2750 1610 2900 1610 20 30 0x00000020) + Line(2955 1560 3510 1560 20 30 0x00000020) + Line(2955 2160 3510 2160 20 30 0x00000020) + Line(2910 660 2845 660 20 30 0x00000020) + Line(2950 1615 3495 1615 20 30 0x00000020) + Line(2905 1710 2955 1660 20 30 0x00000020) + Line(3560 2060 3640 2060 20 30 0x00000020) + Line(2700 1660 2750 1710 20 30 0x00000020) + Line(2750 1710 2900 1710 20 30 0x00000020) + Line(2955 1660 3510 1660 20 30 0x00000020) + Line(2840 460 2900 460 20 30 0x00000020) + Line(2905 760 2840 760 20 30 0x00000020) + Line(2950 1715 3495 1715 20 30 0x00000020) + Line(2905 1810 2955 1760 20 30 0x00000020) + Line(3500 2015 3515 2015 20 30 0x00000020) + Line(2700 1760 2750 1810 20 30 0x00000020) + Line(2750 1810 2900 1810 20 30 0x00000020) + Line(2955 1760 3510 1760 20 30 0x00000020) + Line(2700 1960 2640 1960 20 30 0x00000020) + Line(2950 1815 3495 1815 20 30 0x00000020) + Line(2905 1910 2955 1860 20 30 0x00000020) + Line(3515 2015 3560 2060 20 30 0x00000020) + Line(2700 1860 2750 1910 20 30 0x00000020) + Line(2750 1910 2900 1910 20 30 0x00000020) + Line(2955 1860 3510 1860 20 30 0x00000020) + Line(2950 2115 2905 2160 20 30 0x00000020) + Line(2950 3060 3425 3060 20 30 0x00000020) + Line(2950 1915 3495 1915 20 30 0x00000020) + Line(2570 4730 2570 4220 20 30 0x00000020) + Line(2570 4220 2500 4030 20 30 0x00000020) + Line(2330 3770 2330 3950 20 30 0x00000020) + Line(2330 3950 2390 4010 20 30 0x00000020) + Line(780 3590 580 3790 20 30 0x00000020) + Line(580 3790 580 4170 20 30 0x00000020) + Line(540 3540 630 3540 20 30 0x00000020) + Line(630 3540 700 3610 20 30 0x00000020) + Line(700 3610 540 3770 20 30 0x00000020) + Line(540 3770 540 4150 20 30 0x00000020) + Line(380 3690 430 3640 20 30 0x00000020) + Line(430 3640 580 3640 20 30 0x00000020) + Line(2640 2560 2510 2560 20 30 0x00000020) + Line(2510 2560 2480 2590 20 30 0x00000020) + Line(2480 2590 2420 2590 20 30 0x00000020) + Line(2420 2590 2290 2720 20 30 0x00000020) + Line(2290 2720 2290 2850 20 30 0x00000020) + Line(435 4735 435 4675 20 30 0x00000020) + Text(1470 5335 0 100 "1.1" 0x00000080) + Text(1220 5335 0 100 "VERSION" 0x00000080) + Text(895 5415 0 100 "JA2YKA" 0x00000080) + Text(2130 4020 0 100 "3" 0x00000080) + Text(2330 4230 0 100 "1" 0x00000080) + Text(2050 4230 0 100 "2" 0x00000080) + Text(430 5335 0 100 "DREAMCAST EXTEND BOARD" 0x00000080) + Text(255 5500 0 100 "CREATED BY NAGOYA UNIVERSITY AMATEUR RADIO CLUB" 0x00000080) + Polygon(0x00000010) + ( + (70 70) (250 70) (250 0) (70 0) + ) + Polygon(0x00000010) + ( + (0 310) (100 310) (100 0) (0 0) + ) + Polygon(0x00000010) + ( + (230 70) (1200 70) (1200 0) (230 0) + ) + Polygon(0x00000010) + ( + (1170 70) (2140 70) (2140 0) (1170 0) + ) + Polygon(0x00000010) + ( + (2130 70) (3100 70) (3100 0) (2130 0) + ) + Polygon(0x00000010) + ( + (3940 0) (4000 0) (4000 1990) (3940 1990) + ) + Polygon(0x00000010) + ( + (3940 2270) (4000 2270) (4000 1980) (3940 1980) + ) + Polygon(0x00000010) + ( + (1780 1360) (1800 1320) (1760 1320) + ) + Polygon(0x00000010) + ( + (3940 5795) (3995 5795) (3995 2260) (3940 2260) + ) + Polygon(0x00000010) + ( + (100 5780) (0 5780) (0 300) (100 300) + ) + Polygon(0x00000010) + ( + (3990 6095) (0 6095) (0 5715) (3990 5715) + ) + Polygon(0x00000010) + ( + (1380 1360) (1400 1320) (1360 1320) + ) + Polygon(0x00000010) + ( + (3000 70) (3970 70) (3970 0) (3000 0) + ) +) +Layer(2 "component") +( +) +Layer(3 "GND") +( + Line(380 2090 480 2090 20 30 0x00000020) + Line(1980 4725 1980 4580 20 30 0x00000020) + Line(2700 380 2040 380 20 30 0x00000020) + Line(630 4605 630 4580 20 30 0x00000020) + Line(1960 4610 1970 4620 20 30 0x00000020) + Line(1950 4620 1960 4610 20 30 0x00000020) + Line(640 4620 1950 4620 20 30 0x00000020) + Line(640 4630 640 4620 20 30 0x00000020) + Line(1965 4630 640 4630 20 30 0x00000020) + Line(1970 4635 1965 4630 20 30 0x00000020) + Line(1970 4650 1970 4635 20 30 0x00000020) + Line(635 4650 1970 4650 20 30 0x00000020) + Line(635 4670 635 4650 20 30 0x00000020) + Line(1965 4670 635 4670 20 30 0x00000020) + Line(1970 4675 1965 4670 20 30 0x00000020) + Line(1970 4685 1970 4675 20 30 0x00000020) + Line(1965 4690 1970 4685 20 30 0x00000020) + Line(640 4690 1965 4690 20 30 0x00000020) + Line(635 4695 640 4690 20 30 0x00000020) + Line(635 4710 635 4695 20 30 0x00000020) + Line(640 4705 635 4710 20 30 0x00000020) + Line(1980 4705 640 4705 20 30 0x00000020) + Line(630 4580 1980 4580 20 30 0x00000020) + Line(1230 2620 1150 2700 20 30 0x00000020) + Line(630 4710 630 4600 20 30 0x00000020) + Line(2580 3660 2595 3645 20 30 0x00000020) + Line(2580 4020 2580 3660 20 30 0x00000020) + Line(2595 4035 2580 4020 20 30 0x00000020) + Line(2610 4035 2595 4035 20 30 0x00000020) + Line(2615 4030 2610 4035 20 30 0x00000020) + Line(2615 3560 2615 4030 20 30 0x00000020) + Line(2605 3550 2615 3560 20 30 0x00000020) + Line(2600 3550 2605 3550 20 30 0x00000020) + Line(2600 4035 2600 3550 20 30 0x00000020) + Line(2625 4035 2600 4035 20 30 0x00000020) + Line(2625 3560 2625 4035 20 30 0x00000020) + Line(3640 2560 3590 2560 20 30 0x00000020) + Line(1135 2725 955 2725 20 30 0x00000020) + Line(1140 2720 1135 2725 20 30 0x00000020) + Line(1140 2710 1140 2720 20 30 0x00000020) + Line(960 2710 1140 2710 20 30 0x00000020) + Line(1230 2440 1230 2620 20 30 0x00000020) + Line(1180 2390 1230 2440 20 30 0x00000020) + Line(1180 2170 1180 2390 20 30 0x00000020) + Line(430 4020 370 4065 20 30 0x00000020) + Line(2230 2700 2230 2840 20 30 0x00000020) + Line(1670 4405 1620 4455 20 30 0x00000020) + Line(480 3690 380 3790 20 30 0x00000020) + Line(1570 2930 1570 3070 20 30 0x00000220) + Line(1690 1490 1780 1400 20 30 0x00000020) + Line(570 2135 570 1845 20 30 0x00000220) + Line(1465 4390 1565 4390 20 30 0x00000020) + Line(1870 4380 1820 4430 20 30 0x00000020) + Line(380 3890 480 3890 20 30 0x00000020) + Line(1820 4430 1820 4715 20 30 0x00000020) + Line(3640 5560 3640 5650 20 30 0x00000020) + Line(2610 3540 2630 3560 20 30 0x00000020) + Line(2445 3540 2610 3540 20 30 0x00000020) + Line(2040 990 1610 990 20 30 0x00000020) + Line(2020 3400 2445 3400 20 30 0x00000020) + Line(2010 3390 2020 3400 20 30 0x00000020) + Line(1950 3390 2010 3390 20 30 0x00000020) + Line(805 2130 575 2130 20 30 0x00000020) + Line(2040 380 2040 990 20 30 0x00000020) + Line(480 1990 480 2090 20 30 0x00000020) + Line(2430 4310 2330 4070 20 30 0x00000020) + Line(370 4065 370 4710 20 30 0x00000020) + Line(1370 4495 1370 4710 20 30 0x00000020) + Line(430 3890 430 4020 20 30 0x00000020) + Line(2640 3560 2640 4660 20 30 0x00000020) + Line(2170 5620 2100 5570 20 30 0x00000020) + Line(3640 5650 2180 5650 20 30 0x00000020) + Line(570 1850 560 1840 20 30 0x00000020) + Line(2180 4610 2180 4590 20 30 0x00000020) + Line(675 4725 1865 4725 20 30 0x00000020) + Line(1560 2760 1400 2760 20 30 0x00000020) + Line(1570 3210 1570 3420 20 30 0x00000020) + Line(2430 4310 2430 4580 20 30 0x00000020) + Line(1560 3060 1570 3070 20 30 0x00000220) + Line(1680 3540 1680 3445 20 30 0x00000020) + Line(1600 2890 1560 2930 20 30 0x00000020) + Line(1680 2890 1600 2890 20 30 0x00000020) + Line(1310 2840 1480 2670 20 30 0x00000020) + Line(830 2840 1310 2840 20 30 0x00000020) + Line(800 1260 800 2130 20 30 0x00000020) + Line(1930 2840 1880 2890 20 30 0x00000020) + Line(2230 2840 1930 2840 20 30 0x00000020) + Line(380 3790 380 3890 20 30 0x00000020) + Line(2330 4070 2330 4030 20 30 0x00000020) + Line(2790 2560 2740 2510 20 30 0x00000020) + Line(2840 2560 2790 2560 20 30 0x00000020) + Line(800 2130 1080 2410 20 30 0x00000020) + Line(780 2890 830 2840 20 30 0x00000020) + Line(1080 2490 1080 2405 20 30 0x00000020) + Line(1480 2590 1480 2670 20 30 0x00000020) + Line(1880 2890 1675 2890 20 30 0x00000020) + Line(2170 4725 1870 4725 20 30 0x00000020) + Line(1945 3390 1895 3440 20 30 0x00000020) + Line(1110 1490 1690 1490 20 30 0x00000020) + Line(1680 3590 1680 3535 20 30 0x00000020) + Line(2430 4580 2190 4580 20 30 0x00000020) + Line(1590 3440 1575 3425 20 30 0x00000020) + Line(1525 4405 1525 4715 20 30 0x00000020) + Line(1820 3210 1430 3210 20 30 0x00000020) + Line(1670 4380 1670 4405 20 30 0x00000020) + Line(1620 4455 1620 4590 20 30 0x00000020) + Line(675 4725 640 4710 20 30 0x00000020) + Line(2180 5650 2180 5620 20 30 0x00000020) + Line(460 4270 460 4380 20 30 0x00000020) + Line(2570 4040 2640 4040 20 30 0x00000020) + Line(460 4100 400 4100 20 30 0x00000020) + Line(400 4100 370 4070 20 30 0x00000020) + Line(1570 3090 1820 3090 20 30 0x00000220) + Line(1440 1500 1440 1740 20 30 0x00000020) + Line(430 1840 590 1840 20 30 0x00000020) + Line(1820 3210 1820 3440 20 30 0x00000020) + Line(1140 2960 1140 3430 40 30 0x00000020) + Line(1420 2950 1420 3440 20 30 0x00000020) + Line(1590 3080 1590 2930 40 30 0x00000020) + Line(1410 2940 1390 2910 40 30 0x00000020) + Line(1820 3090 1820 2900 20 30 0x00000020) + Line(1150 3530 1150 3440 20 30 0x00000020) + Line(830 2840 830 2770 20 30 0x00000020) + Line(830 2770 860 2740 20 30 0x00000020) + Line(860 2740 1150 2740 20 30 0x00000020) + Line(1150 2740 1150 2690 20 30 0x00000020) + Line(1150 2690 950 2690 20 30 0x00000020) + Line(950 2690 950 2740 20 30 0x00000020) + Line(1895 3440 1410 3440 20 30 0x00000020) + Line(1670 3080 1670 2900 40 30 0x00000020) + Line(1140 3510 1140 3450 20 30 0x00000020) + Line(1140 3480 1140 3450 20 30 0x00000020) + Line(1670 2900 1630 2900 40 30 0x00000020) + Line(1590 2930 1610 2910 40 30 0x00000020) + Line(1140 3480 1130 3490 20 30 0x00000020) + Line(1630 2900 1630 3080 40 30 0x00000020) + Line(1630 3080 1590 3080 40 30 0x00000020) + Line(1390 2910 1390 2890 40 30 0x00000020) + Line(1040 2950 1040 3440 20 30 0x00000020) + Line(1040 3440 1060 3440 20 30 0x00000020) + Line(1060 2960 1060 3430 40 30 0x00000020) + Line(1060 3430 1100 3430 40 30 0x00000020) + Line(1100 3430 1100 2960 40 30 0x00000020) + Line(1100 2960 1140 2960 40 30 0x00000020) + Line(1710 3080 1670 3080 40 30 0x00000020) + Line(1140 3430 1190 3430 40 30 0x00000020) + Line(1170 2960 1170 3430 40 30 0x00000020) + Line(1170 3430 1200 3430 40 30 0x00000020) + Line(1200 3430 1200 2960 40 30 0x00000020) + Line(1200 2960 1230 2960 40 30 0x00000020) + Line(1230 2960 1230 3420 40 30 0x00000020) + Line(1230 3420 1270 3420 40 30 0x00000020) + Line(1270 3420 1270 2960 40 30 0x00000020) + Line(1270 2960 1310 2960 40 30 0x00000020) + Line(1310 2960 1310 3430 40 30 0x00000020) + Line(1310 3430 1350 3430 40 30 0x00000020) + Line(1350 3430 1350 2960 40 30 0x00000020) + Line(1350 2960 1390 2960 40 30 0x00000020) + Line(1390 2960 1390 3430 40 30 0x00000020) + Line(1430 3240 1810 3240 40 30 0x00000020) + Line(1810 3240 1810 3270 40 30 0x00000020) + Line(1810 3270 1430 3270 40 30 0x00000020) + Line(1430 3270 1430 3300 40 30 0x00000020) + Line(1430 3300 1810 3300 40 30 0x00000020) + Line(1810 3300 1810 3340 40 30 0x00000020) + Line(1810 3340 1440 3340 40 30 0x00000020) + Line(1440 3340 1430 3330 40 30 0x00000020) + Line(1430 3330 1430 3370 40 30 0x00000020) + Line(1430 3370 1440 3380 40 30 0x00000020) + Line(1440 3380 1810 3380 40 30 0x00000020) + Line(1810 3380 1810 3410 40 30 0x00000020) + Line(1810 3410 1420 3410 40 30 0x00000020) + Line(1790 2900 1790 3080 40 30 0x00000020) + Line(1790 3080 1750 3080 40 30 0x00000020) + Line(1750 3080 1750 2910 40 30 0x00000020) + Line(1750 2910 1760 2900 40 30 0x00000020) + Line(1760 2900 1710 2900 40 30 0x00000020) + Line(1710 2900 1710 3080 40 30 0x00000020) + Line(1040 2890 1040 3520 40 30 0x00000020) + Line(1040 3520 1140 3520 40 30 0x00000020) + Line(1140 3520 1140 3470 40 30 0x00000020) + Line(1140 3470 1130 3460 40 30 0x00000020) + Line(1130 3460 1060 3460 40 30 0x00000020) + Line(1060 3460 1060 3490 40 30 0x00000020) + Line(1060 3490 1130 3490 40 30 0x00000020) + Line(1130 3490 1130 3430 40 30 0x00000020) + Line(1130 3430 1520 3430 40 30 0x00000020) + Line(1040 2850 1040 2880 40 30 0x00000020) + Line(1410 2750 1410 2930 40 30 0x00000020) + Line(1400 2940 1040 2940 40 30 0x00000020) + Line(1040 2940 1040 2930 40 30 0x00000020) + Line(1040 2930 1070 2900 40 30 0x00000020) + Line(1070 2900 1380 2900 40 30 0x00000020) + Line(1380 2900 1380 2860 40 30 0x00000020) + Line(1410 2850 1410 2940 40 30 0x00000020) + Line(1050 2860 1070 2880 40 30 0x00000020) + Line(1390 2870 1390 2790 40 30 0x00000020) + Line(1390 2790 1390 2800 40 30 0x00000020) + Line(1390 2800 1340 2850 40 30 0x00000020) + Line(1020 2960 1020 3530 20 30 0x00000020) + Line(1020 3530 1010 3530 20 30 0x00000020) + Line(1010 3530 1010 2960 20 30 0x00000020) + Line(1620 4580 1620 4720 20 30 0x00000020) + Line(2180 5610 2180 4605 20 30 0x00000020) + Line(3640 5560 3750 5560 20 30 0x00000020) + Line(1380 2860 1050 2860 40 30 0x00000020) + Line(1180 2170 1090 2170 20 30 0x00000020) + Line(950 2170 840 2170 20 30 0x00000020) + Line(2370 4380 2430 4380 20 30 0x00000020) + Line(2740 2510 2390 2510 20 30 0x00000020) + Line(2390 2510 2390 2540 20 30 0x00000020) + Line(2390 2540 2230 2700 20 30 0x00000020) + Line(630 4600 1980 4600 20 30 0x00000020) + Line(2845 460 2780 460 20 30 0x00000020) + Line(2780 460 2700 380 20 30 0x00000020) + Line(430 1840 430 2090 20 30 0x00000020) +) +Layer(4 "power") +( + Line(1740 5170 470 5170 20 30 0x00000020) + Line(2040 5470 1740 5170 20 30 0x00000020) + Line(2040 5690 2040 5470 20 30 0x00000020) + Line(3800 5690 2040 5690 20 30 0x00000020) + Line(3800 5460 3800 5690 20 30 0x00000020) + Line(3740 5460 3800 5460 20 30 0x00000020) + Line(1620 620 1550 690 20 30 0x00000020) + Line(1970 620 1620 620 20 30 0x00000020) + Line(2690 610 2270 610 20 30 0x00000020) + Line(1100 350 1210 350 20 30 0x00000020) + Line(945 3535 945 3510 20 30 0x00000020) + Line(920 3510 945 3535 20 30 0x00000020) + Line(920 3495 920 3510 20 30 0x00000020) + Line(570 1695 570 1785 20 30 0x00000020) + Line(2320 4670 2410 4670 20 30 0x00000020) + Line(1680 2590 1680 2830 20 30 0x00000020) + Line(2420 4670 2530 4670 20 30 0x00000020) + Line(1610 1400 1740 1270 20 30 0x00000020) + Line(1110 1400 1610 1400 20 30 0x00000020) + Line(1310 1750 1310 2220 20 30 0x00000020) + Line(980 1750 1310 1750 20 30 0x00000020) + Line(1630 2220 1630 2540 20 30 0x00000020) + Line(1980 3090 1950 3090 20 30 0x00000020) + Line(2265 3130 2265 3095 20 30 0x00000020) + Line(1740 1270 2150 1270 20 30 0x00000020) + Line(2320 5315 2320 4670 20 30 0x00000020) + Line(590 1690 590 1790 20 30 0x00000020) + Line(3740 5460 3740 5360 20 30 0x00000020) + Line(2460 5425 2320 5425 20 30 0x00000020) + Line(2700 5310 2560 5310 20 30 0x00000020) + Line(3640 5360 3730 5360 20 30 0x00000020) + Line(590 1790 550 1790 20 30 0x00000020) + Line(1485 2830 1485 3150 20 30 0x00000020) + Line(1900 3145 1485 3145 20 30 0x00000020) + Line(1570 2220 1630 2220 20 30 0x00000020) + Line(980 480 980 1750 20 30 0x00000020) + Line(1100 360 980 480 20 30 0x00000020) + Line(2570 2710 2350 2930 20 30 0x00000020) + Line(1990 3090 2150 3090 20 30 0x00000020) + Line(2320 3090 1990 3090 20 30 0x00000020) + Line(2350 3120 2320 3090 20 30 0x00000020) + Line(880 3490 980 3590 20 30 0x00000020) + Line(855 3045 940 3045 20 30 0x00000020) + Line(815 3085 855 3045 20 30 0x00000020) + Line(815 3090 815 3085 20 30 0x00000020) + Line(780 3090 810 3090 20 30 0x00000020) + Line(380 1690 590 1690 20 30 0x00000020) + Line(2150 1270 2280 1400 20 30 0x00000020) + Line(1950 3095 1900 3145 20 30 0x00000020) + Line(1950 3090 1950 3095 20 30 0x00000020) + Line(1630 2540 1680 2590 20 30 0x00000020) + Line(880 3490 950 3490 20 30 0x00000020) + Line(380 1590 380 1690 20 30 0x00000020) + Line(480 1690 480 1010 20 30 0x00000020) + Line(480 1015 480 1005 20 30 0x00000020) + Line(480 1005 980 1005 20 30 0x00000020) + Line(2840 5360 2745 5360 20 30 0x00000020) + Line(2745 5360 2700 5315 20 30 0x00000020) + Line(1680 2830 1485 2830 20 30 0x00000020) + Line(2560 5310 2460 5425 20 30 0x00000020) + Line(2395 4665 2385 4665 20 30 0x00000020) + Line(2320 5425 2320 5320 20 30 0x00000020) + Line(2530 4250 2530 4670 20 30 0x00000020) + Line(550 1790 550 1690 20 30 0x00000020) + Line(2270 3550 2280 3550 20 30 0x00000020) + Line(2280 3550 2450 3720 20 30 0x00000020) + Line(2450 3720 2450 4060 20 30 0x00000020) + Line(2450 4060 2530 4250 20 30 0x00000020) + Line(950 3550 950 2895 20 30 0x00000020) + Line(2840 660 2745 660 20 30 0x00000020) + Line(2745 660 2695 610 20 30 0x00000020) + Line(915 3500 910 3505 20 30 0x00000020) + Line(945 3510 935 3500 20 30 0x00000020) + Line(935 3500 915 3500 20 30 0x00000020) +) +Layer(5 "signal1") +( +) +Layer(6 "signal2") +( +) +Layer(7 "unused") +( + Line(1970 620 2270 620 20 30 0x00000020) + Line(2110 1000 2110 1120 20 30 0x00000020) + Line(1210 350 1550 690 20 30 0x00000020) + Line(960 1400 1110 1400 20 30 0x00000020) + Line(1300 2220 1570 2220 20 30 0x00000020) + Line(2265 3130 2265 3560 20 30 0x00000020) + Line(2445 3420 2445 3540 20 30 0x00000020) + Line(1740 3500 1625 3500 20 30 0x00000020) + Line(1090 2170 950 2170 20 30 0x00000020) + Line(900 940 900 1085 20 30 0x00000020) + Line(1570 3070 1570 3210 20 30 0x00000020) + Line(2200 2150 2200 2530 20 30 0x00000020) + Line(2310 2150 2310 2530 20 30 0x00000020) + Line(2360 3110 2350 3120 20 30 0x00000020) + Line(2360 2930 2360 3110 20 30 0x00000020) + Line(630 4710 395 4710 20 30 0x00000020) + Line(960 2900 1480 2900 20 30 0x00000020) + Line(2220 4000 2160 4060 20 30 0x00000020) + Line(2385 3915 2140 3910 20 30 0x00000020) + Line(2330 4030 2570 4030 20 30 0x00000020) + Line(1610 2070 1610 2600 20 30 0x00000020) + Line(1610 2600 580 3630 20 30 0x00000020) + Line(2090 4120 2080 4130 20 30 0x00000020) + Line(2090 3040 2090 4120 20 30 0x00000020) + Line(3740 5460 3740 5560 20 30 0x00000020) + Line(2290 2910 2170 2790 20 30 0x00000020) + Line(2170 2790 2220 2790 20 30 0x00000020) + Line(2220 2790 2350 2660 20 30 0x00000020) + Line(2390 3790 2220 3790 20 30 0x00000020) + Line(2020 3755 2020 3970 20 30 0x00000020) + Line(2220 3790 2220 4000 20 30 0x00000020) + Line(1370 2140 1800 2140 20 30 0x00000020) + Line(2090 3040 2350 2780 20 30 0x00000020) + Line(2430 2950 2430 3280 20 30 0x00000020) + Line(2430 3280 2390 3320 20 30 0x00000020) + Line(2390 3320 2390 3780 20 30 0x00000020) + Line(630 2055 630 2335 20 30 0x00000020) + Line(1570 2760 1570 2930 20 30 0x00000020) + Line(2290 2910 2290 4220 20 30 0x00000020) + Line(1220 2730 1220 3500 20 30 0x00000020) + Line(2290 4220 2350 4280 20 30 0x00000020) + Line(2530 3600 2530 2220 20 30 0x00000020) + Line(800 1490 1110 1490 20 30 0x00000020) +) +Layer(8 "unused") +( + Line(470 5165 475 5170 20 30 0x00000020) + Line(470 4780 470 5165 20 30 0x00000020) + Line(2430 2530 2430 2860 20 30 0x00000020) + Line(800 1590 970 1590 20 30 0x00000020) + Line(3745 4970 3745 5360 20 30 0x00000020) + Line(2350 2660 2330 2660 20 30 0x00000020) +) +Layer(9 "silk") +( +) +Layer(10 "silk") +( +) diff --git a/G2BUS/SCHS/dd-lan/dcext11.ps b/G2BUS/SCHS/dd-lan/dcext11.ps new file mode 100644 index 00000000..adc11bf8 Binary files /dev/null and b/G2BUS/SCHS/dd-lan/dcext11.ps differ diff --git a/G2BUS/SCHS/dd-lan/dd-lan.jpeg b/G2BUS/SCHS/dd-lan/dd-lan.jpeg new file mode 100644 index 00000000..c42a7327 Binary files /dev/null and b/G2BUS/SCHS/dd-lan/dd-lan.jpeg differ diff --git a/GDROM/EXES/Cinepak ADX Player/ADXPLAY.Ini b/GDROM/EXES/Cinepak ADX Player/ADXPLAY.Ini new file mode 100644 index 00000000..baea81d2 --- /dev/null +++ b/GDROM/EXES/Cinepak ADX Player/ADXPLAY.Ini @@ -0,0 +1,16 @@ +[ADXOPTIONS] +Filter1Pos=1 +Filter2=1 +Filter2Pos=0 +Filter3Pos=0 +Vol=16 +VolUp=1 +AUTOCHECK=1 +TMPDIR=C:\My Music\Cinepak ADX Player\Temp + +[OPTIONS] +WAVESAVE=1 +PLAY=1 +CDROM=1 +WAVEINPUT=1 +DIFFRAME=4 diff --git a/GDROM/EXES/Cinepak ADX Player/adxplay.exe b/GDROM/EXES/Cinepak ADX Player/adxplay.exe new file mode 100644 index 00000000..36654679 Binary files /dev/null and b/GDROM/EXES/Cinepak ADX Player/adxplay.exe differ diff --git a/GDROM/EXES/Extract/extract.exe b/GDROM/EXES/Extract/extract.exe new file mode 100644 index 00000000..416d5be8 Binary files /dev/null and b/GDROM/EXES/Extract/extract.exe differ diff --git a/GDROM/EXES/GD Lister 1.7/GDLister17.exe b/GDROM/EXES/GD Lister 1.7/GDLister17.exe new file mode 100644 index 00000000..8660398d Binary files /dev/null and b/GDROM/EXES/GD Lister 1.7/GDLister17.exe differ diff --git a/GDROM/EXES/Isofix 1.3/isofix.exe b/GDROM/EXES/Isofix 1.3/isofix.exe new file mode 100644 index 00000000..bcbfd4e0 Binary files /dev/null and b/GDROM/EXES/Isofix 1.3/isofix.exe differ diff --git a/GDROM/EXES/Isofix 1.3/readme.txt b/GDROM/EXES/Isofix 1.3/readme.txt new file mode 100644 index 00000000..1db4b876 --- /dev/null +++ b/GDROM/EXES/Isofix 1.3/readme.txt @@ -0,0 +1,113 @@ + +ISO LBA fix utility 1.3 (C) 2001 by DeXT + + +What's new in 1.3: + ISOfix now extracts ISO header, too (the same as ISOextract) + Destination ISO image is now named "fixed.iso" by default + Added "/header" option for header-only extraction (no boot, no fixing) + Writing padding data is now 50% faster + Support for new image formats (2056 (Mac), 2336, 2352 b/s) + New "/mac" and "/iso" options to force destination image format + +What's new in 1.2a: + Fixed stupid bug in progress counter which made it go weird + +What's new in 1.2: + New "/boot" option which just extracts boot area from ISO image and exit + +What's new in 1.1: + Boot file renamed to "bootfile.bin" + All fields are optional now so you can simply double-clic program's icon + and it will ask you for required info + + +Usage: ISOfix image.iso [dest.iso] [LBA] [/options] + +image.iso is source image to fix +dest.iso is destination image file name (default: "tmp.iso") +LBA is known start LBA value for that ISO image + +/boot if present it will only extract boot area from image.iso and exit +/header if present it will only extract ISO header and exit + +/mac will write ISO image in Mac/2056 format (auto if source ISO = 2056) +/iso will force standard ISO/2048 format for output (only for Mac users) + +All of these parameters are optional. + + +Examples: + +isofix image.iso (will ask for LBA) + +isofix image.iso 11700 + +isofix image.iso my-fixed-image.iso 345678 + +isofix image.iso /boot (will only extract boot area to "bootfile.bin") + +isofix image.iso /header (will only extract header to "header.iso") + +isofix image.iso /boot /header (will extract boot and header, but won't fix) + + +You can also simply double-clic on isofix.exe icon and it will ask for both +source image filename and starting LBA for that image. + + +This utility will fix a given ISO image with a known starting LBA value so +resulting image dest.iso will have starting LBA = 0. This would let ISObuster +and other ISO managing tools to extract the contents of that image. + +This is intended for multisession ISO tracks whose contents cannot be +extracted if not burned at right position on a real CD. + +If you do not enter any LBA value in the command line the program will ask you +for one. Please note that you MUST enter a valid LBA value for that image, +otherwise resulting image will likely be wrong! + +A right starting LBA value can be retrieved from original CDI image when using +CDIrip (look at LBA value for that data track) or from CD itself if it's +already burned (see start sector of data track). + +If no name is given for destination image, resulting image will be saved as +"fixed.iso". Note that fixed image is not intended for re-burn directly as +multisession track but for file extraction only! You can, however, burn it +at sector 0 in a real CD, although this probably won't have much sense unless +you know what you are doing. + +Also be aware this will only work properly with CD-Extra ISO tracks and not +for real Multisession data tracks with cross references to previous session +(files with starting LBA value below image LBA will be empty). + +What this program does is adding padding information at start of image up to +the given LBA value, and also copies original PVD, SVD and VDT found to the +right positions. This will ensure Joliet extensions will be kept, too. + +While extracting, if boot area isn't empty it will also copy it into a +"bootfile.bin" file. If "/boot" option is specified in the command line, then +the program will just extract boot area and exit. + +From 1.3 version, ISO header will also be automatically extracted to file +"header.iso" (i.e. the same functionality as ISOextract). This can be useful +when converting a CD-Extra type image to simple Multisession one. If "/header" +option is added to the command line, it will only extract header and exit +without fixing ISO image first. + +By default, the program will always save fixed ISO image in standard ISO/2048 +format, no matter the source one. An exception is made with Mac-ISO/2056 +images where format is maintained in destination file (as needed by Mac +users). If you want to force ISO/2048 conversion for these images use "/iso" +option. On the other hand, if you are a Mac user and want to produce a +Mac-2056 ISO image no matter the source format add "/mac" option. + +To extract contents with ISObuster, you should select "Creator Image (*.ISO)" +as file type when loading the fixed ISO since the "Standard ISO Image" type +doesn't seem to work right (perhaps a bug in ISObuster?). + + +This program is based on a smart idea from ciccioriccio. Thanks man! + +DeXT + diff --git a/GDROM/EXES/PararCD/PararCDp.exe b/GDROM/EXES/PararCD/PararCDp.exe new file mode 100644 index 00000000..c21ee5a5 Binary files /dev/null and b/GDROM/EXES/PararCD/PararCDp.exe differ diff --git a/GDROM/ROMS/DrinkTeam GD-ROM Trap Disc/dt-toc122.ccd b/GDROM/ROMS/DrinkTeam GD-ROM Trap Disc/dt-toc122.ccd new file mode 100644 index 00000000..ec6b07cb --- /dev/null +++ b/GDROM/ROMS/DrinkTeam GD-ROM Trap Disc/dt-toc122.ccd @@ -0,0 +1,208 @@ +[CloneCD] +Version=2 + +[Disc] +TocEntries=12 +Sessions=2 +DataTracksScrambled=0 +CDTextLength=0 + +[Session 1] +PreGapMode=1 +PreGapSubC=0 + +[Session 2] +PreGapMode=1 +PreGapSubC=0 + +[Entry 0] +Session=1 +Point=0xa0 +ADR=0x01 +Control=0x04 +TrackNo=0 +AMin=0 +ASec=0 +AFrame=0 +ALBA=-150 +Zero=0 +PMin=1 +PSec=0 +PFrame=0 +PLBA=4350 + +[Entry 1] +Session=1 +Point=0xa1 +ADR=0x01 +Control=0x00 +TrackNo=0 +AMin=0 +ASec=0 +AFrame=0 +ALBA=-150 +Zero=0 +PMin=2 +PSec=0 +PFrame=0 +PLBA=8850 + +[Entry 2] +Session=1 +Point=0xa2 +ADR=0x01 +Control=0x00 +TrackNo=0 +AMin=0 +ASec=0 +AFrame=0 +ALBA=-150 +Zero=0 +PMin=7 +PSec=30 +PFrame=0 +PLBA=33600 + +[Entry 3] +Session=1 +Point=0x01 +ADR=0x01 +Control=0x04 +TrackNo=0 +AMin=0 +ASec=0 +AFrame=0 +ALBA=-150 +Zero=0 +PMin=0 +PSec=2 +PFrame=0 +PLBA=0 + +[Entry 4] +Session=1 +Point=0x02 +ADR=0x01 +Control=0x00 +TrackNo=0 +AMin=0 +ASec=0 +AFrame=0 +ALBA=-150 +Zero=0 +PMin=0 +PSec=15 +PFrame=22 +PLBA=997 + +[Entry 5] +Session=1 +Point=0xb0 +ADR=0x05 +Control=0x00 +TrackNo=0 +AMin=10 +ASec=0 +AFrame=0 +ALBA=44850 +Zero=3 +PMin=74 +PSec=43 +PFrame=0 +PLBA=336075 + +[Entry 6] +Session=1 +Point=0xc0 +ADR=0x05 +Control=0x00 +TrackNo=0 +AMin=194 +ASec=0 +AFrame=136 +ALBA=422986 +Zero=0 +PMin=97 +PSec=34 +PFrame=22 +PLBA=-11078 + +[Entry 7] +Session=2 +Point=0xa0 +ADR=0x01 +Control=0x04 +TrackNo=0 +AMin=0 +ASec=0 +AFrame=0 +ALBA=-150 +Zero=0 +PMin=3 +PSec=0 +PFrame=0 +PLBA=13350 + +[Entry 8] +Session=2 +Point=0xa1 +ADR=0x01 +Control=0x04 +TrackNo=0 +AMin=0 +ASec=0 +AFrame=0 +ALBA=-150 +Zero=0 +PMin=3 +PSec=0 +PFrame=0 +PLBA=13350 + +[Entry 9] +Session=2 +Point=0xa2 +ADR=0x01 +Control=0x04 +TrackNo=0 +AMin=0 +ASec=0 +AFrame=0 +ALBA=-150 +Zero=0 +PMin=125 +PSec=4 +PFrame=01 +PLBA=549150 + +[Entry 10] +Session=2 +Point=0x03 +ADR=0x01 +Control=0x04 +TrackNo=0 +AMin=0 +ASec=0 +AFrame=0 +ALBA=-150 +Zero=0 +PMin=10 +PSec=2 +PFrame=0 +PLBA=45000 + +[Entry 11] +Session=2 +Point=0xb0 +ADR=0x05 +Control=0x00 +TrackNo=0 +AMin=255 +ASec=255 +AFrame=255 +ALBA=716730 +Zero=1 +PMin=180 +PSec=67 +PFrame=0 +PLBA=76875 diff --git a/GDROM/ROMS/DrinkTeam GD-ROM Trap Disc/dt-toc122.img b/GDROM/ROMS/DrinkTeam GD-ROM Trap Disc/dt-toc122.img new file mode 100644 index 00000000..77632a27 Binary files /dev/null and b/GDROM/ROMS/DrinkTeam GD-ROM Trap Disc/dt-toc122.img differ diff --git a/GDROM/ROMS/DrinkTeam GD-ROM Trap Disc/dt-toc122.nfo b/GDROM/ROMS/DrinkTeam GD-ROM Trap Disc/dt-toc122.nfo new file mode 100644 index 00000000..cd03e0f8 --- /dev/null +++ b/GDROM/ROMS/DrinkTeam GD-ROM Trap Disc/dt-toc122.nfo @@ -0,0 +1,43 @@ + + - DRINK TEAM - + P r o u d l y P r e s e n t s + + .: FAKE TOC 122 Minutes :. + (c) by Drink Team + + - --- Release Info -------------------------------------------------> + + Cracked by. [ Drink Team ] - Filename.. [ dt-toc122.rar ] + Tested by.. [ Drink Team ] - Date ..... [ 08-01-2001 ] + Kind ...... [ DC Tool ] - Ripped ... [ --------------- ] + Origin .... [ ---------------- ] - Language . [ --------------- ] + Protection. [ ---------------- ] - RARS ..... [ 1 RAR/CloneCD ] + + + + - --- Release Notes ------------------------------------------------> + + All people claimed that a standard PC/Cdrom can read a GD, that its + very very true. But these people also claimed that they cant rip + 100% a GD, because they only have a 80 min. TOC. We use this TOC + since August 2000, it make us rip a lot of games :) + This CloneCD image is dedicated to all people of forums, that it + say can rip some of GD but any people believe it :) + If you dont know how to rip with this TOC, plz learn it w/o help, + or you became a little lammer child. + + Note: This image have the same structure of a GD, if you want read + the TOC of High Density with My PC and Isobuster. + + + - --- Burn Note -----------------------------------------------------> + + Unpack rar file and burn dt-toc122.img with CloneCD 3. When CloneCD + tell you if you want keep the TOC/LEAD OUT POSITION push YES. + + - --- Greets --------------------------------------------------------> + + Utopia, Kalisto, Echelon, Accesion, Reccesion, Lightforce, Donut, + Krema.Inc.2001, Paradiso, Paradox, Eurasia, Stone Arts, etc... + -----THE END---------------------------------------------------------- + diff --git a/GDROM/ROMS/DrinkTeam GD-ROM Trap Disc/dt-toc122.sub b/GDROM/ROMS/DrinkTeam GD-ROM Trap Disc/dt-toc122.sub new file mode 100644 index 00000000..ec43b354 Binary files /dev/null and b/GDROM/ROMS/DrinkTeam GD-ROM Trap Disc/dt-toc122.sub differ diff --git a/GDROM/ROMS/Yursoft GD-ROM Audio Trap Disc/TOC122A.CCD b/GDROM/ROMS/Yursoft GD-ROM Audio Trap Disc/TOC122A.CCD new file mode 100644 index 00000000..ecc7da3a --- /dev/null +++ b/GDROM/ROMS/Yursoft GD-ROM Audio Trap Disc/TOC122A.CCD @@ -0,0 +1,76 @@ +[CloneCD] +Version=2 + +[Disc] +TocEntries=4 +Sessions=1 +DataTracksScrambled=0 +CDTextLength=0 + +[Session 1] +PreGapMode=0 +PreGapSubC=0 + +[Entry 0] +Session=1 +Point=0xa0 +ADR=0x01 +Control=0x00 +TrackNo=0 +AMin=0 +ASec=0 +AFrame=0 +ALBA=-150 +Zero=0 +PMin=1 +PSec=0 +PFrame=0 +PLBA=4350 + +[Entry 1] +Session=1 +Point=0xa1 +ADR=0x01 +Control=0x00 +TrackNo=0 +AMin=0 +ASec=0 +AFrame=0 +ALBA=-150 +Zero=0 +PMin=1 +PSec=0 +PFrame=0 +PLBA=4350 + +[Entry 2] +Session=1 +Point=0xa2 +ADR=0x01 +Control=0x00 +TrackNo=0 +AMin=0 +ASec=0 +AFrame=0 +ALBA=-150 +Zero=0 +PMin=122 +PSec=4 +PFrame=01 +PLBA=1651 + +[Entry 3] +Session=1 +Point=0x01 +ADR=0x01 +Control=0x00 +TrackNo=0 +AMin=0 +ASec=0 +AFrame=0 +ALBA=-150 +Zero=0 +PMin=0 +PSec=2 +PFrame=0 +PLBA=0 diff --git a/GDROM/ROMS/Yursoft GD-ROM Audio Trap Disc/TOC122A.IMG b/GDROM/ROMS/Yursoft GD-ROM Audio Trap Disc/TOC122A.IMG new file mode 100644 index 00000000..925d167c Binary files /dev/null and b/GDROM/ROMS/Yursoft GD-ROM Audio Trap Disc/TOC122A.IMG differ diff --git a/GDROM/ROMS/Yursoft GD-ROM Audio Trap Disc/TOC122A.SUB b/GDROM/ROMS/Yursoft GD-ROM Audio Trap Disc/TOC122A.SUB new file mode 100644 index 00000000..b66ccd24 Binary files /dev/null and b/GDROM/ROMS/Yursoft GD-ROM Audio Trap Disc/TOC122A.SUB differ diff --git a/GDROM/ROMS/Yursoft GD-ROM Data Trap Disc/yur-122.ccd b/GDROM/ROMS/Yursoft GD-ROM Data Trap Disc/yur-122.ccd new file mode 100644 index 00000000..d9fcccde --- /dev/null +++ b/GDROM/ROMS/Yursoft GD-ROM Data Trap Disc/yur-122.ccd @@ -0,0 +1,80 @@ +[CloneCD] +Version=3 + +[Disc] +TocEntries=4 +Sessions=1 +DataTracksScrambled=0 +CDTextLength=0 + +[Session 1] +PreGapMode=1 +PreGapSubC=0 + +[Entry 0] +Session=1 +Point=0xa0 +ADR=0x01 +Control=0x04 +TrackNo=0 +AMin=0 +ASec=0 +AFrame=0 +ALBA=-150 +Zero=0 +PMin=1 +PSec=0 +PFrame=0 +PLBA=4350 + +[Entry 1] +Session=1 +Point=0xa1 +ADR=0x01 +Control=0x04 +TrackNo=0 +AMin=0 +ASec=0 +AFrame=0 +ALBA=-150 +Zero=0 +PMin=1 +PSec=0 +PFrame=0 +PLBA=4350 + +[Entry 2] +Session=1 +Point=0xa2 +ADR=0x01 +Control=0x04 +TrackNo=0 +AMin=0 +ASec=0 +AFrame=0 +ALBA=-150 +Zero=0 +PMin=122 +PSec=4 +PFrame=0 +PLBA=300 + +[Entry 3] +Session=1 +Point=0x01 +ADR=0x01 +Control=0x04 +TrackNo=0 +AMin=0 +ASec=0 +AFrame=0 +ALBA=-150 +Zero=0 +PMin=0 +PSec=2 +PFrame=0 +PLBA=0 + +[TRACK 1] +MODE=1 +INDEX 1=0 diff --git a/GDROM/ROMS/Yursoft GD-ROM Data Trap Disc/yur-122.img b/GDROM/ROMS/Yursoft GD-ROM Data Trap Disc/yur-122.img new file mode 100644 index 00000000..6a93c57a Binary files /dev/null and b/GDROM/ROMS/Yursoft GD-ROM Data Trap Disc/yur-122.img differ diff --git a/GDROM/ROMS/Yursoft GD-ROM Data Trap Disc/yur-122.sub b/GDROM/ROMS/Yursoft GD-ROM Data Trap Disc/yur-122.sub new file mode 100644 index 00000000..71847875 Binary files /dev/null and b/GDROM/ROMS/Yursoft GD-ROM Data Trap Disc/yur-122.sub differ diff --git a/LAN/DOCS/bba_manual.pdf b/LAN/DOCS/bba_manual.pdf new file mode 100644 index 00000000..25b1da95 Binary files /dev/null and b/LAN/DOCS/bba_manual.pdf differ diff --git a/LAN/ROMS/dc-load-ip-1.0.4-dj4/dc-load.cdi b/LAN/ROMS/dc-load-ip-1.0.4-dj4/dc-load.cdi new file mode 100644 index 00000000..dcb4e50f Binary files /dev/null and b/LAN/ROMS/dc-load-ip-1.0.4-dj4/dc-load.cdi differ diff --git a/LAN/ROMS/dc-load-ip-1.0.4-n6/dc-load-ip-n6.nrg b/LAN/ROMS/dc-load-ip-1.0.4-n6/dc-load-ip-n6.nrg new file mode 100644 index 00000000..5e67c258 Binary files /dev/null and b/LAN/ROMS/dc-load-ip-1.0.4-n6/dc-load-ip-n6.nrg differ diff --git a/LAN/ROMS/dcload-1.0.4-dcplaya-0000.0000.0000.0000/1st_read.bin b/LAN/ROMS/dcload-1.0.4-dcplaya-0000.0000.0000.0000/1st_read.bin new file mode 100644 index 00000000..042f7a4f Binary files /dev/null and b/LAN/ROMS/dcload-1.0.4-dcplaya-0000.0000.0000.0000/1st_read.bin differ diff --git a/LAN/ROMS/dcload-1.0.4-dcplaya-0000.0000.0000.0000/dc-tool b/LAN/ROMS/dcload-1.0.4-dcplaya-0000.0000.0000.0000/dc-tool new file mode 100644 index 00000000..e4e6eb05 Binary files /dev/null and b/LAN/ROMS/dcload-1.0.4-dcplaya-0000.0000.0000.0000/dc-tool differ diff --git a/LAN/ROMS/dcload-ip-104-dj4/SiZiOUS.txt b/LAN/ROMS/dcload-ip-104-dj4/SiZiOUS.txt new file mode 100644 index 00000000..9574aff9 --- /dev/null +++ b/LAN/ROMS/dcload-ip-104-dj4/SiZiOUS.txt @@ -0,0 +1,15 @@ + [big_fury] + 888888888 8888 888888888888 8888 888888888 8888 8888 888888888 + 8888888888888 8888 888888888888 8888 8888888888888 8888 8888 8888888888888 + 8888 8888 88888 8888 8888 8888 8888 8888 8888 + 888888888 8888 888888 8888 8888 8888 8888 8888 888888888 + 8888888888 8888 88888 8888 8888 8888 8888 8888 88888888888 + 888888 8888 88888 8888 8888 8888 8888 8888 888888 + 8888 8888 8888 88888 8888 8888 8888 8888 8888 8888 8888 + 8888888888888 8888 88888888888888 8888 8888888888888 888888888888 8888888888888 + 8888888888 8888 88888888888888 8888 888888888 8888888888 8888888888 + + +This CD image of "DC-LOAD-IP v1.0.4" has been created by [big_fury]SiZiOUS. + +Get DC-TOOL GUI now at http://sbibuilder.shorturl.com/ \ No newline at end of file diff --git a/LAN/ROMS/dcload-ip-104-dj4/dcload-ip-104-dj4.cdi b/LAN/ROMS/dcload-ip-104-dj4/dcload-ip-104-dj4.cdi new file mode 100644 index 00000000..386346da Binary files /dev/null and b/LAN/ROMS/dcload-ip-104-dj4/dcload-ip-104-dj4.cdi differ diff --git a/LAN/ROMS/dcload-ip-104-dj4/readme.txt b/LAN/ROMS/dcload-ip-104-dj4/readme.txt new file mode 100644 index 00000000..636509f3 --- /dev/null +++ b/LAN/ROMS/dcload-ip-104-dj4/readme.txt @@ -0,0 +1,76 @@ +dcload-ip 1.0.4 - a Dreamcast ethernet loader by + +Features + +* Load elf, srec, and bin +* PC I/O (read, write, etc to PC - compatible with original dcload) +* Exception handler +* Extremely fast (at least for me - I get 1130Kbyte/sec on 10mbit half-duplex) +* Now works on 100mbit (I get 2580Kbyte/sec on 100mbit half-duplex) +* Supports both the Broadband Adapter (HIT-0400) and Lan Adapter (HIT-0300) + in a single binary + +Building + +1. Edit Makefile.cfg for your system and network, and then run make + +Installation + +1. PC - run make install (installs dc-tool) +2. DC + a. cd make-cd, edit Makefile, insert blank cd-r, run make + or + b. take target-src/1st_read/1st_read.bin and stuff it on a cd yourself + (please use the IP.BIN from the make-cd directory if you are going + to distribute either cds or cd images) + +On-screen display + +* If you see the message "NO ETHERNET ADAPTER DETECTED!", something has + gone wrong. The background of the screen will be red. + +* The correct display is something like: + dcload-ip 1.0.4 <- name/version + Broadband Adapter (HIT-0400) <- adapter driver in use + 00:d0:f1:02:ab:dd <- dc hardware address + c0.a8.00.04 <- dc ip address (in hex) + idle... <- status + + The background of the screen will be green. + +* For the Broadband Adapter only: if the status line reports "link + change..." and does not change back to "idle..." within a short period + of time, you may have a cable problem. dcload-ip will not work while + "link change..." is displayed, or before it is displayed the first time. + The "link change..." message normally is seen when you start dcload-ip, + when you execute dc-tool -r, and when you disconnect the ethernet cable. + +* If an exception is caught while a loaded program is running, the screen + will turn blue and display the exception info. dcload-ip should be + active again after that point. + +Testing + +1. cd example-src +2. dc-tool -x console-test (tests some PC I/O) +3. dc-tool -x exception-test (generates an exception) +4. dc-tool -x gethostinfo (displays the Dreamcast's ip, and the ip and port of + the dc-tool host) + +Notes + +* You can use arp instead of setting the dreamcast's ip in Makefile.cfg +* Tested systems: Debian GNU/Linux 2.2-3.0, Cygwin +* There are almost certainly bugs +* Patches and improvements are welcome; please send to bard@allusion.net + +Credits +* rtl8139 code based on code by Dan Potter +* Lan Adapter driver is pulled from an early version of the KOS LA driver +* There are some various files from newlib-1.8.2 here +* video.s was written by Marcus Comstedt +* initial win32 porting and implementation of -t by Florian 'Proff' Schulze +* win32 bugfix by The Gypsy +* fixes for cygwin by Florian 'Proff' Schulze +* rx config bug pointed out by Slant +* horridly buggy nature of 1.0.1 + 1.0.2 pointed out by Dan Potter \ No newline at end of file diff --git a/LAN/ROMS/dcload-ip-104-dj4/version.txt b/LAN/ROMS/dcload-ip-104-dj4/version.txt new file mode 100644 index 00000000..14b5692f --- /dev/null +++ b/LAN/ROMS/dcload-ip-104-dj4/version.txt @@ -0,0 +1,6 @@ +iv compiled a cvs build of dctool and dcload as of todays 11/17/2005 with gcc 3.0.4 +since thats the last version that iv seen that has libbfd installed. + +http://www.dcemu.co.uk/vbulletin/showthread.php?t=14020 + +GPF \ No newline at end of file diff --git a/LAN/ROMS/dcload-ip-104-nero6/SiZiOUS.txt b/LAN/ROMS/dcload-ip-104-nero6/SiZiOUS.txt new file mode 100644 index 00000000..9574aff9 --- /dev/null +++ b/LAN/ROMS/dcload-ip-104-nero6/SiZiOUS.txt @@ -0,0 +1,15 @@ + [big_fury] + 888888888 8888 888888888888 8888 888888888 8888 8888 888888888 + 8888888888888 8888 888888888888 8888 8888888888888 8888 8888 8888888888888 + 8888 8888 88888 8888 8888 8888 8888 8888 8888 + 888888888 8888 888888 8888 8888 8888 8888 8888 888888888 + 8888888888 8888 88888 8888 8888 8888 8888 8888 88888888888 + 888888 8888 88888 8888 8888 8888 8888 8888 888888 + 8888 8888 8888 88888 8888 8888 8888 8888 8888 8888 8888 + 8888888888888 8888 88888888888888 8888 8888888888888 888888888888 8888888888888 + 8888888888 8888 88888888888888 8888 888888888 8888888888 8888888888 + + +This CD image of "DC-LOAD-IP v1.0.4" has been created by [big_fury]SiZiOUS. + +Get DC-TOOL GUI now at http://sbibuilder.shorturl.com/ \ No newline at end of file diff --git a/LAN/ROMS/dcload-ip-104-nero6/dcload-ip-104-nero6.nrg b/LAN/ROMS/dcload-ip-104-nero6/dcload-ip-104-nero6.nrg new file mode 100644 index 00000000..543d5467 Binary files /dev/null and b/LAN/ROMS/dcload-ip-104-nero6/dcload-ip-104-nero6.nrg differ diff --git a/LAN/ROMS/dcload-ip-104-nero6/readme.txt b/LAN/ROMS/dcload-ip-104-nero6/readme.txt new file mode 100644 index 00000000..636509f3 --- /dev/null +++ b/LAN/ROMS/dcload-ip-104-nero6/readme.txt @@ -0,0 +1,76 @@ +dcload-ip 1.0.4 - a Dreamcast ethernet loader by + +Features + +* Load elf, srec, and bin +* PC I/O (read, write, etc to PC - compatible with original dcload) +* Exception handler +* Extremely fast (at least for me - I get 1130Kbyte/sec on 10mbit half-duplex) +* Now works on 100mbit (I get 2580Kbyte/sec on 100mbit half-duplex) +* Supports both the Broadband Adapter (HIT-0400) and Lan Adapter (HIT-0300) + in a single binary + +Building + +1. Edit Makefile.cfg for your system and network, and then run make + +Installation + +1. PC - run make install (installs dc-tool) +2. DC + a. cd make-cd, edit Makefile, insert blank cd-r, run make + or + b. take target-src/1st_read/1st_read.bin and stuff it on a cd yourself + (please use the IP.BIN from the make-cd directory if you are going + to distribute either cds or cd images) + +On-screen display + +* If you see the message "NO ETHERNET ADAPTER DETECTED!", something has + gone wrong. The background of the screen will be red. + +* The correct display is something like: + dcload-ip 1.0.4 <- name/version + Broadband Adapter (HIT-0400) <- adapter driver in use + 00:d0:f1:02:ab:dd <- dc hardware address + c0.a8.00.04 <- dc ip address (in hex) + idle... <- status + + The background of the screen will be green. + +* For the Broadband Adapter only: if the status line reports "link + change..." and does not change back to "idle..." within a short period + of time, you may have a cable problem. dcload-ip will not work while + "link change..." is displayed, or before it is displayed the first time. + The "link change..." message normally is seen when you start dcload-ip, + when you execute dc-tool -r, and when you disconnect the ethernet cable. + +* If an exception is caught while a loaded program is running, the screen + will turn blue and display the exception info. dcload-ip should be + active again after that point. + +Testing + +1. cd example-src +2. dc-tool -x console-test (tests some PC I/O) +3. dc-tool -x exception-test (generates an exception) +4. dc-tool -x gethostinfo (displays the Dreamcast's ip, and the ip and port of + the dc-tool host) + +Notes + +* You can use arp instead of setting the dreamcast's ip in Makefile.cfg +* Tested systems: Debian GNU/Linux 2.2-3.0, Cygwin +* There are almost certainly bugs +* Patches and improvements are welcome; please send to bard@allusion.net + +Credits +* rtl8139 code based on code by Dan Potter +* Lan Adapter driver is pulled from an early version of the KOS LA driver +* There are some various files from newlib-1.8.2 here +* video.s was written by Marcus Comstedt +* initial win32 porting and implementation of -t by Florian 'Proff' Schulze +* win32 bugfix by The Gypsy +* fixes for cygwin by Florian 'Proff' Schulze +* rx config bug pointed out by Slant +* horridly buggy nature of 1.0.1 + 1.0.2 pointed out by Dan Potter \ No newline at end of file diff --git a/LAN/ROMS/dcload-ip-104-nero6/version.txt b/LAN/ROMS/dcload-ip-104-nero6/version.txt new file mode 100644 index 00000000..14b5692f --- /dev/null +++ b/LAN/ROMS/dcload-ip-104-nero6/version.txt @@ -0,0 +1,6 @@ +iv compiled a cvs build of dctool and dcload as of todays 11/17/2005 with gcc 3.0.4 +since thats the last version that iv seen that has libbfd installed. + +http://www.dcemu.co.uk/vbulletin/showthread.php?t=14020 + +GPF \ No newline at end of file diff --git a/LAN/ROMS/dcload-ip-dcplaya-104-alcohol/SiZiOUS.txt b/LAN/ROMS/dcload-ip-dcplaya-104-alcohol/SiZiOUS.txt new file mode 100644 index 00000000..6d7bc881 --- /dev/null +++ b/LAN/ROMS/dcload-ip-dcplaya-104-alcohol/SiZiOUS.txt @@ -0,0 +1,15 @@ + [big_fury] + 888888888 8888 888888888888 8888 888888888 8888 8888 888888888 + 8888888888888 8888 888888888888 8888 8888888888888 8888 8888 8888888888888 + 8888 8888 88888 8888 8888 8888 8888 8888 8888 + 888888888 8888 888888 8888 8888 8888 8888 8888 888888888 + 8888888888 8888 88888 8888 8888 8888 8888 8888 88888888888 + 888888 8888 88888 8888 8888 8888 8888 8888 888888 + 8888 8888 8888 88888 8888 8888 8888 8888 8888 8888 8888 + 8888888888888 8888 88888888888888 8888 8888888888888 888888888888 8888888888888 + 8888888888 8888 88888888888888 8888 888888888 8888888888 8888888888 + + +This CD image of "DC-LOAD-IP v1.0.4 DC-PLAYA PATCHED" has been created by [big_fury]SiZiOUS. + +Get DC-TOOL GUI now at http://sbibuilder.shorturl.com/ \ No newline at end of file diff --git a/LAN/ROMS/dcload-ip-dcplaya-104-alcohol/dcload-ip-dcplaya-104-alcohol.mdf b/LAN/ROMS/dcload-ip-dcplaya-104-alcohol/dcload-ip-dcplaya-104-alcohol.mdf new file mode 100644 index 00000000..9ee13945 Binary files /dev/null and b/LAN/ROMS/dcload-ip-dcplaya-104-alcohol/dcload-ip-dcplaya-104-alcohol.mdf differ diff --git a/LAN/ROMS/dcload-ip-dcplaya-104-alcohol/dcload-ip-dcplaya-104-alcohol.mds b/LAN/ROMS/dcload-ip-dcplaya-104-alcohol/dcload-ip-dcplaya-104-alcohol.mds new file mode 100644 index 00000000..c3a611b5 Binary files /dev/null and b/LAN/ROMS/dcload-ip-dcplaya-104-alcohol/dcload-ip-dcplaya-104-alcohol.mds differ diff --git a/LAN/ROMS/dcload-ip-dcplaya-104-alcohol/dcplaya.txt b/LAN/ROMS/dcload-ip-dcplaya-104-alcohol/dcplaya.txt new file mode 100644 index 00000000..aeed201b --- /dev/null +++ b/LAN/ROMS/dcload-ip-dcplaya-104-alcohol/dcplaya.txt @@ -0,0 +1,6 @@ +DCLOAD-IP v1.0.4 DCPLAYA TEAM PATCH +=================================== + +This version of dcload-ip add two thnigs to the origina 1.0.4 version : - a -z option to dc-tool to attach the tool on a running application - sockets are open in non-bloquing mode so that dc-tool does not eat all CPU time. + +http://sashipa.ben.free.fr/dcplaya/ \ No newline at end of file diff --git a/LAN/ROMS/dcload-ip-dcplaya-104-alcohol/readme.txt b/LAN/ROMS/dcload-ip-dcplaya-104-alcohol/readme.txt new file mode 100644 index 00000000..636509f3 --- /dev/null +++ b/LAN/ROMS/dcload-ip-dcplaya-104-alcohol/readme.txt @@ -0,0 +1,76 @@ +dcload-ip 1.0.4 - a Dreamcast ethernet loader by + +Features + +* Load elf, srec, and bin +* PC I/O (read, write, etc to PC - compatible with original dcload) +* Exception handler +* Extremely fast (at least for me - I get 1130Kbyte/sec on 10mbit half-duplex) +* Now works on 100mbit (I get 2580Kbyte/sec on 100mbit half-duplex) +* Supports both the Broadband Adapter (HIT-0400) and Lan Adapter (HIT-0300) + in a single binary + +Building + +1. Edit Makefile.cfg for your system and network, and then run make + +Installation + +1. PC - run make install (installs dc-tool) +2. DC + a. cd make-cd, edit Makefile, insert blank cd-r, run make + or + b. take target-src/1st_read/1st_read.bin and stuff it on a cd yourself + (please use the IP.BIN from the make-cd directory if you are going + to distribute either cds or cd images) + +On-screen display + +* If you see the message "NO ETHERNET ADAPTER DETECTED!", something has + gone wrong. The background of the screen will be red. + +* The correct display is something like: + dcload-ip 1.0.4 <- name/version + Broadband Adapter (HIT-0400) <- adapter driver in use + 00:d0:f1:02:ab:dd <- dc hardware address + c0.a8.00.04 <- dc ip address (in hex) + idle... <- status + + The background of the screen will be green. + +* For the Broadband Adapter only: if the status line reports "link + change..." and does not change back to "idle..." within a short period + of time, you may have a cable problem. dcload-ip will not work while + "link change..." is displayed, or before it is displayed the first time. + The "link change..." message normally is seen when you start dcload-ip, + when you execute dc-tool -r, and when you disconnect the ethernet cable. + +* If an exception is caught while a loaded program is running, the screen + will turn blue and display the exception info. dcload-ip should be + active again after that point. + +Testing + +1. cd example-src +2. dc-tool -x console-test (tests some PC I/O) +3. dc-tool -x exception-test (generates an exception) +4. dc-tool -x gethostinfo (displays the Dreamcast's ip, and the ip and port of + the dc-tool host) + +Notes + +* You can use arp instead of setting the dreamcast's ip in Makefile.cfg +* Tested systems: Debian GNU/Linux 2.2-3.0, Cygwin +* There are almost certainly bugs +* Patches and improvements are welcome; please send to bard@allusion.net + +Credits +* rtl8139 code based on code by Dan Potter +* Lan Adapter driver is pulled from an early version of the KOS LA driver +* There are some various files from newlib-1.8.2 here +* video.s was written by Marcus Comstedt +* initial win32 porting and implementation of -t by Florian 'Proff' Schulze +* win32 bugfix by The Gypsy +* fixes for cygwin by Florian 'Proff' Schulze +* rx config bug pointed out by Slant +* horridly buggy nature of 1.0.1 + 1.0.2 pointed out by Dan Potter \ No newline at end of file diff --git a/LAN/ROMS/dcload-ip-dcplaya-104-dj4/SiZiOUS.txt b/LAN/ROMS/dcload-ip-dcplaya-104-dj4/SiZiOUS.txt new file mode 100644 index 00000000..6d7bc881 --- /dev/null +++ b/LAN/ROMS/dcload-ip-dcplaya-104-dj4/SiZiOUS.txt @@ -0,0 +1,15 @@ + [big_fury] + 888888888 8888 888888888888 8888 888888888 8888 8888 888888888 + 8888888888888 8888 888888888888 8888 8888888888888 8888 8888 8888888888888 + 8888 8888 88888 8888 8888 8888 8888 8888 8888 + 888888888 8888 888888 8888 8888 8888 8888 8888 888888888 + 8888888888 8888 88888 8888 8888 8888 8888 8888 88888888888 + 888888 8888 88888 8888 8888 8888 8888 8888 888888 + 8888 8888 8888 88888 8888 8888 8888 8888 8888 8888 8888 + 8888888888888 8888 88888888888888 8888 8888888888888 888888888888 8888888888888 + 8888888888 8888 88888888888888 8888 888888888 8888888888 8888888888 + + +This CD image of "DC-LOAD-IP v1.0.4 DC-PLAYA PATCHED" has been created by [big_fury]SiZiOUS. + +Get DC-TOOL GUI now at http://sbibuilder.shorturl.com/ \ No newline at end of file diff --git a/LAN/ROMS/dcload-ip-dcplaya-104-dj4/dcload-ip-dcplaya-104-dj4.cdi b/LAN/ROMS/dcload-ip-dcplaya-104-dj4/dcload-ip-dcplaya-104-dj4.cdi new file mode 100644 index 00000000..4f27bbb8 Binary files /dev/null and b/LAN/ROMS/dcload-ip-dcplaya-104-dj4/dcload-ip-dcplaya-104-dj4.cdi differ diff --git a/LAN/ROMS/dcload-ip-dcplaya-104-dj4/dcplaya.txt b/LAN/ROMS/dcload-ip-dcplaya-104-dj4/dcplaya.txt new file mode 100644 index 00000000..aeed201b --- /dev/null +++ b/LAN/ROMS/dcload-ip-dcplaya-104-dj4/dcplaya.txt @@ -0,0 +1,6 @@ +DCLOAD-IP v1.0.4 DCPLAYA TEAM PATCH +=================================== + +This version of dcload-ip add two thnigs to the origina 1.0.4 version : - a -z option to dc-tool to attach the tool on a running application - sockets are open in non-bloquing mode so that dc-tool does not eat all CPU time. + +http://sashipa.ben.free.fr/dcplaya/ \ No newline at end of file diff --git a/LAN/ROMS/dcload-ip-dcplaya-104-dj4/readme.txt b/LAN/ROMS/dcload-ip-dcplaya-104-dj4/readme.txt new file mode 100644 index 00000000..636509f3 --- /dev/null +++ b/LAN/ROMS/dcload-ip-dcplaya-104-dj4/readme.txt @@ -0,0 +1,76 @@ +dcload-ip 1.0.4 - a Dreamcast ethernet loader by + +Features + +* Load elf, srec, and bin +* PC I/O (read, write, etc to PC - compatible with original dcload) +* Exception handler +* Extremely fast (at least for me - I get 1130Kbyte/sec on 10mbit half-duplex) +* Now works on 100mbit (I get 2580Kbyte/sec on 100mbit half-duplex) +* Supports both the Broadband Adapter (HIT-0400) and Lan Adapter (HIT-0300) + in a single binary + +Building + +1. Edit Makefile.cfg for your system and network, and then run make + +Installation + +1. PC - run make install (installs dc-tool) +2. DC + a. cd make-cd, edit Makefile, insert blank cd-r, run make + or + b. take target-src/1st_read/1st_read.bin and stuff it on a cd yourself + (please use the IP.BIN from the make-cd directory if you are going + to distribute either cds or cd images) + +On-screen display + +* If you see the message "NO ETHERNET ADAPTER DETECTED!", something has + gone wrong. The background of the screen will be red. + +* The correct display is something like: + dcload-ip 1.0.4 <- name/version + Broadband Adapter (HIT-0400) <- adapter driver in use + 00:d0:f1:02:ab:dd <- dc hardware address + c0.a8.00.04 <- dc ip address (in hex) + idle... <- status + + The background of the screen will be green. + +* For the Broadband Adapter only: if the status line reports "link + change..." and does not change back to "idle..." within a short period + of time, you may have a cable problem. dcload-ip will not work while + "link change..." is displayed, or before it is displayed the first time. + The "link change..." message normally is seen when you start dcload-ip, + when you execute dc-tool -r, and when you disconnect the ethernet cable. + +* If an exception is caught while a loaded program is running, the screen + will turn blue and display the exception info. dcload-ip should be + active again after that point. + +Testing + +1. cd example-src +2. dc-tool -x console-test (tests some PC I/O) +3. dc-tool -x exception-test (generates an exception) +4. dc-tool -x gethostinfo (displays the Dreamcast's ip, and the ip and port of + the dc-tool host) + +Notes + +* You can use arp instead of setting the dreamcast's ip in Makefile.cfg +* Tested systems: Debian GNU/Linux 2.2-3.0, Cygwin +* There are almost certainly bugs +* Patches and improvements are welcome; please send to bard@allusion.net + +Credits +* rtl8139 code based on code by Dan Potter +* Lan Adapter driver is pulled from an early version of the KOS LA driver +* There are some various files from newlib-1.8.2 here +* video.s was written by Marcus Comstedt +* initial win32 porting and implementation of -t by Florian 'Proff' Schulze +* win32 bugfix by The Gypsy +* fixes for cygwin by Florian 'Proff' Schulze +* rx config bug pointed out by Slant +* horridly buggy nature of 1.0.1 + 1.0.2 pointed out by Dan Potter \ No newline at end of file diff --git a/LAN/ROMS/dcload-ip-dcplaya-104-nero5/SiZiOUS.txt b/LAN/ROMS/dcload-ip-dcplaya-104-nero5/SiZiOUS.txt new file mode 100644 index 00000000..6d7bc881 --- /dev/null +++ b/LAN/ROMS/dcload-ip-dcplaya-104-nero5/SiZiOUS.txt @@ -0,0 +1,15 @@ + [big_fury] + 888888888 8888 888888888888 8888 888888888 8888 8888 888888888 + 8888888888888 8888 888888888888 8888 8888888888888 8888 8888 8888888888888 + 8888 8888 88888 8888 8888 8888 8888 8888 8888 + 888888888 8888 888888 8888 8888 8888 8888 8888 888888888 + 8888888888 8888 88888 8888 8888 8888 8888 8888 88888888888 + 888888 8888 88888 8888 8888 8888 8888 8888 888888 + 8888 8888 8888 88888 8888 8888 8888 8888 8888 8888 8888 + 8888888888888 8888 88888888888888 8888 8888888888888 888888888888 8888888888888 + 8888888888 8888 88888888888888 8888 888888888 8888888888 8888888888 + + +This CD image of "DC-LOAD-IP v1.0.4 DC-PLAYA PATCHED" has been created by [big_fury]SiZiOUS. + +Get DC-TOOL GUI now at http://sbibuilder.shorturl.com/ \ No newline at end of file diff --git a/LAN/ROMS/dcload-ip-dcplaya-104-nero5/dcload-ip-dcplaya-104-nero5.nrg b/LAN/ROMS/dcload-ip-dcplaya-104-nero5/dcload-ip-dcplaya-104-nero5.nrg new file mode 100644 index 00000000..afbe7c92 Binary files /dev/null and b/LAN/ROMS/dcload-ip-dcplaya-104-nero5/dcload-ip-dcplaya-104-nero5.nrg differ diff --git a/LAN/ROMS/dcload-ip-dcplaya-104-nero5/dcplaya.txt b/LAN/ROMS/dcload-ip-dcplaya-104-nero5/dcplaya.txt new file mode 100644 index 00000000..aeed201b --- /dev/null +++ b/LAN/ROMS/dcload-ip-dcplaya-104-nero5/dcplaya.txt @@ -0,0 +1,6 @@ +DCLOAD-IP v1.0.4 DCPLAYA TEAM PATCH +=================================== + +This version of dcload-ip add two thnigs to the origina 1.0.4 version : - a -z option to dc-tool to attach the tool on a running application - sockets are open in non-bloquing mode so that dc-tool does not eat all CPU time. + +http://sashipa.ben.free.fr/dcplaya/ \ No newline at end of file diff --git a/LAN/ROMS/dcload-ip-dcplaya-104-nero5/readme.txt b/LAN/ROMS/dcload-ip-dcplaya-104-nero5/readme.txt new file mode 100644 index 00000000..636509f3 --- /dev/null +++ b/LAN/ROMS/dcload-ip-dcplaya-104-nero5/readme.txt @@ -0,0 +1,76 @@ +dcload-ip 1.0.4 - a Dreamcast ethernet loader by + +Features + +* Load elf, srec, and bin +* PC I/O (read, write, etc to PC - compatible with original dcload) +* Exception handler +* Extremely fast (at least for me - I get 1130Kbyte/sec on 10mbit half-duplex) +* Now works on 100mbit (I get 2580Kbyte/sec on 100mbit half-duplex) +* Supports both the Broadband Adapter (HIT-0400) and Lan Adapter (HIT-0300) + in a single binary + +Building + +1. Edit Makefile.cfg for your system and network, and then run make + +Installation + +1. PC - run make install (installs dc-tool) +2. DC + a. cd make-cd, edit Makefile, insert blank cd-r, run make + or + b. take target-src/1st_read/1st_read.bin and stuff it on a cd yourself + (please use the IP.BIN from the make-cd directory if you are going + to distribute either cds or cd images) + +On-screen display + +* If you see the message "NO ETHERNET ADAPTER DETECTED!", something has + gone wrong. The background of the screen will be red. + +* The correct display is something like: + dcload-ip 1.0.4 <- name/version + Broadband Adapter (HIT-0400) <- adapter driver in use + 00:d0:f1:02:ab:dd <- dc hardware address + c0.a8.00.04 <- dc ip address (in hex) + idle... <- status + + The background of the screen will be green. + +* For the Broadband Adapter only: if the status line reports "link + change..." and does not change back to "idle..." within a short period + of time, you may have a cable problem. dcload-ip will not work while + "link change..." is displayed, or before it is displayed the first time. + The "link change..." message normally is seen when you start dcload-ip, + when you execute dc-tool -r, and when you disconnect the ethernet cable. + +* If an exception is caught while a loaded program is running, the screen + will turn blue and display the exception info. dcload-ip should be + active again after that point. + +Testing + +1. cd example-src +2. dc-tool -x console-test (tests some PC I/O) +3. dc-tool -x exception-test (generates an exception) +4. dc-tool -x gethostinfo (displays the Dreamcast's ip, and the ip and port of + the dc-tool host) + +Notes + +* You can use arp instead of setting the dreamcast's ip in Makefile.cfg +* Tested systems: Debian GNU/Linux 2.2-3.0, Cygwin +* There are almost certainly bugs +* Patches and improvements are welcome; please send to bard@allusion.net + +Credits +* rtl8139 code based on code by Dan Potter +* Lan Adapter driver is pulled from an early version of the KOS LA driver +* There are some various files from newlib-1.8.2 here +* video.s was written by Marcus Comstedt +* initial win32 porting and implementation of -t by Florian 'Proff' Schulze +* win32 bugfix by The Gypsy +* fixes for cygwin by Florian 'Proff' Schulze +* rx config bug pointed out by Slant +* horridly buggy nature of 1.0.1 + 1.0.2 pointed out by Dan Potter \ No newline at end of file diff --git a/LAN/ROMS/dcload-ip-dcplaya-104-nero6/SiZiOUS.txt b/LAN/ROMS/dcload-ip-dcplaya-104-nero6/SiZiOUS.txt new file mode 100644 index 00000000..6d7bc881 --- /dev/null +++ b/LAN/ROMS/dcload-ip-dcplaya-104-nero6/SiZiOUS.txt @@ -0,0 +1,15 @@ + [big_fury] + 888888888 8888 888888888888 8888 888888888 8888 8888 888888888 + 8888888888888 8888 888888888888 8888 8888888888888 8888 8888 8888888888888 + 8888 8888 88888 8888 8888 8888 8888 8888 8888 + 888888888 8888 888888 8888 8888 8888 8888 8888 888888888 + 8888888888 8888 88888 8888 8888 8888 8888 8888 88888888888 + 888888 8888 88888 8888 8888 8888 8888 8888 888888 + 8888 8888 8888 88888 8888 8888 8888 8888 8888 8888 8888 + 8888888888888 8888 88888888888888 8888 8888888888888 888888888888 8888888888888 + 8888888888 8888 88888888888888 8888 888888888 8888888888 8888888888 + + +This CD image of "DC-LOAD-IP v1.0.4 DC-PLAYA PATCHED" has been created by [big_fury]SiZiOUS. + +Get DC-TOOL GUI now at http://sbibuilder.shorturl.com/ \ No newline at end of file diff --git a/LAN/ROMS/dcload-ip-dcplaya-104-nero6/dcload-ip-dcplaya-104-nero6.nrg b/LAN/ROMS/dcload-ip-dcplaya-104-nero6/dcload-ip-dcplaya-104-nero6.nrg new file mode 100644 index 00000000..afbe7c92 Binary files /dev/null and b/LAN/ROMS/dcload-ip-dcplaya-104-nero6/dcload-ip-dcplaya-104-nero6.nrg differ diff --git a/LAN/ROMS/dcload-ip-dcplaya-104-nero6/dcplaya.txt b/LAN/ROMS/dcload-ip-dcplaya-104-nero6/dcplaya.txt new file mode 100644 index 00000000..aeed201b --- /dev/null +++ b/LAN/ROMS/dcload-ip-dcplaya-104-nero6/dcplaya.txt @@ -0,0 +1,6 @@ +DCLOAD-IP v1.0.4 DCPLAYA TEAM PATCH +=================================== + +This version of dcload-ip add two thnigs to the origina 1.0.4 version : - a -z option to dc-tool to attach the tool on a running application - sockets are open in non-bloquing mode so that dc-tool does not eat all CPU time. + +http://sashipa.ben.free.fr/dcplaya/ \ No newline at end of file diff --git a/LAN/ROMS/dcload-ip-dcplaya-104-nero6/readme.txt b/LAN/ROMS/dcload-ip-dcplaya-104-nero6/readme.txt new file mode 100644 index 00000000..636509f3 --- /dev/null +++ b/LAN/ROMS/dcload-ip-dcplaya-104-nero6/readme.txt @@ -0,0 +1,76 @@ +dcload-ip 1.0.4 - a Dreamcast ethernet loader by + +Features + +* Load elf, srec, and bin +* PC I/O (read, write, etc to PC - compatible with original dcload) +* Exception handler +* Extremely fast (at least for me - I get 1130Kbyte/sec on 10mbit half-duplex) +* Now works on 100mbit (I get 2580Kbyte/sec on 100mbit half-duplex) +* Supports both the Broadband Adapter (HIT-0400) and Lan Adapter (HIT-0300) + in a single binary + +Building + +1. Edit Makefile.cfg for your system and network, and then run make + +Installation + +1. PC - run make install (installs dc-tool) +2. DC + a. cd make-cd, edit Makefile, insert blank cd-r, run make + or + b. take target-src/1st_read/1st_read.bin and stuff it on a cd yourself + (please use the IP.BIN from the make-cd directory if you are going + to distribute either cds or cd images) + +On-screen display + +* If you see the message "NO ETHERNET ADAPTER DETECTED!", something has + gone wrong. The background of the screen will be red. + +* The correct display is something like: + dcload-ip 1.0.4 <- name/version + Broadband Adapter (HIT-0400) <- adapter driver in use + 00:d0:f1:02:ab:dd <- dc hardware address + c0.a8.00.04 <- dc ip address (in hex) + idle... <- status + + The background of the screen will be green. + +* For the Broadband Adapter only: if the status line reports "link + change..." and does not change back to "idle..." within a short period + of time, you may have a cable problem. dcload-ip will not work while + "link change..." is displayed, or before it is displayed the first time. + The "link change..." message normally is seen when you start dcload-ip, + when you execute dc-tool -r, and when you disconnect the ethernet cable. + +* If an exception is caught while a loaded program is running, the screen + will turn blue and display the exception info. dcload-ip should be + active again after that point. + +Testing + +1. cd example-src +2. dc-tool -x console-test (tests some PC I/O) +3. dc-tool -x exception-test (generates an exception) +4. dc-tool -x gethostinfo (displays the Dreamcast's ip, and the ip and port of + the dc-tool host) + +Notes + +* You can use arp instead of setting the dreamcast's ip in Makefile.cfg +* Tested systems: Debian GNU/Linux 2.2-3.0, Cygwin +* There are almost certainly bugs +* Patches and improvements are welcome; please send to bard@allusion.net + +Credits +* rtl8139 code based on code by Dan Potter +* Lan Adapter driver is pulled from an early version of the KOS LA driver +* There are some various files from newlib-1.8.2 here +* video.s was written by Marcus Comstedt +* initial win32 porting and implementation of -t by Florian 'Proff' Schulze +* win32 bugfix by The Gypsy +* fixes for cygwin by Florian 'Proff' Schulze +* rx config bug pointed out by Slant +* horridly buggy nature of 1.0.1 + 1.0.2 pointed out by Dan Potter \ No newline at end of file diff --git a/LAN/ROMS/dcload-ip-la-103-192.168.0.4-DiscJuggler3/README.txt b/LAN/ROMS/dcload-ip-la-103-192.168.0.4-DiscJuggler3/README.txt new file mode 100644 index 00000000..74c02984 --- /dev/null +++ b/LAN/ROMS/dcload-ip-la-103-192.168.0.4-DiscJuggler3/README.txt @@ -0,0 +1,79 @@ + +---NOTICE!--- + +This ready-to-burn image was created by The Gypsy for distribution +from www.boob.co.uk. It is meant for those unable (or unwilling to +take the time) to create a bootable disc from the original +distribution. You should be able to just burn this image and boot it +in your DC without any further work on your part. The Gypsy is not +otherwise associated with this project (except for a minor win32 +bugfix as indicated in the Credits/Changelog). + +Note that this version is dcload-ip-la which includes Dan Potter's changes required for use with the Japanese "LAN Adapter" (model number HIT-0300). It will not work with the US or Japanese "Broadband Adapter" (model number HIT-040x). + +---Original README follows--- + +dcload-ip 1.0.3 - a Dreamcast ethernet loader by + +Features + +* Load elf, srec, and bin +* PC I/O (read, write, etc to PC - compatible with original dcload) +* Exception handler +* Extremely fast (at least for me - I get 1130Kbyte/sec on 10mbit half-duplex) +* Now works on 100mbit (I get 2580Kbyte/sec on 100mbit half-duplex) + +Building + +1. Edit Makefile.cfg for your system and network, and then run make + +Installation + +1. PC - run make install (installs dc-tool) +2. DC + a. cd make-cd, edit Makefile, insert blank cd-r, run make + or + b. take target-src/1st_read/1st_read.bin and stuff it on a cd yourself + (please use the IP.BIN from the make-cd directory if you are going + to distribute either cds or cd images) + +On-screen display + +* If you see the message "NO BROADBAND ADAPTER DETECTED!" or + "ERROR INITIALIZING BROADBAND ADAPTER", something has gone wrong. +* The correct display is something like: + dcload-ip 1.0.3 <- name/version + 00:d0:f1:02:ab:dd <- dc hardware address + c0.a8.00.04 <- dc ip address (in hex) + idle... <- status + +* If the status line reports "link change..." and does not change back to + "idle..." within a short period of time, you may have a cable problem. + dcload-ip will not work while "link change..." is displayed. The + "link change..." message normally is seen when you start dcload-ip, when + you execute dc-tool -r, and when you disconnect the ethernet cable. + +Testing + +1. cd example-src +2. dc-tool -x console-test (tests some PC I/O) +3. dc-tool -x exception-test (generates an exception) +4. dc-tool -x gethostinfo (displays the Dreamcast's ip, and the ip and port of + the dc-tool host) + +Notes + +* You can use arp instead of setting the dreamcast's ip in Makefile.cfg +* Tested systems: Debian GNU/Linux 2.2 +* There are almost certainly bugs +* Patches and improvements are welcome + +Credits +* rtl8139 code based on code by Dan Potter +* There are some various files from newlib-1.8.2 here +* video.s was written by Marcus Comstedt +* initial win32 porting and implementation of -t by Florian 'Proff' Schulze +* win32 bugfix by The Gypsy +* fixes for cygwin by Florian 'Proff' Schulze +* rx config bug pointed out by Slant +* horridly buggy nature of 1.0.1 + 1.0.2 pointed out by Dan Potter diff --git a/LAN/ROMS/dcload-ip-la-103-192.168.0.4-DiscJuggler3/dcload-ip-la-103-192.168.0.4-DiscJuggler3.cdi b/LAN/ROMS/dcload-ip-la-103-192.168.0.4-DiscJuggler3/dcload-ip-la-103-192.168.0.4-DiscJuggler3.cdi new file mode 100644 index 00000000..0a01a076 Binary files /dev/null and b/LAN/ROMS/dcload-ip-la-103-192.168.0.4-DiscJuggler3/dcload-ip-la-103-192.168.0.4-DiscJuggler3.cdi differ diff --git a/LAN/ROMS/dcload-ip-la-103-192.168.0.4-Nero5/README.txt b/LAN/ROMS/dcload-ip-la-103-192.168.0.4-Nero5/README.txt new file mode 100644 index 00000000..74c02984 --- /dev/null +++ b/LAN/ROMS/dcload-ip-la-103-192.168.0.4-Nero5/README.txt @@ -0,0 +1,79 @@ + +---NOTICE!--- + +This ready-to-burn image was created by The Gypsy for distribution +from www.boob.co.uk. It is meant for those unable (or unwilling to +take the time) to create a bootable disc from the original +distribution. You should be able to just burn this image and boot it +in your DC without any further work on your part. The Gypsy is not +otherwise associated with this project (except for a minor win32 +bugfix as indicated in the Credits/Changelog). + +Note that this version is dcload-ip-la which includes Dan Potter's changes required for use with the Japanese "LAN Adapter" (model number HIT-0300). It will not work with the US or Japanese "Broadband Adapter" (model number HIT-040x). + +---Original README follows--- + +dcload-ip 1.0.3 - a Dreamcast ethernet loader by + +Features + +* Load elf, srec, and bin +* PC I/O (read, write, etc to PC - compatible with original dcload) +* Exception handler +* Extremely fast (at least for me - I get 1130Kbyte/sec on 10mbit half-duplex) +* Now works on 100mbit (I get 2580Kbyte/sec on 100mbit half-duplex) + +Building + +1. Edit Makefile.cfg for your system and network, and then run make + +Installation + +1. PC - run make install (installs dc-tool) +2. DC + a. cd make-cd, edit Makefile, insert blank cd-r, run make + or + b. take target-src/1st_read/1st_read.bin and stuff it on a cd yourself + (please use the IP.BIN from the make-cd directory if you are going + to distribute either cds or cd images) + +On-screen display + +* If you see the message "NO BROADBAND ADAPTER DETECTED!" or + "ERROR INITIALIZING BROADBAND ADAPTER", something has gone wrong. +* The correct display is something like: + dcload-ip 1.0.3 <- name/version + 00:d0:f1:02:ab:dd <- dc hardware address + c0.a8.00.04 <- dc ip address (in hex) + idle... <- status + +* If the status line reports "link change..." and does not change back to + "idle..." within a short period of time, you may have a cable problem. + dcload-ip will not work while "link change..." is displayed. The + "link change..." message normally is seen when you start dcload-ip, when + you execute dc-tool -r, and when you disconnect the ethernet cable. + +Testing + +1. cd example-src +2. dc-tool -x console-test (tests some PC I/O) +3. dc-tool -x exception-test (generates an exception) +4. dc-tool -x gethostinfo (displays the Dreamcast's ip, and the ip and port of + the dc-tool host) + +Notes + +* You can use arp instead of setting the dreamcast's ip in Makefile.cfg +* Tested systems: Debian GNU/Linux 2.2 +* There are almost certainly bugs +* Patches and improvements are welcome + +Credits +* rtl8139 code based on code by Dan Potter +* There are some various files from newlib-1.8.2 here +* video.s was written by Marcus Comstedt +* initial win32 porting and implementation of -t by Florian 'Proff' Schulze +* win32 bugfix by The Gypsy +* fixes for cygwin by Florian 'Proff' Schulze +* rx config bug pointed out by Slant +* horridly buggy nature of 1.0.1 + 1.0.2 pointed out by Dan Potter diff --git a/LAN/ROMS/dcload-ip-la-103-192.168.0.4-Nero5/dcload-ip-la-103-192.168.0.4-Nero5.nrg b/LAN/ROMS/dcload-ip-la-103-192.168.0.4-Nero5/dcload-ip-la-103-192.168.0.4-Nero5.nrg new file mode 100644 index 00000000..f5120fdf Binary files /dev/null and b/LAN/ROMS/dcload-ip-la-103-192.168.0.4-Nero5/dcload-ip-la-103-192.168.0.4-Nero5.nrg differ diff --git a/LAN/ROMS/dcloadip104/1st_read.bin b/LAN/ROMS/dcloadip104/1st_read.bin new file mode 100644 index 00000000..3e898e33 Binary files /dev/null and b/LAN/ROMS/dcloadip104/1st_read.bin differ diff --git a/LAN/ROMS/dcloadip104/IP.BIN b/LAN/ROMS/dcloadip104/IP.BIN new file mode 100644 index 00000000..1490d019 Binary files /dev/null and b/LAN/ROMS/dcloadip104/IP.BIN differ diff --git a/LAN/ROMS/dcloadip104/dc-tool-ip.exe b/LAN/ROMS/dcloadip104/dc-tool-ip.exe new file mode 100644 index 00000000..f8a496b1 Binary files /dev/null and b/LAN/ROMS/dcloadip104/dc-tool-ip.exe differ diff --git a/LAN/ROMS/dctool-ip-104-alcohol/SiZiOUS.txt b/LAN/ROMS/dctool-ip-104-alcohol/SiZiOUS.txt new file mode 100644 index 00000000..9574aff9 --- /dev/null +++ b/LAN/ROMS/dctool-ip-104-alcohol/SiZiOUS.txt @@ -0,0 +1,15 @@ + [big_fury] + 888888888 8888 888888888888 8888 888888888 8888 8888 888888888 + 8888888888888 8888 888888888888 8888 8888888888888 8888 8888 8888888888888 + 8888 8888 88888 8888 8888 8888 8888 8888 8888 + 888888888 8888 888888 8888 8888 8888 8888 8888 888888888 + 8888888888 8888 88888 8888 8888 8888 8888 8888 88888888888 + 888888 8888 88888 8888 8888 8888 8888 8888 888888 + 8888 8888 8888 88888 8888 8888 8888 8888 8888 8888 8888 + 8888888888888 8888 88888888888888 8888 8888888888888 888888888888 8888888888888 + 8888888888 8888 88888888888888 8888 888888888 8888888888 8888888888 + + +This CD image of "DC-LOAD-IP v1.0.4" has been created by [big_fury]SiZiOUS. + +Get DC-TOOL GUI now at http://sbibuilder.shorturl.com/ \ No newline at end of file diff --git a/LAN/ROMS/dctool-ip-104-alcohol/dctool-ip-104-alcohol.mdf b/LAN/ROMS/dctool-ip-104-alcohol/dctool-ip-104-alcohol.mdf new file mode 100644 index 00000000..a0ec41f7 Binary files /dev/null and b/LAN/ROMS/dctool-ip-104-alcohol/dctool-ip-104-alcohol.mdf differ diff --git a/LAN/ROMS/dctool-ip-104-alcohol/dctool-ip-104-alcohol.mds b/LAN/ROMS/dctool-ip-104-alcohol/dctool-ip-104-alcohol.mds new file mode 100644 index 00000000..c3a611b5 Binary files /dev/null and b/LAN/ROMS/dctool-ip-104-alcohol/dctool-ip-104-alcohol.mds differ diff --git a/LAN/ROMS/dctool-ip-104-alcohol/readme.txt b/LAN/ROMS/dctool-ip-104-alcohol/readme.txt new file mode 100644 index 00000000..636509f3 --- /dev/null +++ b/LAN/ROMS/dctool-ip-104-alcohol/readme.txt @@ -0,0 +1,76 @@ +dcload-ip 1.0.4 - a Dreamcast ethernet loader by + +Features + +* Load elf, srec, and bin +* PC I/O (read, write, etc to PC - compatible with original dcload) +* Exception handler +* Extremely fast (at least for me - I get 1130Kbyte/sec on 10mbit half-duplex) +* Now works on 100mbit (I get 2580Kbyte/sec on 100mbit half-duplex) +* Supports both the Broadband Adapter (HIT-0400) and Lan Adapter (HIT-0300) + in a single binary + +Building + +1. Edit Makefile.cfg for your system and network, and then run make + +Installation + +1. PC - run make install (installs dc-tool) +2. DC + a. cd make-cd, edit Makefile, insert blank cd-r, run make + or + b. take target-src/1st_read/1st_read.bin and stuff it on a cd yourself + (please use the IP.BIN from the make-cd directory if you are going + to distribute either cds or cd images) + +On-screen display + +* If you see the message "NO ETHERNET ADAPTER DETECTED!", something has + gone wrong. The background of the screen will be red. + +* The correct display is something like: + dcload-ip 1.0.4 <- name/version + Broadband Adapter (HIT-0400) <- adapter driver in use + 00:d0:f1:02:ab:dd <- dc hardware address + c0.a8.00.04 <- dc ip address (in hex) + idle... <- status + + The background of the screen will be green. + +* For the Broadband Adapter only: if the status line reports "link + change..." and does not change back to "idle..." within a short period + of time, you may have a cable problem. dcload-ip will not work while + "link change..." is displayed, or before it is displayed the first time. + The "link change..." message normally is seen when you start dcload-ip, + when you execute dc-tool -r, and when you disconnect the ethernet cable. + +* If an exception is caught while a loaded program is running, the screen + will turn blue and display the exception info. dcload-ip should be + active again after that point. + +Testing + +1. cd example-src +2. dc-tool -x console-test (tests some PC I/O) +3. dc-tool -x exception-test (generates an exception) +4. dc-tool -x gethostinfo (displays the Dreamcast's ip, and the ip and port of + the dc-tool host) + +Notes + +* You can use arp instead of setting the dreamcast's ip in Makefile.cfg +* Tested systems: Debian GNU/Linux 2.2-3.0, Cygwin +* There are almost certainly bugs +* Patches and improvements are welcome; please send to bard@allusion.net + +Credits +* rtl8139 code based on code by Dan Potter +* Lan Adapter driver is pulled from an early version of the KOS LA driver +* There are some various files from newlib-1.8.2 here +* video.s was written by Marcus Comstedt +* initial win32 porting and implementation of -t by Florian 'Proff' Schulze +* win32 bugfix by The Gypsy +* fixes for cygwin by Florian 'Proff' Schulze +* rx config bug pointed out by Slant +* horridly buggy nature of 1.0.1 + 1.0.2 pointed out by Dan Potter \ No newline at end of file diff --git a/LAN/ROMS/dctool-ip-104-alcohol/version.txt b/LAN/ROMS/dctool-ip-104-alcohol/version.txt new file mode 100644 index 00000000..14b5692f --- /dev/null +++ b/LAN/ROMS/dctool-ip-104-alcohol/version.txt @@ -0,0 +1,6 @@ +iv compiled a cvs build of dctool and dcload as of todays 11/17/2005 with gcc 3.0.4 +since thats the last version that iv seen that has libbfd installed. + +http://www.dcemu.co.uk/vbulletin/showthread.php?t=14020 + +GPF \ No newline at end of file diff --git a/LAN/SRCS/dcload-ip/CHANGES b/LAN/SRCS/dcload-ip/CHANGES new file mode 100644 index 00000000..0e5dd3d9 --- /dev/null +++ b/LAN/SRCS/dcload-ip/CHANGES @@ -0,0 +1,50 @@ +WHATS NEW IN 1.0.4 + +* Maintenance versions of dcload moved into the CA CVS repository on + SourceForge with the blessings of adk. Please send future bug reports and + patches to bard@allusion.net. If there is sufficient demand, we'll setup + a separate mailing list for it, but you can also join the KOS mailing + list for dcload questions. +* Fix for a bug that makes the last 1024 bytes of an uploaded file sometimes + come out as garbage [Jason Fritcher/Jim Ursetto] +* Hack to avoid some segfaults in dc-tool [adk] +* Use configured LD, not sh-elf-ld in 1st_read [adk] +* Integrated Lan Adapter support [Dan Potter] +* Broadband Adapter driver improvements [dp] +* Colorized backgrounds for status (green, red) [dp] +* Moved text display down and right a bit to avoid border-chop [dp] +* Retries weren't discarding DONEBIN packet in host tool [Walter van Niftrik] +* Multi-pass retry in host tool to avoid incorrect data [dp] +* Renamed some conflicting struct members for glibc2.3.x [WvN] + +WHATS NEW IN 1.0.3 + +* actually seems to be working right, unlike 1.0.1 and 1.0.2, which were both + buggy as hell under many (most?) conditions. If 1.0.1 and 1.0.2 locked up, + went berzerk, or did other strange and horrible things when you used them, + try 1.0.3. +* dc-tool should now be able to recover from dropped packets in nearly all + cases (prior versions would just get stuck if certain packets got dropped) +* gethostinfo syscall now returns the dreamcast's ip, in addition to the ip + and port of the dc-tool host +* dcload-ip now reports "link change..." on the status line while the rtl8139 + is negotiating. This message should be displayed momentarily when dcload-ip + starts, when you execute dc-tool -r, or if you disconnect and reconnect the + ethernet cable. If the message stays there, check your ethernet cable. + +WHATS NEW IN 1.0.2 + +* fixed bug where rx configuration was not restored properly + (only affected dcload syscalls - could cause dc-tool to segfault apparently, + and who knows what else...) + +WHATS NEW IN 1.0.1 + +* works with 100mbit now +* added syscall to return the ip and port of the dc-tool host +* added O_BINARY to all open()s in dc-tool to help cygwin users + +WHATS NEW IN 1.0.0 + +* initial release of dcload-ip + diff --git a/LAN/SRCS/dcload-ip/COPYING b/LAN/SRCS/dcload-ip/COPYING new file mode 100644 index 00000000..d60c31a9 --- /dev/null +++ b/LAN/SRCS/dcload-ip/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/LAN/SRCS/dcload-ip/Makefile b/LAN/SRCS/dcload-ip/Makefile new file mode 100644 index 00000000..9466fd74 --- /dev/null +++ b/LAN/SRCS/dcload-ip/Makefile @@ -0,0 +1,32 @@ +include Makefile.cfg + +SUBDIRS = host-src target-src example-src +MAKE = make + +all: subdirs + +.PHONY : subdirs $(SUBDIRS) + +subdirs: $(SUBDIRS) + +$(SUBDIRS): + $(MAKE) -C $@ + +target-src: host-src + +.PHONY : install +install: + $(MAKE) -C host-src/tool install + +.PHONY : clean +clean: + for dir in $(SUBDIRS); do \ + $(MAKE) -C $$dir clean; \ + done + +.PHONY : distclean +distclean: + for dir in $(SUBDIRS) ; do \ + $(MAKE) -C $$dir distclean; \ + done + diff --git a/LAN/SRCS/dcload-ip/Makefile.cfg b/LAN/SRCS/dcload-ip/Makefile.cfg new file mode 100644 index 00000000..43a62ff7 --- /dev/null +++ b/LAN/SRCS/dcload-ip/Makefile.cfg @@ -0,0 +1,41 @@ +# host compiler and flags +HOSTCC = gcc +#HOSTCFLAGS = -O2 +# cygwin may need this +HOSTCFLAGS = -O2 -D_WIN32 + +# you may have to change the paths for BFDLIB and BFDINCLUDE to +# the ones in your system + +# these must point to your sh-elf bfd, not the system one +BFDLIB = -L/usr/local/dc/sh-elf/lib -lbfd -liberty -lintl +BFDINCLUDE = /usr/local/dc/sh-elf/include + +# cygwin +# these must point to your sh-elf bfd, not the system one +#BFDLIB = -L/usr/local/lib -lbfd -liberty -lintl +#BFDINCLUDE = /usr/local/include + +# sh-elf-stuff +TARGETCC = sh-elf-gcc +TARGETCFLAGS = -O2 -ml -m4 +TARGETOBJCOPY = sh-elf-objcopy +TARGETLD = sh-elf-ld + +# you generally shouldn't change this unless you are making forked +# versions (or test versions) +VERFLAGS = -DDCLOAD_VERSION=\"1.0.4\" +TARGETCFLAGS += $(VERFLAGS) +HOSTCFLAGS += $(VERFLAGS) + +# the ip of your dreamcast - set to 0.0.0.0 if you want to use arp on pc +#DREAMCAST_IP = 000.000.000.000 +DREAMCAST_IP = 192.168.2.4 +#DREAMCAST_IP = 10.0.0.32 + +# dir to install dc-tool in +TOOLINSTALLDIR = /usr/local/dc/dcload +#TOOLINSTALLDIR = /usr/local/dc/bin + +# uncomment this for cygwin +EXECUTABLEEXTENSION = .exe diff --git a/LAN/SRCS/dcload-ip/NETWORK b/LAN/SRCS/dcload-ip/NETWORK new file mode 100644 index 00000000..e5ac9b06 --- /dev/null +++ b/LAN/SRCS/dcload-ip/NETWORK @@ -0,0 +1,16 @@ +* You must either put the ip of your dreamcast in Makefile.cfg, or set it using + arp on your pc. + +dcload-ip implements (to some extent) the following protocols: + +* ARP - dcload-ip will respond to arp requests, if it knows its ip + +* IP + +* ICMP - dcload-ip responds to ICMP echo requests (ping) + +* UDP - dcload-ip uses UDP for transfering data and commands + + + + diff --git a/LAN/SRCS/dcload-ip/README b/LAN/SRCS/dcload-ip/README new file mode 100644 index 00000000..fee87f6b --- /dev/null +++ b/LAN/SRCS/dcload-ip/README @@ -0,0 +1,90 @@ +dcload-ip 1.0.4 - a Dreamcast ethernet loader by + +Features + +* Load elf, srec, and bin +* PC I/O (read, write, etc to PC - compatible with original dcload) +* Exception handler +* Extremely fast (at least for me - I get 1130Kbyte/sec on 10mbit half-duplex) +* Now works on 100mbit (I get 2580Kbyte/sec on 100mbit half-duplex) +* Supports both the Broadband Adapter (HIT-0400) and Lan Adapter (HIT-0300) + in a single binary + +Building + +1. Edit Makefile.cfg for your system and network, and then run make + +Installation + +1. PC - run make install (installs dc-tool) +2. DC + a. cd make-cd, edit Makefile, insert blank cd-r, run make + or + b. take target-src/1st_read/1st_read.bin and stuff it on a cd yourself + (please use the IP.BIN from the make-cd directory if you are going + to distribute either cds or cd images) + +On-screen display + +* If you see the message "NO ETHERNET ADAPTER DETECTED!", something has + gone wrong. The background of the screen will be red. + +* The correct display is something like: + dcload-ip 1.0.4 <- name/version + Broadband Adapter (HIT-0400) <- adapter driver in use + 00:d0:f1:02:ab:dd <- dc hardware address + c0.a8.00.04 <- dc ip address (in hex) + idle... <- status + + The background of the screen will be green. + +* For the Broadband Adapter only: if the status line reports "link + change..." and does not change back to "idle..." within a short period + of time, you may have a cable problem. dcload-ip will not work while + "link change..." is displayed, or before it is displayed the first time. + The "link change..." message normally is seen when you start dcload-ip, + when you execute dc-tool -r, and when you disconnect the ethernet cable. + +* If an exception is caught while a loaded program is running, the screen + will turn blue and display the exception info. dcload-ip should be + active again after that point. + +Testing + +1. cd example-src +2. dc-tool -x console-test (tests some PC I/O) +3. dc-tool -x exception-test (generates an exception) +4. dc-tool -x gethostinfo (displays the Dreamcast's ip, and the ip and port of + the dc-tool host) + +KOS GDB-over-dcload + +To run a GNU debugger session over the dcload connection: + +1. Build/obtain an sh-elf targetted GNU debugger +2. Put a 'gdb_init()' call somewhere in the startup area of your + KOS-based program +3. Build your program with the '-g' GCC switch to include debugging info +4. Launch your program using 'dc-tool -g -x ' +5. Launch sh-elf-gdb and connect to the dc-tool using 'target remote :2159' +6. Squash bugs + +Notes + +* You can use arp instead of setting the dreamcast's ip in Makefile.cfg +* Tested systems: Debian GNU/Linux 2.2-3.0, Cygwin +* There are almost certainly bugs +* Patches and improvements are welcome; please send to bard@allusion.net + +Credits +* rtl8139 code based on code by Dan Potter +* Lan Adapter driver is pulled from an early version of the KOS LA driver +* There are some various files from newlib-1.8.2 here +* video.s was written by Marcus Comstedt +* initial win32 porting and implementation of -t by Florian 'Proff' Schulze +* win32 bugfix by The Gypsy +* fixes for cygwin by Florian 'Proff' Schulze +* rx config bug pointed out by Slant +* horridly buggy nature of 1.0.1 + 1.0.2 pointed out by Dan Potter +* Fixes for libbfd segfaults by Atani + diff --git a/LAN/SRCS/dcload-ip/example-src/Makefile b/LAN/SRCS/dcload-ip/example-src/Makefile new file mode 100644 index 00000000..60820507 --- /dev/null +++ b/LAN/SRCS/dcload-ip/example-src/Makefile @@ -0,0 +1,45 @@ +include ../Makefile.cfg + +CC = $(TARGETCC) +INCLUDE = -I../target-inc +CFLAGS = $(TARGETCFLAGS) +OBJCOPY = $(TARGETOBJCOPY) + +OBJECTS = crt0.o dcload-syscall.o dcload-syscalls.o memcpy.o + +.c.o: + $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $< + +.S.o: + $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $< + +.s.o: + $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $< + +all: console-test.bin exception-test.bin gethostinfo.bin + +console-test.bin: console-test + $(OBJCOPY) -O binary $< $@ + +exception-test.bin: exception-test + $(OBJCOPY) -O binary $< $@ + +gethostinfo.bin: gethostinfo + $(OBJCOPY) -O binary $< $@ + +console-test: $(OBJECTS) console-test.o + $(CC) $(CFLAGS) -Wl,-Tdc.x -nostartfiles -nostdlib $^ -o $@ -L/usr/local/dc/sh-elf/lib/gcc-lib/sh-elf/3.0.4/ml/m4-single-only -lgcc + +gethostinfo: $(OBJECTS) gethostinfo.o + $(CC) $(CFLAGS) -Wl,-Tdc.x -nostartfiles -nostdlib $^ -o $@ -L/usr/local/dc/sh-elf/lib/gcc-lib/sh-elf/3.0.4/ml/m4-single-only -lgcc + +exception-test: $(OBJECTS) exception-test.o + $(CC) $(CFLAGS) -Wl,-Tdc.x -nostartfiles -nostdlib $^ -o $@ -L/usr/local/dc/sh-elf/lib/gcc-lib/sh-elf/3.0.4/ml/m4-single-only -lgcc + +.PHONY : clean +clean: + rm -f *.o console-test exception-test gethostinfo + +.PHONY : distclean +distclean: clean + rm -f *.bin diff --git a/LAN/SRCS/dcload-ip/example-src/README b/LAN/SRCS/dcload-ip/example-src/README new file mode 100644 index 00000000..b8011eab --- /dev/null +++ b/LAN/SRCS/dcload-ip/example-src/README @@ -0,0 +1,11 @@ +crt0.S a version of crt0.S +dc.x a linker script for the Dreamcast +dcload-syscall.S assembly to call a dcload syscall +dcload-syscall.h lowlevel dcload syscall header +dcload-syscalls.c dcload syscall c source +dcload-syscalls.h dcload syscall header + +To use this stuff in your own code, #include "dcload-syscalls.h" and link with dcload-syscalls.o and dcload-syscall.o. + +You're welcome to use any of the code in this directory in any way you please. +I'm not responsible if it causes you to fart fire, grow a third eye, etc, etc. diff --git a/LAN/SRCS/dcload-ip/example-src/asm.h b/LAN/SRCS/dcload-ip/example-src/asm.h new file mode 100644 index 00000000..ed27fdb1 --- /dev/null +++ b/LAN/SRCS/dcload-ip/example-src/asm.h @@ -0,0 +1,22 @@ +#ifdef __STDC__ +# define _C_LABEL(x) _ ## x +#else +# define _C_LABEL(x) _/**/x +#endif +#define _ASM_LABEL(x) x + +#define _ENTRY(name) \ + .text; .align 2; .globl name; name: + +#define ENTRY(name) \ + _ENTRY(_C_LABEL(name)) + +#if (defined (__sh2__) || defined (__sh3__) || defined (__SH3E__) \ + || defined (__SH4_SINGLE__) || defined (__SH4__)) || defined(__SH4_SINGLE_ONLY__) +#define DELAYED_BRANCHES +#define SL(branch, dest, in_slot, in_slot_arg2) \ + branch##.s dest; in_slot, in_slot_arg2 +#else +#define SL(branch, dest, in_slot, in_slot_arg2) \ + in_slot, in_slot_arg2; branch dest +#endif diff --git a/LAN/SRCS/dcload-ip/example-src/console-test.c b/LAN/SRCS/dcload-ip/example-src/console-test.c new file mode 100644 index 00000000..3a71e725 --- /dev/null +++ b/LAN/SRCS/dcload-ip/example-src/console-test.c @@ -0,0 +1,36 @@ +#include "dcload-syscalls.h" + +int main(void) +{ + int fd; + unsigned char buffer[2048]; + int count; + unsigned char wrkmem[65536]; + + assign_wrkmem(wrkmem); + + write(1, "dcload console test program\n\n", 30); + + fd = open("console-test.c", O_RDONLY); + + if (fd == -1) { + write(1, "open failed!\n", 14); + exit(1); + } + + write(1, "Contents of console-test.c:\n\n", 30); + + count = read(fd, buffer, 2048); + + if (count == -1) { + write(1, "read failed!\n", 14); + exit(1); + } + + write(1, buffer, count); + + close(fd); + + exit(0); +} + diff --git a/LAN/SRCS/dcload-ip/example-src/crt0.S b/LAN/SRCS/dcload-ip/example-src/crt0.S new file mode 100644 index 00000000..c4ff866d --- /dev/null +++ b/LAN/SRCS/dcload-ip/example-src/crt0.S @@ -0,0 +1,119 @@ + .section .text + .global start + .global ___exit + .global _atexit +start: + mov.l setup_cache_k,r0 + mov.l p2_mask,r1 + or r1,r0 + jmp @r0 + nop +setup_cache: + mov.l ccr_addr,r0 + mov.w ccr_data,r1 + mov.l r1,@r0 + mov.l start_2_k,r0 + nop + nop + nop + nop + nop + nop + nop + jmp @r0 + nop +start_2: + mov.l old_stack_k,r14 + mov.l r15,@r14 + mov.l old_pr_k,r14 + sts pr,r15 + mov.l r15,@r14 + mov.l stack_k,r15 + + ! zero out bss + mov.l edata_k,r0 + mov.l end_k,r1 + mov #0,r2 +start_l: + mov.l r2,@r0 + add #4,r0 + cmp/ge r0,r1 + bt start_l + +#if defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY) + mov.l set_fpscr_k, r1 + jsr @r1 + mov #0,r4 + lds r3,fpscr +#endif /* defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__) */ + + ! call the mainline + mov.l main_k,r0 + jsr @r0 + or r0,r0 + + ! call exit + mov r0,r4 + mov.l exit_k,r0 + jsr @r0 + or r0,r0 + +___exit: + mov.l old_pr_k,r14 + mov.l @r14,r15 + lds r15,pr + mov.l old_stack_k,r14 + mov.l @r14,r15 + rts + nop + +_atexit: + rts + nop + + .align 4 +#if defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__) +set_fpscr_k: + .long ___set_fpscr +#endif /* defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(SH4_SINGLE_ONLY) */ +stack_k: + .long _stack +edata_k: + .long _edata +end_k: + .long _end +main_k: + .long _main +exit_k: + .long _exit + +old_stack_k: + .long _old_stack +old_pr_k: + .long _old_pr + +_old_stack: + .long 0 +_old_pr: + .long 0 + +setup_cache_k: + .long setup_cache +start_2_k: + .long start_2 +p2_mask: + .long 0xa0000000 +ccr_addr: + .long 0xff00001c +ccr_data: + .word 0x090b + + .align 4 + +#ifdef __ELF__ + .section .stack,"aw" +#else + .section .stack +#endif +! _stack: .long 0xdeaddead + diff --git a/LAN/SRCS/dcload-ip/example-src/dc.x b/LAN/SRCS/dcload-ip/example-src/dc.x new file mode 100644 index 00000000..5ea23dcb --- /dev/null +++ b/LAN/SRCS/dcload-ip/example-src/dc.x @@ -0,0 +1,228 @@ +/* Sega Dreamcast linker script */ + +OUTPUT_FORMAT("elf32-shl", "elf32-shl", + "elf32-shl") +OUTPUT_ARCH(sh) +ENTRY(start) + SEARCH_DIR(/usr/local/dcdev/sh-elf/lib); +/* Do we need any of these for elf? + __DYNAMIC = 0; */ + +MEMORY +{ + ram (rwx) : ORIGIN = 0x8c010000, LENGTH = 0xfe0000 +} + +SECTIONS +{ + /* Read-only sections, merged into text segment: */ +/* . = 0x1000;*/ + .interp : { *(.interp) } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .gnu.version : { *(.gnu.version) } + .gnu.version_d : { *(.gnu.version_d) } + .gnu.version_r : { *(.gnu.version_r) } + .rel.init : { *(.rel.init) } + .rela.init : { *(.rela.init) } + .rel.text : + { + *(.rel.text) + *(.rel.text.*) + *(.rel.gnu.linkonce.t*) + } + .rela.text : + { + *(.rela.text) + *(.rela.text.*) + *(.rela.gnu.linkonce.t*) + } + .rel.fini : { *(.rel.fini) } + .rela.fini : { *(.rela.fini) } + .rel.rodata : + { + *(.rel.rodata) + *(.rel.rodata.*) + *(.rel.gnu.linkonce.r*) + } + .rela.rodata : + { + *(.rela.rodata) + *(.rela.rodata.*) + *(.rela.gnu.linkonce.r*) + } + .rel.data : + { + *(.rel.data) + *(.rel.data.*) + *(.rel.gnu.linkonce.d*) + } + .rela.data : + { + *(.rela.data) + *(.rela.data.*) + *(.rela.gnu.linkonce.d*) + } + .rel.ctors : { *(.rel.ctors) } + .rela.ctors : { *(.rela.ctors) } + .rel.dtors : { *(.rel.dtors) } + .rela.dtors : { *(.rela.dtors) } + .rel.got : { *(.rel.got) } + .rela.got : { *(.rela.got) } + .rel.sdata : + { + *(.rel.sdata) + *(.rel.sdata.*) + *(.rel.gnu.linkonce.s*) + } + .rela.sdata : + { + *(.rela.sdata) + *(.rela.sdata.*) + *(.rela.gnu.linkonce.s*) + } + .rel.sbss : { *(.rel.sbss) } + .rela.sbss : { *(.rela.sbss) } + .rel.bss : { *(.rel.bss) } + .rela.bss : { *(.rela.bss) } + .rel.plt : { *(.rel.plt) } + .rela.plt : { *(.rela.plt) } + .init : + { + KEEP (*(.init)) + } =0 + .plt : { *(.plt) } + .text : + { + *(.text) + *(.text.*) + *(.stub) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + *(.gnu.linkonce.t*) + } =0 + _etext = .; + PROVIDE (etext = .); + .fini : + { + KEEP (*(.fini)) + } =0 + .rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) } + .rodata1 : { *(.rodata1) } + /* Adjust the address for the data segment. We want to adjust up to + the same address within the page on the next page up. */ + . = ALIGN(128) + (. & (128 - 1)); + .data : + { + *(.data) + *(.data.*) + *(.gnu.linkonce.d*) + SORT(CONSTRUCTORS) + } + .data1 : { *(.data1) } + .eh_frame : { *(.eh_frame) } + .gcc_except_table : { *(.gcc_except_table) } + .ctors ALIGN(4): + { + ___ctors = .; + /* gcc uses crtbegin.o to find the start of + the constructors, so we make sure it is + first. Because this is a wildcard, it + doesn't matter if the user does not + actually link against crtbegin.o; the + linker won't look for a file to match a + wildcard. The wildcard also means that it + doesn't matter which directory crtbegin.o + is in. */ + KEEP (*crtbegin.o(.ctors)) + /* We don't want to include the .ctor section from + from the crtend.o file until after the sorted ctors. + The .ctor section from the crtend file contains the + end of ctors marker and it must be last */ + KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + ___ctors_end = .; + } + .dtors : + { + ___dtors = .; + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + ___dtors_end = .; + } + .got : { *(.got.plt) *(.got) } + .dynamic : { *(.dynamic) } + /* We want the small data sections together, so single-instruction offsets + can access them all, and initialized data all before uninitialized, so + we can shorten the on-disk segment size. */ + .sdata : + { + *(.sdata) + *(.sdata.*) + *(.gnu.linkonce.s.*) + } + _edata = .; + PROVIDE (edata = .); + __bss_start = .; + .sbss : + { + *(.dynsbss) + *(.sbss) + *(.sbss.*) + *(.scommon) + } + .bss : + { + *(.dynbss) + *(.bss) + *(.bss.*) + *(COMMON) + /* Align here to ensure that the .bss section occupies space up to + _end. Align after .bss to ensure correct alignment even if the + .bss section disappears because there are no input sections. */ + . = ALIGN(32 / 8); + } + . = ALIGN(32 / 8); + _end = .; + PROVIDE (end = .); + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +/* .stack 0x8c00f400 : { _stack = .; *(.stack) }*/ + /* These must appear regardless of . */ +_stack = 0x8d000000; +} diff --git a/LAN/SRCS/dcload-ip/example-src/dcload-syscall.h b/LAN/SRCS/dcload-ip/example-src/dcload-syscall.h new file mode 100644 index 00000000..27f0a0b4 --- /dev/null +++ b/LAN/SRCS/dcload-ip/example-src/dcload-syscall.h @@ -0,0 +1,30 @@ +#ifndef __DCLOAD_SYSCALL_H__ +#define __DCLOAD_SYSCALL_H__ + +int dcloadsyscall(unsigned int syscall, ...); + +#define pcreadnr 0 +#define pcwritenr 1 +#define pcopennr 2 +#define pcclosenr 3 +#define pccreatnr 4 +#define pclinknr 5 +#define pcunlinknr 6 +#define pcchdirnr 7 +#define pcchmodnr 8 +#define pclseeknr 9 +#define pcfstatnr 10 +#define pctimenr 11 +#define pcstatnr 12 +#define pcutimenr 13 +#define pcassignwrkmem 14 +#define pcexitnr 15 +#define pcopendir 16 +#define pcclosedir 17 +#define pcreaddir 18 +#define pcgethostinfo 19 + +#define DCLOADMAGICVALUE 0xdeadbeef +#define DCLOADMAGICADDR (unsigned int *)0x8c004004 + +#endif diff --git a/LAN/SRCS/dcload-ip/example-src/dcload-syscall.s b/LAN/SRCS/dcload-ip/example-src/dcload-syscall.s new file mode 100644 index 00000000..6a1b7960 --- /dev/null +++ b/LAN/SRCS/dcload-ip/example-src/dcload-syscall.s @@ -0,0 +1,10 @@ + .section .text + .global _dcloadsyscall +_dcloadsyscall: + mov.l dcloadsyscall_k,r0 + mov.l @r0,r0 + jmp @r0 + nop +.align 4 +dcloadsyscall_k: + .long 0x8c004008 diff --git a/LAN/SRCS/dcload-ip/example-src/dcload-syscalls.c b/LAN/SRCS/dcload-ip/example-src/dcload-syscalls.c new file mode 100644 index 00000000..30db9f33 --- /dev/null +++ b/LAN/SRCS/dcload-ip/example-src/dcload-syscalls.c @@ -0,0 +1,134 @@ +#include "dcload-syscall.h" + +int link (const char *oldpath, const char *newpath) +{ + if (*DCLOADMAGICADDR == DCLOADMAGICVALUE) + return dcloadsyscall(pclinknr, oldpath, newpath); + else + return -1; +} + +int read (int file, char *ptr, int len) +{ + if (*DCLOADMAGICADDR == DCLOADMAGICVALUE) + return dcloadsyscall(pcreadnr, file, ptr, len); + else + return -1; +} + +int lseek (int file, int ptr, int dir) +{ + if (*DCLOADMAGICADDR == DCLOADMAGICVALUE) + return dcloadsyscall(pclseeknr, file, ptr, dir); + else + return -1; +} + +int write ( int file, char *ptr, int len) +{ + if (*DCLOADMAGICADDR == DCLOADMAGICVALUE) + return dcloadsyscall(pcwritenr, file, ptr, len); + else + return -1; +} + +int close (int file) +{ + if (*DCLOADMAGICADDR == DCLOADMAGICVALUE) + return dcloadsyscall(pcclosenr, file); + else + return -1; +} + +int fstat (int file, struct stat *st) +{ + if (*DCLOADMAGICADDR == DCLOADMAGICVALUE) + return dcloadsyscall(pcfstatnr, file, st); + else + return -1; +} + +int open (const char *path, int flags) +{ + if (*DCLOADMAGICADDR == DCLOADMAGICVALUE) + return dcloadsyscall(pcopennr, path, flags); + else + return -1; +} + +int creat (const char *path, int mode) +{ + if (*DCLOADMAGICADDR == DCLOADMAGICVALUE) + return dcloadsyscall(pccreatnr, path, mode); + else + return -1; +} + +int unlink (const char *path) +{ + if (*DCLOADMAGICADDR == DCLOADMAGICVALUE) + return dcloadsyscall(pcunlinknr, path); + else + return -1; +} + +void exit (int status) +{ + if (*DCLOADMAGICADDR == DCLOADMAGICVALUE) + dcloadsyscall(pcexitnr); + __exit(status); +} + +int stat (const char *path, struct stat *st) +{ + if (*DCLOADMAGICADDR == DCLOADMAGICVALUE) + return dcloadsyscall(pcstatnr, path, st); + else + return -1; +} + +int chmod (const char *path, short mode) +{ + if (*DCLOADMAGICADDR == DCLOADMAGICVALUE) + return dcloadsyscall(pcchmodnr, path, mode); + else + return -1; +} + +int utime (const char *path, char *times) +{ + if (*DCLOADMAGICADDR == DCLOADMAGICVALUE) + return dcloadsyscall(pcutimenr, path, times); + else + return -1; +} + +int chdir (const char *path) +{ + if (*DCLOADMAGICADDR == DCLOADMAGICVALUE) + return dcloadsyscall(pcchdirnr, path); + else + return -1; +} + +long time(long *t) +{ + if (*DCLOADMAGICADDR == DCLOADMAGICVALUE) + return dcloadsyscall(pctimenr, t); + else + return -1; +} + +void assign_wrkmem(unsigned char *wrkmem) +{ + if (*DCLOADMAGICADDR == DCLOADMAGICVALUE) + dcloadsyscall(pcassignwrkmem, wrkmem); +} + +int gethostinfo(unsigned int *ip, unsigned int *port) +{ + if (*DCLOADMAGICADDR == DCLOADMAGICVALUE) + return dcloadsyscall(pcgethostinfo, ip, port); + else + return -1; +} diff --git a/LAN/SRCS/dcload-ip/example-src/dcload-syscalls.h b/LAN/SRCS/dcload-ip/example-src/dcload-syscalls.h new file mode 100644 index 00000000..6284c633 --- /dev/null +++ b/LAN/SRCS/dcload-ip/example-src/dcload-syscalls.h @@ -0,0 +1,26 @@ +#ifndef __DCLOAD_SYSCALLS_H__ +#define __DCLOAD_SYSCALLS_H__ + +#define O_RDONLY 0 +#define O_WRONLY 1 +#define O_RDWR 2 + +int link (const char *oldpath, const char *newpath); +int read (int file, char *ptr, int len); +int lseek (int file, int ptr, int dir); +int write ( int file, char *ptr, int len); +int close (int file); +int fstat (int file, struct stat *st); +int open (const char *path, int flags); +int creat (const char *path, int mode); +int unlink (const char *path); +void exit (int status); +int stat (const char *path, struct stat *st); +int chmod (const char *path, short mode); +int utime (const char *path, char *times); +int chdir (const char *path); +long time(long *t); +void assign_wrkmem(unsigned char *wrkmem); +int gethostinfo(unsigned int *ip, unsigned int *port); + +#endif diff --git a/LAN/SRCS/dcload-ip/example-src/exception-test.c b/LAN/SRCS/dcload-ip/example-src/exception-test.c new file mode 100644 index 00000000..c0c20367 --- /dev/null +++ b/LAN/SRCS/dcload-ip/example-src/exception-test.c @@ -0,0 +1,9 @@ +int main(void) +{ + int i; + + i = *((volatile unsigned int *)2); +} + + + diff --git a/LAN/SRCS/dcload-ip/example-src/gethostinfo.c b/LAN/SRCS/dcload-ip/example-src/gethostinfo.c new file mode 100644 index 00000000..fd98f20c --- /dev/null +++ b/LAN/SRCS/dcload-ip/example-src/gethostinfo.c @@ -0,0 +1,46 @@ +#include "dcload-syscalls.h" + +void uint_to_string(unsigned int foo, unsigned char *bar) +{ + char hexdigit[16] = "0123456789abcdef"; + int i; + + for(i=7; i>=0; i--) { + bar[i] = hexdigit[(foo & 0x0f)]; + foo = foo >> 4; + } + bar[8] = 0; +} + +int main(void) +{ + unsigned int tool_ip; + unsigned int tool_port; + unsigned int our_ip; + unsigned char tmp[9]; + + write(1, "dcload gethostinfo test program\n\n", 33); + + our_ip = gethostinfo(&tool_ip, &tool_port); + + uint_to_string(our_ip, tmp); + + write(1, "our ip = 0x", 11); + write(1, tmp, 9); + write(1, "\n", 1); + + uint_to_string(tool_ip, tmp); + + write(1, "tool ip = 0x", 12); + write(1, tmp, 9); + write(1, "\n", 1); + + uint_to_string(tool_port, tmp); + + write(1, "tool port = 0x", 14); + write(1, tmp, 9); + write(1, "\n", 1); + + exit(0); +} + diff --git a/LAN/SRCS/dcload-ip/example-src/memcpy.S b/LAN/SRCS/dcload-ip/example-src/memcpy.S new file mode 100644 index 00000000..4df72e37 --- /dev/null +++ b/LAN/SRCS/dcload-ip/example-src/memcpy.S @@ -0,0 +1,221 @@ +! +! Fast SH memcpy +! +! by Toshiyasu Morita (tm@netcom.com) +! hacked by J"orn Rernnecke (amylaar@cygnus.co.uk) ("o for o-umlaut) +! +! Entry: r4: destination pointer +! r5: source pointer +! r6: byte count +! +! Exit: r0: destination pointer +! r1-r7: trashed +! +! Notes: Usually one wants to do small reads and write a longword, but +! unfortunately it is difficult in some cases to concatanate bytes +! into a longword on the SH, so this does a longword read and small +! writes. +! +! This implementation makes two assumptions about how it is called: +! +! 1.: If the byte count is nonzero, the address of the last byte to be +! copied is unsigned greater than the address of the first byte to +! be copied. This could be easily swapped for a signed comparison, +! but the algorithm used needs some comparison. +! +! 2.: When there are two or three bytes in the last word of an 11-or-bore +! bytes memory chunk to b copied, the rest of the word can be read +! without size effects. +! This could be easily changed by increasing the minumum size of +! a fast memcpy and the amount subtracted from r7 before L_2l_loop be 2, +! however, this would cost a few extra cyles on average. +! + +#include "asm.h" + +ENTRY(memcpy) +#ifdef __LITTLE_ENDIAN__ + ! Little endian version copies with increasing addresses. + mov r4,r3 ! Save return value + mov #11,r0 ! Check if small number of bytes + cmp/hs r0,r6 + ! r6 becomes src end address + SL(bf, L_small, add r5,r6) + mov #1,r1 + tst r1,r5 ! check if source even + SL(bt, L_even, mov r6,r7) + mov.b @r5+,r0 ! no, make it even. + mov.b r0,@r4 + add #1,r4 +L_even: tst r1,r4 ! check if destination is even + add #-3,r7 + SL(bf, L_odddst, mov #2,r1) + tst r1,r4 ! check if destination is 4-byte aligned + mov r4,r0 + SL(bt, L_al4dst, sub r5,r0) + mov.w @r5+,r2 + mov.w r2,@r4 + ! add #2,r4 r4 is dead here. +L_al4dst: + tst r1,r5 + bt L_al4both + mov.w @r5+,r1 + swap.w r1,r1 + add #-6,r0 + add #-6,r7 ! r7 := src end address minus 9. + .align 2 +L_2l_loop: + mov.l @r5+,r2 ! Read & write two longwords per iteration + xtrct r2,r1 + mov.l r1,@(r0,r5) + cmp/hs r7,r5 + mov.l @r5+,r1 + xtrct r1,r2 + mov.l r2,@(r0,r5) + bf L_2l_loop + add #-2,r5 + bra L_cleanup + add #5,r0 +L_al4both: + add #-4,r0 + .align 2 +L_al4both_loop: + mov.l @r5+,r4 ! Read longword, write longword per iteration + cmp/hs r7,r5 + SL(bf, L_al4both_loop, mov.l r4,@(r0,r5)) + + bra L_cleanup + add #3,r0 + +L_odddst: + tst r1,r5 + SL(bt, L_al4src, add #-1,r4) + mov.w @r5+,r0 + mov.b r0,@(1,r4) + shlr8 r0 + mov.b r0,@(2,r4) + add #2,r4 +L_al4src: + .align 2 +L_odd_loop: + mov.l @r5+,r0 ! Read longword, write byte, word, byte per iteration + cmp/hs r7,r5 + mov.b r0,@(1,r4) + shlr8 r0 + mov.w r0,@(2,r4) + shlr16 r0 + mov.b r0,@(4,r4) + SL(bf, L_odd_loop, add #4,r4) + .align 2 ! avoid nop in more frequently executed code. +L_cleanup2: + mov r4,r0 + sub r5,r0 +L_cleanup: + cmp/eq r6,r5 + bt L_ready + .align 2 +L_cleanup_loop: + mov.b @r5+,r1 + cmp/eq r6,r5 + mov.b r1,@(r0,r5) + bf L_cleanup_loop +L_ready: + rts + mov r3,r0 +L_small: + bra L_cleanup2 + add #-1,r4 +#else + ! Big endian version copies with decreasing addresses. + mov r4,r0 + add r6,r0 + sub r4,r5 + mov #11,r1 + cmp/hs r1,r6 + SL(bf, L_small, add #-1,r5) + mov r5,r3 + add r0,r3 + shlr r3 + SL(bt, L_even, + mov r4,r7) + mov.b @(r0,r5),r2 + add #-1,r3 + mov.b r2,@-r0 +L_even: + tst #1,r0 + add #-1,r5 + SL(bf, L_odddst, add #8,r7) + tst #2,r0 + bt L_al4dst + add #-1,r3 + mov.w @(r0,r5),r1 + mov.w r1,@-r0 +L_al4dst: + shlr r3 + bt L_al4both + mov.w @(r0,r5),r1 + swap.w r1,r1 + add #4,r7 + add #-4,r5 + .align 2 +L_2l_loop: + mov.l @(r0,r5),r2 + xtrct r2,r1 + mov.l r1,@-r0 + cmp/hs r7,r0 + mov.l @(r0,r5),r1 + xtrct r1,r2 + mov.l r2,@-r0 + bt L_2l_loop + bra L_cleanup + add #5,r5 + + nop ! avoid nop in executed code. +L_al4both: + add #-2,r5 + .align 2 +L_al4both_loop: + mov.l @(r0,r5),r1 + cmp/hs r7,r0 + SL(bt, L_al4both_loop, + mov.l r1,@-r0) + bra L_cleanup + add #3,r5 + + nop ! avoid nop in executed code. +L_odddst: + shlr r3 + bt L_al4src + mov.w @(r0,r5),r1 + mov.b r1,@-r0 + shlr8 r1 + mov.b r1,@-r0 +L_al4src: + add #-2,r5 + .align 2 +L_odd_loop: + mov.l @(r0,r5),r2 + cmp/hs r7,r0 + mov.b r2,@-r0 + shlr8 r2 + mov.w r2,@-r0 + shlr16 r2 + mov.b r2,@-r0 + bt L_odd_loop + + add #3,r5 +L_cleanup: +L_small: + cmp/eq r4,r0 + bt L_ready + add #1,r4 + .align 2 +L_cleanup_loop: + mov.b @(r0,r5),r2 + cmp/eq r4,r0 + mov.b r2,@-r0 + bf L_cleanup_loop +L_ready: + rts + nop +#endif diff --git a/LAN/SRCS/dcload-ip/host-src/Makefile b/LAN/SRCS/dcload-ip/host-src/Makefile new file mode 100644 index 00000000..0bf2e1e2 --- /dev/null +++ b/LAN/SRCS/dcload-ip/host-src/Makefile @@ -0,0 +1,22 @@ +SUBDIRS = tool +MAKE = make + +.PHONY : subdirs $(SUBDIRS) + +subdirs: $(SUBDIRS) + +$(SUBDIRS): + $(MAKE) -C $@ + +.PHONY : clean +clean: + for dir in $(SUBDIRS); do \ + $(MAKE) -C $$dir clean; \ + done + +.PHONY : distclean +distclean: + for dir in $(SUBDIRS) ; do \ + $(MAKE) -C $$dir distclean; \ + done + diff --git a/LAN/SRCS/dcload-ip/host-src/tool/Makefile b/LAN/SRCS/dcload-ip/host-src/tool/Makefile new file mode 100644 index 00000000..e3c4fd0b --- /dev/null +++ b/LAN/SRCS/dcload-ip/host-src/tool/Makefile @@ -0,0 +1,29 @@ +include ../../Makefile.cfg + +CC = $(HOSTCC) +CFLAGS = $(HOSTCFLAGS) -DDREAMCAST_IP=\"$(DREAMCAST_IP)\" -DHAVE_GETOPT +INCLUDE = -I$(BFDINCLUDE) + +DCTOOL = dc-tool$(EXECUTABLEEXTENSION) + +OBJECTS = dc-tool.o syscalls.o + +.c.o: + $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $< + +all: $(DCTOOL) + +$(DCTOOL): $(OBJECTS) + $(CC) -o $@ $(OBJECTS) $(BFDLIB) + +.PHONY : install +install: $(DCTOOL) + cp $(DCTOOL) $(TOOLINSTALLDIR) + +.PHONY : clean +clean: + rm -f $(OBJECTS) + +.PHONY : distclean +distclean: clean + rm -f $(DCTOOL) diff --git a/LAN/SRCS/dcload-ip/host-src/tool/commands.h b/LAN/SRCS/dcload-ip/host-src/tool/commands.h new file mode 100644 index 00000000..3bf86d75 --- /dev/null +++ b/LAN/SRCS/dcload-ip/host-src/tool/commands.h @@ -0,0 +1,25 @@ +#ifndef __COMMANDS_H__ +#define __COMMANDS_H__ + +typedef struct { + unsigned char id[4] __attribute__ ((packed)); + unsigned int address __attribute__ ((packed)); + unsigned int size __attribute__ ((packed)); + unsigned char data[1] __attribute__ ((packed)); +} command_t; + +#define CMD_EXECUTE "EXEC" /* execute */ +#define CMD_LOADBIN "LBIN" /* begin receiving binary */ +#define CMD_PARTBIN "PBIN" /* part of a binary */ +#define CMD_DONEBIN "DBIN" /* end receiving binary */ +#define CMD_SENDBIN "SBIN" /* send a binary */ +#define CMD_SENDBINQ "SBIQ" /* send a binary, quiet */ +#define CMD_VERSION "VERS" /* send version info */ + +#define CMD_RETVAL "RETV" /* return value */ + +#define CMD_REBOOT "RBOT" /* reboot */ + +#define COMMAND_LEN 12 + +#endif diff --git a/LAN/SRCS/dcload-ip/host-src/tool/dc-io.h b/LAN/SRCS/dcload-ip/host-src/tool/dc-io.h new file mode 100644 index 00000000..c9ef0a1d --- /dev/null +++ b/LAN/SRCS/dcload-ip/host-src/tool/dc-io.h @@ -0,0 +1,11 @@ +#ifndef __DC_IO_H__ +#define __DC_IO_H__ + +void recv_data(void *data, unsigned int dcaddr, unsigned int total, unsigned int quiet); +void send_data(unsigned char *addr, unsigned int dcaddr, unsigned int size); + +int recv_response(unsigned char *buffer, int timeout); +void send_command(unsigned char *command, unsigned int addr, unsigned int size, unsigned char *data, unsigned int dsize); +#endif + + diff --git a/LAN/SRCS/dcload-ip/host-src/tool/dc-tool.c b/LAN/SRCS/dcload-ip/host-src/tool/dc-tool.c new file mode 100644 index 00000000..f9c3ecd2 --- /dev/null +++ b/LAN/SRCS/dcload-ip/host-src/tool/dc-tool.c @@ -0,0 +1,787 @@ +/* + * dc-tool, a tool for use with the dcload ethernet loader + * + * Copyright (C) 2001 Andrew Kieschnick + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +#include +#include +#include +#include +#include +#include +#ifdef _WIN32 +#include +#include +#include +#include +#include +#else +#include +#include +#include +#endif +#include +#include +#include +#include + +#include "syscalls.h" +#include "dc-io.h" +#include "commands.h" + +int _nl_msg_cat_cntr; +int gdb_server_socket = -1; + +#define VERSION DCLOAD_VERSION + +#ifndef O_BINARY +#define O_BINARY 0 +#endif + +#ifndef HAVE_GETOPT +/* The following code for getopt is from the libc-source of FreeBSD, + * it might be changed a little bit. + * Florian Schulze (florian.proff.schulze@gmx.net) + */ + +/* + * Copyright (c) 1987, 1993, 1994 + * The Regents of the University of California. 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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 defined(LIBC_SCCS) && !defined(lint) +#if 0 +static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95"; +#endif +static const char rcsid[] = "$FreeBSD$"; +#endif /* LIBC_SCCS and not lint */ + +int opterr = 1, /* if error message should be printed */ + optind = 1, /* index into parent argv vector */ + optopt, /* character checked for validity */ + optreset; /* reset getopt */ +char *optarg; /* argument associated with option */ + +#define BADCH (int)'?' +#define BADARG (int)':' +#define EMSG "" + +char *__progname="prboom_server"; + +/* + * getopt -- + * Parse argc/argv argument vector. + */ +int +getopt(nargc, nargv, ostr) + int nargc; + char * const *nargv; + const char *ostr; +{ + extern char *__progname; + static char *place = EMSG; /* option letter processing */ + char *oli; /* option letter list index */ + int ret; + + if (optreset || !*place) { /* update scanning pointer */ + optreset = 0; + if (optind >= nargc || *(place = nargv[optind]) != '-') { + place = EMSG; + return (-1); + } + if (place[1] && *++place == '-') { /* found "--" */ + ++optind; + place = EMSG; + return (-1); + } + } /* option letter okay? */ + if ((optopt = (int)*place++) == (int)':' || + !(oli = strchr(ostr, optopt))) { + /* + * if the user didn't specify '-' as an option, + * assume it means -1. + */ + if (optopt == (int)'-') + return (-1); + if (!*place) + ++optind; + if (opterr && *ostr != ':') + (void)fprintf(stderr, + "%s: illegal option -- %c\n", __progname, optopt); + return (BADCH); + } + if (*++oli != ':') { /* don't need argument */ + optarg = NULL; + if (!*place) + ++optind; + } + else { /* need an argument */ + if (*place) /* no white space */ + optarg = place; + else if (nargc <= ++optind) { /* no arg */ + place = EMSG; + if (*ostr == ':') + ret = BADARG; + else + ret = BADCH; + if (opterr) + (void)fprintf(stderr, + "%s: option requires an argument -- %c\n", + __progname, optopt); + return (ret); + } + else /* white space */ + optarg = nargv[optind]; + place = EMSG; + ++optind; + } + return (optopt); /* dump back option letter */ +} +#else +#include +#endif + +extern char *optarg; + +unsigned int time_in_usec() +{ + struct timeval thetime; + + gettimeofday(&thetime, NULL); + + return (unsigned int)(thetime.tv_sec * 1000000) + (unsigned int)thetime.tv_usec; +} + +int dcsocket; + +/* 250000 = 0.25 seconds */ +#define PACKET_TIMEOUT 250000 + +/* receive total bytes from dc and store in data */ +void recv_data(void *data, unsigned int dcaddr, unsigned int total, unsigned int quiet) +{ + unsigned char buffer[2048]; + unsigned char *i; + int c; + unsigned char *map = (unsigned char *)malloc((total+1023)/1024); + int packets = 0; + unsigned int start; + int retval; + + memset(map, 0, (total+1023)/1024); + + if (!quiet) + send_command(CMD_SENDBIN, dcaddr, total, NULL, 0); + else + send_command(CMD_SENDBINQ, dcaddr, total, NULL, 0); + + start = time_in_usec(); + + while (((time_in_usec() - start) < PACKET_TIMEOUT)&&(packets < ((total+1023)/1024 + 1))) { + memset(buffer, 0, 2048); + while(((retval = read(dcsocket, buffer, 2048)) == -1)&&((time_in_usec() - start) < PACKET_TIMEOUT)); + if (retval > 0) { + start = time_in_usec(); + if (memcmp(((command_t *)buffer)->id, CMD_DONEBIN, 4)) { + if ( ((ntohl(((command_t *)buffer)->address) - dcaddr)/1024) >= ((total + 1024)/1024) ) { + printf("Obviously bad packet, avoiding segfault\n"); fflush(stdout); + } else { + map[ (ntohl(((command_t *)buffer)->address) - dcaddr)/1024 ] = 1; + i = data + (ntohl(((command_t *)buffer)->address) - dcaddr); + memcpy(i, buffer + 12, ntohl(((command_t *)buffer)->size)); + } + } + packets++; + } + } + + for(c = 0; c < (total+1023)/1024; c++) + if (!map[c]) { + if ( (total - c*1024) >= 1024) + send_command(CMD_SENDBINQ, dcaddr + c*1024, 1024, NULL, 0); + else + send_command(CMD_SENDBINQ, dcaddr + c*1024, total - c*1024, NULL, 0); + start = time_in_usec(); + while(((retval = read(dcsocket, buffer, 2048)) == -1)&&((time_in_usec() - start) < PACKET_TIMEOUT)); + if (retval > 0) { + start = time_in_usec(); + if (memcmp(((command_t *)buffer)->id, CMD_DONEBIN, 4)) { + map[ (ntohl(((command_t *)buffer)->address) - dcaddr)/1024 ] = 1; + /* printf("recv_data: got chunk for %p, %d bytes\n", + (void *)ntohl(((command_t *)buffer)->address), ntohl(((command_t *)buffer)->size)); */ + i = data + (ntohl(((command_t *)buffer)->address) - dcaddr); + memcpy(i, buffer + 12, ntohl(((command_t *)buffer)->size)); + } + + // Get the DONEBIN + while(((retval = read(dcsocket, buffer, 2048)) == -1)&&((time_in_usec() - start) < PACKET_TIMEOUT)); + } + + // Force us to go back and recheck + // XXX This should be improved after recv_data can return errors. + c = -1; + } +} + +/* send size bytes to dc from addr to dcaddr*/ +void send_data(unsigned char * addr, unsigned int dcaddr, unsigned int size) +{ + unsigned char buffer[2048]; + unsigned char * i; + unsigned int a = dcaddr; + unsigned int start; + int count = 0; + + if (!size) + return; + + do + send_command(CMD_LOADBIN, dcaddr, size, NULL, 0); + while(recv_response(buffer, PACKET_TIMEOUT) == -1); + + while(memcmp(((command_t *)buffer)->id, CMD_LOADBIN, 4)) { + printf("send_data: error in response to CMD_LOADBIN, retrying... %c%c%c%c\n",buffer[0],buffer[1],buffer[2],buffer[3]); + do + send_command(CMD_LOADBIN, dcaddr, size, NULL, 0); + while (recv_response(buffer, PACKET_TIMEOUT) == -1); + } + + for(i = addr; i < addr + size; i += 1024) { + if (((addr + size) - i) >= 1024) + send_command(CMD_PARTBIN, dcaddr, 1024, i, 1024); + else + send_command(CMD_PARTBIN, dcaddr, (addr + size) - i, i, (addr + size) - i); + dcaddr += 1024; + + /* give the DC a chance to empty its rx fifo + * this increases transfer rate on 100mbit by about 3.4x + */ + count++; + if (count == 15) { + start = time_in_usec(); + while ((time_in_usec() - start) < PACKET_TIMEOUT/51); + count = 0; + } + } + + start = time_in_usec(); + /* delay a bit to try to make sure all data goes out before CMD_DONEBIN */ + while ((time_in_usec() - start) < PACKET_TIMEOUT/10); + + do + send_command(CMD_DONEBIN, 0, 0, NULL, 0); + while (recv_response(buffer, PACKET_TIMEOUT) == -1); + + while(memcmp(((command_t *)buffer)->id, CMD_DONEBIN, 4)) { + printf("send_data: error in response to CMD_DONEBIN, retrying...\n"); + do + send_command(CMD_LOADBIN, dcaddr, size, NULL, 0); + while (recv_response(buffer, PACKET_TIMEOUT) == -1); + } + + while ( ntohl(((command_t *)buffer)->size) != 0) { +/* printf("%d bytes at 0x%x were missing, resending\n", ntohl(((command_t *)buffer)->size),ntohl(((command_t *)buffer)->address)); */ + send_command(CMD_PARTBIN, ntohl(((command_t *)buffer)->address), ntohl(((command_t *)buffer)->size), addr + (ntohl(((command_t *)buffer)->address) - a), ntohl(((command_t *)buffer)->size)); + + do + send_command(CMD_DONEBIN, 0, 0, NULL, 0); + while (recv_response(buffer, PACKET_TIMEOUT) == -1); + + while(memcmp(((command_t *)buffer)->id, CMD_DONEBIN, 4)) { + printf("send_data: error in response to CMD_DONEBIN, retrying...\n"); + do + send_command(CMD_LOADBIN, dcaddr, size, NULL, 0); + while (recv_response(buffer, PACKET_TIMEOUT) == -1); + } + } +} + +void usage(void) +{ + printf("\ndc-tool %s by \n\n",VERSION); + printf("-x Upload and execute \n"); + printf("-u Upload \n"); + printf("-d Download to \n"); + printf("-a
Set address to
(default: 0x8c010000)\n"); + printf("-s Set size to \n"); + printf("-t Communicate with (default is: %s)\n",DREAMCAST_IP); + printf("-n Do not attach console and fileserver\n"); + printf("-q Do not clear screen before download\n"); + printf("-c Chroot to (must be super-user)\n"); + printf("-i Enable cdfs redirection using iso image \n"); + printf("-r Reset (only works when dcload is in control)\n"); + printf("-g Start a GDB server\n"); + printf("-h Usage information (you\'re looking at it)\n\n"); + exit(0); +} + +int open_socket(unsigned char *hostname) +{ + struct sockaddr_in sin; + struct hostent * host; + + dcsocket = socket(AF_INET, SOCK_DGRAM, 0); + + if (dcsocket < 0) { + perror("socket"); + return -1; + } + + bzero(&sin, sizeof(sin)); + sin.sin_family = AF_INET; + sin.sin_port = htons(31313); + + host = gethostbyname(hostname); + + if (!host) { + perror("gethostbyname"); + return -1; + } + + memcpy((char *)&sin.sin_addr, host->h_addr, host->h_length); + + if (connect(dcsocket, (struct sockaddr *)&sin, sizeof(sin)) < 0) { + perror("connect"); + return -1; + } + + fcntl(dcsocket, F_SETFL, O_NONBLOCK); +} + +int recv_response(unsigned char *buffer, int timeout) +{ + int start = time_in_usec(); + int rv = -1; + + while( ((time_in_usec() - start) < timeout) && (rv == -1)) + rv = read(dcsocket, buffer, 2048); + + return rv; +} + +void send_command(unsigned char *command, unsigned int addr, unsigned int size, unsigned char *data, unsigned int dsize) +{ + unsigned char c_buff[2048]; + unsigned int tmp; + + memcpy(c_buff, command, 4); + tmp = htonl(addr); + memcpy(c_buff + 4, &tmp, 4); + tmp = htonl(size); + memcpy(c_buff + 8, &tmp, 4); + if (data != 0) + memcpy(c_buff + 12, data, dsize); + + write(dcsocket, c_buff, 12 + dsize); +} + +unsigned int upload(unsigned char *filename, unsigned int address) +{ + int inputfd; + int size; + unsigned char *inbuf; + struct timeval starttime, endtime; + + unsigned char c; + double stime, etime; + bfd *somebfd; + + somebfd = bfd_openr(filename, 0); + + if (somebfd) { /* try bfd first */ + if (bfd_check_format(somebfd, bfd_object)) { + asection *section; + + printf("File format is %s, ", somebfd->xvec->name); + address = somebfd->start_address; + size = 0; + printf("start address is 0x%x\n", address); + + gettimeofday(&starttime, 0); + + for (section = somebfd->sections; section != NULL; section = section->next) + if ((section->flags & SEC_HAS_CONTENTS) && (section->flags & SEC_LOAD)) { + printf("Section %s, ",section->name); + printf("lma 0x%x, ",section->lma); + printf("size %d\n",section->_raw_size); + if (section->_raw_size) { + size += section->_raw_size; + inbuf = malloc(section->_raw_size); + bfd_get_section_contents(somebfd, section, inbuf, 0, section->_raw_size); + + send_data(inbuf, section->lma, section->_raw_size); + + free(inbuf); + } + } + bfd_close(somebfd); + } else { + +/* if that fails, send raw bin */ + + printf("File format is raw binary, start address is 0x%x\n", address); + inputfd = open(filename, O_RDONLY | O_BINARY); + + if (inputfd < 0) { + perror(filename); + exit(-1); + } + + size = lseek(inputfd, 0, SEEK_END); + lseek(inputfd, 0, SEEK_SET); + + inbuf = malloc(size); + + read(inputfd, inbuf, size); + + close(inputfd); + + gettimeofday(&starttime, 0); + + send_data(inbuf, address, size); + + } + + gettimeofday(&endtime, 0); + + stime = starttime.tv_sec + starttime.tv_usec / 1000000.0; + etime = endtime.tv_sec + endtime.tv_usec / 1000000.0; + + printf("transferred at %f bytes / sec\n", (double) size / (etime - stime)); + fflush(stdout); + + } + return address; +} + +void download(unsigned char *filename, unsigned int address, + unsigned int size, unsigned int quiet) +{ + int outputfd; + + unsigned char c; + unsigned int wrkmem = 0x8cff0000; + unsigned char *data; + struct timeval starttime, endtime; + double stime, etime; + + outputfd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644); + + if (outputfd < 0) { + perror(filename); + exit(-1); + } + + data = malloc(size); + + gettimeofday(&starttime, 0); + + recv_data(data, address, size, 0); + + gettimeofday(&endtime, 0); + + printf("Received %d bytes\n", size); + + stime = starttime.tv_sec + starttime.tv_usec / 1000000.0; + etime = endtime.tv_sec + endtime.tv_usec / 1000000.0; + + printf("transferred at %f bytes / sec\n", (double) size / (etime - stime)); + fflush(stdout); + + write(outputfd, data, size); + + close(outputfd); + +} + +void execute(unsigned int address, unsigned int console, unsigned int cdfsredir) +{ + unsigned char buffer[2048]; + + printf("Sending execute command (0x%x, console=%d, cdfsredir=%d)...",address,console,cdfsredir); + + do + send_command(CMD_EXECUTE, address, (cdfsredir << 1) | console, NULL, 0); + while (recv_response(buffer, PACKET_TIMEOUT) == -1); + + printf("executing\n"); +} + +void do_console(unsigned char *path, unsigned char *isofile) +{ + unsigned char command; + int isofd; + unsigned char buffer[2048]; + + if (isofile) { + isofd = open(isofile, O_RDONLY | O_BINARY); + if (isofd < 0) + perror(isofile); + } + + if (path) + if (chroot(path)) + perror(path); + + while (1) { + fflush(stdout); + + while(recv_response(buffer, PACKET_TIMEOUT) == -1); + + if (!(memcmp(buffer, CMD_EXIT, 4))) + exit(0); + if (!(memcmp(buffer, CMD_FSTAT, 4))) + dc_fstat(buffer); + if (!(memcmp(buffer, CMD_WRITE, 4))) + dc_write(buffer); + if (!(memcmp(buffer, CMD_READ, 4))) + dc_read(buffer); + if (!(memcmp(buffer, CMD_OPEN, 4))) + dc_open(buffer); + if (!(memcmp(buffer, CMD_CLOSE, 4))) + dc_close(buffer); + if (!(memcmp(buffer, CMD_CREAT, 4))) + dc_creat(buffer); + if (!(memcmp(buffer, CMD_LINK, 4))) + dc_link(buffer); + if (!(memcmp(buffer, CMD_UNLINK, 4))) + dc_unlink(buffer); + if (!(memcmp(buffer, CMD_CHDIR, 4))) + dc_chdir(buffer); + if (!(memcmp(buffer, CMD_CHMOD, 4))) + dc_chmod(buffer); + if (!(memcmp(buffer, CMD_LSEEK, 4))) + dc_lseek(buffer); + if (!(memcmp(buffer, CMD_TIME, 4))) + dc_time(buffer); + if (!(memcmp(buffer, CMD_STAT, 4))) + dc_stat(buffer); + if (!(memcmp(buffer, CMD_UTIME, 4))) + dc_utime(buffer); + if (!(memcmp(buffer, CMD_BAD, 4))) + printf("command 15 should not happen... (but it did)\n"); + if (!(memcmp(buffer, CMD_OPENDIR, 4))) + dc_opendir(buffer); + if (!(memcmp(buffer, CMD_CLOSEDIR, 4))) + dc_closedir(buffer); + if (!(memcmp(buffer, CMD_READDIR, 4))) + dc_readdir(buffer); + if (!(memcmp(buffer, CMD_CDFSREAD, 4))) + dc_cdfs_redir_read_sectors(isofd, buffer); + if (!(memcmp(buffer, CMD_GDBPACKET, 4))) + dc_gdbpacket(buffer); + } +} + +int open_gdb_socket(int port) +{ + struct sockaddr_in server_addr; + + server_addr.sin_family = AF_INET; + server_addr.sin_port = htons( port ); + server_addr.sin_addr.s_addr = htonl( INADDR_LOOPBACK ); + + if ( (gdb_server_socket = socket( PF_INET, SOCK_STREAM, IPPROTO_TCP )) < 0 ) { + perror( "error creating gdb server socket" ); + return -1; + } + + if ( bind( gdb_server_socket, (struct sockaddr*)&server_addr, sizeof( server_addr ) ) < 0 ) { + perror( "error binding gdb server socket" ); + return -1; + } + + if ( listen( gdb_server_socket, 0 ) < 0 ) { + perror( "error listening to gdb server socket" ); + return -1; + } +} + +int main(int argc, char *argv[]) +{ + unsigned int address = 0x8c010000; + unsigned int size = 0; + unsigned char *filename = 0; + unsigned char *path = 0; + unsigned int console = 1; + unsigned int quiet = 0; + unsigned char command = 0; + char *hostname = DREAMCAST_IP; + unsigned int cdfs_redir = 0; + unsigned char *isofile = 0; + int someopt; + + if (argc < 2) + usage(); + + someopt = getopt(argc, argv, "x:u:d:a:s:t:c:i:npqhrg"); + while (someopt > 0) { + switch (someopt) { + case 'x': + if (command) { + printf("You can only specify one of -x, -u, -d, and -r\n"); + exit(0); + } + command = 'x'; + filename = malloc(strlen(optarg) + 1); + strcpy(filename, optarg); + break; + case 'u': + if (command) { + printf("You can only specify one of -x, -u, -d, and -r\n"); + exit(0); + } + command = 'u'; + filename = malloc(strlen(optarg) + 1); + strcpy(filename, optarg); + break; + case 'd': + if (command) { + printf("You can only specify one of -x, -u, -d, and -r\n"); + exit(0); + } + command = 'd'; + filename = malloc(strlen(optarg) + 1); + strcpy(filename, optarg); + break; + case 'c': + path = malloc(strlen(optarg) + 1); + strcpy(path, optarg); + break; + case 'i': + cdfs_redir = 1; + isofile = malloc(strlen(optarg) + 1); + strcpy(isofile, optarg); + break; + case 'a': + address = strtoul(optarg, NULL, 0); + break; + case 's': + size = strtoul(optarg, NULL, 0); + break; + case 't': + hostname = malloc(strlen(optarg) + 1); + strcpy(hostname, optarg); + break; + case 'n': + console = 0; + break; + case 'q': + quiet = 1; + break; + case 'h': + usage(); + break; + case 'r': + if (command) { + printf("You can only specify one of -x, -u, -d, and -r\n"); + exit(0); + } + command = 'r'; + break; + case 'g': + printf("Starting a GDB server on port 2159\n"); + open_gdb_socket(2159); + break; + default: + break; + } + someopt = getopt(argc, argv, "x:u:d:a:s:t:c:i:nqhr"); + } + + if (cdfs_redir & (!console)) + console = 1; + + if (console & command=='x') + printf("Console enabled\n"); + + if (quiet) + printf("Quiet download\n"); + + if (path) + printf("Chroot enabled\n"); + + if (cdfs_redir & command=='x') + printf("Cdfs redirection enabled\n"); + + if (open_socket(hostname)<0) + { + return 1; + } + + switch (command) { + case 'x': + printf("Upload <%s>\n", filename); + address = upload(filename, address); + printf("Executing at <0x%x>\n", address); + execute(address, console, cdfs_redir); + if (console) + do_console(path, isofile); + break; + case 'u': + printf("Upload <%s> at <0x%x>\n", filename, address); + upload(filename, address); + break; + case 'd': + if (!size) { + printf + ("You must specify a size (-s ) with download (-d )\n"); + exit(0); + } + printf("Download %d bytes at <0x%x> to <%s>\n", size, address, + filename); + download(filename, address, size, quiet); + break; + case 'r': + printf("Reseting...\n"); + send_command(CMD_REBOOT, 0, 0, NULL, 0); + break; + default: + usage(); + break; + } + exit(0); +} diff --git a/LAN/SRCS/dcload-ip/host-src/tool/dcload-types.h b/LAN/SRCS/dcload-ip/host-src/tool/dcload-types.h new file mode 100644 index 00000000..0bfcff4f --- /dev/null +++ b/LAN/SRCS/dcload-ip/host-src/tool/dcload-types.h @@ -0,0 +1,38 @@ +#ifndef __DCLOAD_TYPES_H__ +#define __DCLOAD_TYPES_H__ + +/* dcload dirent */ + +typedef struct { + long d_ino; /* inode number */ + off_t d_off; /* offset to the next dirent */ + unsigned short d_reclen;/* length of this record */ + unsigned char d_type; /* type of file */ + char d_name[256]; /* filename */ +} dcload_dirent_t; + +/* dcload stat */ + +typedef struct { + unsigned short st_dev; + unsigned short st_ino; + int st_mode; + unsigned short st_nlink; + unsigned short st_uid; + unsigned short st_gid; + unsigned short st_rdev; + long st_size; + long st_atime_priv; + long st_spare1; + long st_mtime_priv; + long st_spare2; + long st_ctime_priv; + long st_spare3; + long st_blksize; + long st_blocks; + long st_spare4[2]; +} dcload_stat_t; + +#endif + + diff --git a/LAN/SRCS/dcload-ip/host-src/tool/syscalls.c b/LAN/SRCS/dcload-ip/host-src/tool/syscalls.c new file mode 100644 index 00000000..9973d138 --- /dev/null +++ b/LAN/SRCS/dcload-ip/host-src/tool/syscalls.c @@ -0,0 +1,400 @@ +/* + * This file is part of the dcload Dreamcast ethernet loader + * + * Copyright (C) 2001 Andrew Kieschnick + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "syscalls.h" +#include "dc-io.h" +#include "dcload-types.h" +#include "commands.h" + +#ifndef O_BINARY +#define O_BINARY 0 +#endif + +/* syscalls for dcload-ip + * + * 1. receive all parameters from dc + * 2. get any data from dc using recv_data (dc passes address/size of buffer) + * 3. send any data to dc using send_data (dc passess address/size of buffer) + * 4. send return value to dc + */ + +unsigned int dc_order(unsigned int x) +{ + if (x == htonl(x)) + return (x << 24) | ((x << 8) & 0xff0000) | ((x >> 8) & 0xff00) | ((x >> 24) & 0xff); + else + return x; +} + +void dc_fstat(unsigned char * buffer) +{ + struct stat filestat; + int retval; + dcload_stat_t dcstat; + command_3int_t *command = (command_3int_t *)buffer; + /* value0 = fd, value1 = addr, value2 = size */ + + retval = fstat(ntohl(command->value0), &filestat); + + dcstat.st_dev = dc_order(filestat.st_dev); + dcstat.st_ino = dc_order(filestat.st_ino); + dcstat.st_mode = dc_order(filestat.st_mode); + dcstat.st_nlink = dc_order(filestat.st_nlink); + dcstat.st_uid = dc_order(filestat.st_uid); + dcstat.st_gid = dc_order(filestat.st_gid); + dcstat.st_rdev = dc_order(filestat.st_rdev); + dcstat.st_size = dc_order(filestat.st_size); + dcstat.st_blksize = dc_order(filestat.st_blksize); + dcstat.st_blocks = dc_order(filestat.st_blocks); + dcstat.st_atime_priv = dc_order(filestat.st_atime); + dcstat.st_mtime_priv = dc_order(filestat.st_mtime); + dcstat.st_ctime_priv = dc_order(filestat.st_ctime); + + send_data((unsigned char *)&dcstat, ntohl(command->value1), ntohl(command->value2)); + + send_command(CMD_RETVAL, retval, retval, NULL, 0); +} + +void dc_write(unsigned char * buffer) +{ + unsigned char *data; + int retval; + command_3int_t *command = (command_3int_t *)buffer; + /* value0 = fd, value1 = addr, value2 = size */ + + data = malloc(ntohl(command->value2)); + + recv_data(data, ntohl(command->value1), ntohl(command->value2), 1); + + retval = write(ntohl(command->value0), data, ntohl(command->value2)); + + send_command(CMD_RETVAL, retval, retval, NULL, 0); + + free(data); +} + +void dc_read(unsigned char * buffer) +{ + unsigned char *data; + int retval; + command_3int_t *command = (command_3int_t *)buffer; + /* value0 = fd, value1 = addr, value2 = size */ + + data = malloc(ntohl(command->value2)); + retval = read(ntohl(command->value0), data, ntohl(command->value2)); + + send_data(data, ntohl(command->value1), ntohl(command->value2)); + + send_command(CMD_RETVAL, retval, retval, NULL, 0); + + free(data); +} + +void dc_open(unsigned char * buffer) +{ + int retval; + int flags; + int ourflags = 0; + int mode; + command_2int_string_t *command = (command_2int_string_t *)buffer; + /* value0 = flags value1 = mode string = name */ + + /* translate flags */ + + if (ntohl(command->value0) & 0x0001) + ourflags |= O_WRONLY; + if (ntohl(command->value0) & 0x0002) + ourflags |= O_RDWR; + if (ntohl(command->value0) & 0x0008) + ourflags |= O_APPEND; + if (ntohl(command->value0) & 0x0200) + ourflags |= O_CREAT; + if (ntohl(command->value0) & 0x0400) + ourflags |= O_TRUNC; + if (ntohl(command->value0) & 0x0800) + ourflags |= O_EXCL; + + retval = open(command->string, ourflags | O_BINARY, ntohl(command->value1)); + + send_command(CMD_RETVAL, retval, retval, NULL, 0); +} + +void dc_close(unsigned char * buffer) +{ + int retval; + command_int_t *command = (command_int_t *)buffer; + + retval = close(ntohl(command->value0)); + + send_command(CMD_RETVAL, retval, retval, NULL, 0); +} + +void dc_creat(unsigned char * buffer) +{ + int namelen; + unsigned char *pathname; + int retval; + int mode; + command_int_string_t *command = (command_int_string_t *)buffer; + + retval = creat(command->string, ntohl(command->value0)); + + send_command(CMD_RETVAL, retval, retval, NULL, 0); +} + +void dc_link(unsigned char * buffer) +{ + unsigned char *pathname1, *pathname2; + int retval; + command_string_t *command = (command_string_t *)buffer; + + pathname1 = command->string; + pathname2 = &command->string[strlen(command->string)+1]; + + retval = link(pathname1, pathname2); + + send_command(CMD_RETVAL, retval, retval, NULL, 0); +} + +void dc_unlink(unsigned char * buffer) +{ + int retval; + command_string_t *command = (command_string_t *)buffer; + + retval = unlink(command->string); + + send_command(CMD_RETVAL, retval, retval, NULL, 0); +} + +void dc_chdir(unsigned char * buffer) +{ + int retval; + command_string_t *command = (command_string_t *)buffer; + + retval = chdir(command->string); + + send_command(CMD_RETVAL, retval, retval, NULL, 0); +} + +void dc_chmod(unsigned char * buffer) +{ + int retval; + command_int_string_t *command = (command_int_string_t *)buffer; + + retval = chmod(command->string, ntohl(command->value0)); + + send_command(CMD_RETVAL, retval, retval, NULL, 0); +} + +void dc_lseek(unsigned char * buffer) +{ + int filedes; + int offset; + int whence; + int retval; + command_3int_t *command = (command_3int_t *)buffer; + + retval = lseek(ntohl(command->value0), ntohl(command->value1), ntohl(command->value2)); + + send_command(CMD_RETVAL, retval, retval, NULL, 0); +} + +void dc_time(unsigned char * buffer) +{ + time_t t; + + time(&t); + + send_command(CMD_RETVAL, t, t, NULL, 0); +} + +void dc_stat(unsigned char * buffer) +{ + struct stat filestat; + int retval; + dcload_stat_t dcstat; + command_2int_string_t *command = (command_2int_string_t *)buffer; + + retval = stat(command->string, &filestat); + + dcstat.st_dev = dc_order(filestat.st_dev); + dcstat.st_ino = dc_order(filestat.st_ino); + dcstat.st_mode = dc_order(filestat.st_mode); + dcstat.st_nlink = dc_order(filestat.st_nlink); + dcstat.st_uid = dc_order(filestat.st_uid); + dcstat.st_gid = dc_order(filestat.st_gid); + dcstat.st_rdev = dc_order(filestat.st_rdev); + dcstat.st_size = dc_order(filestat.st_size); + dcstat.st_blksize = dc_order(filestat.st_blksize); + dcstat.st_blocks = dc_order(filestat.st_blocks); + dcstat.st_atime_priv = dc_order(filestat.st_atime); + dcstat.st_mtime_priv = dc_order(filestat.st_mtime); + dcstat.st_ctime_priv = dc_order(filestat.st_ctime); + + send_data((unsigned char *)&dcstat, ntohl(command->value0), ntohl(command->value1)); + + send_command(CMD_RETVAL, retval, retval, NULL, 0); +} + +void dc_utime(unsigned char * buffer) +{ + struct utimbuf tbuf; + int retval; + command_3int_string_t *command = (command_3int_string_t *)buffer; + + if (ntohl(command->value0)) { + + tbuf.actime = ntohl(command->value1); + tbuf.modtime = ntohl(command->value2); + + retval = utime(command->string, &tbuf); + } else { + retval = utime(command->string, 0); + } + send_command(CMD_RETVAL, retval, retval, NULL, 0); +} + +void dc_opendir(unsigned char * buffer) +{ + DIR *somedir; + command_string_t *command = (command_string_t *)buffer; + + somedir = opendir(command->string); + + send_command(CMD_RETVAL, (unsigned int)somedir, (unsigned int)somedir, NULL, 0); +} + +void dc_closedir(unsigned char * buffer) +{ + int retval; + command_int_t *command = (command_int_t *)buffer; + + retval = closedir((DIR *) ntohl(command->value0)); + + send_command(CMD_RETVAL, retval, retval, NULL, 0); +} + +void dc_readdir(unsigned char * buffer) +{ + struct dirent *somedirent; + dcload_dirent_t dcdirent; + command_3int_t *command = (command_3int_t *)buffer; + + somedirent = readdir((DIR *)ntohl(command->value0)); + + if (somedirent) { +#ifdef __APPLE__ + dcdirent.d_ino = dc_order(somedirent->d_fileno); + dcdirent.d_off = dc_order(0); + dcdirent.d_reclen = dc_order(somedirent->d_reclen); + dcdirent.d_type = dc_order(somedirent->d_type); +#else + dcdirent.d_ino = dc_order(somedirent->d_ino); +# ifdef _WIN32 + dcdirent.d_off = dc_order(0); + dcdirent.d_reclen = dc_order(0); + dcdirent.d_type = dc_order(0); +# else + dcdirent.d_off = dc_order(somedirent->d_off); + dcdirent.d_reclen = dc_order(somedirent->d_reclen); + dcdirent.d_type = dc_order(somedirent->d_type); +# endif +#endif + strcpy(dcdirent.d_name, somedirent->d_name); + + send_data((unsigned char *)&dcdirent, ntohl(command->value1), ntohl(command->value2)); + } + + send_command(CMD_RETVAL, (unsigned int)somedirent, (unsigned int)somedirent, NULL, 0); +} + +void dc_cdfs_redir_read_sectors(int isofd, unsigned char * buffer) +{ + int start; + unsigned char * buf; + command_3int_t *command = (command_3int_t *)buffer; + + start = ntohl(command->value0) - 150; + + lseek(isofd, start * 2048, SEEK_SET); + + buf = malloc(ntohl(command->value2)); + + read(isofd, buf, ntohl(command->value2)); + + send_data(buf, ntohl(command->value1), ntohl(command->value2)); + + send_command(CMD_RETVAL, 0, 0, NULL, 0); +} + +#define GDBBUFSIZE 1024 +extern int gdb_server_socket; + +void dc_gdbpacket(unsigned char * buffer) +{ + size_t in_size, out_size; + + static int socket_fd = -1; + static char gdb_buf[GDBBUFSIZE]; + + int count, size, retval; + + if (gdb_server_socket < 0) { + send_command(CMD_RETVAL, -1, -1, NULL, 0); + return; + } + + if (socket_fd < 0) { + printf( "waiting for gdb client connection...\n" ); + if ( (socket_fd = accept( gdb_server_socket, NULL, NULL )) < 0) { + perror("error accepting gdb server connection"); + return; + } + } + + command_2int_string_t *command = (command_2int_string_t *)buffer; + /* value0 = in_size, value1 = out_size, string = packet */ + + retval = 0; + + in_size = ntohl(command->value0); + out_size = ntohl(command->value1); + + if (in_size) + write(socket_fd, command->string, in_size); + + if (out_size) { + retval = read(socket_fd, gdb_buf, out_size > GDBBUFSIZE ? GDBBUFSIZE : out_size); + if (retval == 0) + socket_fd = -1; + } + + send_command(CMD_RETVAL, retval, retval, gdb_buf, retval); +} diff --git a/LAN/SRCS/dcload-ip/host-src/tool/syscalls.h b/LAN/SRCS/dcload-ip/host-src/tool/syscalls.h new file mode 100644 index 00000000..24be95bd --- /dev/null +++ b/LAN/SRCS/dcload-ip/host-src/tool/syscalls.h @@ -0,0 +1,129 @@ +/* + * This file is part of the dcload Dreamcast ethernet loader + * + * Copyright (C) 2001 Andrew Kieschnick + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __SYSCALLS_H__ +#define __SYSCALLS_H__ + +void dc_fstat(unsigned char * buffer); +void dc_write(unsigned char * buffer); +void dc_read(unsigned char * buffer); +void dc_open(unsigned char * buffer); +void dc_close(unsigned char * buffer); +void dc_creat(unsigned char * buffer); +void dc_link(unsigned char * buffer); +void dc_unlink(unsigned char * buffer); +void dc_chdir(unsigned char * buffer); +void dc_chmod(unsigned char * buffer); +void dc_lseek(unsigned char * buffer); +void dc_time(unsigned char * buffer); +void dc_stat(unsigned char * buffer); +void dc_utime(unsigned char * buffer); + +void dc_opendir(unsigned char * buffer); +void dc_readdir(unsigned char * buffer); +void dc_closedir(unsigned char * buffer); + +void dc_cdfs_redir_read_sectors(int isofd, unsigned char * buffer); + +void dc_gdbpacket(unsigned char * buffer); + +#define CMD_EXIT "DC00" +#define CMD_FSTAT "DC01" +#define CMD_WRITE "DD02" +#define CMD_READ "DC03" +#define CMD_OPEN "DC04" +#define CMD_CLOSE "DC05" +#define CMD_CREAT "DC06" +#define CMD_LINK "DC07" +#define CMD_UNLINK "DC08" +#define CMD_CHDIR "DC09" +#define CMD_CHMOD "DC10" +#define CMD_LSEEK "DC11" +#define CMD_TIME "DC12" +#define CMD_STAT "DC13" +#define CMD_UTIME "DC14" +#define CMD_BAD "DC15" +#define CMD_OPENDIR "DC16" +#define CMD_CLOSEDIR "DC17" +#define CMD_READDIR "DC18" +#define CMD_CDFSREAD "DC19" +#define CMD_GDBPACKET "DC20" + +typedef struct { + unsigned char id[4] __attribute__ ((packed)); + unsigned int value0 __attribute__ ((packed)); + unsigned int value1 __attribute__ ((packed)); + unsigned int value2 __attribute__ ((packed)); +} command_3int_t; + +typedef struct { + unsigned char id[4] __attribute__ ((packed)); + unsigned int value0 __attribute__ ((packed)); + unsigned int value1 __attribute__ ((packed)); + unsigned char string[1] __attribute__ ((packed)); +} command_2int_string_t; + +typedef struct { + unsigned char id[4] __attribute__ ((packed)); + unsigned int value0 __attribute__ ((packed)); +} command_int_t; + +typedef struct { + unsigned char id[4] __attribute__ ((packed)); + unsigned int value0 __attribute__ ((packed)); + unsigned char string[1] __attribute__ ((packed)); +} command_int_string_t; + +typedef struct { + unsigned char id[4] __attribute__ ((packed)); + unsigned char string[1] __attribute__ ((packed)); +} command_string_t; + +typedef struct { + unsigned char id[4] __attribute__ ((packed)); + unsigned int value0 __attribute__ ((packed)); + unsigned int value1 __attribute__ ((packed)); + unsigned int value2 __attribute__ ((packed)); + unsigned char string[1] __attribute__ ((packed)); +} command_3int_string_t; + +/* fstat fd, addr, size + * write fd, addr, size + * read fd, addr, size + * open flags, mode, string + * close fd + * creat mode, string + * link string1+string2 + * unlink string + * chdir string + * cdmod mode, string + * lseek fd, offset, whence + * time - + * stat addr, size, string + * utime foo, actime, modtime, string + * opendir string + * closedir dir + * readdir dir, addr, size + * cdfsread sector, addr, size + * gdb_packet count, size, string + */ + +#endif diff --git a/LAN/SRCS/dcload-ip/make-cd/IP.BIN b/LAN/SRCS/dcload-ip/make-cd/IP.BIN new file mode 100644 index 00000000..1490d019 Binary files /dev/null and b/LAN/SRCS/dcload-ip/make-cd/IP.BIN differ diff --git a/LAN/SRCS/dcload-ip/make-cd/Makefile b/LAN/SRCS/dcload-ip/make-cd/Makefile new file mode 100644 index 00000000..6ce58da3 --- /dev/null +++ b/LAN/SRCS/dcload-ip/make-cd/Makefile @@ -0,0 +1,38 @@ +CDRECORD = cdrecord dev=0,0,0 speed=8 +SCRAMBLE = scramble +DD = dd +CP = cp +MKISOFS = mkisofs +CAT = cat +TOUCH = touch +1ST_READ = ../target-src/1st_read/1st_read.bin + +all: $(1ST_READ) audio.raw burn-audio data.raw burn-data + +audio.raw: + $(DD) if=/dev/zero of=audio.raw bs=2352 count=300 + +burn-audio: audio.raw + $(CDRECORD) -multi -audio audio.raw + touch burn-audio + +1st_read.bin: $(1ST_READ) + $(SCRAMBLE) $(1ST_READ) 1st_read.bin + +data.raw: tmp.iso IP.BIN + ( cat IP.BIN ; dd if=tmp.iso bs=2048 skip=16 ) > data.raw + +tmp.iso: 1st_read.bin burn-audio + $(MKISOFS) -C `$(CDRECORD) -msinfo` -o tmp.iso 1st_read.bin + +burn-data: data.raw + $(CDRECORD) -xa1 data.raw + rm -f audio.raw data.raw burn-audio + +.PHONY : clean +clean: + rm -f tmp.iso burn-audio 1st_read.bin + +.PHONY : distclean +distclean: clean + rm -f audio.raw data.raw diff --git a/LAN/SRCS/dcload-ip/target-inc/_ansi.h b/LAN/SRCS/dcload-ip/target-inc/_ansi.h new file mode 100644 index 00000000..b4dc0110 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/_ansi.h @@ -0,0 +1,71 @@ +/* Provide support for both ANSI and non-ANSI environments. */ + +/* Some ANSI environments are "broken" in the sense that __STDC__ cannot be + relied upon to have it's intended meaning. Therefore we must use our own + concoction: _HAVE_STDC. Always use _HAVE_STDC instead of __STDC__ in newlib + sources! + + To get a strict ANSI C environment, define macro __STRICT_ANSI__. This will + "comment out" the non-ANSI parts of the ANSI header files (non-ANSI header + files aren't affected). */ + +#ifndef _ANSIDECL_H_ +#define _ANSIDECL_H_ + +#include + +/* First try to figure out whether we really are in an ANSI C environment. */ +/* FIXME: This probably needs some work. Perhaps sys/config.h can be + prevailed upon to give us a clue. */ + +#ifdef __STDC__ +#define _HAVE_STDC +#endif + +#ifdef _HAVE_STDC +#define _PTR void * +#define _AND , +#define _NOARGS void +#define _CONST const +#define _VOLATILE volatile +#define _SIGNED signed +#define _DOTS , ... +#define _VOID void +#define _EXFUN(name, proto) name proto +#define _DEFUN(name, arglist, args) name(args) +#define _DEFUN_VOID(name) name(_NOARGS) +#define _CAST_VOID (void) +#ifndef _LONG_DOUBLE +#define _LONG_DOUBLE long double +#endif +#ifndef _PARAMS +#define _PARAMS(paramlist) paramlist +#endif +#else +#define _PTR char * +#define _AND ; +#define _NOARGS +#define _CONST +#define _VOLATILE +#define _SIGNED +#define _DOTS +#define _VOID void +#define _EXFUN(name, proto) name() +#define _DEFUN(name, arglist, args) name arglist args; +#define _DEFUN_VOID(name) name() +#define _CAST_VOID +#define _LONG_DOUBLE double +#ifndef _PARAMS +#define _PARAMS(paramlist) () +#endif +#endif + +/* Support gcc's __attribute__ facility. */ + +#ifdef __GNUC__ +#define _ATTRIBUTE(attrs) __attribute__ (attrs) +#else +#define _ATTRIBUTE(attrs) +#endif + +#endif /* _ANSIDECL_H_ */ diff --git a/LAN/SRCS/dcload-ip/target-inc/_syslist.h b/LAN/SRCS/dcload-ip/target-inc/_syslist.h new file mode 100644 index 00000000..fa552fb6 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/_syslist.h @@ -0,0 +1,29 @@ +/* internal use only -- mapping of "system calls" for libraries that lose + and only provide C names, so that we end up in violation of ANSI */ +#ifndef __SYSLIST_H +#define __SYSLIST_H +#ifdef MISSING_SYSCALL_NAMES +#define _close close +#define _execve execve +#define _fcntl fcntl +#define _fork fork +#define _fstat fstat +#define _getpid getpid +#define _gettimeofday gettimeofday +#define _kill kill +#define _link link +#define _lseek lseek +#define _open open +#define _read read +#define _sbrk sbrk +#define _stat stat +#define _times times +#define _unlink unlink +#define _wait wait +#define _write write +/* functions not yet sysfaked */ +#define _opendir opendir +#define _readdir readdir +#define _closedir closedir +#endif +#endif diff --git a/LAN/SRCS/dcload-ip/target-inc/ar.h b/LAN/SRCS/dcload-ip/target-inc/ar.h new file mode 100644 index 00000000..ac2e4ca9 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/ar.h @@ -0,0 +1,69 @@ +/* $NetBSD: ar.h,v 1.4 1994/10/26 00:55:43 cgd Exp $ */ + +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * This code is derived from software contributed to Berkeley by + * Hugh Smith at The University of Guelph. + * + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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. + * + * @(#)ar.h 8.2 (Berkeley) 1/21/94 + */ + +#ifndef _AR_H_ +#define _AR_H_ + +/* Pre-4BSD archives had these magic numbers in them. */ +#define OARMAG1 0177555 +#define OARMAG2 0177545 + +#define ARMAG "!\n" /* ar "magic number" */ +#define SARMAG 8 /* strlen(ARMAG); */ + +#define AR_EFMT1 "#1/" /* extended format #1 */ + +struct ar_hdr { + char ar_name[16]; /* name */ + char ar_date[12]; /* modification time */ + char ar_uid[6]; /* user id */ + char ar_gid[6]; /* group id */ + char ar_mode[8]; /* octal file permissions */ + char ar_size[10]; /* size in bytes */ +#define ARFMAG "`\n" + char ar_fmag[2]; /* consistency check */ +}; + +#endif /* !_AR_H_ */ diff --git a/LAN/SRCS/dcload-ip/target-inc/assert.h b/LAN/SRCS/dcload-ip/target-inc/assert.h new file mode 100644 index 00000000..b681a851 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/assert.h @@ -0,0 +1,29 @@ +/* + assert.h +*/ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "_ansi.h" + +#undef assert + +#ifdef NDEBUG /* required by ANSI standard */ +#define assert(p) ((void)0) +#else + +#ifdef __STDC__ +#define assert(e) ((e) ? (void)0 : __assert(__FILE__, __LINE__, #e)) +#else /* PCC */ +#define assert(e) ((e) ? (void)0 : __assert(__FILE__, __LINE__, "e")) +#endif + +#endif /* NDEBUG */ + +void _EXFUN(__assert,(const char *, int, const char *)); + +#ifdef __cplusplus +} +#endif diff --git a/LAN/SRCS/dcload-ip/target-inc/ctype.h b/LAN/SRCS/dcload-ip/target-inc/ctype.h new file mode 100644 index 00000000..224b703a --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/ctype.h @@ -0,0 +1,73 @@ +#ifndef _CTYPE_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _CTYPE_H_ + +#include "_ansi.h" + +int _EXFUN(isalnum, (int __c)); +int _EXFUN(isalpha, (int __c)); +int _EXFUN(iscntrl, (int __c)); +int _EXFUN(isdigit, (int __c)); +int _EXFUN(isgraph, (int __c)); +int _EXFUN(islower, (int __c)); +int _EXFUN(isprint, (int __c)); +int _EXFUN(ispunct, (int __c)); +int _EXFUN(isspace, (int __c)); +int _EXFUN(isupper, (int __c)); +int _EXFUN(isxdigit,(int __c)); +int _EXFUN(tolower, (int __c)); +int _EXFUN(toupper, (int __c)); + +#ifndef __STRICT_ANSI__ +int _EXFUN(isascii, (int __c)); +int _EXFUN(toascii, (int __c)); +int _EXFUN(_tolower, (int __c)); +int _EXFUN(_toupper, (int __c)); +#endif + +#define _U 01 +#define _L 02 +#define _N 04 +#define _S 010 +#define _P 020 +#define _C 040 +#define _X 0100 +#define _B 0200 + +#if !defined(__CYGWIN32__) || defined(__INSIDE_CYGWIN__) || defined(_COMPILING_NEWLIB) +extern _CONST char _ctype_[]; +#else +extern _CONST char _ctype_[] __declspec(dllimport); +#endif + +#define isalpha(c) ((_ctype_+1)[(unsigned)(c)]&(_U|_L)) +#define isupper(c) ((_ctype_+1)[(unsigned)(c)]&_U) +#define islower(c) ((_ctype_+1)[(unsigned)(c)]&_L) +#define isdigit(c) ((_ctype_+1)[(unsigned)(c)]&_N) +#define isxdigit(c) ((_ctype_+1)[(unsigned)(c)]&(_X|_N)) +#define isspace(c) ((_ctype_+1)[(unsigned)(c)]&_S) +#define ispunct(c) ((_ctype_+1)[(unsigned)(c)]&_P) +#define isalnum(c) ((_ctype_+1)[(unsigned)(c)]&(_U|_L|_N)) +#define isprint(c) ((_ctype_+1)[(unsigned)(c)]&(_P|_U|_L|_N|_B)) +#define isgraph(c) ((_ctype_+1)[(unsigned)(c)]&(_P|_U|_L|_N)) +#define iscntrl(c) ((_ctype_+1)[(unsigned)(c)]&_C) +/* Non-gcc versions will get the library versions, and will be + slightly slower */ +#ifdef __GNUC__ +# define toupper(c) \ + ({ int __x = (c); islower(__x) ? (__x - 'a' + 'A') : __x;}) +# define tolower(c) \ + ({ int __x = (c); isupper(__x) ? (__x - 'A' + 'a') : __x;}) +#endif + +#ifndef __STRICT_ANSI__ +#define isascii(c) ((unsigned)(c)<=0177) +#define toascii(c) ((c)&0177) +#endif + +#ifdef __cplusplus +} +#endif +#endif /* _CTYPE_H_ */ diff --git a/LAN/SRCS/dcload-ip/target-inc/dirent.h b/LAN/SRCS/dcload-ip/target-inc/dirent.h new file mode 100644 index 00000000..eaa4c190 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/dirent.h @@ -0,0 +1,7 @@ +#ifdef __cplusplus +extern "C" { +#endif +#include +#ifdef __cplusplus +} +#endif diff --git a/LAN/SRCS/dcload-ip/target-inc/errno.h b/LAN/SRCS/dcload-ip/target-inc/errno.h new file mode 100644 index 00000000..fa8efb7f --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/errno.h @@ -0,0 +1 @@ +#include diff --git a/LAN/SRCS/dcload-ip/target-inc/fastmath.h b/LAN/SRCS/dcload-ip/target-inc/fastmath.h new file mode 100644 index 00000000..95eea5f3 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/fastmath.h @@ -0,0 +1,13 @@ +#ifndef _FASTMATH_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _FASTMATH_H_ + +#include +#include + +#ifdef __cplusplus +} +#endif +#endif /* _FASTMATH_H_ */ diff --git a/LAN/SRCS/dcload-ip/target-inc/fcntl.h b/LAN/SRCS/dcload-ip/target-inc/fcntl.h new file mode 100644 index 00000000..86a91677 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/fcntl.h @@ -0,0 +1 @@ +#include diff --git a/LAN/SRCS/dcload-ip/target-inc/grp.h b/LAN/SRCS/dcload-ip/target-inc/grp.h new file mode 100644 index 00000000..b8680a5d --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/grp.h @@ -0,0 +1,85 @@ +/* $NetBSD: grp.h,v 1.7 1995/04/29 05:30:40 cgd Exp $ */ + +/*- + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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. + * + * @(#)grp.h 8.2 (Berkeley) 1/21/94 + */ + +#ifndef _GRP_H_ +#define _GRP_H_ + +#include + +#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE) +#define _PATH_GROUP "/etc/group" +#endif + +struct group { + char *gr_name; /* group name */ + char *gr_passwd; /* group password */ + gid_t gr_gid; /* group id */ + char **gr_mem; /* group members */ +}; + + +#ifdef __cplusplus +extern "C" { +#endif + +struct group *getgrgid (gid_t); +struct group *getgrnam (const char *); +int getgrnam_r (const char *, struct group *, + char *, size_t, struct group **); +int getgrgid_r (gid_t, struct group *, + char *, size_t, struct group **); +#ifndef _POSIX_SOURCE +struct group *getgrent (void); +void setgrent (void); +void endgrent (void); +void setgrfile (const char *); +#ifndef _XOPEN_SOURCE +char *group_from_gid (gid_t, int); +int setgroupent (int); +#endif /* !_XOPEN_SOURCE */ +#endif /* !_POSIX_SOURCE */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_GRP_H_ */ diff --git a/LAN/SRCS/dcload-ip/target-inc/ieeefp.h b/LAN/SRCS/dcload-ip/target-inc/ieeefp.h new file mode 100644 index 00000000..78bb5bf6 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/ieeefp.h @@ -0,0 +1,241 @@ +#ifndef _IEEE_FP_H_ +#define _IEEE_FP_H_ + +#include "_ansi.h" + +#include + +/* FIXME FIXME FIXME: + Neither of __ieee_{float,double}_shape_tape seem to be used anywhere + except in libm/test. If that is the case, please delete these from here. + If that is not the case, please insert documentation here describing why + they're needed. */ + +#ifdef __IEEE_BIG_ENDIAN + +typedef union +{ + double value; + struct + { + unsigned int sign : 1; + unsigned int exponent: 11; + unsigned int fraction0:4; + unsigned int fraction1:16; + unsigned int fraction2:16; + unsigned int fraction3:16; + + } number; + struct + { + unsigned int sign : 1; + unsigned int exponent: 11; + unsigned int quiet:1; + unsigned int function0:3; + unsigned int function1:16; + unsigned int function2:16; + unsigned int function3:16; + } nan; + struct + { + unsigned long msw; + unsigned long lsw; + } parts; + long aslong[2]; +} __ieee_double_shape_type; + +#endif + +#ifdef __IEEE_LITTLE_ENDIAN + +typedef union +{ + double value; + struct + { +#ifdef __SMALL_BITFIELDS + unsigned int fraction3:16; + unsigned int fraction2:16; + unsigned int fraction1:16; + unsigned int fraction0: 4; +#else + unsigned int fraction1:32; + unsigned int fraction0:20; +#endif + unsigned int exponent :11; + unsigned int sign : 1; + } number; + struct + { +#ifdef __SMALL_BITFIELDS + unsigned int function3:16; + unsigned int function2:16; + unsigned int function1:16; + unsigned int function0:3; +#else + unsigned int function1:32; + unsigned int function0:19; +#endif + unsigned int quiet:1; + unsigned int exponent: 11; + unsigned int sign : 1; + } nan; + struct + { + unsigned long lsw; + unsigned long msw; + } parts; + + long aslong[2]; + +} __ieee_double_shape_type; + +#endif + +#ifdef __IEEE_BIG_ENDIAN + +typedef union +{ + float value; + struct + { + unsigned int sign : 1; + unsigned int exponent: 8; + unsigned int fraction0: 7; + unsigned int fraction1: 16; + } number; + struct + { + unsigned int sign:1; + unsigned int exponent:8; + unsigned int quiet:1; + unsigned int function0:6; + unsigned int function1:16; + } nan; + long p1; + +} __ieee_float_shape_type; + +#endif + +#ifdef __IEEE_LITTLE_ENDIAN + +typedef union +{ + float value; + struct + { + unsigned int fraction0: 7; + unsigned int fraction1: 16; + unsigned int exponent: 8; + unsigned int sign : 1; + } number; + struct + { + unsigned int function1:16; + unsigned int function0:6; + unsigned int quiet:1; + unsigned int exponent:8; + unsigned int sign:1; + } nan; + long p1; + +} __ieee_float_shape_type; + +#endif + + + + + +/* FLOATING ROUNDING */ + +typedef int fp_rnd; +#define FP_RN 0 /* Round to nearest */ +#define FP_RM 1 /* Round down */ +#define FP_RP 2 /* Round up */ +#define FP_RZ 3 /* Round to zero (trunate) */ + +fp_rnd _EXFUN(fpgetround,(void)); +fp_rnd _EXFUN(fpsetround, (fp_rnd)); + +/* EXCEPTIONS */ + +typedef int fp_except; +#define FP_X_INV 0x10 /* Invalid operation */ +#define FP_X_DX 0x80 /* Divide by zero */ +#define FP_X_OFL 0x04 /* Overflow exception */ +#define FP_X_UFL 0x02 /* Underflow exception */ +#define FP_X_IMP 0x01 /* imprecise exception */ + +fp_except _EXFUN(fpgetmask,(void)); +fp_except _EXFUN(fpsetmask,(fp_except)); +fp_except _EXFUN(fpgetsticky,(void)); +fp_except _EXFUN(fpsetsticky, (fp_except)); + +/* INTEGER ROUNDING */ + +typedef int fp_rdi; +#define FP_RDI_TOZ 0 /* Round to Zero */ +#define FP_RDI_RD 1 /* Follow float mode */ + +fp_rdi _EXFUN(fpgetroundtoi,(void)); +fp_rdi _EXFUN(fpsetroundtoi,(fp_rdi)); + +int _EXFUN(isnan, (double)); +int _EXFUN(isinf, (double)); +int _EXFUN(finite, (double)); + + + +int _EXFUN(isnanf, (float)); +int _EXFUN(isinff, (float)); +int _EXFUN(finitef, (float)); + +#define __IEEE_DBL_EXPBIAS 1023 +#define __IEEE_FLT_EXPBIAS 127 + +#define __IEEE_DBL_EXPLEN 11 +#define __IEEE_FLT_EXPLEN 8 + + +#define __IEEE_DBL_FRACLEN (64 - (__IEEE_DBL_EXPLEN + 1)) +#define __IEEE_FLT_FRACLEN (32 - (__IEEE_FLT_EXPLEN + 1)) + +#define __IEEE_DBL_MAXPOWTWO ((double)(1L << 32 - 2) * (1L << (32-11) - 32 + 1)) +#define __IEEE_FLT_MAXPOWTWO ((float)(1L << (32-8) - 1)) + +#define __IEEE_DBL_NAN_EXP 0x7ff +#define __IEEE_FLT_NAN_EXP 0xff + + +#define isnanf(x) (((*(long *)&(x) & 0x7f800000L)==0x7f800000L) && \ + ((*(long *)&(x) & 0x007fffffL)!=0000000000L)) + +#define isinff(x) (((*(long *)&(x) & 0x7f800000L)==0x7f800000L) && \ + ((*(long *)&(x) & 0x007fffffL)==0000000000L)) + +#define finitef(x) (((*(long *)&(x) & 0x7f800000L)!=0x7f800000L)) + +#ifdef _DOUBLE_IS_32BITS +#undef __IEEE_DBL_EXPBIAS +#define __IEEE_DBL_EXPBIAS __IEEE_FLT_EXPBIAS + +#undef __IEEE_DBL_EXPLEN +#define __IEEE_DBL_EXPLEN __IEEE_FLT_EXPLEN + +#undef __IEEE_DBL_FRACLEN +#define __IEEE_DBL_FRACLEN __IEEE_FLT_FRACLEN + +#undef __IEEE_DBL_MAXPOWTWO +#define __IEEE_DBL_MAXPOWTWO __IEEE_FLT_MAXPOWTWO + +#undef __IEEE_DBL_NAN_EXP +#define __IEEE_DBL_NAN_EXP __IEEE_FLT_NAN_EXP + +#undef __ieee_double_shape_type +#define __ieee_double_shape_type __ieee_float_shape_type + +#endif /* _DOUBLE_IS_32BITS */ + +#endif /* _IEEE_FP_H_ */ diff --git a/LAN/SRCS/dcload-ip/target-inc/locale.h b/LAN/SRCS/dcload-ip/target-inc/locale.h new file mode 100644 index 00000000..38a196f6 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/locale.h @@ -0,0 +1,60 @@ +/* + locale.h + Values appropriate for the formatting of monetary and other + numberic quantities. +*/ + +#ifndef _LOCALE_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _LOCALE_H_ + +#include "_ansi.h" + +#ifndef NULL +#define NULL 0L +#endif + +#define LC_ALL 0 +#define LC_COLLATE 1 +#define LC_CTYPE 2 +#define LC_MONETARY 3 +#define LC_NUMERIC 4 +#define LC_TIME 5 + +struct lconv +{ + char *decimal_point; + char *thousands_sep; + char *grouping; + char *int_curr_symbol; + char *currency_symbol; + char *mon_decimal_point; + char *mon_thousands_sep; + char *mon_grouping; + char *positive_sign; + char *negative_sign; + char int_frac_digits; + char frac_digits; + char p_cs_precedes; + char p_sep_by_space; + char n_cs_precedes; + char n_sep_by_space; + char p_sign_posn; + char n_sign_posn; +}; + +#ifndef _REENT_ONLY +char *_EXFUN(setlocale,(int category, const char *locale)); +struct lconv *_EXFUN(localeconv,(void)); +#endif + +struct _reent; +char *_EXFUN(_setlocale_r,(struct _reent *, int category, const char *locale)); +struct lconv *_EXFUN(_localeconv_r,(struct _reent *)); + +#ifdef __cplusplus +} +#endif +#endif /* _LOCALE_H_ */ diff --git a/LAN/SRCS/dcload-ip/target-inc/machine/fastmath.h b/LAN/SRCS/dcload-ip/target-inc/machine/fastmath.h new file mode 100644 index 00000000..b13befa2 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/machine/fastmath.h @@ -0,0 +1,100 @@ +#ifdef __sysvnecv70_target +double EXFUN(fast_sin,(double)); +double EXFUN(fast_cos,(double)); +double EXFUN(fast_tan,(double)); + +double EXFUN(fast_asin,(double)); +double EXFUN(fast_acos,(double)); +double EXFUN(fast_atan,(double)); + +double EXFUN(fast_sinh,(double)); +double EXFUN(fast_cosh,(double)); +double EXFUN(fast_tanh,(double)); + +double EXFUN(fast_asinh,(double)); +double EXFUN(fast_acosh,(double)); +double EXFUN(fast_atanh,(double)); + +double EXFUN(fast_abs,(double)); +double EXFUN(fast_sqrt,(double)); +double EXFUN(fast_exp2,(double)); +double EXFUN(fast_exp10,(double)); +double EXFUN(fast_expe,(double)); +double EXFUN(fast_log10,(double)); +double EXFUN(fast_log2,(double)); +double EXFUN(fast_loge,(double)); + + +#define sin(x) fast_sin(x) +#define cos(x) fast_cos(x) +#define tan(x) fast_tan(x) +#define asin(x) fast_asin(x) +#define acos(x) fast_acos(x) +#define atan(x) fast_atan(x) +#define sinh(x) fast_sinh(x) +#define cosh(x) fast_cosh(x) +#define tanh(x) fast_tanh(x) +#define asinh(x) fast_asinh(x) +#define acosh(x) fast_acosh(x) +#define atanh(x) fast_atanh(x) +#define abs(x) fast_abs(x) +#define sqrt(x) fast_sqrt(x) +#define exp2(x) fast_exp2(x) +#define exp10(x) fast_exp10(x) +#define expe(x) fast_expe(x) +#define log10(x) fast_log10(x) +#define log2(x) fast_log2(x) +#define loge(x) fast_loge(x) + +#ifdef _HAVE_STDC +/* These functions are in assembler, they really do take floats. This + can only be used with a real ANSI compiler */ + +float EXFUN(fast_sinf,(float)); +float EXFUN(fast_cosf,(float)); +float EXFUN(fast_tanf,(float)); + +float EXFUN(fast_asinf,(float)); +float EXFUN(fast_acosf,(float)); +float EXFUN(fast_atanf,(float)); + +float EXFUN(fast_sinhf,(float)); +float EXFUN(fast_coshf,(float)); +float EXFUN(fast_tanhf,(float)); + +float EXFUN(fast_asinhf,(float)); +float EXFUN(fast_acoshf,(float)); +float EXFUN(fast_atanhf,(float)); + +float EXFUN(fast_absf,(float)); +float EXFUN(fast_sqrtf,(float)); +float EXFUN(fast_exp2f,(float)); +float EXFUN(fast_exp10f,(float)); +float EXFUN(fast_expef,(float)); +float EXFUN(fast_log10f,(float)); +float EXFUN(fast_log2f,(float)); +float EXFUN(fast_logef,(float)); +#define sinf(x) fast_sinf(x) +#define cosf(x) fast_cosf(x) +#define tanf(x) fast_tanf(x) +#define asinf(x) fast_asinf(x) +#define acosf(x) fast_acosf(x) +#define atanf(x) fast_atanf(x) +#define sinhf(x) fast_sinhf(x) +#define coshf(x) fast_coshf(x) +#define tanhf(x) fast_tanhf(x) +#define asinhf(x) fast_asinhf(x) +#define acoshf(x) fast_acoshf(x) +#define atanhf(x) fast_atanhf(x) +#define absf(x) fast_absf(x) +#define sqrtf(x) fast_sqrtf(x) +#define exp2f(x) fast_exp2f(x) +#define exp10f(x) fast_exp10f(x) +#define expef(x) fast_expef(x) +#define log10f(x) fast_log10f(x) +#define log2f(x) fast_log2f(x) +#define logef(x) fast_logef(x) +#endif +/* Override the functions defined in math.h */ +#endif /* __sysvnecv70_target */ + diff --git a/LAN/SRCS/dcload-ip/target-inc/machine/ieeefp.h b/LAN/SRCS/dcload-ip/target-inc/machine/ieeefp.h new file mode 100644 index 00000000..ce8f0ffc --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/machine/ieeefp.h @@ -0,0 +1,157 @@ +#ifndef __IEEE_BIG_ENDIAN +#ifndef __IEEE_LITTLE_ENDIAN + +#if defined(__arm__) || defined(__thumb__) +/* ARM always has big-endian words. Within those words the byte ordering + appears to be big or little endian. Newlib doesn't seem to care about + the byte ordering within words. */ +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef __hppa__ +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef __sparc__ +#ifdef __LITTLE_ENDIAN_DATA__ +#define __IEEE_LITTLE_ENDIAN +#else +#define __IEEE_BIG_ENDIAN +#endif +#endif + +#if defined(__m68k__) || defined(__mc68000__) +#define __IEEE_BIG_ENDIAN +#endif + +#if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__) +#define __IEEE_BIG_ENDIAN +#define __SMALL_BITFIELDS +#define _DOUBLE_IS_32BITS +#endif + +#ifdef __H8500__ +#define __IEEE_BIG_ENDIAN +#define __SMALL_BITFIELDS +#define _DOUBLE_IS_32BITS +#endif + +#ifdef __sh__ +#ifdef __LITTLE_ENDIAN__ +#define __IEEE_LITTLE_ENDIAN +#else +#define __IEEE_BIG_ENDIAN +#endif +#if defined(__SH3E__) || defined(__SH4_SINGLE_ONLY__) +#define _DOUBLE_IS_32BITS +#endif +#endif + +#ifdef _AM29K +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef _WIN32 +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __i386__ +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __i960__ +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __M32R__ +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef __TIC80__ +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __MIPSEL__ +#define __IEEE_LITTLE_ENDIAN +#endif +#ifdef __MIPSEB__ +#define __IEEE_BIG_ENDIAN +#endif + +/* necv70 was __IEEE_LITTLE_ENDIAN. */ + +#ifdef __W65__ +#define __IEEE_LITTLE_ENDIAN +#define __SMALL_BITFIELDS +#define _DOUBLE_IS_32BITS +#endif + +#if defined(__Z8001__) || defined(__Z8002__) +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef __m88k__ +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef __mn10300__ +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __mn10200__ +#define __IEEE_LITTLE_ENDIAN +#define __SMALL_BITFIELDS +#define _DOUBLE_IS_32BITS +#endif + +#ifdef __v800 +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __v850 +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __D10V__ +#define __IEEE_BIG_ENDIAN +#define _DOUBLE_IS_32BITS +#define __SMALL_BITFIELDS +#endif + +#ifdef __PPC__ +#if (defined(_BIG_ENDIAN) && _BIG_ENDIAN) || (defined(_AIX) && _AIX) +#define __IEEE_BIG_ENDIAN +#else +#if (defined(_LITTLE_ENDIAN) && _LITTLE_ENDIAN) || (defined(__sun__) && __sun__) || (defined(_WIN32) && _WIN32) +#define __IEEE_LITTLE_ENDIAN +#endif +#endif +#endif + +#ifdef __arc__ +#ifdef __big_endian__ +#define __IEEE_BIG_ENDIAN +#else +#define __IEEE_LITTLE_ENDIAN +#endif +#endif + +#ifdef __fr30__ +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef __mcore__ +#define __IEEE_BIG_ENDIAN +#endif + + + +#ifndef __IEEE_BIG_ENDIAN +#ifndef __IEEE_LITTLE_ENDIAN +#error Endianess not declared!! +#endif /* not __IEEE_LITTLE_ENDIAN */ +#endif /* not __IEEE_BIG_ENDIAN */ + +#endif /* not __IEEE_LITTLE_ENDIAN */ +#endif /* not __IEEE_BIG_ENDIAN */ + diff --git a/LAN/SRCS/dcload-ip/target-inc/machine/setjmp-dj.h b/LAN/SRCS/dcload-ip/target-inc/machine/setjmp-dj.h new file mode 100644 index 00000000..0243f7e7 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/machine/setjmp-dj.h @@ -0,0 +1,44 @@ +/* +** Copyright (C) 1991 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954 +** +** This file is distributed under the terms listed in the document +** "copying.dj", available from DJ Delorie at the address above. +** A copy of "copying.dj" should accompany this file; if not, a copy +** should be available from where this file was obtained. This file +** may not be distributed without a verbatim copy of "copying.dj". +** +** This file is distributed WITHOUT ANY WARRANTY; without even the implied +** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +/* Modified to use SETJMP_DJ_H rather than SETJMP_H to avoid + conflicting with setjmp.h. Ian Taylor, Cygnus support, April, + 1993. */ + +#ifndef _SETJMP_DJ_H_ +#define _SETJMP_DJ_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + unsigned long eax; + unsigned long ebx; + unsigned long ecx; + unsigned long edx; + unsigned long esi; + unsigned long edi; + unsigned long ebp; + unsigned long esp; + unsigned long eip; +} jmp_buf[1]; + +extern int setjmp(jmp_buf); +extern void longjmp(jmp_buf, int); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/LAN/SRCS/dcload-ip/target-inc/machine/setjmp.h b/LAN/SRCS/dcload-ip/target-inc/machine/setjmp.h new file mode 100644 index 00000000..4656c0ff --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/machine/setjmp.h @@ -0,0 +1,168 @@ +#if defined(__arm__) || defined(__thumb__) +/* + * All callee preserved registers: + * v1 - v7, fp, ip, sp, lr, f4, f5, f6, f7 + */ +#define _JBLEN 23 +#endif + +#ifdef __sparc__ +/* + * onsstack,sigmask,sp,pc,npc,psr,g1,o0,wbcnt (sigcontext). + * All else recovered by under/over(flow) handling. + */ +#define _JBLEN 13 +#endif + +/* necv70 was 9 as well. */ + +#ifdef __mc68000__ +/* + * onsstack,sigmask,sp,pc,psl,d2-d7,a2-a6, + * fp2-fp7 for 68881. + * All else recovered by under/over(flow) handling. + */ +#define _JBLEN 34 +#endif + +#if defined(__Z8001__) || defined(__Z8002__) +/* 16 regs + pc */ +#define _JBLEN 20 +#endif + +#ifdef _AM29K +/* + * onsstack,sigmask,sp,pc,npc,psr,g1,o0,wbcnt (sigcontext). + * All else recovered by under/over(flow) handling. + */ +#define _JBLEN 9 +#endif + +#if defined(__CYGWIN__) && !defined (_JBLEN) +#define _JBLEN (13 * 4) +#elif defined (__i386__) +#ifdef __unix__ +# define _JBLEN 36 +#else +#include "setjmp-dj.h" +#endif +#endif + +#ifdef __i960__ +#define _JBLEN 35 +#endif + +#ifdef __M32R__ +/* Only 8 words are currently needed. 10 gives us some slop if we need + to expand. */ +#define _JBLEN 10 +#endif + +#ifdef __mips__ +#define _JBLEN 11 +#endif + +#ifdef __m88000__ +#define _JBLEN 21 +#endif + +#ifdef __H8300__ +#define _JBLEN 5 +typedef int jmp_buf[_JBLEN]; +#endif + +#ifdef __H8300H__ +/* same as H8/300 but registers are twice as big */ +#define _JBLEN 5 +#define _JBTYPE long +#endif + +#ifdef __H8300S__ +/* same as H8/300 but registers are twice as big */ +#define _JBLEN 5 +#define _JBTYPE long +#endif + +#ifdef __H8500__ +#define _JBLEN 4 +#endif + +#ifdef __sh__ +#define _JBLEN 20 +#endif + +#ifdef __v800 +#define _JBLEN 28 +#endif + +#ifdef __PPC__ +#define _JBLEN 32 +#define _JBTYPE double +#endif + +#ifdef __hppa__ +/* %r30, %r2-%r18, %r27, pad, %fr12-%fr15. + Note space exists for the FP registers, but they are not + saved. */ +#define _JBLEN 28 +#endif + +#if defined(__mn10300__) || defined(__mn10200__) +/* A guess */ +#define _JBLEN 10 +#endif + +#ifdef __v850 +/* I think our setjmp is saving 15 regs at the moment. Gives us one word + slop if we need to expand. */ +#define _JBLEN 16 +#endif + +#ifdef __TIC80__ +#define _JBLEN 13 +#endif + +#ifdef __D10V__ +#define _JBLEN 8 +#endif + +#ifdef __D30V__ +#define _JBLEN ((64 /* GPR */ + (2*2) /* ACs */ + 18 /* CRs */) / 2) +#define _JBTYPE double +#endif + + +#ifdef __fr30__ +#define _JBLEN 10 +#endif + +#ifdef __mcore__ +#define _JBLEN 16 +#endif + +#ifdef _JBLEN +#ifdef _JBTYPE +typedef _JBTYPE jmp_buf[_JBLEN]; +#else +typedef int jmp_buf[_JBLEN]; +#endif + +#if defined(__CYGWIN32__) || defined(__rtems__) +#include + +/* POSIX sigsetjmp/siglongjmp macros */ +typedef int sigjmp_buf[_JBLEN+2]; + +#define _SAVEMASK _JBLEN +#define _SIGMASK (_JBLEN+1) + +#define sigsetjmp(env, savemask) (env[_SAVEMASK] = savemask,\ + sigprocmask (SIG_SETMASK, 0, (sigset_t *) &env[_SIGMASK]),\ + setjmp (env)) + +#define siglongjmp(env, val) (((env[_SAVEMASK])?\ + sigprocmask (SIG_SETMASK, (sigset_t *) &env[_SIGMASK], 0):0),\ + longjmp (env, val)) + +#endif /* __CYGWIN32__ or __rtems__ */ +#endif diff --git a/LAN/SRCS/dcload-ip/target-inc/machine/time.h b/LAN/SRCS/dcload-ip/target-inc/machine/time.h new file mode 100644 index 00000000..13857bfd --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/machine/time.h @@ -0,0 +1,10 @@ +#ifndef _MACHTIME_H_ +#define _MACHTIME_H_ + +#if defined(__arm__) || defined(__thumb__) +#define _CLOCKS_PER_SEC_ 100 +#endif + +#endif /* _MACHTIME_H_ */ + + diff --git a/LAN/SRCS/dcload-ip/target-inc/machine/types.h b/LAN/SRCS/dcload-ip/target-inc/machine/types.h new file mode 100644 index 00000000..b71a67f5 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/machine/types.h @@ -0,0 +1,9 @@ +#ifndef _MACHTYPES_H_ +#define _MACHTYPES_H_ + +#define _CLOCK_T_ unsigned long /* clock() */ +#define _TIME_T_ long /* time() */ + +#endif /* _MACHTYPES_H_ */ + + diff --git a/LAN/SRCS/dcload-ip/target-inc/malloc.h b/LAN/SRCS/dcload-ip/target-inc/malloc.h new file mode 100644 index 00000000..64abe91c --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/malloc.h @@ -0,0 +1,97 @@ +/* malloc.h -- header file for memory routines. */ + +#ifndef _INCLUDE_MALLOC_H_ +#define _INCLUDE_MALLOC_H_ + +#include <_ansi.h> +#include + +#define __need_size_t +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* This version of struct mallinfo must match the one in + libc/stdlib/mallocr.c. */ + +struct mallinfo { + int arena; /* total space allocated from system */ + int ordblks; /* number of non-inuse chunks */ + int smblks; /* unused -- always zero */ + int hblks; /* number of mmapped regions */ + int hblkhd; /* total space in mmapped regions */ + int usmblks; /* unused -- always zero */ + int fsmblks; /* unused -- always zero */ + int uordblks; /* total allocated space */ + int fordblks; /* total non-inuse space */ + int keepcost; /* top-most, releasable (via malloc_trim) space */ +}; + +/* The routines. */ + +extern _PTR malloc _PARAMS ((size_t)); +extern _PTR _malloc_r _PARAMS ((struct _reent *, size_t)); + +extern _VOID free _PARAMS ((_PTR)); +extern _VOID _free_r _PARAMS ((struct _reent *, _PTR)); + +extern _PTR realloc _PARAMS ((_PTR, size_t)); +extern _PTR _realloc_r _PARAMS ((struct _reent *, _PTR, size_t)); + +extern _PTR calloc _PARAMS ((size_t, size_t)); +extern _PTR _calloc_r _PARAMS ((struct _reent *, size_t, size_t)); + +extern _PTR memalign _PARAMS ((size_t, size_t)); +extern _PTR _memalign_r _PARAMS ((struct _reent *, size_t, size_t)); + +extern struct mallinfo mallinfo _PARAMS ((void)); +extern struct mallinfo _mallinfo_r _PARAMS ((struct _reent *)); + +extern void malloc_stats _PARAMS ((void)); +extern void _malloc_stats_r _PARAMS ((struct _reent *)); + +extern int mallopt _PARAMS ((int, int)); +extern int _mallopt_r _PARAMS ((struct _reent *, int, int)); + +extern size_t malloc_usable_size _PARAMS ((_PTR)); +extern size_t _malloc_usable_size_r _PARAMS ((struct _reent *, _PTR)); + +/* These aren't too useful on an embedded system, but we define them + anyhow. */ + +extern _PTR valloc _PARAMS ((size_t)); +extern _PTR _valloc_r _PARAMS ((struct _reent *, size_t)); + +extern _PTR pvalloc _PARAMS ((size_t)); +extern _PTR _pvalloc_r _PARAMS ((struct _reent *, size_t)); + +extern int malloc_trim _PARAMS ((size_t)); +extern int _malloc_trim_r _PARAMS ((struct _reent *, size_t)); + +/* Some systems provide this, so do too for compatibility. */ + +extern void cfree _PARAMS ((_PTR)); + +/* A compatibility routine for an earlier version of the allocator. */ + +extern _VOID mstats _PARAMS ((char *)); +extern _VOID _mstats_r _PARAMS ((struct _reent *, char *)); + +#ifdef __CYGWIN32__ + +/* Cygwin32 needs to be able to copy all the malloc information from + the parent to the child. However, cygwin32 does not normally copy + any data in the DLL data section. This routine handles copying + that information. */ + +extern int __malloc_copy _PARAMS ((int (*) (void *, void *, void *, int), + void *, int)); +#endif /* __CYGWIN32 */ + +#ifdef __cplusplus +} +#endif + +#endif /* _INCLUDE_MALLOC_H_ */ diff --git a/LAN/SRCS/dcload-ip/target-inc/math.h b/LAN/SRCS/dcload-ip/target-inc/math.h new file mode 100644 index 00000000..d3f2e99a --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/math.h @@ -0,0 +1,273 @@ +/* math.h -- Definitions for the math floating point package. */ + +#ifndef _MATH_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _MATH_H_ + +#include +#include +#include "_ansi.h" + +#ifndef HUGE_VAL + +/* Define HUGE_VAL as infinity, unless HUGE_VAL is already defined + (which might have been done by something like math-68881.h). */ + +union __dmath +{ + __uint32_t i[2]; + double d; +}; + +extern const union __dmath __infinity; + +#define HUGE_VAL (__infinity.d) + +#endif /* ! defined (HUGE_VAL) */ + +/* Reentrant ANSI C functions. */ + +#ifndef __math_68881 +extern double atan _PARAMS((double)); +extern double cos _PARAMS((double)); +extern double sin _PARAMS((double)); +extern double tan _PARAMS((double)); +extern double tanh _PARAMS((double)); +extern double frexp _PARAMS((double, int *)); +extern double modf _PARAMS((double, double *)); +extern double ceil _PARAMS((double)); +extern double fabs _PARAMS((double)); +extern double floor _PARAMS((double)); +#endif /* ! defined (__math_68881) */ + +/* Non reentrant ANSI C functions. */ + +#ifndef _REENT_ONLY +#ifndef __math_6881 +extern double acos _PARAMS((double)); +extern double asin _PARAMS((double)); +extern double atan2 _PARAMS((double, double)); +extern double cosh _PARAMS((double)); +extern double sinh _PARAMS((double)); +extern double exp _PARAMS((double)); +extern double ldexp _PARAMS((double, int)); +extern double log _PARAMS((double)); +extern double log10 _PARAMS((double)); +extern double pow _PARAMS((double, double)); +extern double sqrt _PARAMS((double)); +extern double fmod _PARAMS((double, double)); +#endif /* ! defined (__math_68881) */ +#endif /* ! defined (_REENT_ONLY) */ + +#ifndef __STRICT_ANSI__ + +/* Non ANSI double precision functions. */ + +extern double infinity _PARAMS((void)); +extern double nan _PARAMS((void)); +extern int isnan _PARAMS((double)); +extern int isinf _PARAMS((double)); +extern int finite _PARAMS((double)); +extern double copysign _PARAMS((double, double)); +extern int ilogb _PARAMS((double)); + +extern double asinh _PARAMS((double)); +extern double cbrt _PARAMS((double)); +extern double nextafter _PARAMS((double, double)); +extern double rint _PARAMS((double)); +extern double scalbn _PARAMS((double, int)); + +#ifndef __math_68881 +extern double log1p _PARAMS((double)); +extern double expm1 _PARAMS((double)); +#endif /* ! defined (__math_68881) */ + +#ifndef _REENT_ONLY +extern double acosh _PARAMS((double)); +extern double atanh _PARAMS((double)); +extern double remainder _PARAMS((double, double)); +extern double gamma _PARAMS((double)); +extern double gamma_r _PARAMS((double, int *)); +extern double lgamma _PARAMS((double)); +extern double lgamma_r _PARAMS((double, int *)); +extern double erf _PARAMS((double)); +extern double erfc _PARAMS((double)); +extern double y0 _PARAMS((double)); +extern double y1 _PARAMS((double)); +extern double yn _PARAMS((int, double)); +extern double j0 _PARAMS((double)); +extern double j1 _PARAMS((double)); +extern double jn _PARAMS((int, double)); +#define log2(x) (log (x) / M_LOG2_E) + +#ifndef __math_68881 +extern double hypot _PARAMS((double, double)); +#endif + +extern double cabs(); +extern double drem _PARAMS((double, double)); + +#endif /* ! defined (_REENT_ONLY) */ + +/* Single precision versions of ANSI functions. */ + +extern float atanf _PARAMS((float)); +extern float cosf _PARAMS((float)); +extern float sinf _PARAMS((float)); +extern float tanf _PARAMS((float)); +extern float tanhf _PARAMS((float)); +extern float frexpf _PARAMS((float, int *)); +extern float modff _PARAMS((float, float *)); +extern float ceilf _PARAMS((float)); +extern float fabsf _PARAMS((float)); +extern float floorf _PARAMS((float)); + +#ifndef _REENT_ONLY +extern float acosf _PARAMS((float)); +extern float asinf _PARAMS((float)); +extern float atan2f _PARAMS((float, float)); +extern float coshf _PARAMS((float)); +extern float sinhf _PARAMS((float)); +extern float expf _PARAMS((float)); +extern float ldexpf _PARAMS((float, int)); +extern float logf _PARAMS((float)); +extern float log10f _PARAMS((float)); +extern float powf _PARAMS((float, float)); +extern float sqrtf _PARAMS((float)); +extern float fmodf _PARAMS((float, float)); +#endif /* ! defined (_REENT_ONLY) */ + +/* Other single precision functions. */ + +extern float infinityf _PARAMS((void)); +extern float nanf _PARAMS((void)); +extern int isnanf _PARAMS((float)); +extern int isinff _PARAMS((float)); +extern int finitef _PARAMS((float)); +extern float copysignf _PARAMS((float, float)); +extern int ilogbf _PARAMS((float)); + +extern float asinhf _PARAMS((float)); +extern float cbrtf _PARAMS((float)); +extern float nextafterf _PARAMS((float, float)); +extern float rintf _PARAMS((float)); +extern float scalbnf _PARAMS((float, int)); +extern float log1pf _PARAMS((float)); +extern float expm1f _PARAMS((float)); + +#ifndef _REENT_ONLY +extern float acoshf _PARAMS((float)); +extern float atanhf _PARAMS((float)); +extern float remainderf _PARAMS((float, float)); +extern float gammaf _PARAMS((float)); +extern float gammaf_r _PARAMS((float, int *)); +extern float lgammaf _PARAMS((float)); +extern float lgammaf_r _PARAMS((float, int *)); +extern float erff _PARAMS((float)); +extern float erfcf _PARAMS((float)); +extern float y0f _PARAMS((float)); +extern float y1f _PARAMS((float)); +extern float ynf _PARAMS((int, float)); +extern float j0f _PARAMS((float)); +extern float j1f _PARAMS((float)); +extern float jnf _PARAMS((int, float)); +#define log2f(x) (logf (x) / (float) M_LOG2_E) +extern float hypotf _PARAMS((float, float)); + +extern float cabsf(); +extern float dremf _PARAMS((float, float)); + +#endif /* ! defined (_REENT_ONLY) */ + +/* The gamma functions use a global variable, signgam. */ + +extern int signgam; + +/* The exception structure passed to the matherr routine. */ + +#ifdef __cplusplus +struct __exception +#else +struct exception +#endif +{ + int type; + char *name; + double arg1; + double arg2; + double retval; + int err; +}; + +#ifdef __cplusplus +extern int matherr _PARAMS((struct __exception *e)); +#else +extern int matherr _PARAMS((struct exception *e)); +#endif + +/* Values for the type field of struct exception. */ + +#define DOMAIN 1 +#define SING 2 +#define OVERFLOW 3 +#define UNDERFLOW 4 +#define TLOSS 5 +#define PLOSS 6 + +/* Useful constants. */ + +#define M_E 2.7182818284590452354 +#define M_LOG2E 1.4426950408889634074 +#define M_LOG10E 0.43429448190325182765 +#define M_LN2 0.69314718055994530942 +#define M_LN10 2.30258509299404568402 +#define M_PI 3.14159265358979323846 +#define M_TWOPI (M_PI * 2.0) +#define M_PI_2 1.57079632679489661923 +#define M_PI_4 0.78539816339744830962 +#define M_3PI_4 2.3561944901923448370E0 +#define M_SQRTPI 1.77245385090551602792981 +#define M_1_PI 0.31830988618379067154 +#define M_2_PI 0.63661977236758134308 +#define M_2_SQRTPI 1.12837916709551257390 +#define M_SQRT2 1.41421356237309504880 +#define M_SQRT1_2 0.70710678118654752440 +#define M_LN2LO 1.9082149292705877000E-10 +#define M_LN2HI 6.9314718036912381649E-1 +#define M_SQRT3 1.73205080756887719000 +#define M_IVLN10 0.43429448190325182765 /* 1 / log(10) */ +#define M_LOG2_E 0.693147180559945309417 +#define M_INVLN2 1.4426950408889633870E0 /* 1 / log(2) */ + +/* Global control over fdlibm error handling. */ + +enum __fdlibm_version +{ + __fdlibm_ieee = -1, + __fdlibm_svid, + __fdlibm_xopen, + __fdlibm_posix +}; + +#define _LIB_VERSION_TYPE enum __fdlibm_version +#define _LIB_VERSION __fdlib_version + +extern _CONST _LIB_VERSION_TYPE _LIB_VERSION; + +#define _IEEE_ __fdlibm_ieee +#define _SVID_ __fdlibm_svid +#define _XOPEN_ __fdlibm_xopen +#define _POSIX_ __fdlibm_posix + +#endif /* ! defined (__STRICT_ANSI__) */ + +#ifdef __FAST_MATH__ +#include +#endif + +#ifdef __cplusplus +} +#endif +#endif /* _MATH_H_ */ diff --git a/LAN/SRCS/dcload-ip/target-inc/paths.h b/LAN/SRCS/dcload-ip/target-inc/paths.h new file mode 100644 index 00000000..36cf78a9 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/paths.h @@ -0,0 +1,7 @@ +#ifndef _PATHS_H_ +#define _PATHS_H_ + +#define _PATH_DEV "/dev/" +#define _PATH_BSHELL "/bin/sh" + +#endif /* _PATHS_H_ */ diff --git a/LAN/SRCS/dcload-ip/target-inc/process.h b/LAN/SRCS/dcload-ip/target-inc/process.h new file mode 100644 index 00000000..ca5b451c --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/process.h @@ -0,0 +1,60 @@ +/* process.h. This file comes with MSDOS and WIN32 systems. */ + +#ifndef __PROCESS_H_ +#define __PROCESS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +int execl(const char *path, const char *argv0, ...); +int execle(const char *path, const char *argv0, ... /*, char * const *envp */); +int execlp(const char *path, const char *argv0, ...); +int execlpe(const char *path, const char *argv0, ... /*, char * const *envp */); + +int execv(const char *path, char * const *argv); +int execve(const char *path, char * const *argv, char * const *envp); +int execvp(const char *path, char * const *argv); +int execvpe(const char *path, char * const *argv, char * const *envp); + +int spawnl(int mode, const char *path, const char *argv0, ...); +int spawnle(int mode, const char *path, const char *argv0, ... /*, char * const *envp */); +int spawnlp(int mode, const char *path, const char *argv0, ...); +int spawnlpe(int mode, const char *path, const char *argv0, ... /*, char * const *envp */); + +int spawnv(int mode, const char *path, const char * const *argv); +int spawnve(int mode, const char *path, char * const *argv, const char * const *envp); +int spawnvp(int mode, const char *path, const char * const *argv); +int spawnvpe(int mode, const char *path, const char * const *argv, const char * const *envp); + +#ifdef __CYGWIN32__ +/* Secure exec() functions family */ +/* The first arg should really be a HANDLE which is a void *. But we + can't include windows.h here so... */ +#include +pid_t sexecl(void *, const char *path, const char *argv0, ...); +pid_t sexecle(void *, const char *path, const char *argv0, ... /*, char * const *envp */); +pid_t sexeclp(void *, const char *path, const char *argv0, ...); +pid_t sexeclpe(void *, const char *path, const char *argv0, ... /*, char * const *envp */); + +pid_t sexecv(void *, const char *path, const char * const *argv); +pid_t sexecve(void *, const char *path, const char * const *argv, const char * const *envp); +pid_t sexecvp(void *, const char *path, const char * const *argv); +pid_t sexecvpe(void *, const char *path, const char * const *argv, const char * const *envp); +#endif + +int cwait(int *, int, int); + +#define _P_WAIT 1 +#define _P_NOWAIT 2 /* always generates error */ +#define _P_OVERLAY 3 +#define _P_NOWAITO 4 +#define _P_DETACH 5 + +#define WAIT_CHILD 1 + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/LAN/SRCS/dcload-ip/target-inc/pwd.h b/LAN/SRCS/dcload-ip/target-inc/pwd.h new file mode 100644 index 00000000..59d6ab55 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/pwd.h @@ -0,0 +1,76 @@ +/*- + * Copyright (c) 1989 The Regents of the University of California. + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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. + * + * @(#)pwd.h 5.13 (Berkeley) 5/28/91 + */ + +#ifndef _PWD_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _PWD_H_ + +#include + +#ifndef _POSIX_SOURCE +#define _PATH_PASSWD "/etc/passwd" + +#define _PASSWORD_LEN 128 /* max length, not counting NULL */ +#endif + +struct passwd { + char *pw_name; /* user name */ + char *pw_passwd; /* encrypted password */ + int pw_uid; /* user uid */ + int pw_gid; /* user gid */ + char *pw_comment; /* comment */ + char *pw_gecos; /* Honeywell login info */ + char *pw_dir; /* home directory */ + char *pw_shell; /* default shell */ +}; + +struct passwd *getpwuid (uid_t); +struct passwd *getpwnam (const char *); +int getpwnam_r (const char *, struct passwd *, + char *, size_t , struct passwd **); +int getpwuid_r (uid_t, struct passwd *, char *, + size_t, struct passwd **); +#ifndef _POSIX_SOURCE +struct passwd *getpwent (void); +void setpwent (void); +void endpwent (void); +#endif + +#ifdef __cplusplus +} +#endif +#endif /* _PWD_H_ */ diff --git a/LAN/SRCS/dcload-ip/target-inc/reent.h b/LAN/SRCS/dcload-ip/target-inc/reent.h new file mode 100644 index 00000000..56fae91a --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/reent.h @@ -0,0 +1,87 @@ +/* This header file provides the reentrancy. */ + +/* The reentrant system calls here serve two purposes: + + 1) Provide reentrant versions of the system calls the ANSI C library + requires. + 2) Provide these system calls in a namespace clean way. + + It is intended that *all* system calls that the ANSI C library needs + be declared here. It documents them all in one place. All library access + to the system is via some form of these functions. + + There are three ways a target may provide the needed syscalls. + + 1) Define the reentrant versions of the syscalls directly. + (eg: _open_r, _close_r, etc.). Please keep the namespace clean. + When you do this, set "syscall_dir" to "syscalls" in configure.in, + and add -DREENTRANT_SYSCALLS_PROVIDED to target_cflags in configure.in. + + 2) Define namespace clean versions of the system calls by prefixing + them with '_' (eg: _open, _close, etc.). Technically, there won't be + true reentrancy at the syscall level, but the library will be namespace + clean. + When you do this, set "syscall_dir" to "syscalls" in configure.in. + + 3) Define or otherwise provide the regular versions of the syscalls + (eg: open, close, etc.). The library won't be reentrant nor namespace + clean, but at least it will work. + When you do this, add -DMISSING_SYSCALL_NAMES to target_cflags in + configure.in. + + Stubs of the reentrant versions of the syscalls exist in the libc/reent + source directory and are used if REENTRANT_SYSCALLS_PROVIDED isn't defined. + They use the native system calls: _open, _close, etc. if they're available + (MISSING_SYSCALL_NAMES is *not* defined), otherwise open, close, etc. + (MISSING_SYSCALL_NAMES *is* defined). */ + +/* WARNING: All identifiers here must begin with an underscore. This file is + included by stdio.h and others and we therefore must only use identifiers + in the namespace allotted to us. */ + +#ifndef _REENT_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _REENT_H_ + +#include +#include +#include + +#define __need_size_t +#include + +/* FIXME: not namespace clean */ +struct stat; +struct tms; +struct timeval; +struct timezone; + +/* Reentrant versions of system calls. */ + +extern int _close_r _PARAMS ((struct _reent *, int)); +extern int _execve_r _PARAMS ((struct _reent *, char *, char **, char **)); +extern int _fcntl_r _PARAMS ((struct _reent *, int, int, int)); +extern int _fork_r _PARAMS ((struct _reent *)); +extern int _fstat_r _PARAMS ((struct _reent *, int, struct stat *)); +extern int _getpid_r _PARAMS ((struct _reent *)); +extern int _kill_r _PARAMS ((struct _reent *, int, int)); +extern int _link_r _PARAMS ((struct _reent *, const char *, const char *)); +extern _off_t _lseek_r _PARAMS ((struct _reent *, int, _off_t, int)); +extern int _open_r _PARAMS ((struct _reent *, const char *, int, int)); +extern _ssize_t _read_r _PARAMS ((struct _reent *, int, void *, size_t)); +extern void *_sbrk_r _PARAMS ((struct _reent *, size_t)); +extern int _stat_r _PARAMS ((struct _reent *, const char *, struct stat *)); +extern _CLOCK_T_ _times_r _PARAMS ((struct _reent *, struct tms *)); +extern int _unlink_r _PARAMS ((struct _reent *, const char *)); +extern int _wait_r _PARAMS ((struct _reent *, int *)); +extern _ssize_t _write_r _PARAMS ((struct _reent *, int, const void *, size_t)); + +/* This one is not guaranteed to be available on all targets. */ +extern int _gettimeofday_r _PARAMS ((struct _reent *, struct timeval *tp, struct timezone *tzp)); + +#ifdef __cplusplus +} +#endif +#endif /* _REENT_H_ */ diff --git a/LAN/SRCS/dcload-ip/target-inc/regdef.h b/LAN/SRCS/dcload-ip/target-inc/regdef.h new file mode 100644 index 00000000..8cf144b8 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/regdef.h @@ -0,0 +1,7 @@ +/* regdef.h -- define register names. */ + +/* This is a standard include file for MIPS targets. Other target + probably don't define it, and attempts to include this file will + fail. */ + +#include diff --git a/LAN/SRCS/dcload-ip/target-inc/setjmp.h b/LAN/SRCS/dcload-ip/target-inc/setjmp.h new file mode 100644 index 00000000..53d0223f --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/setjmp.h @@ -0,0 +1,22 @@ +/* + setjmp.h + stubs for future use. +*/ + +#ifndef _SETJMP_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _SETJMP_H_ + +#include "_ansi.h" +#include + +void _EXFUN(longjmp,(jmp_buf __jmpb, int __retval)); +int _EXFUN(setjmp,(jmp_buf __jmpb)); + +#ifdef __cplusplus +} +#endif +#endif /* _SETJMP_H_ */ + diff --git a/LAN/SRCS/dcload-ip/target-inc/signal.h b/LAN/SRCS/dcload-ip/target-inc/signal.h new file mode 100644 index 00000000..31114914 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/signal.h @@ -0,0 +1,37 @@ +#ifndef _SIGNAL_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _SIGNAL_H_ + +#include "_ansi.h" +#include + +typedef int sig_atomic_t; /* Atomic entity type (ANSI) */ + +#if defined(__STDC__) || defined(__cplusplus) +#define SIG_DFL ((void (*)(int))0) /* Default action */ +#define SIG_IGN ((void (*)(int))1) /* Ignore action */ +#define SIG_ERR ((void (*)(int))-1) /* Error return */ +#else +#define SIG_DFL ((void (*)())0) /* Default action */ +#define SIG_IGN ((void (*)())1) /* Ignore action */ +#define SIG_ERR ((void (*)())-1) /* Error return */ +#endif + +typedef void (*_sig_func_ptr) (int); + +struct _reent; + +_sig_func_ptr _EXFUN(_signal_r, (struct _reent *, int, _sig_func_ptr)); +int _EXFUN(_raise_r, (struct _reent *, int)); + +#ifndef _REENT_ONLY +_sig_func_ptr _EXFUN(signal, (int, _sig_func_ptr)); +int _EXFUN(raise, (int)); +#endif + +#ifdef __cplusplus +} +#endif +#endif /* _SIGNAL_H_ */ diff --git a/LAN/SRCS/dcload-ip/target-inc/stdio.h b/LAN/SRCS/dcload-ip/target-inc/stdio.h new file mode 100644 index 00000000..2c2b46cf --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/stdio.h @@ -0,0 +1,313 @@ +/* + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the University of California, Berkeley. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * @(#)stdio.h 5.3 (Berkeley) 3/15/86 + */ + +/* + * NB: to fit things in six character monocase externals, the + * stdio code uses the prefix `__s' for stdio objects, typically + * followed by a three-character attempt at a mnemonic. + */ + +#ifndef _STDIO_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _STDIO_H_ + +#include "_ansi.h" + +#define _FSTDIO /* ``function stdio'' */ + +#define __need_size_t +#include + +#define __need___va_list +#include + +/* + * defines __sFILE, _fpos_t. + * They must be defined there because struct _reent needs them (and we don't + * want reent.h to include this file. + */ + +#include + +typedef _fpos_t fpos_t; + +typedef struct __sFILE FILE; + +#define __SLBF 0x0001 /* line buffered */ +#define __SNBF 0x0002 /* unbuffered */ +#define __SRD 0x0004 /* OK to read */ +#define __SWR 0x0008 /* OK to write */ + /* RD and WR are never simultaneously asserted */ +#define __SRW 0x0010 /* open for reading & writing */ +#define __SEOF 0x0020 /* found EOF */ +#define __SERR 0x0040 /* found error */ +#define __SMBF 0x0080 /* _buf is from malloc */ +#define __SAPP 0x0100 /* fdopen()ed in append mode - so must write to end */ +#define __SSTR 0x0200 /* this is an sprintf/snprintf string */ +#define __SOPT 0x0400 /* do fseek() optimisation */ +#define __SNPT 0x0800 /* do not do fseek() optimisation */ +#define __SOFF 0x1000 /* set iff _offset is in fact correct */ +#define __SMOD 0x2000 /* true => fgetline modified _p text */ + +/* + * The following three definitions are for ANSI C, which took them + * from System V, which stupidly took internal interface macros and + * made them official arguments to setvbuf(), without renaming them. + * Hence, these ugly _IOxxx names are *supposed* to appear in user code. + * + * Although these happen to match their counterparts above, the + * implementation does not rely on that (so these could be renumbered). + */ +#define _IOFBF 0 /* setvbuf should set fully buffered */ +#define _IOLBF 1 /* setvbuf should set line buffered */ +#define _IONBF 2 /* setvbuf should set unbuffered */ + +#ifndef NULL +#define NULL 0 +#endif + +#define BUFSIZ 1024 +#define EOF (-1) + +#define FOPEN_MAX 20 /* must be <= OPEN_MAX */ +#define FILENAME_MAX 1024 /* must be <= PATH_MAX */ +#define L_tmpnam 1024 /* XXX must be == PATH_MAX */ +#ifndef __STRICT_ANSI__ +#define P_tmpdir "/tmp" +#endif + +#ifndef SEEK_SET +#define SEEK_SET 0 /* set file offset to offset */ +#endif +#ifndef SEEK_CUR +#define SEEK_CUR 1 /* set file offset to current plus offset */ +#endif +#ifndef SEEK_END +#define SEEK_END 2 /* set file offset to EOF plus offset */ +#endif + +#define TMP_MAX 26 + +#define stdin (_impure_ptr->_stdin) +#define stdout (_impure_ptr->_stdout) +#define stderr (_impure_ptr->_stderr) + +#define _stdin_r(x) ((x)->_stdin) +#define _stdout_r(x) ((x)->_stdout) +#define _stderr_r(x) ((x)->_stderr) + +/* + * Functions defined in ANSI C standard. + */ + +#ifdef __GNUC__ +#define __VALIST __gnuc_va_list +#else +#define __VALIST char* +#endif + +#ifndef _REENT_ONLY +int _EXFUN(remove, (const char *)); +int _EXFUN(rename, (const char *, const char *)); +#endif +char * _EXFUN(tempnam, (const char *, const char *)); +FILE * _EXFUN(tmpfile, (void)); +char * _EXFUN(tmpnam, (char *)); +int _EXFUN(fclose, (FILE *)); +int _EXFUN(fflush, (FILE *)); +FILE * _EXFUN(freopen, (const char *, const char *, FILE *)); +void _EXFUN(setbuf, (FILE *, char *)); +int _EXFUN(setvbuf, (FILE *, char *, int, size_t)); +int _EXFUN(fprintf, (FILE *, const char *, ...)); +int _EXFUN(fscanf, (FILE *, const char *, ...)); +int _EXFUN(printf, (const char *, ...)); +int _EXFUN(scanf, (const char *, ...)); +int _EXFUN(sscanf, (const char *, const char *, ...)); +int _EXFUN(vfprintf, (FILE *, const char *, __VALIST)); +int _EXFUN(vprintf, (const char *, __VALIST)); +int _EXFUN(vsprintf, (char *, const char *, __VALIST)); +int _EXFUN(vsnprintf, (char *, size_t, const char *, __VALIST)); +int _EXFUN(fgetc, (FILE *)); +char * _EXFUN(fgets, (char *, int, FILE *)); +int _EXFUN(fputc, (int, FILE *)); +int _EXFUN(fputs, (const char *, FILE *)); +int _EXFUN(getc, (FILE *)); +int _EXFUN(getchar, (void)); +char * _EXFUN(gets, (char *)); +int _EXFUN(putc, (int, FILE *)); +int _EXFUN(putchar, (int)); +int _EXFUN(puts, (const char *)); +int _EXFUN(ungetc, (int, FILE *)); +size_t _EXFUN(fread, (_PTR, size_t _size, size_t _n, FILE *)); +size_t _EXFUN(fwrite, (const _PTR , size_t _size, size_t _n, FILE *)); +int _EXFUN(fgetpos, (FILE *, fpos_t *)); +int _EXFUN(fseek, (FILE *, long, int)); +int _EXFUN(fsetpos, (FILE *, const fpos_t *)); +long _EXFUN(ftell, ( FILE *)); +void _EXFUN(rewind, (FILE *)); +void _EXFUN(clearerr, (FILE *)); +int _EXFUN(feof, (FILE *)); +int _EXFUN(ferror, (FILE *)); +void _EXFUN(perror, (const char *)); +#ifndef _REENT_ONLY +FILE * _EXFUN(fopen, (const char *_name, const char *_type)); +int _EXFUN(sprintf, (char *, const char *, ...)); +int _EXFUN(snprintf, (char *, size_t, const char *, ...)); +#endif +#ifndef __STRICT_ANSI__ +int _EXFUN(vfiprintf, (FILE *, const char *, __VALIST)); +int _EXFUN(iprintf, (const char *, ...)); +int _EXFUN(fiprintf, (FILE *, const char *, ...)); +int _EXFUN(siprintf, (char *, const char *, ...)); +#endif + +/* + * Routines in POSIX 1003.1. + */ + +#ifndef __STRICT_ANSI__ +#ifndef _REENT_ONLY +FILE * _EXFUN(fdopen, (int, const char *)); +#endif +int _EXFUN(fileno, (FILE *)); +int _EXFUN(getw, (FILE *)); +int _EXFUN(pclose, (FILE *)); +FILE * _EXFUN(popen, (const char *, const char *)); +int _EXFUN(putw, (int, FILE *)); +void _EXFUN(setbuffer, (FILE *, char *, int)); +int _EXFUN(setlinebuf, (FILE *)); +#endif + +/* + * Recursive versions of the above. + */ + +FILE * _EXFUN(_fdopen_r, (struct _reent *, int, const char *)); +FILE * _EXFUN(_fopen_r, (struct _reent *, const char *, const char *)); +int _EXFUN(_getchar_r, (struct _reent *)); +char * _EXFUN(_gets_r, (struct _reent *, char *)); +int _EXFUN(_iprintf_r, (struct _reent *, const char *, ...)); +int _EXFUN(_mkstemp_r, (struct _reent *, char *)); +char * _EXFUN(_mktemp_r, (struct _reent *, char *)); +void _EXFUN(_perror_r, (struct _reent *, const char *)); +int _EXFUN(_printf_r, (struct _reent *, const char *, ...)); +int _EXFUN(_putchar_r, (struct _reent *, int)); +int _EXFUN(_puts_r, (struct _reent *, const char *)); +int _EXFUN(_remove_r, (struct _reent *, const char *)); +int _EXFUN(_rename_r, (struct _reent *, + const char *_old, const char *_new)); +int _EXFUN(_scanf_r, (struct _reent *, const char *, ...)); +int _EXFUN(_sprintf_r, (struct _reent *, char *, const char *, ...)); +int _EXFUN(_snprintf_r, (struct _reent *, char *, size_t, const char *, ...)); +char * _EXFUN(_tempnam_r, (struct _reent *, const char *, const char *)); +FILE * _EXFUN(_tmpfile_r, (struct _reent *)); +char * _EXFUN(_tmpnam_r, (struct _reent *, char *)); +int _EXFUN(_vfprintf_r, (struct _reent *, FILE *, const char *, __VALIST)); +int _EXFUN(_vprintf_r, (struct _reent *, const char *, __VALIST)); +int _EXFUN(_vsprintf_r, (struct _reent *, char *, const char *, __VALIST)); +int _EXFUN(_vsnprintf_r, (struct _reent *, char *, size_t, const char *, __VALIST)); + +/* + * Routines internal to the implementation. + */ + +int _EXFUN(__srget, (FILE *)); +int _EXFUN(__swbuf, (int, FILE *)); + +/* + * Stdio function-access interface. + */ + +#ifndef __STRICT_ANSI__ +FILE *_EXFUN(funopen,(const _PTR _cookie, + int (*readfn)(_PTR _cookie, char *_buf, int _n), + int (*writefn)(_PTR _cookie, const char *_buf, int _n), + fpos_t (*seekfn)(_PTR _cookie, fpos_t _off, int _whence), + int (*closefn)(_PTR _cookie))); + +#define fropen(cookie, fn) funopen(cookie, fn, (int (*)())0, (fpos_t (*)())0, (int (*)())0) +#define fwopen(cookie, fn) funopen(cookie, (int (*)())0, fn, (fpos_t (*)())0, (int (*)())0) +#endif + +/* + * The __sfoo macros are here so that we can + * define function versions in the C library. + */ +#define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++)) +#ifdef _never /* __GNUC__ */ +/* If this inline is actually used, then systems using coff debugging + info get hopelessly confused. 21sept93 rich@cygnus.com. */ +static __inline int __sputc(int _c, FILE *_p) { + if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n')) + return (*_p->_p++ = _c); + else + return (__swbuf(_c, _p)); +} +#else +/* + * This has been tuned to generate reasonable code on the vax using pcc + */ +#define __sputc(c, p) \ + (--(p)->_w < 0 ? \ + (p)->_w >= (p)->_lbfsize ? \ + (*(p)->_p = (c)), *(p)->_p != '\n' ? \ + (int)*(p)->_p++ : \ + __swbuf('\n', p) : \ + __swbuf((int)(c), p) : \ + (*(p)->_p = (c), (int)*(p)->_p++)) +#endif + +#define __sfeof(p) (((p)->_flags & __SEOF) != 0) +#define __sferror(p) (((p)->_flags & __SERR) != 0) +#define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF))) +#define __sfileno(p) ((p)->_file) + +#define feof(p) __sfeof(p) +#define ferror(p) __sferror(p) +#define clearerr(p) __sclearerr(p) + +#if 0 /*ndef __STRICT_ANSI__ - FIXME: must initialize stdio first, use fn */ +#define fileno(p) __sfileno(p) +#endif + +#ifndef lint +#define getc(fp) __sgetc(fp) +#define putc(x, fp) __sputc(x, fp) +#endif /* lint */ + +#define getchar() getc(stdin) +#define putchar(x) putc(x, stdout) + +#ifndef __STRICT_ANSI__ +/* fast always-buffered version, true iff error */ +#define fast_putc(x,p) (--(p)->_w < 0 ? \ + __swbuf((int)(x), p) == EOF : (*(p)->_p = (x), (p)->_p++, 0)) + +#define L_cuserid 9 /* posix says it goes in stdio.h :( */ +#ifdef __CYGWIN32__ +#define L_ctermid 16 +#endif +#endif + +#ifdef __cplusplus +} +#endif +#endif /* _STDIO_H_ */ diff --git a/LAN/SRCS/dcload-ip/target-inc/stdlib.h b/LAN/SRCS/dcload-ip/target-inc/stdlib.h new file mode 100644 index 00000000..5300663f --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/stdlib.h @@ -0,0 +1,140 @@ +/* + * stdlib.h + * + * Definitions for common types, variables, and functions. + */ + +#ifndef _STDLIB_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _STDLIB_H_ + +#include "_ansi.h" + +#define __need_size_t +#define __need_wchar_t +#include + +#include + +typedef struct +{ + int quot; /* quotient */ + int rem; /* remainder */ +} div_t; + +typedef struct +{ + long quot; /* quotient */ + long rem; /* remainder */ +} ldiv_t; + +#ifndef NULL +#define NULL 0 +#endif + +#define EXIT_FAILURE 1 +#define EXIT_SUCCESS 0 + +#define RAND_MAX 0x7fffffff + +#if (defined(__CYGWIN__) || defined(__CYGWIN32__)) && ! defined(_COMPILING_NEWLIB) +extern __declspec(dllimport) int __mb_cur_max; +#else +extern int __mb_cur_max; +#endif + +#define MB_CUR_MAX __mb_cur_max + +_VOID _EXFUN(abort,(_VOID) _ATTRIBUTE ((noreturn))); +int _EXFUN(abs,(int)); +int _EXFUN(atexit,(_VOID (*__func)(_VOID))); +double _EXFUN(atof,(const char *__nptr)); +#ifndef __STRICT_ANSI__ +float _EXFUN(atoff,(const char *__nptr)); +#endif +int _EXFUN(atoi,(const char *__nptr)); +long _EXFUN(atol,(const char *__nptr)); +_PTR _EXFUN(bsearch,(const _PTR __key, + const _PTR __base, + size_t __nmemb, + size_t __size, + int _EXFUN((*_compar),(const _PTR, const _PTR)))); +_PTR _EXFUN(calloc,(size_t __nmemb, size_t __size)); +div_t _EXFUN(div,(int __numer, int __denom)); +_VOID _EXFUN(exit,(int __status) _ATTRIBUTE ((noreturn))); +_VOID _EXFUN(free,(_PTR)); +char * _EXFUN(getenv,(const char *__string)); +char * _EXFUN(_getenv_r,(struct _reent *, const char *__string)); +char * _EXFUN(_findenv,(_CONST char *, int *)); +char * _EXFUN(_findenv_r,(struct _reent *, _CONST char *, int *)); +long _EXFUN(labs,(long)); +ldiv_t _EXFUN(ldiv,(long __numer, long __denom)); +_PTR _EXFUN(malloc,(size_t __size)); +int _EXFUN(mblen,(const char *, size_t)); +int _EXFUN(_mblen_r,(struct _reent *, const char *, size_t, int *)); +int _EXFUN(mbtowc,(wchar_t *, const char *, size_t)); +int _EXFUN(_mbtowc_r,(struct _reent *, wchar_t *, const char *, size_t, int *)); +int _EXFUN(wctomb,(char *, wchar_t)); +int _EXFUN(_wctomb_r,(struct _reent *, char *, wchar_t, int *)); +size_t _EXFUN(mbstowcs,(wchar_t *, const char *, size_t)); +size_t _EXFUN(_mbstowcs_r,(struct _reent *, wchar_t *, const char *, size_t, int *)); +size_t _EXFUN(wcstombs,(char *, const wchar_t *, size_t)); +size_t _EXFUN(_wcstombs_r,(struct _reent *, char *, const wchar_t *, size_t, int *)); +_VOID _EXFUN(qsort,(_PTR __base, size_t __nmemb, size_t __size, int(*_compar)(const _PTR, const _PTR))); +int _EXFUN(rand,(_VOID)); +_PTR _EXFUN(realloc,(_PTR __r, size_t __size)); +_VOID _EXFUN(srand,(unsigned __seed)); +double _EXFUN(strtod,(const char *__n, char **_end_PTR)); +#ifndef __STRICT_ANSI__ +float _EXFUN(strtodf,(const char *__n, char **_end_PTR)); +#endif +long _EXFUN(strtol,(const char *__n, char **_end_PTR, int __base)); +unsigned long _EXFUN(strtoul,(const char *_n_PTR, char **_end_PTR, int __base)); +unsigned long _EXFUN(_strtoul_r,(struct _reent *,const char *_n_PTR, char **_end_PTR, int __base)); +int _EXFUN(system,(const char *__string)); + +#ifndef __STRICT_ANSI__ +_VOID _EXFUN(cfree,(_PTR)); +int _EXFUN(putenv,(const char *__string)); +int _EXFUN(setenv,(const char *__string, const char *__value, int __overwrite)); +int _EXFUN(_setenv_r,(struct _reent *, const char *__string, const char *__value, int __overwrite)); + +char * _EXFUN(gcvt,(double,int,char *)); +char * _EXFUN(gcvtf,(float,int,char *)); +char * _EXFUN(fcvt,(double,int,int *,int *)); +char * _EXFUN(fcvtf,(float,int,int *,int *)); +char * _EXFUN(ecvt,(double,int,int *,int *)); +char * _EXFUN(ecvtbuf,(double, int, int*, int*, char *)); +char * _EXFUN(fcvtbuf,(double, int, int*, int*, char *)); +char * _EXFUN(ecvtf,(float,int,int *,int *)); +char * _EXFUN(dtoa,(double, int, int, int *, int*, char**)); +int _EXFUN(rand_r,(unsigned *__seed)); + +#ifdef __CYGWIN32__ +char * _EXFUN(realpath,(const char *, char *)); +void _EXFUN(unsetenv,(const char *__string)); +int _EXFUN(random,(_VOID)); +long _EXFUN(srandom,(unsigned __seed)); +char * _EXFUN(ptsname, (int)); +int _EXFUN(grantpt, (int)); +int _EXFUN(unlockpt,(int)); +#endif + +#endif /* ! __STRICT_ANSI__ */ + +char * _EXFUN(_dtoa_r,(struct _reent *, double, int, int, int *, int*, char**)); +_PTR _EXFUN(_malloc_r,(struct _reent *, size_t)); +_PTR _EXFUN(_calloc_r,(struct _reent *, size_t, size_t)); +_VOID _EXFUN(_free_r,(struct _reent *, _PTR)); +_PTR _EXFUN(_realloc_r,(struct _reent *, _PTR, size_t)); +_VOID _EXFUN(_mstats_r,(struct _reent *, char *)); +int _EXFUN(_system_r,(struct _reent *, const char *)); + +_VOID _EXFUN(__eprintf,(const char *, const char *, unsigned int, const char *)); + +#ifdef __cplusplus +} +#endif +#endif /* _STDLIB_H_ */ diff --git a/LAN/SRCS/dcload-ip/target-inc/string.h b/LAN/SRCS/dcload-ip/target-inc/string.h new file mode 100644 index 00000000..40ba5440 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/string.h @@ -0,0 +1,90 @@ +/* + * string.h + * + * Definitions for memory and string functions. + */ + +#ifndef _STRING_H_ +#define _STRING_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "_ansi.h" + +#define __need_size_t +#include + +#ifndef NULL +#define NULL 0 +#endif + +_PTR _EXFUN(memchr,(const _PTR, int, size_t)); +int _EXFUN(memcmp,(const _PTR, const _PTR, size_t)); +_PTR _EXFUN(memcpy,(_PTR, const _PTR, size_t)); +_PTR _EXFUN(memmove,(_PTR, const _PTR, size_t)); +_PTR _EXFUN(memset,(_PTR, int, size_t)); +char *_EXFUN(strcat,(char *, const char *)); +char *_EXFUN(strchr,(const char *, int)); +int _EXFUN(strcmp,(const char *, const char *)); +int _EXFUN(strcoll,(const char *, const char *)); +char *_EXFUN(strcpy,(char *, const char *)); +size_t _EXFUN(strcspn,(const char *, const char *)); +char *_EXFUN(strerror,(int)); +size_t _EXFUN(strlen,(const char *)); +char *_EXFUN(strncat,(char *, const char *, size_t)); +int _EXFUN(strncmp,(const char *, const char *, size_t)); +char *_EXFUN(strncpy,(char *, const char *, size_t)); +char *_EXFUN(strpbrk,(const char *, const char *)); +char *_EXFUN(strrchr,(const char *, int)); +size_t _EXFUN(strspn,(const char *, const char *)); +char *_EXFUN(strstr,(const char *, const char *)); + +#ifndef _REENT_ONLY +char *_EXFUN(strtok,(char *, const char *)); +#endif + +size_t _EXFUN(strxfrm,(char *, const char *, size_t)); + +#ifndef __STRICT_ANSI__ +char *_EXFUN(strtok_r,(char *, const char *, char **)); + +int _EXFUN(bcmp,(const char *, const char *, size_t)); +void _EXFUN(bcopy,(const char *, char *, size_t)); +void _EXFUN(bzero,(char *, size_t)); +int _EXFUN(ffs,(int)); +char *_EXFUN(index,(const char *, int)); +_PTR _EXFUN(memccpy,(_PTR, const _PTR, int, size_t)); +char *_EXFUN(rindex,(const char *, int)); +int _EXFUN(strcasecmp,(const char *, const char *)); +char *_EXFUN(strdup,(const char *)); +int _EXFUN(strncasecmp,(const char *, const char *, size_t)); +char *_EXFUN(strsep,(char **, const char *)); +char *_EXFUN(strlwr,(char *)); +char *_EXFUN(strupr,(char *)); +#ifdef __CYGWIN32__ +char *_EXFUN(strsignal, (int __signo)); +int _EXFUN(strtosigno, (const char *__name)); +#endif + +/* These function names are used on Windows and perhaps other systems. */ +#ifndef strcmpi +#define strcmpi strcasecmp +#endif +#ifndef stricmp +#define stricmp strcasecmp +#endif +#ifndef strncmpi +#define strncmpi strncasecmp +#endif +#ifndef strnicmp +#define strnicmp strncasecmp +#endif + +#endif /* ! __STRICT_ANSI__ */ + +#ifdef __cplusplus +} +#endif +#endif /* _STRING_H_ */ diff --git a/LAN/SRCS/dcload-ip/target-inc/sys/_types.h b/LAN/SRCS/dcload-ip/target-inc/sys/_types.h new file mode 100644 index 00000000..8186f2d9 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/sys/_types.h @@ -0,0 +1,15 @@ +/* ANSI C namespace clean utility typedefs */ + +/* This file defines various typedefs needed by the system calls that support + the C library. Basically, they're just the POSIX versions with an '_' + prepended. This file lives in the `sys' directory so targets can provide + their own if desired (or they can put target dependant conditionals here). +*/ + +#ifndef _SYS__TYPES_H +#define _SYS__TYPES_H + +typedef long _off_t; +typedef long _ssize_t; + +#endif /* _SYS__TYPES_H */ diff --git a/LAN/SRCS/dcload-ip/target-inc/sys/config.h b/LAN/SRCS/dcload-ip/target-inc/sys/config.h new file mode 100644 index 00000000..e274119b --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/sys/config.h @@ -0,0 +1,115 @@ +#ifndef __SYS_CONFIG_H__ +#define __SYS_CONFIG_H__ + +/* exceptions first */ +/* ??? Why is much of this stuff duplicated with machine/ieeefp.h? */ +#if defined(__H8300__) || defined(__H8500__) || defined (__H8300H__) || defined(__W65__) || defined (__H8300S__) +#define _FLOAT_ARG float +#define __SMALL_BITFIELDS +#define _DOUBLE_IS_32BITS +#define __IEEE_BIG_ENDIAN +/* ??? This conditional is true for the h8500 and the w65, defining H8300 + in those cases probably isn't the right thing to do. */ +#define H8300 1 +#endif + +#ifdef __W65__ +#define _DOUBLE_IS_32BITS +#define __SMALL_BITFIELDS +#define __IEEE_BIG_ENDIAN +#undef INT_MAX +#undef UINT_MAX +#define INT_MAX 32767 +#define UINT_MAX 65535 + +#endif + +/* 16 bit integer machines */ +#if defined(__Z8001__) || defined(__Z8002__) || defined(__H8300__) || defined(__H8500__) || defined(__W65__) || defined (__H8300H__) || defined (__H8300S__) || defined (__mn10200__) + +#undef INT_MAX +#undef UINT_MAX +#define INT_MAX 32767 +#define UINT_MAX 65535 +#endif + +#if defined(__D10V__) +#undef INT_MAX +#undef UINT_MAX +#define INT_MAX __INT_MAX__ +#define UINT_MAX (__INT_MAX__ * 2U + 1) +#define _DOUBLE_IS_32BITS +#define _POINTER_INT short +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef ___AM29K__ +#define _FLOAT_RET double +#endif + +#ifdef __i386__ +#ifndef __unix__ +/* in other words, go32 */ +#define _FLOAT_RET double +#endif +#endif + +#ifdef __M32R__ +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef __m68k__ +/* This is defined in machine/ieeefp.h; need to check is it redundant here? */ +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef __mn10300__ +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __mn10200__ +#define _DOUBLE_IS_32BITS +#define __SMALL_BITFIELDS +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __TIC80__ +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __v850 +#define __IEEE_LITTLE_ENDIAN +#define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__sda__)) +#endif + +#ifdef __D30V__ +#define __IEEE_BIG_ENDIAN +#endif + +/* For the PowerPC eabi, force the _impure_ptr to be in .sdata */ +#if defined(__PPC__) && defined(_CALL_SYSV) +#define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__section__(".sdata"))) +#endif + +#ifdef __sparc__ +#ifdef __LITTLE_ENDIAN_DATA__ +#define __IEEE_LITTLE_ENDIAN +#else +#define __IEEE_BIG_ENDIAN +#endif +#endif + +#if INT_MAX == 32767 +typedef long int __int32_t; +typedef unsigned long int __uint32_t; +#else +typedef int __int32_t; +typedef unsigned int __uint32_t; +#endif + +#ifndef _POINTER_INT +#define _POINTER_INT long +#endif + + +#endif /* __SYS_CONFIG_H__ */ diff --git a/LAN/SRCS/dcload-ip/target-inc/sys/dirent.h b/LAN/SRCS/dcload-ip/target-inc/sys/dirent.h new file mode 100644 index 00000000..1fb30087 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/sys/dirent.h @@ -0,0 +1,21 @@ +#ifdef __cplusplus +extern "C" { +#endif + +struct dirent { + long d_ino; /* inode number */ + off_t d_off; /* offset to the next dirent */ + unsigned short d_reclen;/* length of this record */ + unsigned char d_type; /* type of file */ + char d_name[256]; /* filename */ +}; + +typedef int DIR; + +DIR *opendir(const char *name); +int closedir(DIR *dir); +struct dirent *readdir(DIR *dir); + +#ifdef __cplusplus +} +#endif diff --git a/LAN/SRCS/dcload-ip/target-inc/sys/errno.h b/LAN/SRCS/dcload-ip/target-inc/sys/errno.h new file mode 100644 index 00000000..0247fa23 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/sys/errno.h @@ -0,0 +1,154 @@ +/* errno is not a global variable, because that would make using it + non-reentrant. Instead, its address is returned by the function + __errno. */ + +#ifndef _SYS_ERRNO_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _SYS_ERRNO_H_ + +#include + +#ifndef _REENT_ONLY +#define errno (*__errno()) +extern int *__errno _PARAMS ((void)); +#endif + +#if !defined(__CYGWIN32__) || defined(__INSIDE_CYGWIN__) +extern _CONST char * _CONST _sys_errlist[]; +extern int _sys_nerr; +#else +extern _CONST char * _CONST _sys_errlist[] __declspec(dllimport); +extern int _sys_nerr __declspec(dllimport); +#endif + +#define __errno_r(ptr) ((ptr)->_errno) + +#define EPERM 1 /* Not super-user */ +#define ENOENT 2 /* No such file or directory */ +#define ESRCH 3 /* No such process */ +#define EINTR 4 /* Interrupted system call */ +#define EIO 5 /* I/O error */ +#define ENXIO 6 /* No such device or address */ +#define E2BIG 7 /* Arg list too long */ +#define ENOEXEC 8 /* Exec format error */ +#define EBADF 9 /* Bad file number */ +#define ECHILD 10 /* No children */ +#define EAGAIN 11 /* No more processes */ +#define ENOMEM 12 /* Not enough core */ +#define EACCES 13 /* Permission denied */ +#define EFAULT 14 /* Bad address */ +#define ENOTBLK 15 /* Block device required */ +#define EBUSY 16 /* Mount device busy */ +#define EEXIST 17 /* File exists */ +#define EXDEV 18 /* Cross-device link */ +#define ENODEV 19 /* No such device */ +#define ENOTDIR 20 /* Not a directory */ +#define EISDIR 21 /* Is a directory */ +#define EINVAL 22 /* Invalid argument */ +#define ENFILE 23 /* Too many open files in system */ +#define EMFILE 24 /* Too many open files */ +#define ENOTTY 25 /* Not a typewriter */ +#define ETXTBSY 26 /* Text file busy */ +#define EFBIG 27 /* File too large */ +#define ENOSPC 28 /* No space left on device */ +#define ESPIPE 29 /* Illegal seek */ +#define EROFS 30 /* Read only file system */ +#define EMLINK 31 /* Too many links */ +#define EPIPE 32 /* Broken pipe */ +#define EDOM 33 /* Math arg out of domain of func */ +#define ERANGE 34 /* Math result not representable */ +#define ENOMSG 35 /* No message of desired type */ +#define EIDRM 36 /* Identifier removed */ +#define ECHRNG 37 /* Channel number out of range */ +#define EL2NSYNC 38 /* Level 2 not synchronized */ +#define EL3HLT 39 /* Level 3 halted */ +#define EL3RST 40 /* Level 3 reset */ +#define ELNRNG 41 /* Link number out of range */ +#define EUNATCH 42 /* Protocol driver not attached */ +#define ENOCSI 43 /* No CSI structure available */ +#define EL2HLT 44 /* Level 2 halted */ +#define EDEADLK 45 /* Deadlock condition */ +#define ENOLCK 46 /* No record locks available */ +#define EBADE 50 /* Invalid exchange */ +#define EBADR 51 /* Invalid request descriptor */ +#define EXFULL 52 /* Exchange full */ +#define ENOANO 53 /* No anode */ +#define EBADRQC 54 /* Invalid request code */ +#define EBADSLT 55 /* Invalid slot */ +#define EDEADLOCK 56 /* File locking deadlock error */ +#define EBFONT 57 /* Bad font file fmt */ +#define ENOSTR 60 /* Device not a stream */ +#define ENODATA 61 /* No data (for no delay io) */ +#define ETIME 62 /* Timer expired */ +#define ENOSR 63 /* Out of streams resources */ +#define ENONET 64 /* Machine is not on the network */ +#define ENOPKG 65 /* Package not installed */ +#define EREMOTE 66 /* The object is remote */ +#define ENOLINK 67 /* The link has been severed */ +#define EADV 68 /* Advertise error */ +#define ESRMNT 69 /* Srmount error */ +#define ECOMM 70 /* Communication error on send */ +#define EPROTO 71 /* Protocol error */ +#define EMULTIHOP 74 /* Multihop attempted */ +#define ELBIN 75 /* Inode is remote (not really error) */ +#define EDOTDOT 76 /* Cross mount point (not really error) */ +#define EBADMSG 77 /* Trying to read unreadable message */ +#define ENOTUNIQ 80 /* Given log. name not unique */ +#define EBADFD 81 /* f.d. invalid for this operation */ +#define EREMCHG 82 /* Remote address changed */ +#define ELIBACC 83 /* Can't access a needed shared lib */ +#define ELIBBAD 84 /* Accessing a corrupted shared lib */ +#define ELIBSCN 85 /* .lib section in a.out corrupted */ +#define ELIBMAX 86 /* Attempting to link in too many libs */ +#define ELIBEXEC 87 /* Attempting to exec a shared library */ +#define ENOSYS 88 /* Function not implemented */ +#define ENMFILE 89 /* No more files */ +#define ENOTEMPTY 90 /* Directory not empty */ +#define ENAMETOOLONG 91 /* File or path name too long */ +#define ELOOP 92 /* Too many symbolic links */ +#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ +#define EPFNOSUPPORT 96 /* Protocol family not supported */ +#define ECONNRESET 104 /* Connection reset by peer */ +#define ENOBUFS 105 /* No buffer space available */ +#define EAFNOSUPPORT 106 +#define EPROTOTYPE 107 +#define ENOTSOCK 108 +#define ENOPROTOOPT 109 +#define ESHUTDOWN 110 +#define ECONNREFUSED 111 /* Connection refused */ +#define EADDRINUSE 112 /* Address already in use */ +#define ECONNABORTED 113 /* Connection aborted */ +#define ENETUNREACH 114 +#define ENETDOWN 115 +#define ETIMEDOUT 116 +#define EHOSTDOWN 117 +#define EHOSTUNREACH 118 +#define EINPROGRESS 119 +#define EALREADY 120 +#define EDESTADDRREQ 121 +#define EMSGSIZE 122 +#define EPROTONOSUPPORT 123 +#define ESOCKTNOSUPPORT 124 +#define EADDRNOTAVAIL 125 +#define ENETRESET 126 +#define EISCONN 127 +#define ENOTCONN 128 +#define ETOOMANYREFS 129 +#define EPROCLIM 130 +#define EUSERS 131 +#define EDQUOT 132 +#define ESTALE 133 +#define ENOTSUP 134 +#define ENOMEDIUM 135 + +/* From cygwin32. */ +#define EWOULDBLOCK EAGAIN /* Operation would block */ + +#define __ELASTERROR 2000 /* Users can add values starting here */ + +#ifdef __cplusplus +} +#endif +#endif /* _SYS_ERRNO_H */ diff --git a/LAN/SRCS/dcload-ip/target-inc/sys/fcntl.h b/LAN/SRCS/dcload-ip/target-inc/sys/fcntl.h new file mode 100644 index 00000000..ed32fab9 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/sys/fcntl.h @@ -0,0 +1,178 @@ + +#ifndef _FCNTL_ +#ifdef __cplusplus +extern "C" { +#endif +#define _FCNTL_ +#include <_ansi.h> +#define _FOPEN (-1) /* from sys/file.h, kernel use only */ +#define _FREAD 0x0001 /* read enabled */ +#define _FWRITE 0x0002 /* write enabled */ +#define _FNDELAY 0x0004 /* non blocking I/O (4.2 style) */ +#define _FAPPEND 0x0008 /* append (writes guaranteed at the end) */ +#define _FMARK 0x0010 /* internal; mark during gc() */ +#define _FDEFER 0x0020 /* internal; defer for next gc pass */ +#define _FASYNC 0x0040 /* signal pgrp when data ready */ +#define _FSHLOCK 0x0080 /* BSD flock() shared lock present */ +#define _FEXLOCK 0x0100 /* BSD flock() exclusive lock present */ +#define _FCREAT 0x0200 /* open with file create */ +#define _FTRUNC 0x0400 /* open with truncation */ +#define _FEXCL 0x0800 /* error on open if file exists */ +#define _FNBIO 0x1000 /* non blocking I/O (sys5 style) */ +#define _FSYNC 0x2000 /* do all writes synchronously */ +#define _FNONBLOCK 0x4000 /* non blocking I/O (POSIX style) */ +#define _FNOCTTY 0x8000 /* don't assign a ctty on this open */ + +#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) + +/* + * Flag values for open(2) and fcntl(2) + * The kernel adds 1 to the open modes to turn it into some + * combination of FREAD and FWRITE. + */ +#define O_RDONLY 0 /* +1 == FREAD */ +#define O_WRONLY 1 /* +1 == FWRITE */ +#define O_RDWR 2 /* +1 == FREAD|FWRITE */ +#define O_APPEND _FAPPEND +#define O_CREAT _FCREAT +#define O_TRUNC _FTRUNC +#define O_EXCL _FEXCL +/* O_SYNC _FSYNC not posix, defined below */ +/* O_NDELAY _FNDELAY set in include/fcntl.h */ +/* O_NDELAY _FNBIO set in 5include/fcntl.h */ +#define O_NONBLOCK _FNONBLOCK +#define O_NOCTTY _FNOCTTY +/* For machines which care - */ +#if defined (_WIN32) || defined (__CYGWIN__) +#define _FBINARY 0x10000 +#define _FTEXT 0x20000 +#define _FNOINHERIT 0x40000 + +#define O_BINARY _FBINARY +#define O_TEXT _FTEXT +#define O_NOINHERIT _FNOINHERIT + +/* The windows header files define versions with a leading underscore. */ +#define _O_RDONLY O_RDONLY +#define _O_WRONLY O_WRONLY +#define _O_RDWR O_RDWR +#define _O_APPEND O_APPEND +#define _O_CREAT O_CREAT +#define _O_TRUNC O_TRUNC +#define _O_EXCL O_EXCL +#define _O_TEXT O_TEXT +#define _O_BINARY O_BINARY +#define _O_RAW O_BINARY +#define _O_NOINHERIT O_NOINHERIT +#endif + +#ifndef _POSIX_SOURCE + +#define O_SYNC _FSYNC + +/* + * Flags that work for fcntl(fd, F_SETFL, FXXXX) + */ +#define FAPPEND _FAPPEND +#define FSYNC _FSYNC +#define FASYNC _FASYNC +#define FNBIO _FNBIO +#define FNONBIO _FNONBLOCK /* XXX fix to be NONBLOCK everywhere */ +#define FNDELAY _FNDELAY + +/* + * Flags that are disallowed for fcntl's (FCNTLCANT); + * used for opens, internal state, or locking. + */ +#define FREAD _FREAD +#define FWRITE _FWRITE +#define FMARK _FMARK +#define FDEFER _FDEFER +#define FSHLOCK _FSHLOCK +#define FEXLOCK _FEXLOCK + +/* + * The rest of the flags, used only for opens + */ +#define FOPEN _FOPEN +#define FCREAT _FCREAT +#define FTRUNC _FTRUNC +#define FEXCL _FEXCL +#define FNOCTTY _FNOCTTY + +#endif /* !_POSIX_SOURCE */ + +/* XXX close on exec request; must match UF_EXCLOSE in user.h */ +#define FD_CLOEXEC 1 /* posix */ + +/* fcntl(2) requests */ +#define F_DUPFD 0 /* Duplicate fildes */ +#define F_GETFD 1 /* Get fildes flags (close on exec) */ +#define F_SETFD 2 /* Set fildes flags (close on exec) */ +#define F_GETFL 3 /* Get file flags */ +#define F_SETFL 4 /* Set file flags */ +#ifndef _POSIX_SOURCE +#define F_GETOWN 5 /* Get owner - for ASYNC */ +#define F_SETOWN 6 /* Set owner - for ASYNC */ +#endif /* !_POSIX_SOURCE */ +#define F_GETLK 7 /* Get record-locking information */ +#define F_SETLK 8 /* Set or Clear a record-lock (Non-Blocking) */ +#define F_SETLKW 9 /* Set or Clear a record-lock (Blocking) */ +#ifndef _POSIX_SOURCE +#define F_RGETLK 10 /* Test a remote lock to see if it is blocked */ +#define F_RSETLK 11 /* Set or unlock a remote lock */ +#define F_CNVT 12 /* Convert a fhandle to an open fd */ +#define F_RSETLKW 13 /* Set or Clear remote record-lock(Blocking) */ +#endif /* !_POSIX_SOURCE */ + +/* fcntl(2) flags (l_type field of flock structure) */ +#define F_RDLCK 1 /* read lock */ +#define F_WRLCK 2 /* write lock */ +#define F_UNLCK 3 /* remove lock(s) */ +#ifndef _POSIX_SOURCE +#define F_UNLKSYS 4 /* remove remote locks for a given system */ +#endif /* !_POSIX_SOURCE */ + +/*#include */ + +/* file segment locking set data type - information passed to system by user */ +struct flock { + short l_type; /* F_RDLCK, F_WRLCK, or F_UNLCK */ + short l_whence; /* flag to choose starting offset */ + long l_start; /* relative offset, in bytes */ + long l_len; /* length, in bytes; 0 means lock to EOF */ + short l_pid; /* returned with F_GETLK */ + short l_xxx; /* reserved for future use */ +}; + +#ifndef _POSIX_SOURCE +/* extended file segment locking set data type */ +struct eflock { + short l_type; /* F_RDLCK, F_WRLCK, or F_UNLCK */ + short l_whence; /* flag to choose starting offset */ + long l_start; /* relative offset, in bytes */ + long l_len; /* length, in bytes; 0 means lock to EOF */ + short l_pid; /* returned with F_GETLK */ + short l_xxx; /* reserved for future use */ + long l_rpid; /* Remote process id wanting this lock */ + long l_rsys; /* Remote system id wanting this lock */ +}; +#endif /* !_POSIX_SOURCE */ + + +#include +#include /* sigh. for the mode bits for open/creat */ + +extern int open _PARAMS ((const char *, int, ...)); +extern int creat _PARAMS ((const char *, mode_t)); +extern int fcntl _PARAMS ((int, int, ...)); + +/* Provide _ prototypes for functions provided by some versions + of newlib. */ +extern int _open _PARAMS ((const char *, int, ...)); +extern int _fcntl _PARAMS ((int, int, ...)); + +#ifdef __cplusplus +} +#endif +#endif /* !_FCNTL_ */ diff --git a/LAN/SRCS/dcload-ip/target-inc/sys/file.h b/LAN/SRCS/dcload-ip/target-inc/sys/file.h new file mode 100644 index 00000000..58d4fac3 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/sys/file.h @@ -0,0 +1,2 @@ + +#include diff --git a/LAN/SRCS/dcload-ip/target-inc/sys/param.h b/LAN/SRCS/dcload-ip/target-inc/sys/param.h new file mode 100644 index 00000000..3470ef5d --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/sys/param.h @@ -0,0 +1,18 @@ +/* This is a dummy file, not customized for any + particular system. If there is a param.h in libc/sys/SYSDIR/sys, + it will override this one. */ + +#ifndef _SYS_PARAM_H +# define _SYS_PARAM_H + +# define HZ (60) +# define NOFILE (60) +# define PATHSIZE (1024) + +#ifdef __i386__ +#define BIG_ENDIAN 4321 +#define LITTLE_ENDIAN 1234 +#define BYTE_ORDER LITTLE_ENDIAN +#endif + +#endif diff --git a/LAN/SRCS/dcload-ip/target-inc/sys/reent.h b/LAN/SRCS/dcload-ip/target-inc/sys/reent.h new file mode 100644 index 00000000..11049367 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/sys/reent.h @@ -0,0 +1,238 @@ +/* This header file provides the reentrancy. */ + +/* WARNING: All identifiers here must begin with an underscore. This file is + included by stdio.h and others and we therefore must only use identifiers + in the namespace allotted to us. */ + +#ifndef _SYS_REENT_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _SYS_REENT_H_ + +#include <_ansi.h> +#include + +#ifndef __Long +#if __LONG_MAX__ == 2147483647L +#define __Long long +typedef unsigned __Long __ULong; +#elif __INT_MAX__ == 2147483647 +#define __Long int +typedef unsigned __Long __ULong; +#endif +#endif + +#ifndef __Long +#define __Long __int32_t +typedef __uint32_t __ULong; +#endif + +struct _glue +{ + struct _glue *_next; + int _niobs; + struct __sFILE *_iobs; +}; + +struct _Bigint +{ + struct _Bigint *_next; + int _k, _maxwds, _sign, _wds; + __ULong _x[1]; +}; + +/* + * atexit() support + */ + +#define _ATEXIT_SIZE 32 /* must be at least 32 to guarantee ANSI conformance */ + +struct _atexit { + struct _atexit *_next; /* next in list */ + int _ind; /* next index in this table */ + void (*_fns[_ATEXIT_SIZE])(void); /* the table itself */ +}; + +/* + * Stdio buffers. + * + * This and __sFILE are defined here because we need them for struct _reent, + * but we don't want stdio.h included when stdlib.h is. + */ + +struct __sbuf { + unsigned char *_base; + int _size; +}; + +/* + * We need fpos_t for the following, but it doesn't have a leading "_", + * so we use _fpos_t instead. + */ + +typedef long _fpos_t; /* XXX must match off_t in */ + /* (and must be `long' for now) */ + +/* + * Stdio state variables. + * + * The following always hold: + * + * if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR), + * _lbfsize is -_bf._size, else _lbfsize is 0 + * if _flags&__SRD, _w is 0 + * if _flags&__SWR, _r is 0 + * + * This ensures that the getc and putc macros (or inline functions) never + * try to write or read from a file that is in `read' or `write' mode. + * (Moreover, they can, and do, automatically switch from read mode to + * write mode, and back, on "r+" and "w+" files.) + * + * _lbfsize is used only to make the inline line-buffered output stream + * code as compact as possible. + * + * _ub, _up, and _ur are used when ungetc() pushes back more characters + * than fit in the current _bf, or when ungetc() pushes back a character + * that does not match the previous one in _bf. When this happens, + * _ub._base becomes non-nil (i.e., a stream has ungetc() data iff + * _ub._base!=NULL) and _up and _ur save the current values of _p and _r. + */ + +struct __sFILE { + unsigned char *_p; /* current position in (some) buffer */ + int _r; /* read space left for getc() */ + int _w; /* write space left for putc() */ + short _flags; /* flags, below; this FILE is free if 0 */ + short _file; /* fileno, if Unix descriptor, else -1 */ + struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */ + int _lbfsize; /* 0 or -_bf._size, for inline putc */ + + /* operations */ + _PTR _cookie; /* cookie passed to io functions */ + + int _EXFUN((*_read),(_PTR _cookie, char *_buf, int _n)); + int _EXFUN((*_write),(_PTR _cookie, const char *_buf, int _n)); + _fpos_t _EXFUN((*_seek),(_PTR _cookie, _fpos_t _offset, int _whence)); + int _EXFUN((*_close),(_PTR _cookie)); + + /* separate buffer for long sequences of ungetc() */ + struct __sbuf _ub; /* ungetc buffer */ + unsigned char *_up; /* saved _p when _p is doing ungetc data */ + int _ur; /* saved _r when _r is counting ungetc data */ + + /* tricks to meet minimum requirements even when malloc() fails */ + unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */ + unsigned char _nbuf[1]; /* guarantee a getc() buffer */ + + /* separate buffer for fgetline() when line crosses buffer boundary */ + struct __sbuf _lb; /* buffer for fgetline() */ + + /* Unix stdio files get aligned to block boundaries on fseek() */ + int _blksize; /* stat.st_blksize (may be != _bf._size) */ + int _offset; /* current lseek offset */ + + struct _reent *_data; +}; + +/* + * struct _reent + * + * This structure contains *all* globals needed by the library. + * It's raison d'etre is to facilitate threads by making all library routines + * reentrant. IE: All state information is contained here. + */ + +struct _reent +{ + /* local copy of errno */ + int _errno; + + /* FILE is a big struct and may change over time. To try to achieve binary + compatibility with future versions, put stdin,stdout,stderr here. + These are pointers into member __sf defined below. */ + struct __sFILE *_stdin, *_stdout, *_stderr; + + int _inc; /* used by tmpnam */ + char _emergency[25]; + + int _current_category; /* used by setlocale */ + _CONST char *_current_locale; + + int __sdidinit; /* 1 means stdio has been init'd */ + + void _EXFUN((*__cleanup),(struct _reent *)); + + /* used by mprec routines */ + struct _Bigint *_result; + int _result_k; + struct _Bigint *_p5s; + struct _Bigint **_freelist; + + /* used by some fp conversion routines */ + int _cvtlen; /* should be size_t */ + char *_cvtbuf; + + union + { + struct + { + unsigned int _rand_next; + char * _strtok_last; + char _asctime_buf[26]; + struct tm _localtime_buf; + int _gamma_signgam; + } _reent; + /* Two next two fields were once used by malloc. They are no longer + used. They are used to preserve the space used before so as to + allow addition of new reent fields and keep binary compatibility. */ + struct + { +#define _N_LISTS 30 + unsigned char * _nextf[_N_LISTS]; + unsigned int _nmalloc[_N_LISTS]; + } _unused; + } _new; + + /* atexit stuff */ + struct _atexit *_atexit; /* points to head of LIFO stack */ + struct _atexit _atexit0; /* one guaranteed table, required by ANSI */ + + /* signal info */ + void (**(_sig_func))(int); + + /* These are here last so that __sFILE can grow without changing the offsets + of the above members (on the off chance that future binary compatibility + would be broken otherwise). */ + struct _glue __sglue; /* root of glue chain */ + struct __sFILE __sf[3]; /* first three file descriptors */ +}; + +#define _REENT_INIT(var) \ + { 0, &var.__sf[0], &var.__sf[1], &var.__sf[2], 0, "", 0, "C", \ + 0, NULL, NULL, 0, NULL, NULL, 0, NULL, { {1, NULL, "", \ + { 0,0,0,0,0,0,0,0}, 0 } } } + +/* + * All references to struct _reent are via this pointer. + * Internally, newlib routines that need to reference it should use _REENT. + */ + +#ifndef __ATTRIBUTE_IMPURE_PTR__ +#define __ATTRIBUTE_IMPURE_PTR__ +#endif + +extern struct _reent *_impure_ptr __ATTRIBUTE_IMPURE_PTR__; + +void _reclaim_reent _PARAMS ((struct _reent *)); + +/* #define _REENT_ONLY define this to get only reentrant routines */ + +#ifndef _REENT_ONLY +#define _REENT _impure_ptr +#endif + +#ifdef __cplusplus +} +#endif +#endif /* _SYS_REENT_H_ */ diff --git a/LAN/SRCS/dcload-ip/target-inc/sys/resource.h b/LAN/SRCS/dcload-ip/target-inc/sys/resource.h new file mode 100644 index 00000000..eb827552 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/sys/resource.h @@ -0,0 +1,15 @@ +#ifndef _SYS_RESOURCE_H_ +#define _SYS_RESOURCE_H_ + +#include + +#define RUSAGE_SELF 0 /* calling process */ +#define RUSAGE_CHILDREN -1 /* terminated child processes */ + +struct rusage { + struct timeval ru_utime; /* user time used */ + struct timeval ru_stime; /* system time used */ +}; + +#endif + diff --git a/LAN/SRCS/dcload-ip/target-inc/sys/signal.h b/LAN/SRCS/dcload-ip/target-inc/sys/signal.h new file mode 100644 index 00000000..00d25ead --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/sys/signal.h @@ -0,0 +1,182 @@ +/* sys/signal.h */ + +#ifndef _SYS_SIGNAL_H +#define _SYS_SIGNAL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "_ansi.h" + +#ifndef __STRICT_ANSI__ +typedef unsigned long sigset_t; +struct sigaction +{ + void (*sa_handler)(int); + sigset_t sa_mask; + int sa_flags; +}; +#define SA_NOCLDSTOP 1 /* only value supported now for sa_flags */ +#define SIG_SETMASK 0 /* set mask with sigprocmask() */ +#define SIG_BLOCK 1 /* set of signals to block */ +#define SIG_UNBLOCK 2 /* set of signals to, well, unblock */ + +/* These depend upon the type of sigset_t, which right now + is always a long.. They're in the POSIX namespace, but + are not ANSI. */ +#define sigaddset(what,sig) (*(what) |= (1<<(sig))) +#define sigemptyset(what) (*(what) = 0) + +int sigprocmask (int __how, const sigset_t *__a, sigset_t *__b); + +/* protos for functions found in winsup sources */ +#if defined(__CYGWIN32__) +#undef sigaddset +#undef sigemptyset +/* The first argument to kill should be pid_t. Right now + always defines pid_t to be int. If that ever + changes, then we will need to do something else, perhaps along the + lines of . */ +int _EXFUN(kill, (int, int)); +int _EXFUN(sigaction, (int, const struct sigaction *, struct sigaction *)); +int _EXFUN(sigaddset, (sigset_t *, const int)); +int _EXFUN(sigdelset, (sigset_t *, const int)); +int _EXFUN(sigismember, (const sigset_t *, int)); +int _EXFUN(sigfillset, (sigset_t *)); +int _EXFUN(sigemptyset, (sigset_t *)); +int _EXFUN(sigpending, (sigset_t *)); +int _EXFUN(sigsuspend, (const sigset_t *)); +int _EXFUN(sigpause, (int)); +#endif + +#endif /* __STRICT_ANSI__ */ + +#if defined(___AM29K__) +/* These all need to be defined for ANSI C, but I don't think they are + meaningful. */ +#define SIGABRT 1 +#define SIGFPE 1 +#define SIGILL 1 +#define SIGINT 1 +#define SIGSEGV 1 +#define SIGTERM 1 +/* These need to be defined for POSIX, and some others do too. */ +#define SIGHUP 1 +#define SIGQUIT 1 +#define NSIG 2 +#elif defined(__GO32__) +#define SIGINT 1 +#define SIGKILL 2 +#define SIGPIPE 3 +#define SIGFPE 4 +#define SIGHUP 5 +#define SIGTERM 6 +#define SIGSEGV 7 +#define SIGTSTP 8 +#define SIGQUIT 9 +#define SIGTRAP 10 +#define SIGILL 11 +#define SIGEMT 12 +#define SIGALRM 13 +#define SIGBUS 14 +#define SIGLOST 15 +#define SIGSTOP 16 +#define SIGABRT 17 +#define SIGUSR1 18 +#define SIGUSR2 19 +#define NSIG 20 +#elif defined(__CYGWIN32__) /* BSD signals symantics */ +#define SIGHUP 1 /* hangup */ +#define SIGINT 2 /* interrupt */ +#define SIGQUIT 3 /* quit */ +#define SIGILL 4 /* illegal instruction (not reset when caught) */ +#define SIGTRAP 5 /* trace trap (not reset when caught) */ +#define SIGABRT 6 /* used by abort */ +#define SIGEMT 7 /* EMT instruction */ +#define SIGFPE 8 /* floating point exception */ +#define SIGKILL 9 /* kill (cannot be caught or ignored) */ +#define SIGBUS 10 /* bus error */ +#define SIGSEGV 11 /* segmentation violation */ +#define SIGSYS 12 /* bad argument to system call */ +#define SIGPIPE 13 /* write on a pipe with no one to read it */ +#define SIGALRM 14 /* alarm clock */ +#define SIGTERM 15 /* software termination signal from kill */ +#define SIGURG 16 /* urgent condition on IO channel */ +#define SIGSTOP 17 /* sendable stop signal not from tty */ +#define SIGTSTP 18 /* stop signal from tty */ +#define SIGCONT 19 /* continue a stopped process */ +#define SIGCHLD 20 /* to parent on child stop or exit */ +#define SIGCLD 20 /* System V name for SIGCHLD */ +#define SIGTTIN 21 /* to readers pgrp upon background tty read */ +#define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */ +#define SIGIO 23 /* input/output possible signal */ +#define SIGPOLL SIGIO /* System V name for SIGIO */ +#define SIGXCPU 24 /* exceeded CPU time limit */ +#define SIGXFSZ 25 /* exceeded file size limit */ +#define SIGVTALRM 26 /* virtual time alarm */ +#define SIGPROF 27 /* profiling time alarm */ +#define SIGWINCH 28 /* window changed */ +#define SIGLOST 29 /* resource lost (eg, record-lock lost) */ +#define SIGUSR1 30 /* user defined signal 1 */ +#define SIGUSR2 31 /* user defined signal 2 */ +#define NSIG 32 /* signal 0 implied */ +#else +#define SIGHUP 1 /* hangup */ +#define SIGINT 2 /* interrupt */ +#define SIGQUIT 3 /* quit */ +#define SIGILL 4 /* illegal instruction (not reset when caught) */ +#define SIGTRAP 5 /* trace trap (not reset when caught) */ +#define SIGIOT 6 /* IOT instruction */ +#define SIGABRT 6 /* used by abort, replace SIGIOT in the future */ +#define SIGEMT 7 /* EMT instruction */ +#define SIGFPE 8 /* floating point exception */ +#define SIGKILL 9 /* kill (cannot be caught or ignored) */ +#define SIGBUS 10 /* bus error */ +#define SIGSEGV 11 /* segmentation violation */ +#define SIGSYS 12 /* bad argument to system call */ +#define SIGPIPE 13 /* write on a pipe with no one to read it */ +#define SIGALRM 14 /* alarm clock */ +#define SIGTERM 15 /* software termination signal from kill */ + +#if defined(__svr4__) +/* svr4 specifics. different signals above 15, and sigaction. */ +#define SIGUSR1 16 +#define SIGUSR2 17 +#define SIGCLD 18 +#define SIGPWR 19 +#define SIGWINCH 20 +#define SIGPOLL 22 /* 20 for x.out binaries!!!! */ +#define SIGSTOP 23 /* sendable stop signal not from tty */ +#define SIGTSTP 24 /* stop signal from tty */ +#define SIGCONT 25 /* continue a stopped process */ +#define SIGTTIN 26 /* to readers pgrp upon background tty read */ +#define SIGTTOU 27 /* like TTIN for output if (tp->t_local<OSTOP) */ +#define NSIG 28 +#else +#define SIGURG 16 /* urgent condition on IO channel */ +#define SIGSTOP 17 /* sendable stop signal not from tty */ +#define SIGTSTP 18 /* stop signal from tty */ +#define SIGCONT 19 /* continue a stopped process */ +#define SIGCHLD 20 /* to parent on child stop or exit */ +#define SIGCLD 20 /* System V name for SIGCHLD */ +#define SIGTTIN 21 /* to readers pgrp upon background tty read */ +#define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */ +#define SIGIO 23 /* input/output possible signal */ +#define SIGPOLL SIGIO /* System V name for SIGIO */ +#define SIGXCPU 24 /* exceeded CPU time limit */ +#define SIGXFSZ 25 /* exceeded file size limit */ +#define SIGVTALRM 26 /* virtual time alarm */ +#define SIGPROF 27 /* profiling time alarm */ +#define SIGWINCH 28 /* window changed */ +#define SIGLOST 29 /* resource lost (eg, record-lock lost) */ +#define SIGUSR1 30 /* user defined signal 1 */ +#define SIGUSR2 31 /* user defined signal 2 */ +#define NSIG 32 /* signal 0 implied */ +#endif +#endif + +#ifdef __cplusplus +} +#endif +#endif /* _SYS_SIGNAL_H */ diff --git a/LAN/SRCS/dcload-ip/target-inc/sys/stat-dj.h b/LAN/SRCS/dcload-ip/target-inc/sys/stat-dj.h new file mode 100644 index 00000000..b533a167 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/sys/stat-dj.h @@ -0,0 +1,59 @@ +/* This is file STAT.H */ +/* +** Copyright (C) 1991 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954 +** +** This file is distributed under the terms listed in the document +** "copying.dj", available from DJ Delorie at the address above. +** A copy of "copying.dj" should accompany this file; if not, a copy +** should be available from where this file was obtained. This file +** may not be distributed without a verbatim copy of "copying.dj". +** +** This file is distributed WITHOUT ANY WARRANTY; without even the implied +** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +#ifndef _STAT_H_ +#define _STAT_H_ + +struct stat { + short st_dev; + short st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + short st_rdev; + short st_align_for_word32; + long st_size; + long st_atime; + long st_mtime; + long st_ctime; + long st_blksize; +}; + +#define S_IFMT 0xF000 /* file type mask */ +#define S_IFDIR 0x4000 /* directory */ +#define S_IFIFO 0x1000 /* FIFO special */ +#define S_IFCHR 0x2000 /* character special */ +#define S_IFBLK 0x3000 /* block special */ +#define S_IFREG 0x8000 /* or just 0x0000, regular */ +#define S_IREAD 0x0100 /* owner may read */ +#define S_IWRITE 0x0080 /* owner may write */ +#define S_IEXEC 0x0040 /* owner may execute */ + +#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) +#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) +#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) + +#ifdef __cplusplus +extern "C" { +#endif +int stat(const char *, struct stat *); +int fstat(int, struct stat *); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/LAN/SRCS/dcload-ip/target-inc/sys/stat.h b/LAN/SRCS/dcload-ip/target-inc/sys/stat.h new file mode 100644 index 00000000..31dfaf49 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/sys/stat.h @@ -0,0 +1,149 @@ +#ifndef _SYS_STAT_H +#define _SYS_STAT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <_ansi.h> +#include +#include + +#ifdef __i386__ +#ifdef __MSDOS__ +#include "stat-dj.h" +#endif +#endif + +/* dj's stat defines _STAT_H_ */ +#ifndef _STAT_H_ + +/* It is intended that the layout of this structure not change when the + sizes of any of the basic types change (short, int, long) [via a compile + time option]. */ + +struct stat +{ + dev_t st_dev; + ino_t st_ino; + mode_t st_mode; + nlink_t st_nlink; + uid_t st_uid; + gid_t st_gid; + dev_t st_rdev; + off_t st_size; + /* SysV/sco doesn't have the rest... But Solaris, eabi does. */ +#if defined(__svr4__) && !defined(__PPC__) && !defined(__sun__) + time_t st_atime; + time_t st_mtime; + time_t st_ctime; +#else + time_t st_atime; + long st_spare1; + time_t st_mtime; + long st_spare2; + time_t st_ctime; + long st_spare3; + long st_blksize; + long st_blocks; + long st_spare4[2]; +#endif +}; + +#define _IFMT 0170000 /* type of file */ +#define _IFDIR 0040000 /* directory */ +#define _IFCHR 0020000 /* character special */ +#define _IFBLK 0060000 /* block special */ +#define _IFREG 0100000 /* regular */ +#define _IFLNK 0120000 /* symbolic link */ +#define _IFSOCK 0140000 /* socket */ +#define _IFIFO 0010000 /* fifo */ + +#define S_BLKSIZE 1024 /* size of a block */ + +#define S_ISUID 0004000 /* set user id on execution */ +#define S_ISGID 0002000 /* set group id on execution */ +#ifndef _POSIX_SOURCE +#define S_ISVTX 0001000 /* save swapped text even after use */ +#define S_IREAD 0000400 /* read permission, owner */ +#define S_IWRITE 0000200 /* write permission, owner */ +#define S_IEXEC 0000100 /* execute/search permission, owner */ + +#define S_ENFMT 0002000 /* enforcement-mode locking */ + +#define S_IFMT _IFMT +#define S_IFDIR _IFDIR +#define S_IFCHR _IFCHR +#define S_IFBLK _IFBLK +#define S_IFREG _IFREG +#define S_IFLNK _IFLNK +#define S_IFSOCK _IFSOCK +#define S_IFIFO _IFIFO +#endif /* !_POSIX_SOURCE */ + +#ifdef _WIN32 +/* The Windows header files define _S_ forms of these, so we do too + for easier portability. */ +#define _S_IFMT _IFMT +#define _S_IFDIR _IFDIR +#define _S_IFCHR _IFCHR +#define _S_IFIFO _IFIFO +#define _S_IFREG _IFREG +#define _S_IREAD 0000400 +#define _S_IWRITE 0000200 +#define _S_IEXEC 0000100 +#endif + +#define S_IRWXU 0000700 /* rwx, owner */ +#define S_IRUSR 0000400 /* read permission, owner */ +#define S_IWUSR 0000200 /* write permission, owner */ +#define S_IXUSR 0000100 /* execute/search permission, owner */ +#define S_IRWXG 0000070 /* rwx, group */ +#define S_IRGRP 0000040 /* read permission, group */ +#define S_IWGRP 0000020 /* write permission, grougroup */ +#define S_IXGRP 0000010 /* execute/search permission, group */ +#define S_IRWXO 0000007 /* rwx, other */ +#define S_IROTH 0000004 /* read permission, other */ +#define S_IWOTH 0000002 /* write permission, other */ +#define S_IXOTH 0000001 /* execute/search permission, other */ + +#define S_ISBLK(m) (((m)&_IFMT) == _IFBLK) +#define S_ISCHR(m) (((m)&_IFMT) == _IFCHR) +#define S_ISDIR(m) (((m)&_IFMT) == _IFDIR) +#define S_ISFIFO(m) (((m)&_IFMT) == _IFIFO) +#define S_ISREG(m) (((m)&_IFMT) == _IFREG) +#define S_ISLNK(m) (((m)&_IFMT) == _IFLNK) +#define S_ISSOCK(m) (((m)&_IFMT) == _IFSOCK) + + +int _EXFUN(chmod,( const char *__path, mode_t __mode )); +int _EXFUN(fchmod,(int __fd, mode_t __mode)); +int _EXFUN(fstat,( int __fd, struct stat *__sbuf )); +int _EXFUN(mkdir,( const char *_path, mode_t __mode )); +int _EXFUN(mkfifo,( const char *__path, mode_t __mode )); +int _EXFUN(stat,( const char *__path, struct stat *__sbuf )); +mode_t _EXFUN(umask,( mode_t __mask )); + +#if defined(__rtems__) +int _EXFUN(mknod,( const char *_path, mode_t _mode, dev_t dev )); +#endif + +/* Provide prototypes for most of the _ names that are + provided in newlib for some compilers. */ +int _EXFUN(_fstat,( int __fd, struct stat *__sbuf )); +int _EXFUN(_stat,( const char *__path, struct stat *__sbuf )); + +#ifdef __CYGWIN32__ +int _EXFUN(lstat,( const char *__path, struct stat *__buf )); +#endif + +#if defined(__rtems__) +int _EXFUN(mknod,( const char *_path, mode_t _mode, dev_t dev )); +int _EXFUN(lstat,( const char *_path, struct stat *_sbuf )); +#endif + +#endif /* !_STAT_H_ */ +#ifdef __cplusplus +} +#endif +#endif /* _SYS_STAT_H */ diff --git a/LAN/SRCS/dcload-ip/target-inc/sys/syscall.h b/LAN/SRCS/dcload-ip/target-inc/sys/syscall.h new file mode 100644 index 00000000..f141df76 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/sys/syscall.h @@ -0,0 +1,31 @@ +#define SYS_exit 1 +#define SYS_fork 2 + +#define SYS_read 3 +#define SYS_write 4 +#define SYS_open 5 +#define SYS_close 6 +#define SYS_wait4 7 +#define SYS_creat 8 +#define SYS_link 9 +#define SYS_unlink 10 +#define SYS_execv 11 +#define SYS_chdir 12 +#define SYS_mknod 14 +#define SYS_chmod 15 +#define SYS_chown 16 +#define SYS_lseek 19 +#define SYS_getpid 20 +#define SYS_isatty 21 +#define SYS_fstat 22 +#define SYS_time 23 + + +#define SYS_ARG 24 +#define SYS_stat 38 + +#define SYS_pipe 42 +#define SYS_execve 59 + +#define SYS_utime 201 /* not really a system call */ +#define SYS_wait 202 /* nor is this */ diff --git a/LAN/SRCS/dcload-ip/target-inc/sys/time.h b/LAN/SRCS/dcload-ip/target-inc/sys/time.h new file mode 100644 index 00000000..bc08820a --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/sys/time.h @@ -0,0 +1,51 @@ +/* time.h -- An implementation of the standard Unix file. + Written by Geoffrey Noer + Public domain; no rights reserved. */ + +#ifndef _SYS_TIME_H_ +#define _SYS_TIME_H_ + +#include <_ansi.h> +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _WINSOCK_H +struct timeval { + long tv_sec; + long tv_usec; +}; + +struct timezone { + int tz_minuteswest; + int tz_dsttime; +}; + +#ifdef __CYGWIN32__ +#include +#endif /* __CYGWIN32__ */ + +#endif /* _WINSOCK_H */ + +#define ITIMER_REAL 0 +#define ITIMER_VIRTUAL 1 +#define ITIMER_PROF 2 + +struct itimerval { + struct timeval it_interval; + struct timeval it_value; +}; + +int _EXFUN(gettimeofday, (struct timeval *__p, struct timezone *__z)); +int _EXFUN(settimeofday, (const struct timeval *, const struct timezone *)); +int _EXFUN(utimes, (const char *__path, struct timeval *__tvp)); +int _EXFUN(getitimer, (int __which, struct itimerval *__value)); +int _EXFUN(setitimer, (int __which, const struct itimerval *__value, + struct itimerval *__ovalue)); + +#ifdef __cplusplus +} +#endif +#endif /* _SYS_TIME_H_ */ diff --git a/LAN/SRCS/dcload-ip/target-inc/sys/timeb.h b/LAN/SRCS/dcload-ip/target-inc/sys/timeb.h new file mode 100644 index 00000000..0a2c3de8 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/sys/timeb.h @@ -0,0 +1,39 @@ +/* timeb.h -- An implementation of the standard Unix file. + Written by Ian Lance Taylor + Public domain; no rights reserved. + + declares the structure used by the ftime function, as + well as the ftime function itself. Newlib does not provide an + implementation of ftime. */ + +#ifndef _SYS_TIMEB_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define _SYS_TIMEB_H + +#include <_ansi.h> +#include + +#ifndef __time_t_defined +typedef _TIME_T_ time_t; +#define __time_t_defined +#endif + +struct timeb +{ + time_t time; + unsigned short millitm; + short timezone; + short dstflag; +}; + +extern int ftime _PARAMS ((struct timeb *)); + +#ifdef __cplusplus +} +#endif + +#endif /* ! defined (_SYS_TIMEB_H) */ diff --git a/LAN/SRCS/dcload-ip/target-inc/sys/times.h b/LAN/SRCS/dcload-ip/target-inc/sys/times.h new file mode 100644 index 00000000..c973ae1b --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/sys/times.h @@ -0,0 +1,27 @@ +#ifndef _SYS_TIMES_H +#ifdef __cplusplus +extern "C" { +#endif +#define _SYS_TIMES_H + +#include <_ansi.h> +#include + +#ifndef __clock_t_defined +typedef _CLOCK_T_ clock_t; +#define __clock_t_defined +#endif + +struct tms { + clock_t tms_utime; /* user time */ + clock_t tms_stime; /* system time */ + clock_t tms_cutime; /* user time, children */ + clock_t tms_cstime; /* system time, children */ +}; + +clock_t _EXFUN(times,(struct tms *)); + +#ifdef __cplusplus +} +#endif +#endif /* !_SYS_TIMES_H */ diff --git a/LAN/SRCS/dcload-ip/target-inc/sys/types.h b/LAN/SRCS/dcload-ip/target-inc/sys/types.h new file mode 100644 index 00000000..7d2e5246 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/sys/types.h @@ -0,0 +1,174 @@ +/* unified sys/types.h: + start with sef's sysvi386 version. + merge go32 version -- a few ifdefs. + h8300hms, h8300xray, and sysvnecv70 disagree on the following types: + + typedef int gid_t; + typedef int uid_t; + typedef int dev_t; + typedef int ino_t; + typedef int mode_t; + typedef int caddr_t; + + however, these aren't "reasonable" values, the sysvi386 ones make far + more sense, and should work sufficiently well (in particular, h8300 + doesn't have a stat, and the necv70 doesn't matter.) -- eichin + */ + +#ifndef _SYS_TYPES_H +#define _SYS_TYPES_H + +#if defined (_WIN32) || defined (__CYGWIN__) +#define __MS_types__ +#endif + +#ifdef __i386__ +#if defined (GO32) || defined (__MSDOS__) +#define __MS_types__ +#endif +#endif + +# include +# include + +/* To ensure the stat struct's layout doesn't change when sizeof(int), etc. + changes, we assume sizeof short and long never change and have all types + used to define struct stat use them and not int where possible. + Where not possible, _ST_INTxx are used. It would be preferable to not have + such assumptions, but until the extra fluff is necessary, it's avoided. + No 64 bit targets use stat yet. What to do about them is postponed + until necessary. */ +#ifdef __GNUC__ +#define _ST_INT32 __attribute__ ((__mode__ (__SI__))) +#else +#define _ST_INT32 +#endif + +# ifndef _POSIX_SOURCE + +# define physadr physadr_t +# define quad quad_t + +#ifndef _WINSOCK_H +typedef unsigned char u_char; +typedef unsigned short u_short; +typedef unsigned int u_int; +typedef unsigned long u_long; +#endif + +typedef unsigned short ushort; /* System V compatibility */ +typedef unsigned int uint; /* System V compatibility */ +# endif /*!_POSIX_SOURCE */ + +#ifndef __time_t_defined +typedef _TIME_T_ time_t; +#define __time_t_defined +#endif + +typedef long daddr_t; +typedef char * caddr_t; + +#ifdef __MS_types__ +typedef unsigned long ino_t; +#else +#ifdef __sparc__ +typedef unsigned long ino_t; +#else +typedef unsigned short ino_t; +#endif +#endif + +#ifdef __MS_types__ +typedef unsigned long vm_offset_t; +typedef unsigned long vm_size_t; + +#define __BIT_TYPES_DEFINED__ + +typedef char int8_t; +typedef unsigned char u_int8_t; +typedef short int16_t; +typedef unsigned short u_int16_t; +typedef int int32_t; +typedef unsigned int u_int32_t; +typedef long long int64_t; +typedef unsigned long long u_int64_t; +typedef int32_t register_t; +#endif /* __MS_types__ */ + +/* + * All these should be machine specific - right now they are all broken. + * However, for all of Cygnus' embedded targets, we want them to all be + * the same. Otherwise things like sizeof (struct stat) might depend on + * how the file was compiled (e.g. -mint16 vs -mint32, etc.). + */ + +typedef short dev_t; + +typedef long off_t; + +typedef unsigned short uid_t; +typedef unsigned short gid_t; +typedef int pid_t; +typedef long key_t; +typedef long ssize_t; + +#ifdef __MS_types__ +typedef char * addr_t; +typedef int mode_t; +#else +#if defined (__sparc__) && !defined (__sparc_v9__) +#ifdef __svr4__ +typedef unsigned long mode_t; +#else +typedef unsigned short mode_t; +#endif +#else +typedef unsigned int mode_t _ST_INT32; +#endif +#endif /* ! __MS_types__ */ + +typedef unsigned short nlink_t; + +/* We don't define fd_set and friends if we are compiling POSIX + source, or if we have included the Windows Sockets.h header (which + defines Windows versions of them). Note that a program which + includes the Windows sockets.h header must know what it is doing; + it must not call the cygwin32 select function. */ +# if ! defined (_POSIX_SOURCE) && ! defined (_WINSOCK_H) + +# define NBBY 8 /* number of bits in a byte */ +/* + * Select uses bit masks of file descriptors in longs. + * These macros manipulate such bit fields (the filesystem macros use chars). + * FD_SETSIZE may be defined by the user, but the default here + * should be >= NOFILE (param.h). + */ +# ifndef FD_SETSIZE +# define FD_SETSIZE 64 +# endif + +typedef long fd_mask; +# define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */ +# ifndef howmany +# define howmany(x,y) (((x)+((y)-1))/(y)) +# endif + +/* We use a macro for fd_set so that including Sockets.h afterwards + can work. */ +typedef struct _types_fd_set { + fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; +} _types_fd_set; + +#define fd_set _types_fd_set + +# define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1L << ((n) % NFDBITS))) +# define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1L << ((n) % NFDBITS))) +# define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1L << ((n) % NFDBITS))) +# define FD_ZERO(p) bzero((caddr_t)(p), sizeof (*(p))) + +# endif /* ! defined (_POSIX_SOURCE) && ! defined (_WINSOCK_H) */ + +#undef __MS_types__ +#undef _ST_INT32 + +#endif /* _SYS_TYPES_H */ diff --git a/LAN/SRCS/dcload-ip/target-inc/sys/unistd.h b/LAN/SRCS/dcload-ip/target-inc/sys/unistd.h new file mode 100644 index 00000000..98d1e1f2 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/sys/unistd.h @@ -0,0 +1,175 @@ +#ifndef _SYS_UNISTD_H +#define _SYS_UNISTD_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <_ansi.h> +#include +#define __need_size_t +#include + +extern char **environ; + +void _EXFUN(_exit, (int __status ) _ATTRIBUTE ((noreturn))); + +int _EXFUN(access,(const char *__path, int __amode )); +unsigned _EXFUN(alarm, (unsigned __secs )); +int _EXFUN(chdir, (const char *__path )); +int _EXFUN(chmod, (const char *__path, mode_t __mode )); +int _EXFUN(chown, (const char *__path, uid_t __owner, gid_t __group )); +int _EXFUN(close, (int __fildes )); +char _EXFUN(*ctermid, (char *__s )); +char _EXFUN(*cuserid, (char *__s )); +int _EXFUN(dup, (int __fildes )); +int _EXFUN(dup2, (int __fildes, int __fildes2 )); +int _EXFUN(execl, (const char *__path, const char *, ... )); +int _EXFUN(execle, (const char *__path, const char *, ... )); +int _EXFUN(execlp, (const char *__file, const char *, ... )); +int _EXFUN(execv, (const char *__path, char * const __argv[] )); +int _EXFUN(execve, (const char *__path, char * const __argv[], char * const __envp[] )); +int _EXFUN(execvp, (const char *__file, char * const __argv[] )); +pid_t _EXFUN(fork, (void )); +long _EXFUN(fpathconf, (int __fd, int __name )); +int _EXFUN(fsync, (int __fd)); +char _EXFUN(*getcwd, (char *__buf, size_t __size )); +gid_t _EXFUN(getegid, (void )); +uid_t _EXFUN(geteuid, (void )); +gid_t _EXFUN(getgid, (void )); +int _EXFUN(getgroups, (int __gidsetsize, gid_t __grouplist[] )); +char _EXFUN(*getlogin, (void )); +char _EXFUN(*getpass, (__const char *__prompt)); +size_t _EXFUN(getpagesize, (void)); +pid_t _EXFUN(getpgrp, (void )); +pid_t _EXFUN(getpid, (void )); +pid_t _EXFUN(getppid, (void )); +uid_t _EXFUN(getuid, (void )); +int _EXFUN(isatty, (int __fildes )); +int _EXFUN(link, (const char *__path1, const char *__path2 )); +int _EXFUN(nice, (int __nice_value )); +off_t _EXFUN(lseek, (int __fildes, off_t __offset, int __whence )); +long _EXFUN(pathconf, (const char *__path, int __name )); +int _EXFUN(pause, (void )); +int _EXFUN(pipe, (int __fildes[2] )); +int _EXFUN(read, (int __fildes, void *__buf, size_t __nbyte )); +int _EXFUN(rmdir, (const char *__path )); +void * _EXFUN(sbrk, (size_t __incr)); +int _EXFUN(setgid, (gid_t __gid )); +int _EXFUN(setpgid, (pid_t __pid, pid_t __pgid )); +pid_t _EXFUN(setsid, (void )); +int _EXFUN(setuid, (uid_t __uid )); +unsigned _EXFUN(sleep, (unsigned int __seconds )); +void _EXFUN(swab, (const void *, void *, ssize_t)); +long _EXFUN(sysconf, (int __name )); +pid_t _EXFUN(tcgetpgrp, (int __fildes )); +int _EXFUN(tcsetpgrp, (int __fildes, pid_t __pgrp_id )); +char _EXFUN(*ttyname, (int __fildes )); +int _EXFUN(unlink, (const char *__path )); +int _EXFUN(write, (int __fildes, const void *__buf, size_t __nbyte )); + +/* Provide prototypes for most of the _ names that are + provided in newlib for some compilers. */ +int _EXFUN(_close, (int __fildes )); +pid_t _EXFUN(_fork, (void )); +pid_t _EXFUN(_getpid, (void )); +int _EXFUN(_link, (const char *__path1, const char *__path2 )); +off_t _EXFUN(_lseek, (int __fildes, off_t __offset, int __whence )); +int _EXFUN(_read, (int __fildes, void *__buf, size_t __nbyte )); +void * _EXFUN(_sbrk, (size_t __incr)); +int _EXFUN(_unlink, (const char *__path )); +int _EXFUN(_write, (int __fildes, const void *__buf, size_t __nbyte )); + +#if defined(__CYGWIN32__) || defined(__rtems__) +unsigned _EXFUN(usleep, (unsigned int __useconds)); +int _EXFUN(ftruncate, (int __fd, off_t __length)); +int _EXFUN(truncate, (const char *, off_t __length)); +int _EXFUN(gethostname, (char *__name, size_t __len)); +char * _EXFUN(mktemp, (char *)); +int _EXFUN(sync, (void)); +int _EXFUN(readlink, (const char *__path, char *__buf, int __buflen)); +int _EXFUN(symlink, (const char *__name1, const char *__name2)); +#endif + +# define F_OK 0 +# define R_OK 4 +# define W_OK 2 +# define X_OK 1 + +# define SEEK_SET 0 +# define SEEK_CUR 1 +# define SEEK_END 2 + +/* + * RTEMS adheres to a later version of POSIX -- 1003.1b. + * + * XXX this version string should change. + */ + +#ifdef __rtems__ +#ifndef _POSIX_JOB_CONTROL +# define _POSIX_JOB_CONTROL 1 +#endif +#ifndef _POSIX_SAVED_IDS +# define _POSIX_SAVED_IDS 1 +#endif +# define _POSIX_VERSION 199009L +#else +#ifdef __svr4__ +# define _POSIX_JOB_CONTROL 1 +# define _POSIX_SAVED_IDS 1 +# define _POSIX_VERSION 199009L +#endif +#endif + +#ifdef __CYGWIN32__ +# define _POSIX_JOB_CONTROL 1 +# define _POSIX_SAVED_IDS 0 +# define _POSIX_VERSION 199009L +#endif + +#define STDIN_FILENO 0 /* standard input file descriptor */ +#define STDOUT_FILENO 1 /* standard output file descriptor */ +#define STDERR_FILENO 2 /* standard error file descriptor */ + +long _EXFUN(sysconf, (int __name)); + +# define _SC_ARG_MAX 0 +# define _SC_CHILD_MAX 1 +# define _SC_CLK_TCK 2 +# define _SC_NGROUPS_MAX 3 +# define _SC_OPEN_MAX 4 +/* no _SC_STREAM_MAX */ +# define _SC_JOB_CONTROL 5 +# define _SC_SAVED_IDS 6 +# define _SC_VERSION 7 +# define _SC_PAGESIZE 8 + +# define _PC_LINK_MAX 0 +# define _PC_MAX_CANON 1 +# define _PC_MAX_INPUT 2 +# define _PC_NAME_MAX 3 +# define _PC_PATH_MAX 4 +# define _PC_PIPE_BUF 5 +# define _PC_CHOWN_RESTRICTED 6 +# define _PC_NO_TRUNC 7 +# define _PC_VDISABLE 8 +# define _PC_ASYNC_IO 9 +# define _PC_PRIO_IO 10 +# define _PC_SYNC_IO 11 + +# ifndef _POSIX_SOURCE +# define MAXNAMLEN 1024 +# endif /* _POSIX_SOURCE */ + +/* FIXME: This is temporary until winsup gets sorted out. */ +#ifdef __CYGWIN32__ +#define MAXPATHLEN (260 - 1 /* NUL */) +#else +# define MAXPATHLEN 1024 +#endif + +#ifdef __cplusplus +} +#endif +#endif /* _SYS_UNISTD_H */ diff --git a/LAN/SRCS/dcload-ip/target-inc/sys/utime.h b/LAN/SRCS/dcload-ip/target-inc/sys/utime.h new file mode 100644 index 00000000..5e937f10 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/sys/utime.h @@ -0,0 +1,22 @@ +#ifndef _SYS_UTIME_H +#define _SYS_UTIME_H + +/* This is a dummy file, not customized for any + particular system. If there is a utime.h in libc/sys/SYSDIR/sys, + it will override this one. */ + +#ifdef __cplusplus +extern "C" { +#endif + +struct utimbuf +{ + time_t actime; + time_t modtime; +}; + +#ifdef __cplusplus +}; +#endif + +#endif /* _SYS_UTIME_H */ diff --git a/LAN/SRCS/dcload-ip/target-inc/sys/wait.h b/LAN/SRCS/dcload-ip/target-inc/sys/wait.h new file mode 100644 index 00000000..0e4a3394 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/sys/wait.h @@ -0,0 +1,40 @@ +#ifndef _SYS_WAIT_H +#define _SYS_WAIT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define WNOHANG 1 +#define WUNTRACED 2 + +/* A status looks like: + <2 bytes info> <2 bytes code> + + == 0, child has exited, info is the exit value + == 1..7e, child has exited, info is the signal number. + == 7f, child has stopped, info was the signal number. + == 80, there was a core dump. +*/ + +#define WIFEXITED(w) (((w) & 0xff) == 0) +#define WIFSIGNALED(w) (((w) & 0x7f) > 0 && (((w) & 0x7f) < 0x7f)) +#define WIFSTOPPED(w) (((w) & 0xff) == 0x7f) +#define WEXITSTATUS(w) (((w) >> 8) & 0xff) +#define WTERMSIG(w) ((w) & 0x7f) +#define WSTOPSIG WEXITSTATUS + +pid_t wait (int *); +pid_t waitpid (pid_t, int *, int); + +/* Provide prototypes for most of the _ names that are + provided in newlib for some compilers. */ +pid_t _wait (int *); + +#ifdef __cplusplus +}; +#endif + +#endif diff --git a/LAN/SRCS/dcload-ip/target-inc/termios.h b/LAN/SRCS/dcload-ip/target-inc/termios.h new file mode 100644 index 00000000..ee1820ce --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/termios.h @@ -0,0 +1,7 @@ +#ifdef __cplusplus +extern "C" { +#endif +#include +#ifdef __cplusplus +} +#endif diff --git a/LAN/SRCS/dcload-ip/target-inc/time.h b/LAN/SRCS/dcload-ip/target-inc/time.h new file mode 100644 index 00000000..4a966177 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/time.h @@ -0,0 +1,90 @@ +/* + * time.h + * + * Struct and function declarations for dealing with time. + */ + +#ifndef _TIME_H_ +#define _TIME_H_ + +#include "_ansi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef NULL +#define NULL 0 +#endif + +/* Get _CLOCKS_PER_SEC_ */ +#include + +#ifndef _CLOCKS_PER_SEC_ +#define _CLOCKS_PER_SEC_ 1000 +#endif + +#define CLOCKS_PER_SEC _CLOCKS_PER_SEC_ +#define CLK_TCK CLOCKS_PER_SEC +#define __need_size_t +#include + +/* Get _CLOCK_T_ and _TIME_T_. */ +#include + +#ifndef __clock_t_defined +typedef _CLOCK_T_ clock_t; +#define __clock_t_defined +#endif + +#ifndef __time_t_defined +typedef _TIME_T_ time_t; +#define __time_t_defined +#endif + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; +}; + +clock_t _EXFUN(clock, (void)); +double _EXFUN(difftime, (time_t _time2, time_t _time1)); +time_t _EXFUN(mktime, (struct tm *_timeptr)); +time_t _EXFUN(time, (time_t *_timer)); +#ifndef _REENT_ONLY +char *_EXFUN(asctime, (const struct tm *_tblock)); +char *_EXFUN(ctime, (const time_t *_time)); +struct tm *_EXFUN(gmtime, (const time_t *_timer)); +struct tm *_EXFUN(localtime,(const time_t *_timer)); +#endif +size_t _EXFUN(strftime, (char *_s, size_t _maxsize, const char *_fmt, const struct tm *_t)); + +char *_EXFUN(asctime_r, (const struct tm *, char *)); +char *_EXFUN(ctime_r, (const time_t *, char *)); +struct tm *_EXFUN(gmtime_r, (const time_t *, struct tm *)); +struct tm *_EXFUN(localtime_r, (const time_t *, struct tm *)); + +#ifdef __CYGWIN32__ +#ifndef __STRICT_ANSI__ +extern time_t _timezone __declspec(dllimport); +extern int _daylight __declspec(dllimport); +extern char *_tzname[2] __declspec(dllimport); + +char *_EXFUN(timezone, (void)); +void _EXFUN(tzset, (void)); +#endif +#endif /* __CYGWIN32__ */ + +#ifdef __cplusplus +} +#endif +#endif /* _TIME_H_ */ + diff --git a/LAN/SRCS/dcload-ip/target-inc/unctrl.h b/LAN/SRCS/dcload-ip/target-inc/unctrl.h new file mode 100644 index 00000000..8205ea60 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/unctrl.h @@ -0,0 +1,46 @@ +/* From curses.h. */ +/* + * Copyright (c) 1981, 1993 + * The Regents of the University of California. 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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 _UNCTRL_H_ +#define _UNCTRL_H_ + +#include <_ansi.h> + +#define unctrl(c) __unctrl[(c) & 0xff] +#define unctrllen(ch) __unctrllen[(ch) & 0xff] + +extern _CONST char * _CONST __unctrl[256]; /* Control strings. */ +extern _CONST char __unctrllen[256]; /* Control strings length. */ + +#endif /* _UNCTRL_H_ */ diff --git a/LAN/SRCS/dcload-ip/target-inc/unistd.h b/LAN/SRCS/dcload-ip/target-inc/unistd.h new file mode 100644 index 00000000..f9fca847 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/unistd.h @@ -0,0 +1,6 @@ +#ifndef _UNISTD_H_ +#define _UNISTD_H_ + +# include + +#endif /* _UNISTD_H_ */ diff --git a/LAN/SRCS/dcload-ip/target-inc/utime.h b/LAN/SRCS/dcload-ip/target-inc/utime.h new file mode 100644 index 00000000..c05e08e9 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/utime.h @@ -0,0 +1,10 @@ +#ifdef __cplusplus +extern "C" { +#endif + +/* The utime function is defined in libc/sys//sys if it exists. */ +#include + +#ifdef __cplusplus +} +#endif diff --git a/LAN/SRCS/dcload-ip/target-inc/utmp.h b/LAN/SRCS/dcload-ip/target-inc/utmp.h new file mode 100644 index 00000000..88cf6f85 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-inc/utmp.h @@ -0,0 +1,8 @@ +#ifdef __cplusplus +extern "C" { +#endif +#include +#ifdef __cplusplus +} +#endif + diff --git a/LAN/SRCS/dcload-ip/target-src/1st_read/1st_read.c b/LAN/SRCS/dcload-ip/target-src/1st_read/1st_read.c new file mode 100644 index 00000000..264eac44 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/1st_read/1st_read.c @@ -0,0 +1,40 @@ +/* + * This file is part of the dcload Dreamcast ethernet loader + * + * Copyright (C) 2001 Andrew Kieschnick + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#define TARGET1 (unsigned int *)0x8c004000 +#define TARGET2 (unsigned int *)0x8c00f400 + +extern void disable_cache(void); + +extern unsigned int binary_dcload_bin_start; +extern unsigned int binary_dcload_bin_size; +extern unsigned int binary_exception_bin_start; +extern unsigned int binary_exception_bin_size; + +int main(void) +{ + memcpy(TARGET1, &binary_dcload_bin_start, &binary_dcload_bin_size); + memcpy(TARGET2, &binary_exception_bin_start, &binary_exception_bin_size); + + disable_cache(); + (*(void (*)()) 0x8c004000) (); + +} diff --git a/LAN/SRCS/dcload-ip/target-src/1st_read/Makefile b/LAN/SRCS/dcload-ip/target-src/1st_read/Makefile new file mode 100644 index 00000000..87d8a1e9 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/1st_read/Makefile @@ -0,0 +1,49 @@ +include ../../Makefile.cfg + +CC = $(TARGETCC) +CFLAGS = $(TARGETCFLAGS) +INCLUDE = -I../../target-inc +OBJCOPY = $(TARGETOBJCOPY) +LD = $(TARGETLD) + +OBJECTS = crt0.o 1st_read.o disable.o memcpy.o dcload.o exception.o + +.c.o: + $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $< + +.S.o: + $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $< + +.s.o: + $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $< + +all: 1st_read.bin 1st_read.srec + +dcload.bin: ../dcload/dcload.bin + cp $< $@ + +exception.bin: ../dcload/exception.bin + cp $< $@ + +dcload.o: dcload.bin + $(LD) -A sh -b binary --oformat elf32-shl $< -o $@ -r -EL --no-warn-mismatch + +exception.o: exception.bin + $(LD) -A sh -b binary --oformat elf32-shl $< -o $@ -r -EL --no-warn-mismatch + +1st_read.bin: 1st_read + $(OBJCOPY) -O binary $< $@ + +1st_read.srec: 1st_read + $(OBJCOPY) -O srec $< $@ + +1st_read: $(OBJECTS) + $(CC) $(CFLAGS) -Wl,-Tdc.x -nostartfiles -nostdlib $^ -o $@ -L/usr/local/dc/sh-elf/lib/gcc-lib/sh-elf/3.0.4/ml/m4-single-only -lgcc + +.PHONY : clean +clean: + rm -f $(OBJECTS) 1st_read dcload.bin exception.bin + +.PHONY : distclean +distclean: clean + rm -f 1st_read.bin 1st_read.srec diff --git a/LAN/SRCS/dcload-ip/target-src/1st_read/asm.h b/LAN/SRCS/dcload-ip/target-src/1st_read/asm.h new file mode 100644 index 00000000..ed27fdb1 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/1st_read/asm.h @@ -0,0 +1,22 @@ +#ifdef __STDC__ +# define _C_LABEL(x) _ ## x +#else +# define _C_LABEL(x) _/**/x +#endif +#define _ASM_LABEL(x) x + +#define _ENTRY(name) \ + .text; .align 2; .globl name; name: + +#define ENTRY(name) \ + _ENTRY(_C_LABEL(name)) + +#if (defined (__sh2__) || defined (__sh3__) || defined (__SH3E__) \ + || defined (__SH4_SINGLE__) || defined (__SH4__)) || defined(__SH4_SINGLE_ONLY__) +#define DELAYED_BRANCHES +#define SL(branch, dest, in_slot, in_slot_arg2) \ + branch##.s dest; in_slot, in_slot_arg2 +#else +#define SL(branch, dest, in_slot, in_slot_arg2) \ + in_slot, in_slot_arg2; branch dest +#endif diff --git a/LAN/SRCS/dcload-ip/target-src/1st_read/crt0.S b/LAN/SRCS/dcload-ip/target-src/1st_read/crt0.S new file mode 100644 index 00000000..1af82cca --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/1st_read/crt0.S @@ -0,0 +1,99 @@ + .section .text + .global start + .global _atexit +start: + mov.l setup_cache_k,r0 + mov.l p2_mask,r1 + or r1,r0 + jmp @r0 + nop +setup_cache: + mov.l ccr_addr,r0 + mov.w ccr_data,r1 + mov.l r1,@r0 + mov.l start_2_k,r0 + nop + nop + nop + nop + nop + nop + nop + jmp @r0 + nop +start_2: + mov.l old_stack_k,r14 + mov.l r15,@r14 + mov.l old_pr_k,r14 + sts pr,r15 + mov.l r15,@r14 + mov.l stack_k,r15 + + ! zero out bss + mov.l edata_k,r0 + mov.l end_k,r1 + mov #0,r2 +start_l: + mov.l r2,@r0 + add #4,r0 + cmp/ge r0,r1 + bt start_l + + mov.l set_fpscr_k, r1 + jsr @r1 + mov #0,r4 + lds r3,fpscr + + ! call the mainline + mov.l main_k,r0 + jsr @r0 + nop + + mov.l old_pr_k,r14 + mov.l @r14,r15 + lds r15,pr + mov.l old_stack_k,r14 + mov.l @r14,r15 + +_atexit: + rts + nop + + .align 4 +set_fpscr_k: + .long ___set_fpscr +stack_k: + .long _stack +edata_k: + .long _edata +end_k: + .long _end +main_k: + .long _main +old_stack_k: + .long _old_stack +old_pr_k: + .long _old_pr +_old_stack: + .long 0 +_old_pr: + .long 0 +setup_cache_k: + .long setup_cache +start_2_k: + .long start_2 +p2_mask: + .long 0xa0000000 +ccr_addr: + .long 0xff00001c +ccr_data: + .word 0x090b + + .align 4 + +#ifdef __ELF__ + .section .stack,"aw" +#else + .section .stack +#endif + diff --git a/LAN/SRCS/dcload-ip/target-src/1st_read/dc.x b/LAN/SRCS/dcload-ip/target-src/1st_read/dc.x new file mode 100644 index 00000000..5ea23dcb --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/1st_read/dc.x @@ -0,0 +1,228 @@ +/* Sega Dreamcast linker script */ + +OUTPUT_FORMAT("elf32-shl", "elf32-shl", + "elf32-shl") +OUTPUT_ARCH(sh) +ENTRY(start) + SEARCH_DIR(/usr/local/dcdev/sh-elf/lib); +/* Do we need any of these for elf? + __DYNAMIC = 0; */ + +MEMORY +{ + ram (rwx) : ORIGIN = 0x8c010000, LENGTH = 0xfe0000 +} + +SECTIONS +{ + /* Read-only sections, merged into text segment: */ +/* . = 0x1000;*/ + .interp : { *(.interp) } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .gnu.version : { *(.gnu.version) } + .gnu.version_d : { *(.gnu.version_d) } + .gnu.version_r : { *(.gnu.version_r) } + .rel.init : { *(.rel.init) } + .rela.init : { *(.rela.init) } + .rel.text : + { + *(.rel.text) + *(.rel.text.*) + *(.rel.gnu.linkonce.t*) + } + .rela.text : + { + *(.rela.text) + *(.rela.text.*) + *(.rela.gnu.linkonce.t*) + } + .rel.fini : { *(.rel.fini) } + .rela.fini : { *(.rela.fini) } + .rel.rodata : + { + *(.rel.rodata) + *(.rel.rodata.*) + *(.rel.gnu.linkonce.r*) + } + .rela.rodata : + { + *(.rela.rodata) + *(.rela.rodata.*) + *(.rela.gnu.linkonce.r*) + } + .rel.data : + { + *(.rel.data) + *(.rel.data.*) + *(.rel.gnu.linkonce.d*) + } + .rela.data : + { + *(.rela.data) + *(.rela.data.*) + *(.rela.gnu.linkonce.d*) + } + .rel.ctors : { *(.rel.ctors) } + .rela.ctors : { *(.rela.ctors) } + .rel.dtors : { *(.rel.dtors) } + .rela.dtors : { *(.rela.dtors) } + .rel.got : { *(.rel.got) } + .rela.got : { *(.rela.got) } + .rel.sdata : + { + *(.rel.sdata) + *(.rel.sdata.*) + *(.rel.gnu.linkonce.s*) + } + .rela.sdata : + { + *(.rela.sdata) + *(.rela.sdata.*) + *(.rela.gnu.linkonce.s*) + } + .rel.sbss : { *(.rel.sbss) } + .rela.sbss : { *(.rela.sbss) } + .rel.bss : { *(.rel.bss) } + .rela.bss : { *(.rela.bss) } + .rel.plt : { *(.rel.plt) } + .rela.plt : { *(.rela.plt) } + .init : + { + KEEP (*(.init)) + } =0 + .plt : { *(.plt) } + .text : + { + *(.text) + *(.text.*) + *(.stub) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + *(.gnu.linkonce.t*) + } =0 + _etext = .; + PROVIDE (etext = .); + .fini : + { + KEEP (*(.fini)) + } =0 + .rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) } + .rodata1 : { *(.rodata1) } + /* Adjust the address for the data segment. We want to adjust up to + the same address within the page on the next page up. */ + . = ALIGN(128) + (. & (128 - 1)); + .data : + { + *(.data) + *(.data.*) + *(.gnu.linkonce.d*) + SORT(CONSTRUCTORS) + } + .data1 : { *(.data1) } + .eh_frame : { *(.eh_frame) } + .gcc_except_table : { *(.gcc_except_table) } + .ctors ALIGN(4): + { + ___ctors = .; + /* gcc uses crtbegin.o to find the start of + the constructors, so we make sure it is + first. Because this is a wildcard, it + doesn't matter if the user does not + actually link against crtbegin.o; the + linker won't look for a file to match a + wildcard. The wildcard also means that it + doesn't matter which directory crtbegin.o + is in. */ + KEEP (*crtbegin.o(.ctors)) + /* We don't want to include the .ctor section from + from the crtend.o file until after the sorted ctors. + The .ctor section from the crtend file contains the + end of ctors marker and it must be last */ + KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + ___ctors_end = .; + } + .dtors : + { + ___dtors = .; + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + ___dtors_end = .; + } + .got : { *(.got.plt) *(.got) } + .dynamic : { *(.dynamic) } + /* We want the small data sections together, so single-instruction offsets + can access them all, and initialized data all before uninitialized, so + we can shorten the on-disk segment size. */ + .sdata : + { + *(.sdata) + *(.sdata.*) + *(.gnu.linkonce.s.*) + } + _edata = .; + PROVIDE (edata = .); + __bss_start = .; + .sbss : + { + *(.dynsbss) + *(.sbss) + *(.sbss.*) + *(.scommon) + } + .bss : + { + *(.dynbss) + *(.bss) + *(.bss.*) + *(COMMON) + /* Align here to ensure that the .bss section occupies space up to + _end. Align after .bss to ensure correct alignment even if the + .bss section disappears because there are no input sections. */ + . = ALIGN(32 / 8); + } + . = ALIGN(32 / 8); + _end = .; + PROVIDE (end = .); + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +/* .stack 0x8c00f400 : { _stack = .; *(.stack) }*/ + /* These must appear regardless of . */ +_stack = 0x8d000000; +} diff --git a/LAN/SRCS/dcload-ip/target-src/1st_read/disable.s b/LAN/SRCS/dcload-ip/target-src/1st_read/disable.s new file mode 100644 index 00000000..c62a6647 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/1st_read/disable.s @@ -0,0 +1,37 @@ + .section .text + .global _disable_cache + +_disable_cache: + mov.l disable_cache_k,r0 + mov.l p2_mask,r1 + or r1,r0 + jmp @r0 + nop +disable_cache: + mov.l ccr_addr,r0 + mov.l ccr_data_k,r1 + mov.l @r1,r1 + mov.l r1,@r0 + nop + nop + nop + nop + nop + nop + nop + nop + rts + nop + + .align 4 + +disable_cache_k: + .long disable_cache +p2_mask: + .long 0xa0000000 +ccr_addr: + .long 0xff00001c +ccr_data_k: + .long ccr_data +ccr_data: + .long 0x00000808 diff --git a/LAN/SRCS/dcload-ip/target-src/1st_read/memcpy.S b/LAN/SRCS/dcload-ip/target-src/1st_read/memcpy.S new file mode 100644 index 00000000..4df72e37 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/1st_read/memcpy.S @@ -0,0 +1,221 @@ +! +! Fast SH memcpy +! +! by Toshiyasu Morita (tm@netcom.com) +! hacked by J"orn Rernnecke (amylaar@cygnus.co.uk) ("o for o-umlaut) +! +! Entry: r4: destination pointer +! r5: source pointer +! r6: byte count +! +! Exit: r0: destination pointer +! r1-r7: trashed +! +! Notes: Usually one wants to do small reads and write a longword, but +! unfortunately it is difficult in some cases to concatanate bytes +! into a longword on the SH, so this does a longword read and small +! writes. +! +! This implementation makes two assumptions about how it is called: +! +! 1.: If the byte count is nonzero, the address of the last byte to be +! copied is unsigned greater than the address of the first byte to +! be copied. This could be easily swapped for a signed comparison, +! but the algorithm used needs some comparison. +! +! 2.: When there are two or three bytes in the last word of an 11-or-bore +! bytes memory chunk to b copied, the rest of the word can be read +! without size effects. +! This could be easily changed by increasing the minumum size of +! a fast memcpy and the amount subtracted from r7 before L_2l_loop be 2, +! however, this would cost a few extra cyles on average. +! + +#include "asm.h" + +ENTRY(memcpy) +#ifdef __LITTLE_ENDIAN__ + ! Little endian version copies with increasing addresses. + mov r4,r3 ! Save return value + mov #11,r0 ! Check if small number of bytes + cmp/hs r0,r6 + ! r6 becomes src end address + SL(bf, L_small, add r5,r6) + mov #1,r1 + tst r1,r5 ! check if source even + SL(bt, L_even, mov r6,r7) + mov.b @r5+,r0 ! no, make it even. + mov.b r0,@r4 + add #1,r4 +L_even: tst r1,r4 ! check if destination is even + add #-3,r7 + SL(bf, L_odddst, mov #2,r1) + tst r1,r4 ! check if destination is 4-byte aligned + mov r4,r0 + SL(bt, L_al4dst, sub r5,r0) + mov.w @r5+,r2 + mov.w r2,@r4 + ! add #2,r4 r4 is dead here. +L_al4dst: + tst r1,r5 + bt L_al4both + mov.w @r5+,r1 + swap.w r1,r1 + add #-6,r0 + add #-6,r7 ! r7 := src end address minus 9. + .align 2 +L_2l_loop: + mov.l @r5+,r2 ! Read & write two longwords per iteration + xtrct r2,r1 + mov.l r1,@(r0,r5) + cmp/hs r7,r5 + mov.l @r5+,r1 + xtrct r1,r2 + mov.l r2,@(r0,r5) + bf L_2l_loop + add #-2,r5 + bra L_cleanup + add #5,r0 +L_al4both: + add #-4,r0 + .align 2 +L_al4both_loop: + mov.l @r5+,r4 ! Read longword, write longword per iteration + cmp/hs r7,r5 + SL(bf, L_al4both_loop, mov.l r4,@(r0,r5)) + + bra L_cleanup + add #3,r0 + +L_odddst: + tst r1,r5 + SL(bt, L_al4src, add #-1,r4) + mov.w @r5+,r0 + mov.b r0,@(1,r4) + shlr8 r0 + mov.b r0,@(2,r4) + add #2,r4 +L_al4src: + .align 2 +L_odd_loop: + mov.l @r5+,r0 ! Read longword, write byte, word, byte per iteration + cmp/hs r7,r5 + mov.b r0,@(1,r4) + shlr8 r0 + mov.w r0,@(2,r4) + shlr16 r0 + mov.b r0,@(4,r4) + SL(bf, L_odd_loop, add #4,r4) + .align 2 ! avoid nop in more frequently executed code. +L_cleanup2: + mov r4,r0 + sub r5,r0 +L_cleanup: + cmp/eq r6,r5 + bt L_ready + .align 2 +L_cleanup_loop: + mov.b @r5+,r1 + cmp/eq r6,r5 + mov.b r1,@(r0,r5) + bf L_cleanup_loop +L_ready: + rts + mov r3,r0 +L_small: + bra L_cleanup2 + add #-1,r4 +#else + ! Big endian version copies with decreasing addresses. + mov r4,r0 + add r6,r0 + sub r4,r5 + mov #11,r1 + cmp/hs r1,r6 + SL(bf, L_small, add #-1,r5) + mov r5,r3 + add r0,r3 + shlr r3 + SL(bt, L_even, + mov r4,r7) + mov.b @(r0,r5),r2 + add #-1,r3 + mov.b r2,@-r0 +L_even: + tst #1,r0 + add #-1,r5 + SL(bf, L_odddst, add #8,r7) + tst #2,r0 + bt L_al4dst + add #-1,r3 + mov.w @(r0,r5),r1 + mov.w r1,@-r0 +L_al4dst: + shlr r3 + bt L_al4both + mov.w @(r0,r5),r1 + swap.w r1,r1 + add #4,r7 + add #-4,r5 + .align 2 +L_2l_loop: + mov.l @(r0,r5),r2 + xtrct r2,r1 + mov.l r1,@-r0 + cmp/hs r7,r0 + mov.l @(r0,r5),r1 + xtrct r1,r2 + mov.l r2,@-r0 + bt L_2l_loop + bra L_cleanup + add #5,r5 + + nop ! avoid nop in executed code. +L_al4both: + add #-2,r5 + .align 2 +L_al4both_loop: + mov.l @(r0,r5),r1 + cmp/hs r7,r0 + SL(bt, L_al4both_loop, + mov.l r1,@-r0) + bra L_cleanup + add #3,r5 + + nop ! avoid nop in executed code. +L_odddst: + shlr r3 + bt L_al4src + mov.w @(r0,r5),r1 + mov.b r1,@-r0 + shlr8 r1 + mov.b r1,@-r0 +L_al4src: + add #-2,r5 + .align 2 +L_odd_loop: + mov.l @(r0,r5),r2 + cmp/hs r7,r0 + mov.b r2,@-r0 + shlr8 r2 + mov.w r2,@-r0 + shlr16 r2 + mov.b r2,@-r0 + bt L_odd_loop + + add #3,r5 +L_cleanup: +L_small: + cmp/eq r4,r0 + bt L_ready + add #1,r4 + .align 2 +L_cleanup_loop: + mov.b @(r0,r5),r2 + cmp/eq r4,r0 + mov.b r2,@-r0 + bf L_cleanup_loop +L_ready: + rts + nop +#endif diff --git a/LAN/SRCS/dcload-ip/target-src/Makefile b/LAN/SRCS/dcload-ip/target-src/Makefile new file mode 100644 index 00000000..2d18d228 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/Makefile @@ -0,0 +1,24 @@ +SUBDIRS = 1st_read dcload +MAKE = make + +.PHONY : subdirs $(SUBDIRS) + +subdirs: $(SUBDIRS) + +$(SUBDIRS): + $(MAKE) -C $@ + +1st_read: dcload + +.PHONY : clean +clean: + for dir in $(SUBDIRS); do \ + $(MAKE) -C $$dir clean; \ + done + +.PHONY : distclean +distclean: + for dir in $(SUBDIRS) ; do \ + $(MAKE) -C $$dir distclean; \ + done + diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/Makefile b/LAN/SRCS/dcload-ip/target-src/dcload/Makefile new file mode 100644 index 00000000..14af1476 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/Makefile @@ -0,0 +1,35 @@ +include ../../Makefile.cfg + +CC = $(TARGETCC) +CFLAGS = $(TARGETCFLAGS) -DDREAMCAST_IP=\"$(DREAMCAST_IP)\" +INCLUDE = -I../../target-inc + +OBJCOPY = $(TARGETOBJCOPY) + +DCLOBJECTS = dcload-crt0.o syscalls.o memcpy.o memset.o memcmp.o disable.o go.o video.o dcload.o cdfs_redir.o cdfs_syscalls.o bswap.o packet.o rtl8139.o net.o commands.o adapter.o lan_adapter.o +EXCOBJECTS = exception.o + +%.o : %.c + $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $< +%.o : %.s + $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $< +%.o : %.S + $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $< +%.bin: % + $(OBJCOPY) -O binary $< $@ + +all: dcload.bin exception.bin + +dcload: $(DCLOBJECTS) + $(CC) $(CFLAGS) -Wl,-Tdcload.x -nostartfiles -nostdlib $^ -o $@ -L/usr/local/dc/sh-elf/lib/gcc-lib/sh-elf/3.0.4/ml/m4-single-only -lgcc + +exception: $(EXCOBJECTS) + $(CC) $(CFLAGS) -Wl,-Ttext=0x8c00f400 -nostartfiles -nostdlib $^ -o $@ + +.PHONY : clean +clean: + rm -f $(DCLOBJECTS) $(EXCOBJECTS) dcload exception + +.PHONY : distclean +distclean: clean + rm -f dcload.bin exception.bin diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/adapter.c b/LAN/SRCS/dcload-ip/target-src/dcload/adapter.c new file mode 100644 index 00000000..210ba3f0 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/adapter.c @@ -0,0 +1,31 @@ +#include "adapter.h" +#include "rtl8139.h" +#include "lan_adapter.h" + +// Loop escape flag, used by all drivers. +unsigned int escape_loop = 0; + +// The currently configured driver. +adapter_t * bb; + +// Packet receive buffer +unsigned char current_pkt[1514]; + +int adapter_detect() { + // Try the BBA first. + if (adapter_bba.detect() >= 0) { + bb = &adapter_bba; + } else if (adapter_la.detect() >= 0) { + bb = &adapter_la; + } else { + return -1; + } + + // Initialize the chosen adapter. + if (bb->init() < 0) + return -1; + + escape_loop = 0; + + return 0; +} diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/adapter.h b/LAN/SRCS/dcload-ip/target-src/dcload/adapter.h new file mode 100644 index 00000000..c635f174 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/adapter.h @@ -0,0 +1,44 @@ +#ifndef __ADAPTER_H__ +#define __ADAPTER_H__ + +// Defines a "network adapter". There will be one of these for each of the +// available drivers. +typedef struct { + // Driver name + const char * name; + + // Mac address + unsigned char mac[6]; + + // Check to see if we have one + int (*detect)(); + + // Initialize the adapter + int (*init)(); + + // Start network I/O + void (*start)(); + + // Stop network I/O + void (*stop)(); + + // Poll for I/O + void (*loop)(); + + // Transmit a packet on the adapter + int (*tx)(unsigned char * pkt, int len); +} adapter_t; + +// Detect which adapter we are using and init our structs. +int adapter_detect(); + +// The configured adapter, to be used in all other funcs. +extern adapter_t * bb; + +// Set this variable to non-zero if you want the loop to exit. +extern unsigned int escape_loop; + +// All adapter drivers should use this shared buffer to receive. +extern unsigned char current_pkt[1514]; + +#endif diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/asm.h b/LAN/SRCS/dcload-ip/target-src/dcload/asm.h new file mode 100644 index 00000000..ed27fdb1 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/asm.h @@ -0,0 +1,22 @@ +#ifdef __STDC__ +# define _C_LABEL(x) _ ## x +#else +# define _C_LABEL(x) _/**/x +#endif +#define _ASM_LABEL(x) x + +#define _ENTRY(name) \ + .text; .align 2; .globl name; name: + +#define ENTRY(name) \ + _ENTRY(_C_LABEL(name)) + +#if (defined (__sh2__) || defined (__sh3__) || defined (__SH3E__) \ + || defined (__SH4_SINGLE__) || defined (__SH4__)) || defined(__SH4_SINGLE_ONLY__) +#define DELAYED_BRANCHES +#define SL(branch, dest, in_slot, in_slot_arg2) \ + branch##.s dest; in_slot, in_slot_arg2 +#else +#define SL(branch, dest, in_slot, in_slot_arg2) \ + in_slot, in_slot_arg2; branch dest +#endif diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/bswap.h b/LAN/SRCS/dcload-ip/target-src/dcload/bswap.h new file mode 100644 index 00000000..743ce54f --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/bswap.h @@ -0,0 +1,7 @@ +#ifndef __BSWAP_H__ +#define __BSWAP_H__ + +unsigned short bswap16(unsigned short x); +unsigned int bswap32(unsigned int x); + +#endif diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/bswap.s b/LAN/SRCS/dcload-ip/target-src/dcload/bswap.s new file mode 100644 index 00000000..2429c049 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/bswap.s @@ -0,0 +1,18 @@ + .globl _bswap16, _bswap32 + + .text + + ! r4 = dest + +_bswap16: + rts + swap.b r4,r0 + +_bswap32: + swap.b r4,r0 + swap.w r0,r4 + rts + swap.b r4,r0 + + .end + diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/cdfs.h b/LAN/SRCS/dcload-ip/target-src/dcload/cdfs.h new file mode 100644 index 00000000..f09ef324 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/cdfs.h @@ -0,0 +1,9 @@ +#ifndef __CDFS_H__ +#define __CDFS_H__ + +void cdfs_redir_enable(void); +void cdfs_redir_save(void); +void cdfs_redir_disable(void); +void cdfs_redir_enable(void); + +#endif diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/cdfs_redir.s b/LAN/SRCS/dcload-ip/target-src/dcload/cdfs_redir.s new file mode 100644 index 00000000..895eebdf --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/cdfs_redir.s @@ -0,0 +1,83 @@ + .section .text + .global _cdfs_redir_enable + .global _cdfs_redir_disable + .global _cdfs_redir_save +.align 2 + +_cdfs_redir_save: + mov.l cdfs_saved_k, r0 + mov.l @r0, r0 + tst r0,r0 + bf already_saved + mov.l cdfs_entry_k, r0 + mov.l @r0,r0 + mov.l cdfs_saved_k, r1 + mov.l r0, @r1 +already_saved: + rts + nop + +_cdfs_redir_disable: + mov.l cdfs_saved_k, r0 + mov.l @r0, r0 + mov.l cdfs_entry_k, r1 + mov.l r0, @r1 + rts + nop + +_cdfs_redir_enable: + mov.l cdfs_entry_k, r0 + mov.l cdfs_redir_k, r1 + mov.l r1, @r0 + rts + nop + +.align 4 +cdfs_entry_k: + .long 0x8c0000bc +cdfs_saved_k: + .long cdfs_saved +cdfs_saved: + .long 0 +cdfs_redir_k: + .long cdfs_redir + +cdfs_redir: + mov r7,r0 + mov #10,r1 + cmp/hs r0,r1 + bf badsyscall + mov.l gd_first_k,r1 + shll2 r0 + mov.l @(r0,r1),r0 + jmp @r0 + nop +badsyscall: + mov #-1,r0 + rts + nop + +gd_first_k: + .long gdGdcReqCmd +gdGdcReqCmd: + .long _gdGdcReqCmd +gdGdcGetCmdStat: + .long _gdGdcGetCmdStat +gdGdcExecServer: + .long _gdGdcExecServer +gdGdcInitSystem: + .long _gdGdcInitSystem +gdGdcGetDrvStat: + .long _gdGdcGetDrvStat +gdGdcG1DmaEnd: + .long badsyscall +gdGdcReqDmaTrans: + .long badsyscall +gdGdcCheckDmaTrans: + .long badsyscall +gdGdcReadAbort: + .long badsyscall +gdGdcReset: + .long badsyscall +gdGdcChangeDataType: + .long _gdGdcChangeDataType diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/cdfs_syscalls.c b/LAN/SRCS/dcload-ip/target-src/dcload/cdfs_syscalls.c new file mode 100644 index 00000000..98427800 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/cdfs_syscalls.c @@ -0,0 +1,104 @@ +/* + * This file is part of the dcload Dreamcast ethernet loader + * + * Copyright (C) 2001 Andrew Kieschnick + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include "syscalls.h" +#include "packet.h" +#include "net.h" +#include "adapter.h" +#include "commands.h" + +int gdStatus; + +struct TOC { + unsigned int entry[99]; + unsigned int first, last; + unsigned int dunno; +}; + +int gdGdcReqCmd(int cmd, int *param) +{ + command_3int_t * command = (command_3int_t *)(pkt_buf + ETHER_H_LEN + IP_H_LEN + UDP_H_LEN); + struct TOC *toc; + int i; + + switch (cmd) { + case 16: /* read sectors */ + + memcpy(command->id, CMD_CDFSREAD, 4); + command->value0 = htonl(param[0]); + command->value1 = htonl(param[2]); + command->value2 = htonl(param[1]*2048); + build_send_packet(sizeof(command_3int_t)); + bb->loop(); + + param[3] = 0; + gdStatus = 2; + + return 0; + break; + case 19: /* read toc */ + toc = (struct TOC *)param[1]; + toc->entry[0] = 0x41000096; /* CTRL = 4, ADR = 1, LBA = 150 */ + for(i=1; i<99; i++) + toc->entry[i] = -1; + toc->first = 0x41010000; /* first = track 1 */ + toc->last = 0x41010000; /* last = track 1 */ + gdStatus = 2; + return 0; + break; + case 24: /* init disc */ + gdStatus = 2; + return 0; + break; + default: + gdStatus = 0; + return -1; + break; + } + +} + +void gdGdcExecServer(void) +{ +} + +int gdGdcGetCmdStat(int f, int *status) +{ + if (gdStatus == 0) + status[0] = 0; + return gdStatus; + +} + +void gdGdcGetDrvStat(int *param) +{ + param[1] = 32; +} + +int gdGdcChangeDataType(int *param) +{ + return 0; +} + +void gdGdcInitSystem(void) +{ +} + diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/commands.c b/LAN/SRCS/dcload-ip/target-src/dcload/commands.c new file mode 100644 index 00000000..f7e06b58 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/commands.c @@ -0,0 +1,207 @@ +#include "commands.h" +#include "packet.h" +#include "net.h" +#include "video.h" +#include "adapter.h" +#include "syscalls.h" +#include "cdfs.h" +#include "dcload.h" +#include "go.h" +#include "disable.h" +#include "scif.h" + +unsigned int our_ip; +unsigned int tool_ip; +unsigned char tool_mac[6]; +unsigned short tool_port; + +#define NAME "dcload-ip " DCLOAD_VERSION +#define min(a, b) ((a) < (b) ? (a) : (b)) + +typedef struct { + unsigned int load_address; + unsigned int load_size; + unsigned char map[16384]; +} bin_info_t; + +bin_info_t bin_info; + +unsigned char buffer[COMMAND_LEN + 1024]; /* buffer for response */ +command_t * response = (command_t *)buffer; + +void cmd_reboot(ether_header_t * ether, ip_header_t * ip, udp_header_t * udp, command_t * command) +{ + booted = 0; + running = 0; + + disable_cache(); + go(0x8c004000); +} + +void cmd_execute(ether_header_t * ether, ip_header_t * ip, udp_header_t * udp, command_t * command) +{ + if (!running) { + tool_ip = ntohl(ip->src); + tool_port = ntohs(udp->src); + memcpy(tool_mac, ether->src, 6); + our_ip = ntohl(ip->dest); + + make_ip(ntohl(ip->src), ntohl(ip->dest), UDP_H_LEN + COMMAND_LEN, 17, (ip_header_t *)(pkt_buf + ETHER_H_LEN)); + make_udp(ntohs(udp->src), ntohs(udp->dest),(unsigned char *) command, COMMAND_LEN, (ip_header_t *)(pkt_buf + ETHER_H_LEN), (udp_header_t *)(pkt_buf + ETHER_H_LEN + IP_H_LEN)); + bb->tx(pkt_buf, ETHER_H_LEN + IP_H_LEN + UDP_H_LEN + COMMAND_LEN); + + if (!booted) + disp_info(); + else + disp_status("executing..."); + + if (ntohl(command->size)&1) + *(unsigned int *)0x8c004004 = 0xdeadbeef; /* enable console */ + else + *(unsigned int *)0x8c004004 = 0xfeedface; /* disable console */ + if (ntohl(command->size)>>1) + cdfs_redir_enable(); + + bb->stop(); + + running = 1; + + disable_cache(); + go(ntohl(command->address)); + } +} + +void cmd_loadbin(ip_header_t * ip, udp_header_t * udp, command_t * command) +{ + bin_info.load_address = ntohl(command->address); + bin_info.load_size = ntohl(command->size); + memset(bin_info.map, 0, 16384); + + our_ip = ntohl(ip->dest); + + make_ip(ntohl(ip->src), ntohl(ip->dest), UDP_H_LEN + COMMAND_LEN, 17, (ip_header_t *)(pkt_buf + ETHER_H_LEN)); + make_udp(ntohs(udp->src), ntohs(udp->dest),(unsigned char *) command, COMMAND_LEN, (ip_header_t *)(pkt_buf + ETHER_H_LEN), (udp_header_t *)(pkt_buf + ETHER_H_LEN + IP_H_LEN)); + bb->tx(pkt_buf, ETHER_H_LEN + IP_H_LEN + UDP_H_LEN + COMMAND_LEN); + + if (!running) { + if (!booted) + disp_info(); + disp_status("receiving data..."); + } +} + +void cmd_partbin(ip_header_t * ip, udp_header_t * udp, command_t * command) +{ + int index = 0; + + memcpy((unsigned char *)ntohl(command->address), command->data, ntohl(command->size)); + + index = (ntohl(command->address) - bin_info.load_address) >> 10; + bin_info.map[index] = 1; +} + +void cmd_donebin(ip_header_t * ip, udp_header_t * udp, command_t * command) +{ + int i; + + for(i = 0; i < (bin_info.load_size + 1023)/1024; i++) + if (!bin_info.map[i]) + break; + if ( i == (bin_info.load_size + 1023)/1024 ) { + command->address = htonl(0); + command->size = htonl(0); + } else { + command->address = htonl( bin_info.load_address + i * 1024); + command->size = htonl(min(bin_info.load_size - i * 1024, 1024)); + } + + make_ip(ntohl(ip->src), ntohl(ip->dest), UDP_H_LEN + COMMAND_LEN, 17, (ip_header_t *)(pkt_buf + ETHER_H_LEN)); + make_udp(ntohs(udp->src), ntohs(udp->dest),(unsigned char *) command, COMMAND_LEN, (ip_header_t *)(pkt_buf + ETHER_H_LEN), (udp_header_t *)(pkt_buf + ETHER_H_LEN + IP_H_LEN)); + bb->tx(pkt_buf, ETHER_H_LEN + IP_H_LEN + UDP_H_LEN + COMMAND_LEN); + + if (!running) { + if (!booted) + disp_info(); + disp_status("idle..."); + } +} + +void cmd_sendbinq(ip_header_t * ip, udp_header_t * udp, command_t * command) +{ + int numpackets, i; + unsigned char *ptr; + unsigned int bytes_left; + unsigned int bytes_thistime; + + bytes_left = ntohl(command->size); + numpackets = (ntohl(command->size)+1023) / 1024; + ptr = (unsigned char *)ntohl(command->address); + + memcpy(response->id, CMD_SENDBIN, 4); + for(i = 0; i < numpackets; i++) { + if (bytes_left >= 1024) + bytes_thistime = 1024; + else + bytes_thistime = bytes_left; + bytes_left -= bytes_thistime; + + response->address = htonl((unsigned int)ptr); + memcpy(response->data, ptr, bytes_thistime); + response->size = htonl(bytes_thistime); + make_ip(ntohl(ip->src), ntohl(ip->dest), UDP_H_LEN + COMMAND_LEN + bytes_thistime, 17, (ip_header_t *)(pkt_buf + ETHER_H_LEN)); + make_udp(ntohs(udp->src), ntohs(udp->dest),(unsigned char *) response, COMMAND_LEN + bytes_thistime, (ip_header_t *)(pkt_buf + ETHER_H_LEN), (udp_header_t *)(pkt_buf + ETHER_H_LEN + IP_H_LEN)); + bb->tx(pkt_buf, ETHER_H_LEN + IP_H_LEN + UDP_H_LEN + COMMAND_LEN + bytes_thistime); + ptr += bytes_thistime; + } + + memcpy(response->id, CMD_DONEBIN, 4); + response->address = htonl(0); + response->size = htonl(0); + make_ip(ntohl(ip->src), ntohl(ip->dest), UDP_H_LEN + COMMAND_LEN, 17, (ip_header_t *)(pkt_buf + ETHER_H_LEN)); + make_udp(ntohs(udp->src), ntohs(udp->dest),(unsigned char *) response, COMMAND_LEN, (ip_header_t *)(pkt_buf + ETHER_H_LEN), (udp_header_t *)(pkt_buf + ETHER_H_LEN + IP_H_LEN)); + bb->tx(pkt_buf, ETHER_H_LEN + IP_H_LEN + UDP_H_LEN + COMMAND_LEN); +} + +void cmd_sendbin(ip_header_t * ip, udp_header_t * udp, command_t * command) +{ + our_ip = ntohl(ip->dest); + + if (!running) { + if (!booted) + disp_info(); + disp_status("sending data..."); + } + + cmd_sendbinq(ip, udp, command); + + if (!running) { + disp_status("idle..."); + } +} + +void cmd_version(ip_header_t * ip, udp_header_t * udp, command_t * command) +{ + int i; + + i = strlen("DCLOAD-IP " DCLOAD_VERSION) + 1; + memcpy(response, command, COMMAND_LEN); + strcpy(response->data, "DCLOAD-IP " DCLOAD_VERSION); + make_ip(ntohl(ip->src), ntohl(ip->dest), UDP_H_LEN + COMMAND_LEN + i, 17, (ip_header_t *)(pkt_buf + ETHER_H_LEN)); + make_udp(ntohs(udp->src), ntohs(udp->dest),(unsigned char *) response, COMMAND_LEN + i, (ip_header_t *)(pkt_buf + ETHER_H_LEN), (udp_header_t *)(pkt_buf + ETHER_H_LEN + IP_H_LEN)); + bb->tx(pkt_buf, ETHER_H_LEN + IP_H_LEN + UDP_H_LEN + COMMAND_LEN + i); +} + +void cmd_retval(ip_header_t * ip, udp_header_t * udp, command_t * command) +{ + if (running) { + make_ip(ntohl(ip->src), ntohl(ip->dest), UDP_H_LEN + COMMAND_LEN, 17, (ip_header_t *)(pkt_buf + ETHER_H_LEN)); + make_udp(ntohs(udp->src), ntohs(udp->dest),(unsigned char *) command, COMMAND_LEN, (ip_header_t *)(pkt_buf + ETHER_H_LEN), (udp_header_t *)(pkt_buf + ETHER_H_LEN + IP_H_LEN)); + bb->tx(pkt_buf, ETHER_H_LEN + IP_H_LEN + UDP_H_LEN + COMMAND_LEN); + + bb->stop(); + + syscall_retval = ntohl(command->address); + syscall_data = command->data; + escape_loop = 1; + } +} diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/commands.h b/LAN/SRCS/dcload-ip/target-src/dcload/commands.h new file mode 100644 index 00000000..3e4dbf00 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/commands.h @@ -0,0 +1,29 @@ +#ifndef __COMMANDS_H__ +#define __COMMANDS_H__ + +typedef struct { + unsigned char id[4] __attribute__ ((packed)); + unsigned int address __attribute__ ((packed)); + unsigned int size __attribute__ ((packed)); + unsigned char data[1] __attribute__ ((packed)); +} command_t; + +#define CMD_EXECUTE "EXEC" /* execute */ +#define CMD_LOADBIN "LBIN" /* begin receiving binary */ +#define CMD_PARTBIN "PBIN" /* part of a binary */ +#define CMD_DONEBIN "DBIN" /* end receiving binary */ +#define CMD_SENDBIN "SBIN" /* send a binary */ +#define CMD_SENDBINQ "SBIQ" /* send a binary, quiet */ +#define CMD_VERSION "VERS" /* send version info */ + +#define CMD_RETVAL "RETV" /* return value */ + +#define CMD_REBOOT "RBOT" /* reboot */ + +#define COMMAND_LEN 12 + +extern unsigned int tool_ip; +extern unsigned char tool_mac[6]; +extern unsigned short tool_port; + +#endif diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/dcload-crt0.s b/LAN/SRCS/dcload-ip/target-src/dcload/dcload-crt0.s new file mode 100644 index 00000000..39bd13b9 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/dcload-crt0.s @@ -0,0 +1,191 @@ +! crt0.s for dcload + + .section .text + .global start + .global _atexit + .global _dcloadsyscall +start: + bra realstart + nop + +! for checking if dcload is present + +dcloadmagic: + .long 0xdeadbeef + +! normal programs use this call + +dcloadsyscall_k: + .long _dcloadsyscall + +! exception handler uses these calls + +setup_video_k: + .long _setup_video +clrscr_k: + .long _clrscr +draw_string_k: + .long _draw_string +uint_to_string_k: + .long _uint_to_string +exc_to_string_k: + .long _exception_code_to_string + +realstart: + stc sr,r0 + mov.l sr_mask,r1 + and r1,r0 + or #0xf0,r0 + ldc r0,sr + mov.l setup_cache_k,r0 + mov.l p2_mask,r1 + or r1,r0 + jmp @r0 + nop + +setup_cache: + mov.l ccr_addr,r0 + mov.w ccr_data,r1 + mov.l r1,@r0 + mov.l start_2_k,r0 + mov #0,r1 + nop + nop + nop + nop + nop + nop + jmp @r0 + mov r1,r0 + +start_2: + mov.l stack_k,r15 + ! zero out bss + mov.l edata_k,r0 + mov.l end_k,r1 + mov #0,r2 + +start_l: + mov.l r2,@r0 + add #4,r0 + cmp/ge r0,r1 + bt start_l + + mov.l set_fpscr_k, r1 + jsr @r1 + mov #0,r4 + lds r3,fpscr + + ! call main + mov.l main_k,r0 + jsr @r0 + or r0,r0 + ! bootloader should never exit, but what the hell + bra realstart + nop + +_atexit: + rts + nop + + + .align 4 +sr_mask: + .long 0xefff7fff +set_fpscr_k: + .long ___set_fpscr +stack_k: + .long _stack +edata_k: + .long _edata +end_k: + .long _end +main_k: + .long _main +setup_cache_k: + .long setup_cache +start_2_k: + .long start_2 +p2_mask: + .long 0xa0000000 +ccr_addr: + .long 0xff00001c +ccr_data: + .word 0x090b + +_dcloadsyscall: + mov.l dcloadmagic_k,r1 + mov.l @r1,r1 + mov.l correctmagic,r0 + cmp/eq r0,r1 + bf badsyscall + + mov r4,r0 + mov r5,r4 + mov r6,r5 + mov r7,r6 + + mov #20,r1 + cmp/hs r0,r1 + bf badsyscall + + mov.l first_syscall,r1 + shll2 r0 + mov.l @(r0,r1),r0 + jmp @r0 + nop + +badsyscall: + mov #-1,r0 + rts + nop + +.align 4 +dcloadmagic_k: + .long dcloadmagic +correctmagic: + .long 0xdeadbeef +first_syscall: + .long read_k +read_k: + .long _read +write_k: + .long _write +open_k: + .long _open +close_k: + .long _close +creat_k: + .long _creat +link_k: + .long _link +unlink_k: + .long _unlink +chdir_k: + .long _chdir +chmod_k: + .long _chmod +lseek_k: + .long _lseek +fstat_k: + .long _fstat +time_k: + .long _time +stat_k: + .long _stat +utime_k: + .long _utime +assign_wrkmem_k: + .long badsyscall +exit_k: + .long _dcexit +opendir_k: + .long _opendir +closedir_k: + .long _closedir +readdir_k: + .long _readdir +hostinfo_k: + .long _gethostinfo +gdbpacket_k: + .long _gdbpacket diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/dcload.c b/LAN/SRCS/dcload-ip/target-src/dcload/dcload.c new file mode 100644 index 00000000..f1be7030 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/dcload.c @@ -0,0 +1,239 @@ +/* + * dcload, a Dreamcast ethernet loader + * + * Copyright (C) 2001 Andrew Kieschnick + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +/* uncomment following line to enable crappy screensaver (it just blanks) */ +/* #define SCREENSAVER */ + +#include "scif.h" +#include "video.h" +#include "packet.h" +#include "commands.h" +#include "adapter.h" +#include "net.h" +#include "cdfs.h" + +#define NAME "dcload-ip " DCLOAD_VERSION + +#define VIDMODEREG (volatile unsigned int *)0xa05f8044 +#define VIDBORDER (volatile unsigned int *)0xa05f8040 + +unsigned int booted = 0; +unsigned int running = 0; + +/* converts expevt value to description, used by exception handler */ +unsigned char * exception_code_to_string(unsigned int expevt) +{ + switch(expevt) { + case 0x1e0: + return "User break"; + break; + case 0x0e0: + return "Address error (read)"; + break; + case 0x040: + return "TLB miss exception (read)"; + break; + case 0x0a0: + return "TLB protection violation exception (read)"; + break; + case 0x180: + return "General illegal instruction exception"; + break; + case 0x1a0: + return "Slot illegal instruction exception"; + break; + case 0x800: + return "General FPU disable exception"; + break; + case 0x820: + return "Slot FPU disable exception"; + break; + case 0x100: + return "Address error (write)"; + break; + case 0x060: + return "TLB miss exception (write)"; + break; + case 0x0c0: + return "TLB protection violation exception (write)"; + break; + case 0x120: + return "FPU exception"; + break; + case 0x080: + return "Initial page write exception"; + break; + case 0x160: + return "Unconditional trap (TRAPA)"; + break; + default: + return "Unknown exception"; + break; + } +} + +void uint_to_string(unsigned int foo, unsigned char *bar) +{ + char hexdigit[16] = "0123456789abcdef"; + int i; + + for(i=7; i>=0; i--) { + bar[i] = hexdigit[(foo & 0x0f)]; + foo = foo >> 4; + } + bar[8] = 0; +} + +void uchar_to_string(unsigned int foo, unsigned char *bar) +{ + char hexdigit[16] = "0123456789abcdef"; + int i; + + bar[1] = hexdigit[foo & 0x0f]; + bar[0] = hexdigit[foo >> 4]; +} + +/* set n lines starting at line y to value c */ +void clear_lines(unsigned int y, unsigned int n, unsigned int c) +{ + unsigned short * vmem = (unsigned short *)(0xa5000000 + y*640*2); + n = n * 640; + while (n-- > 0) + *vmem++ = c; +} + +void draw_progress(unsigned int current, unsigned int total) +{ + unsigned char current_string[9]; + unsigned char total_string[9]; + + uint_to_string(total, total_string); + uint_to_string(current, current_string); + clear_lines(120, 24, 0x0100); + draw_string(30, 174, "(", 0xffff); + draw_string(42, 174, current_string, 0xffff); + draw_string(138, 174, "/", 0xffff); + draw_string(150, 174, total_string, 0xffff); + draw_string(246, 174, ")", 0xffff); +} + +void setup_video(unsigned int mode, unsigned int color) +{ + init_video(check_cable(), mode); + clrscr(color); +} + +void error_bb(unsigned char *msg) +{ + setup_video(0,0x2000); + draw_string(30, 54, NAME, 0xffff); + draw_string(30, 78, msg, 0xffff); + while(1); +} + +unsigned char *mac_string = "de:ad:be:ef:ba:be"; +unsigned char *ip_string = "00.00.00.00"; + +void disp_info(void) +{ + int c; + unsigned char *ip = (unsigned char *)&our_ip; + + setup_video(0,0x0100); + draw_string(30, 54, NAME, 0xffff); + draw_string(30, 78, bb->name, 0xffff); + draw_string(30, 102, mac_string, 0xffff); + for(c = 0; c < 4; c++) + uchar_to_string(ip[3-c], &ip_string[c*3]); + draw_string(30, 126, ip_string, 0xffff); + booted = 1; +} + +void disp_status(const char * status) { + clear_lines(150, 24, 0x0100); + draw_string(30, 150, status, 0xffff); +} + +void set_ip(void) +{ + int i; + int c; + unsigned char *ip = (unsigned char *)&our_ip; + + i = 0; + c = 0; + + while(DREAMCAST_IP[c] != 0) { + if (DREAMCAST_IP[c] != '.') { + ip[i] *= 10; + ip[i] += DREAMCAST_IP[c] - '0'; + } + else + i++; + c++; + } + + our_ip = ntohl(our_ip); + +} + + +int main(void) +{ + unsigned char crap; + unsigned int addr; + unsigned int size; + unsigned int console; + unsigned int start; + + running = 0; + +/* scif_init(115200); */ + + if (adapter_detect() < 0) + error_bb("NO ETHERNET ADAPTER DETECTED!"); + + for(start = 0; start < 6; start++) + uchar_to_string(bb->mac[start], mac_string + start*3); + + set_ip(); + + cdfs_redir_save(); /* will only save value once */ + cdfs_redir_disable(); + + if (!booted) { + disp_info(); + } else + booted = 0; +/* + scif_puts(NAME); + scif_puts("\n"); +*/ + while (1) { + *VIDBORDER = 0; + + if (booted) { + disp_status("idle..."); + } + + bb->loop(); + } +} diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/dcload.h b/LAN/SRCS/dcload-ip/target-src/dcload/dcload.h new file mode 100644 index 00000000..c7eedc9b --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/dcload.h @@ -0,0 +1,9 @@ +#ifndef __DCLOAD_H__ +#define __DCLOAD_H__ + +extern unsigned int booted; +extern void disp_info(void); +extern void disp_status(const char * status); +extern unsigned int running; + +#endif diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/dcload.x b/LAN/SRCS/dcload-ip/target-src/dcload/dcload.x new file mode 100644 index 00000000..8ce2ce67 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/dcload.x @@ -0,0 +1,228 @@ +/* Sega Dreamcast linker script */ + +OUTPUT_FORMAT("elf32-shl", "elf32-shl", + "elf32-shl") +OUTPUT_ARCH(sh) +ENTRY(start) + SEARCH_DIR(/usr/local/dcdev/sh-elf/lib); +/* Do we need any of these for elf? + __DYNAMIC = 0; */ + +MEMORY +{ + ram (rwx) : ORIGIN = 0x8c004000, LENGTH = 0xb400 +} + +SECTIONS +{ + /* Read-only sections, merged into text segment: */ +/* . = 0x1000;*/ + .interp : { *(.interp) } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .gnu.version : { *(.gnu.version) } + .gnu.version_d : { *(.gnu.version_d) } + .gnu.version_r : { *(.gnu.version_r) } + .rel.init : { *(.rel.init) } + .rela.init : { *(.rela.init) } + .rel.text : + { + *(.rel.text) + *(.rel.text.*) + *(.rel.gnu.linkonce.t*) + } + .rela.text : + { + *(.rela.text) + *(.rela.text.*) + *(.rela.gnu.linkonce.t*) + } + .rel.fini : { *(.rel.fini) } + .rela.fini : { *(.rela.fini) } + .rel.rodata : + { + *(.rel.rodata) + *(.rel.rodata.*) + *(.rel.gnu.linkonce.r*) + } + .rela.rodata : + { + *(.rela.rodata) + *(.rela.rodata.*) + *(.rela.gnu.linkonce.r*) + } + .rel.data : + { + *(.rel.data) + *(.rel.data.*) + *(.rel.gnu.linkonce.d*) + } + .rela.data : + { + *(.rela.data) + *(.rela.data.*) + *(.rela.gnu.linkonce.d*) + } + .rel.ctors : { *(.rel.ctors) } + .rela.ctors : { *(.rela.ctors) } + .rel.dtors : { *(.rel.dtors) } + .rela.dtors : { *(.rela.dtors) } + .rel.got : { *(.rel.got) } + .rela.got : { *(.rela.got) } + .rel.sdata : + { + *(.rel.sdata) + *(.rel.sdata.*) + *(.rel.gnu.linkonce.s*) + } + .rela.sdata : + { + *(.rela.sdata) + *(.rela.sdata.*) + *(.rela.gnu.linkonce.s*) + } + .rel.sbss : { *(.rel.sbss) } + .rela.sbss : { *(.rela.sbss) } + .rel.bss : { *(.rel.bss) } + .rela.bss : { *(.rela.bss) } + .rel.plt : { *(.rel.plt) } + .rela.plt : { *(.rela.plt) } + .init : + { + KEEP (*(.init)) + } =0 + .plt : { *(.plt) } + .text : + { + *(.text) + *(.text.*) + *(.stub) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + *(.gnu.linkonce.t*) + } =0 + _etext = .; + PROVIDE (etext = .); + .fini : + { + KEEP (*(.fini)) + } =0 + .rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) } + .rodata1 : { *(.rodata1) } + /* Adjust the address for the data segment. We want to adjust up to + the same address within the page on the next page up. */ + . = ALIGN(128) + (. & (128 - 1)); + .data : + { + *(.data) + *(.data.*) + *(.gnu.linkonce.d*) + SORT(CONSTRUCTORS) + } + .data1 : { *(.data1) } + .eh_frame : { *(.eh_frame) } + .gcc_except_table : { *(.gcc_except_table) } + .ctors ALIGN(4): + { + ___ctors = .; + /* gcc uses crtbegin.o to find the start of + the constructors, so we make sure it is + first. Because this is a wildcard, it + doesn't matter if the user does not + actually link against crtbegin.o; the + linker won't look for a file to match a + wildcard. The wildcard also means that it + doesn't matter which directory crtbegin.o + is in. */ + KEEP (*crtbegin.o(.ctors)) + /* We don't want to include the .ctor section from + from the crtend.o file until after the sorted ctors. + The .ctor section from the crtend file contains the + end of ctors marker and it must be last */ + KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + ___ctors_end = .; + } + .dtors : + { + ___dtors = .; + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + ___dtors_end = .; + } + .got : { *(.got.plt) *(.got) } + .dynamic : { *(.dynamic) } + /* We want the small data sections together, so single-instruction offsets + can access them all, and initialized data all before uninitialized, so + we can shorten the on-disk segment size. */ + .sdata : + { + *(.sdata) + *(.sdata.*) + *(.gnu.linkonce.s.*) + } + _edata = .; + PROVIDE (edata = .); + __bss_start = .; + .sbss : + { + *(.dynsbss) + *(.sbss) + *(.sbss.*) + *(.scommon) + } + .bss : + { + *(.dynbss) + *(.bss) + *(.bss.*) + *(COMMON) + /* Align here to ensure that the .bss section occupies space up to + _end. Align after .bss to ensure correct alignment even if the + .bss section disappears because there are no input sections. */ + . = ALIGN(32 / 8); + } + . = ALIGN(32 / 8); + _end = .; + PROVIDE (end = .); + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +/* .stack 0x8c00f400 : { _stack = .; *(.stack) }*/ + /* These must appear regardless of . */ +_stack = 0x8c00f400; +} diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/disable.h b/LAN/SRCS/dcload-ip/target-src/dcload/disable.h new file mode 100644 index 00000000..a93133ec --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/disable.h @@ -0,0 +1,6 @@ +#ifndef __DISABLE_H__ +#define __DISABLE_H__ + +void disable_cache(void); + +#endif diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/disable.s b/LAN/SRCS/dcload-ip/target-src/dcload/disable.s new file mode 100644 index 00000000..c62a6647 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/disable.s @@ -0,0 +1,37 @@ + .section .text + .global _disable_cache + +_disable_cache: + mov.l disable_cache_k,r0 + mov.l p2_mask,r1 + or r1,r0 + jmp @r0 + nop +disable_cache: + mov.l ccr_addr,r0 + mov.l ccr_data_k,r1 + mov.l @r1,r1 + mov.l r1,@r0 + nop + nop + nop + nop + nop + nop + nop + nop + rts + nop + + .align 4 + +disable_cache_k: + .long disable_cache +p2_mask: + .long 0xa0000000 +ccr_addr: + .long 0xff00001c +ccr_data_k: + .long ccr_data +ccr_data: + .long 0x00000808 diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/exception.s b/LAN/SRCS/dcload-ip/target-src/dcload/exception.s new file mode 100644 index 00000000..5d2c3d46 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/exception.s @@ -0,0 +1,580 @@ +! exception handlers +! +! a general exception handler that displays a register dump onscreen +! for general exceptions (VBR + 0x100) and TLB miss exceptions (VBR + 0x400) +! + + .section .text +disp_labels: + + ! r4 -> @(0,r15) = addr of labels + ! r5 -> @(4,r15) = number of labels + ! r6 -> @(12,r15) = starting x-position + ! r7 -> @(8,r15)= starting y-position + + sts.l pr,@-r15 + add #-16,r15 +! loop init + mov.l r4,@(0,r15) + mov.l r7,@(8,r15) + mov.l r6,@(12,r15) + mov r5,r0 +disp_loop: +! display a label + mov.l r0,@(4,r15) + mov.l @(12,r15),r4 + mov.l @(8,r15),r5 + mov.l @(0,r15),r6 + mov #0xff,r7 + mov.l draw_k,r0 + mov.l @r0,r0 + jsr @r0 + nop +! increment / decrement / blahblahblah + mov.l @(8,r15),r0 + add #24,r0 + mov.l r0,@(8,r15) + mov.l @(0,r15),r0 + add #5,r0 + mov.l r0,@(0,r15) + mov.l @(4,r15),r0 + dt r0 + bf disp_loop + add #16,r15 + lds.l @r15+,pr + rts + nop + +disp_values: + ! r4 -> @(0,r15) = addr of values + ! r5 -> @(4,r15) = number of values + ! r6 -> @(12,r15) = starting x-position + ! r7 -> @(8,r15)= starting y-position + + sts.l pr,@-r15 + add #-16,r15 +! loop init + mov.l r4,@(0,r15) + mov.l r7,@(8,r15) + mov.l r6,@(12,r15) + mov r5,r0 +val_loop: + mov.l r0,@(4,r15) + mov.l @(0,r15),r4 + mov.l @r4,r4 +! convert string + mova misc_string,r0 + mov r0,r5 + mov.l uint_to_string_k,r0 + mov.l @r0,r0 + jsr @r0 + nop + mova misc_string,r0 + mov r0,r6 +! display string + mov.l @(12,r15),r4 + mov.l @(8,r15),r5 + mov #0xff,r7 + mov.l draw_k,r0 + mov.l @r0,r0 + jsr @r0 + nop +! increment / decrement + mov.l @(8,r15),r0 + add #24,r0 + mov.l r0,@(8,r15) + mov.l @(0,r15),r0 + add #4,r0 + mov.l r0,@(0,r15) + mov.l @(4,r15),r0 + dt r0 + bf val_loop + add #16,r15 + lds.l @r15+,pr + rts + nop + +.balign 0x100 + +! VBR + 0x100 +! general exceptions +general_1: +! assume the stack may be fux0red + mov.l stack_addr,r15 +! save and display registers + add #-66,r15 + add #-66,r15 + add #-66,r15 + add #-66,r15 + sts.l pr,@-r15 + mov.l r0,@-r15 + mov.l r1,@-r15 + mova regdump,r0 + jsr @r0 + nop + add #12,r15 + add #66,r15 + add #66,r15 + add #66,r15 + add #66,r15 +! display exception identifier string + mov.l expevt,r4 + mov.l @r4,r4 + mov.l exc_to_string_k,r0 + mov.l @r0,r0 + jsr @r0 + nop + mov #0,r4 + mov #24,r5 + mov r0,r6 + mov #0xff,r7 + mov.l draw_k,r0 + mov.l @r0,r0 + jsr @r0 + nop +! display "EXPEVT" + mov #0,r4 + mov #48,r5 + mova expevt_string,r0 + mov r0,r6 + mov #0xff,r7 + mov.l draw_k,r0 + mov.l @r0,r0 + jsr @r0 + nop +! convert expevt to string + mov.l expevt,r4 + mov.l @r4,r4 + mova misc_string,r0 + mov r0,r5 + mov.l uint_to_string_k,r0 + mov.l @r0,r0 + jsr @r0 + nop +! display expevt + mov #84,r4 + extu.b r4,r4 + mov #48,r5 + mova misc_string,r0 + mov r0,r6 + mov #0xff,r7 + mov.l draw_k,r0 + mov.l @r0,r0 + jsr @r0 + nop +! return to bootloader + mov.l entry_addr,r0 + jmp @r0 + nop +.align 4 +stack_addr: + .long 0x8d000000 +exc_to_string_k: + .long 0x8c00401c + +regdump: +! save registers for display +! caller has allocated 264 bytes on stack for regs +! caller has left r0,r1, and old pr on stack + sts.l pr,@-r15 + mov r15,r0 + add #16,r0 +! (s)pc, pr, (s)sr, gbr, vbr, dbr, mach, macl + stc spc,r1 + mov.l r1,@r0 + add #4,r0 + mov.l @(12,r15),r1 + mov.l r1,@r0 + add #4,r0 + stc ssr,r1 + mov.l r1,@r0 + add #4,r0 + stc gbr,r1 + mov.l r1,@r0 + add #4,r0 + stc vbr,r1 + mov.l r1,@r0 + add #4,r0 + stc dbr,r1 + mov.l r1,@r0 + add #4,r0 + sts mach,r1 + mov.l r1,@r0 + add #4,r0 + sts macl,r1 + mov.l r1,@r0 + add #4,r0 +! r0-r7 bank 0 + stc r0_bank,r1 + mov.l r1,@r0 + add #4,r0 + stc r1_bank,r1 + mov.l r1,@r0 + add #4,r0 + stc r2_bank,r1 + mov.l r1,@r0 + add #4,r0 + stc r3_bank,r1 + mov.l r1,@r0 + add #4,r0 + stc r4_bank,r1 + mov.l r1,@r0 + add #4,r0 + stc r5_bank,r1 + mov.l r1,@r0 + add #4,r0 + stc r6_bank,r1 + mov.l r1,@r0 + add #4,r0 + stc r7_bank,r1 + mov.l r1,@r0 + add #4,r0 +! r0-r7 bank 1 + mov.l @(8,r15),r1 + mov.l r1,@r0 + add #4,r0 + mov.l @(4,r15),r1 + mov.l r1,@r0 + add #4,r0 + mov.l r2,@r0 + add #4,r0 + mov.l r3,@r0 + add #4,r0 + mov.l r4,@r0 + add #4,r0 + mov.l r5,@r0 + add #4,r0 + mov.l r6,@r0 + add #4,r0 + mov.l r7,@r0 + add #4,r0 +! r8-r14 + mov.l r8,@r0 + add #4,r0 + mov.l r9,@r0 + add #4,r0 + mov.l r10,@r0 + add #4,r0 + mov.l r11,@r0 + add #4,r0 + mov.l r12,@r0 + add #4,r0 + mov.l r13,@r0 + add #4,r0 + mov.l r14,@r0 + add #4,r0 +! sgr (r15) + stc sgr,r1 + mov.l r1,@r0 + add #4,r0 +! fpscr + sts fpscr,r1 + mov.l r1,@r0 + add #4,r0 +! set fpscr.fr = 0, to get fr0-fr15 + mov.l fpscr_val_fr,r1 + lds r1,fpscr +! fr0-fr15 + fmov.s fr0,@r0 + add #4,r0 + fmov.s fr1,@r0 + add #4,r0 + fmov.s fr2,@r0 + add #4,r0 + fmov.s fr3,@r0 + add #4,r0 + fmov.s fr4,@r0 + add #4,r0 + fmov.s fr5,@r0 + add #4,r0 + fmov.s fr6,@r0 + add #4,r0 + fmov.s fr7,@r0 + add #4,r0 + fmov.s fr8,@r0 + add #4,r0 + fmov.s fr9,@r0 + add #4,r0 + fmov.s fr10,@r0 + add #4,r0 + fmov.s fr11,@r0 + add #4,r0 + fmov.s fr12,@r0 + add #4,r0 + fmov.s fr13,@r0 + add #4,r0 + fmov.s fr14,@r0 + add #4,r0 + fmov.s fr15,@r0 + add #4,r0 +! fpul + sts fpul,r1 + mov.l r1,@r0 + add #4,r0 +! set fpscr.fr = 1, to get xf0-xf15 + mov.l fpscr_val_xf,r1 + lds r1,fpscr +! xf0-xf15 + fmov.s fr0,@r0 + add #4,r0 + fmov.s fr1,@r0 + add #4,r0 + fmov.s fr2,@r0 + add #4,r0 + fmov.s fr3,@r0 + add #4,r0 + fmov.s fr4,@r0 + add #4,r0 + fmov.s fr5,@r0 + add #4,r0 + fmov.s fr6,@r0 + add #4,r0 + fmov.s fr7,@r0 + add #4,r0 + fmov.s fr8,@r0 + add #4,r0 + fmov.s fr9,@r0 + add #4,r0 + fmov.s fr10,@r0 + add #4,r0 + fmov.s fr11,@r0 + add #4,r0 + fmov.s fr12,@r0 + add #4,r0 + fmov.s fr13,@r0 + add #4,r0 + fmov.s fr14,@r0 + add #4,r0 + fmov.s fr15,@r0 + add #4,r0 +! init video + mov.l setup_video_k,r0 + mov.l @r0,r0 + mov #0,r4 + mov #0x1f,r5 + jsr @r0 + nop +! display 1st set of labels + mov.l labels1_k,r4 + mov #16,r5 + mov #0,r6 + mov #72,r7 + mov.l disp_addr,r0 + jsr @r0 + nop +! display 2nd set of labels + mov.l labels2_k,r4 + mov #16,r5 + mov #160,r6 + extu.b r6,r6 + mov #72,r7 + mov.l disp_addr,r0 + jsr @r0 + nop +! display 3rd set of labels + mov.l labels3_k,r4 + mov #17,r5 + mov #160,r6 + extu.b r6,r6 + shll r6 + mov #48,r7 + mov.l disp_addr,r0 + jsr @r0 + nop +! display 4th set of labels + mov.l labels4_k,r4 + mov #17,r5 + mov #160,r6 + extu.b r6,r6 + mov r6,r7 + shll r6 + add r7,r6 + mov #48,r7 + mov.l disp_addr,r0 + jsr @r0 + nop +! display 1st set of values + mov r15,r0 + add #16,r0 + mov r0,r4 + mov #16,r5 + mov #52,r6 + mov #72,r7 + mov.l val_addr,r0 + jsr @r0 + nop +! display 2nd set of values + mov r15,r0 + add #16,r0 + add #64,r0 + mov r0,r4 + mov #16,r5 + mov #52,r6 + mov #160,r7 + extu.b r7,r7 + add r7,r6 + mov #72,r7 + mov.l val_addr,r0 + jsr @r0 + nop +! display 3rd set of values + mov r15,r0 + add #16,r0 + mov #128,r1 + extu.b r1,r1 + add r1,r0 + mov r0,r4 + mov #17,r5 + mov #52,r6 + mov #160,r7 + extu.b r7,r7 + shll r7 + add r7,r6 + mov #48,r7 + mov.l val_addr,r0 + jsr @r0 + nop +! display 4th set of values + mov r15,r0 + add #16,r0 + mov #196,r1 + extu.b r1,r1 + add r1,r0 + mov r0,r4 + mov #17,r5 + mov #52,r6 + mov #160,r7 + extu.b r7,r7 + mov r7,r8 + shll r8 + add r8,r7 + add r7,r6 + mov #48,r7 + mov.l val_addr,r0 + jsr @r0 + nop +! return + lds.l @r15+,pr + rts + nop +.align 4 +fpscr_val_fr: + .long 0x00040001 +fpscr_val_xf: + .long 0x00240001 +disp_addr: + .long disp_labels +val_addr: + .long disp_values +entry_addr: + .long 0x8c004000 +draw_k: + .long 0x8c004014 +uint_to_string_k: + .long 0x8c004018 +expevt: + .long 0xff000024 +labels1_k: + .long labels1 +labels2_k: + .long labels2 +labels3_k: + .long labels3 +labels4_k: + .long labels4 +setup_video_k: + .long 0x8c00400c +.align 2 +expevt_string: + .asciz "EXPEVT" +.align 2 +misc_string: + .asciz "DEADBEEF" + +.balign 0x400 + +! VBR + 0x400 +general_2: + bra general_1 + nop +.align 2 +labels1: + .asciz "PC " + .asciz "PR " + .asciz "SR " + .asciz "GBR " + .asciz "VBR " + .asciz "DBR " + .asciz "MACH" + .asciz "MACL" + .asciz "R0B0" + .asciz "R1B0" + .asciz "R2B0" + .asciz "R3B0" + .asciz "R4B0" + .asciz "R5B0" + .asciz "R6B0" + .asciz "R7B0" +.align 2 +labels2: + .asciz "R0B1" + .asciz "R1B1" + .asciz "R2B1" + .asciz "R3B1" + .asciz "R4B1" + .asciz "R5B1" + .asciz "R6B1" + .asciz "R7B1" + .asciz "R8 " + .asciz "R9 " + .asciz "R10 " + .asciz "R11 " + .asciz "R12 " + .asciz "R13 " + .asciz "R14 " + .asciz "R15 " +.align 2 +labels3: + .asciz "FPSC" ! FPSCR + .asciz "FR0 " + .asciz "FR1 " + .asciz "FR2 " + .asciz "FR3 " + .asciz "FR4 " + .asciz "FR5 " + .asciz "FR6 " + .asciz "FR7 " + .asciz "FR8 " + .asciz "FR9 " + .asciz "FR10" + .asciz "FR11" + .asciz "FR12" + .asciz "FR13" + .asciz "FR14" + .asciz "FR15" +.align 2 +labels4: + .asciz "FPUL" + .asciz "XF0 " + .asciz "XF1 " + .asciz "XF2 " + .asciz "XF3 " + .asciz "XF4 " + .asciz "XF5 " + .asciz "XF6 " + .asciz "XF7 " + .asciz "XF8 " + .asciz "XF9 " + .asciz "XF10" + .asciz "XF11" + .asciz "XF12" + .asciz "XF13" + .asciz "XF14" + .asciz "XF15" + +.balign 0x200 + +! VBR + 0x600 +interrupt: + rte + nop diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/go.h b/LAN/SRCS/dcload-ip/target-src/dcload/go.h new file mode 100644 index 00000000..42bc2bb9 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/go.h @@ -0,0 +1,6 @@ +#ifndef __GO_H__ +#define __GO_H__ + +void go(unsigned int addr); + +#endif diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/go.s b/LAN/SRCS/dcload-ip/target-src/dcload/go.s new file mode 100644 index 00000000..8cd593aa --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/go.s @@ -0,0 +1,57 @@ + .section .text + .global _go + +_go: + mov.l stack_addr_k,r0 + mov.l @r0,r15 + mov.l entry_addr_k,r0 + mov.l @r0,r0 + lds r0,pr + mov.l sr_data_k,r0 + mov.l @r0,r0 + ldc r0,sr + mov.l vbr_data_k,r0 + mov.l @r0,r0 + ldc r0,vbr + mov.l fpscr_data_k,r0 + mov.l @r0,r0 + lds r0,fpscr + mov #0,r0 + mov r0,r1 + mov r0,r2 + mov r0,r3 + mov r0,r5 + mov r0,r6 + mov r0,r7 + mov r0,r8 + mov r0,r9 + mov r0,r10 + mov r0,r11 + mov r0,r12 + mov r0,r13 + mov r0,r14 + jmp @r4 + mov r0,r4 + + .align 4 +stack_addr_k: + .long stack_addr +stack_addr: + .long 0x8c00f400 +entry_addr_k: + .long entry_addr +entry_addr: + .long 0x8c004000 +sr_data_k: + .long sr_data +sr_data: + .long 0x600000f0 +vbr_data_k: + .long vbr_data +vbr_data: + .long 0x8c00f400 +fpscr_data_k: + .long fpscr_data +fpscr_data: + .long 0x40001 + \ No newline at end of file diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/lan_adapter.c b/LAN/SRCS/dcload-ip/target-src/dcload/lan_adapter.c new file mode 100644 index 00000000..46d97b75 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/lan_adapter.c @@ -0,0 +1,420 @@ +/* + DC "Lan Adapter" driver for dc-load-ip + + Copyright (C)2002,2003 Dan Potter (NEW BSD LICENSE) + */ + +#include "packet.h" +#include "net.h" +#include "adapter.h" +#include "lan_adapter.h" +#include "dcload.h" + +typedef volatile unsigned int vuint32; +typedef volatile unsigned short vuint16; +typedef volatile unsigned char vuint8; + +typedef unsigned char uint8; + +/* Some basic macros to assist with register access */ +#undef REGL +#undef REGS +#undef REGC +#define REGL(a) (vuint32 *)(a) +#define REGS(a) (vuint16 *)(a) +#define REGC(a) (vuint8 *)(a) + +static vuint8 *xpc = REGC(0xa0600000); +static vuint16 *xps = REGS(0xa0600000); +static vuint32 *xpl = REGL(0xa0600000); +#define REG(x) ( xpl[(x) + 0x400/4] & 0xff ) +#define REGW(x) ( xpc[(x)*4 + 0x400] ) + +/* This is based on the JLI EEPROM reader from FreeBSD. EEPROM in the + Sega adapter is a bit simpler than what is described in the Fujitsu + manual -- it appears to contain only the MAC address and not a base + address like the manual says. EEPROM is read one bit (!) at a time + through the EEPROM interface port. */ +#define FE_B16_SELECT 0x20 /* EEPROM chip select */ +#define FE_B16_CLOCK 0x40 /* EEPROM shift clock */ +#define FE_B17_DATA 0x80 /* EEPROM data bit */ +static void net_strobe_eeprom() { + REGW(16) = FE_B16_SELECT; + REGW(16) = FE_B16_SELECT | FE_B16_CLOCK; + REGW(16) = FE_B16_SELECT | FE_B16_CLOCK; + REGW(16) = FE_B16_SELECT; +} +static void net_read_eeprom(uint8 *data) { + uint8 save16, save17, val; + int n, bit; + + /* Save the current value of the EEPROM registers */ + save16 = REG(16); + save17 = REG(17); + + /* Read bytes from EEPROM, two per iteration */ + for (n=0; n<3; n++) { + /* Reset the EEPROM interface */ + REGW(16) = 0; + REGW(17) = 0; + + /* Start EEPROM access */ + REGW(16) = FE_B16_SELECT; + REGW(17) = FE_B17_DATA; + net_strobe_eeprom(); + + /* Pass the iteration count as well as a READ command */ + val = 0x80 | n; + for (bit=0x80; bit != 0x00; bit>>=1) { + REGW(17) = (val & bit) ? FE_B17_DATA : 0; + net_strobe_eeprom(); + } + REGW(17) = 0; + + /* Read a byte */ + val = 0; + for (bit=0x80; bit != 0x00; bit>>=1) { + net_strobe_eeprom(); + if (REG(17) & FE_B17_DATA) + val |= bit; + } + *data++ = val; + + /* Read one more byte */ + val = 0; + for (bit=0x80; bit != 0x00; bit>>=1) { + net_strobe_eeprom(); + if (REG(17) & FE_B17_DATA) + val |= bit; + } + *data++ = val; + } +} + +/* To select a register bank */ +#define SETBANK(x) do { \ + int i = (REG(7) & ~0x0c) | ((x) << 2); \ + REGW(7) = i; \ +} while(0) + +static int bb_started = 0; + +/* Libdream-style sleep function */ +static void net_sleep_ms(int ms) { + int i, j, cnt; + vuint32 *a05f688c = (vuint32*)0xa05f688c; + + cnt = 0x1800 * 0x58e * ms / 1000; + for (i=0; i 0) { + DEBUG("bb_detect exited, already started\r\n"); + return 0; + } + + if (bb_started != 0) { + clear_lines(168, 24, 0); + draw_string(30, 168, "bb_detect() called out of sequence!", 0xf800); + for (;;) + ; + } + + /* Reset the interface */ + xpc[0x0480] = 0; + xpc[0x0480] = 1; + xpc[0x0480] = 0; + + /* Give it a few ms to come back */ + net_sleep_ms(100); + + /* Read the chip type and verify it */ + type = (REG(7) >> 6) & 3; + if (type != 2) { + DEBUG("bb_detect exited, detection failed\r\n"); + return -1; + } + + /* That should do */ + DEBUG("bb_detect exited, success\r\n"); + bb_started = 1; + return 0; +} + +/* Reset the lan adapter and set it up for send/receive */ +static int bb_init() { + int i, type; + uint8 mac[6]; + + DEBUG("bb_init started\r\n"); + + if (bb_started == 2) { + DEBUG("bb_init exited, already done\r\n"); + return 0; + } + + if (bb_started == 0) { + if (!bb_detect()) { + DEBUG("bb_init exited, bb_detect() failed\r\n"); + return -1; + } + } + + /* Clear interrupt status */ + REGW(0) = 0xff; + REGW(1) = 0xff; + + /* Power down chip */ + net_sleep_ms(2); + REGW(7) = REG(7) & ~0x20; + net_sleep_ms(2); + + /* Disable rx/tx */ + net_sleep_ms(2); + REGW(6) = REG(6) | 0x80; + net_sleep_ms(2); + + /* Power up the chip */ + net_sleep_ms(2); + REGW(7) = REG(7) | 0x20; + net_sleep_ms(2); + + /* Read the chip type */ + type = (REG(7) >> 6) & 3; + if (type != 2) { + DEBUG("bb_init exited, type check failed\r\n"); + return -1; + } + + /* Read the EEPROM data */ + net_read_eeprom(mac); + + /* Select BANK0 and write the MAC address */ + SETBANK(0); + net_sleep_ms(2); + for (i=0; i<6; i++) { + REGW(i+8) = mac[i]; + } + + /* Copy it into the adapter structure for dcload */ + memcpy(adapter_la.mac, mac, 6); + + /* Clear the multicast address */ + SETBANK(1); + for (i=0; i<6; i++) + REGW(i+8) = 0; + + /* Select the BMPR bank for normal operation */ + SETBANK(2); + REGW(10) = 0; + REGW(11) = 0x03; + REGW(12) = 0; + REGW(13) = 0; + REGW(14) = 0; + REGW(15) = 0xff; + + /* Set non-promiscuous mode (use 0x03 for promiscuous) */ + REGW(5) = (REG(5) | 0x02) & ~0x01; + + /* Enable transmitter / receiver */ + REGW(6) = REG(6) & ~0x80; + + DEBUG("bb_init exited, success\r\n"); + bb_started = 2; + return 0; +} + +/* Start lan adapter */ +void bb_start() { + DEBUG("bb_start entered\r\n"); + + if (bb_started != 3) { + DEBUG("bb_start exited, state != 3\r\n"); + return; + } + + /* Set non-promiscuous mode (use 0x03 for promiscuous) */ + REGW(5) = (REG(5) | 0x02) & ~0x01; + + bb_started = 2; + DEBUG("bb_start exited\r\n"); +} + +/* Stop lan adapter */ +void bb_stop() { + DEBUG("bb_stop entered\r\n"); + + if (bb_started != 2) { + DEBUG("bb_stop exited, state != 2\r\n"); + return; + } + + /* Make sure we aren't transmitting currently */ + while (REG(10) & 0x7f) + net_sleep_ms(2); + + /* Disable all receive */ + REGW(5) = (REG(5) & ~0x03); + + bb_started = 3; + DEBUG("bb_stop exited\r\n"); +} + +static int total_pkts_rx = 0, total_pkts_tx = 0; + +/* static void draw_total() { + char buffer[16]; + + uint_to_string(total_pkts_rx, buffer); + clear_lines(120, 24, 0); + draw_string(0, 120, "RX: ", 0xffe0); + draw_string(4*12, 120, buffer, 0xffff); + + uint_to_string(total_pkts_tx, buffer); + clear_lines(144, 24, 0); + draw_string(0, 144, "TX: ", 0xffe0); + draw_string(4*12, 144, buffer, 0xffff); +} */ + +/* Transmit a packet */ +/* Note that it's technically possible to queue up more than one packet + at a time for transmission, but this is the simple way. */ +static int bb_tx(unsigned char *pkt, int len) { + int i; + char buffer[16]; + + DEBUG("bb_tx entered\r\n"); + + if (bb_started != 2) { + clear_lines(168, 24, 0); + draw_string(30, 168, "bb_tx() called out of sequence!", 0xf800); + for (;;) + ; + } + + /* Wait for queue to empty */ + while (REG(10) & 0x7f) + net_sleep_ms(2); + + /* clear_lines(192, 24, 0); + uint_to_string(len, buffer); + draw_string(0, 192, buffer, 0xffff); */ + + /* Is the length less than the minimum? */ + if (len < 0x60) + len = 0x60; + + /* Poke the length */ + REGW(8) = (len & 0x00ff); + REGW(8) = (len & 0xff00) >> 8; + + /* Write the packet */ + for (i=0; i 1514) { + DEBUG("bb_rx exited: big packet\r\n"); + return -2; + } + for (i=0; i>---compare two memory areas + +INDEX + memcmp + +ANSI_SYNOPSIS + #include + int memcmp(const void *<[s1]>, const void *<[s2]>, size_t <[n]>); + +TRAD_SYNOPSIS + #include + int memcmp(<[s1]>, <[s2]>, <[n]>) + void *<[s1]>; + void *<[s2]>; + size_t <[n]>; + +DESCRIPTION + This function compares not more than <[n]> characters of the + object pointed to by <[s1]> with the object pointed to by <[s2]>. + + +RETURNS + The function returns an integer greater than, equal to or + less than zero according to whether the object pointed to by + <[s1]> is greater than, equal to or less than the object + pointed to by <[s2]>. + +PORTABILITY +<> is ANSI C. + +<> requires no supporting OS subroutines. + +QUICKREF + memcmp ansi pure +*/ + +#include + + +/* Nonzero if either X or Y is not aligned on a "long" boundary. */ +#define UNALIGNED(X, Y) \ + (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1))) + +/* How many bytes are copied each iteration of the word copy loop. */ +#define LBLOCKSIZE (sizeof (long)) + +/* Threshhold for punting to the byte copier. */ +#define TOO_SMALL(LEN) ((LEN) < LBLOCKSIZE) + +int +_DEFUN(memcmp, (m1, m2, n), + _CONST _PTR m1 _AND _CONST _PTR m2 _AND size_t n) +{ +#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) + unsigned char *s1 = (unsigned char *) m1; + unsigned char *s2 = (unsigned char *) m2; + + while (n--) { + if (*s1 != *s2) { + return *s1 - *s2; + } + s1++; + s2++; + } + return 0; +#else + unsigned char *s1 = (unsigned char *) m1; + unsigned char *s2 = (unsigned char *) m2; + unsigned long *a1; + unsigned long *a2; + + /* If the size is too small, or either pointer is unaligned, + then we punt to the byte compare loop. Hopefully this will + not turn up in inner loops. */ + if (!TOO_SMALL(n) && !UNALIGNED(s1, s2)) { + /* Otherwise, load and compare the blocks of memory one + word at a time. */ + a1 = (unsigned long *) s1; + a2 = (unsigned long *) s2; + while (n >= LBLOCKSIZE) { + if (*a1 != *a2) + break; + a1++; + a2++; + n -= LBLOCKSIZE; + } + + /* check m mod LBLOCKSIZE remaining characters */ + + s1 = (char *) a1; + s2 = (char *) a2; + } + + while (n--) { + if (*s1 != *s2) + return *s1 - *s2; + s1++; + s2++; + } + + return 0; +#endif /* not PREFER_SIZE_OVER_SPEED */ +} diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/memcpy.S b/LAN/SRCS/dcload-ip/target-src/dcload/memcpy.S new file mode 100644 index 00000000..4df72e37 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/memcpy.S @@ -0,0 +1,221 @@ +! +! Fast SH memcpy +! +! by Toshiyasu Morita (tm@netcom.com) +! hacked by J"orn Rernnecke (amylaar@cygnus.co.uk) ("o for o-umlaut) +! +! Entry: r4: destination pointer +! r5: source pointer +! r6: byte count +! +! Exit: r0: destination pointer +! r1-r7: trashed +! +! Notes: Usually one wants to do small reads and write a longword, but +! unfortunately it is difficult in some cases to concatanate bytes +! into a longword on the SH, so this does a longword read and small +! writes. +! +! This implementation makes two assumptions about how it is called: +! +! 1.: If the byte count is nonzero, the address of the last byte to be +! copied is unsigned greater than the address of the first byte to +! be copied. This could be easily swapped for a signed comparison, +! but the algorithm used needs some comparison. +! +! 2.: When there are two or three bytes in the last word of an 11-or-bore +! bytes memory chunk to b copied, the rest of the word can be read +! without size effects. +! This could be easily changed by increasing the minumum size of +! a fast memcpy and the amount subtracted from r7 before L_2l_loop be 2, +! however, this would cost a few extra cyles on average. +! + +#include "asm.h" + +ENTRY(memcpy) +#ifdef __LITTLE_ENDIAN__ + ! Little endian version copies with increasing addresses. + mov r4,r3 ! Save return value + mov #11,r0 ! Check if small number of bytes + cmp/hs r0,r6 + ! r6 becomes src end address + SL(bf, L_small, add r5,r6) + mov #1,r1 + tst r1,r5 ! check if source even + SL(bt, L_even, mov r6,r7) + mov.b @r5+,r0 ! no, make it even. + mov.b r0,@r4 + add #1,r4 +L_even: tst r1,r4 ! check if destination is even + add #-3,r7 + SL(bf, L_odddst, mov #2,r1) + tst r1,r4 ! check if destination is 4-byte aligned + mov r4,r0 + SL(bt, L_al4dst, sub r5,r0) + mov.w @r5+,r2 + mov.w r2,@r4 + ! add #2,r4 r4 is dead here. +L_al4dst: + tst r1,r5 + bt L_al4both + mov.w @r5+,r1 + swap.w r1,r1 + add #-6,r0 + add #-6,r7 ! r7 := src end address minus 9. + .align 2 +L_2l_loop: + mov.l @r5+,r2 ! Read & write two longwords per iteration + xtrct r2,r1 + mov.l r1,@(r0,r5) + cmp/hs r7,r5 + mov.l @r5+,r1 + xtrct r1,r2 + mov.l r2,@(r0,r5) + bf L_2l_loop + add #-2,r5 + bra L_cleanup + add #5,r0 +L_al4both: + add #-4,r0 + .align 2 +L_al4both_loop: + mov.l @r5+,r4 ! Read longword, write longword per iteration + cmp/hs r7,r5 + SL(bf, L_al4both_loop, mov.l r4,@(r0,r5)) + + bra L_cleanup + add #3,r0 + +L_odddst: + tst r1,r5 + SL(bt, L_al4src, add #-1,r4) + mov.w @r5+,r0 + mov.b r0,@(1,r4) + shlr8 r0 + mov.b r0,@(2,r4) + add #2,r4 +L_al4src: + .align 2 +L_odd_loop: + mov.l @r5+,r0 ! Read longword, write byte, word, byte per iteration + cmp/hs r7,r5 + mov.b r0,@(1,r4) + shlr8 r0 + mov.w r0,@(2,r4) + shlr16 r0 + mov.b r0,@(4,r4) + SL(bf, L_odd_loop, add #4,r4) + .align 2 ! avoid nop in more frequently executed code. +L_cleanup2: + mov r4,r0 + sub r5,r0 +L_cleanup: + cmp/eq r6,r5 + bt L_ready + .align 2 +L_cleanup_loop: + mov.b @r5+,r1 + cmp/eq r6,r5 + mov.b r1,@(r0,r5) + bf L_cleanup_loop +L_ready: + rts + mov r3,r0 +L_small: + bra L_cleanup2 + add #-1,r4 +#else + ! Big endian version copies with decreasing addresses. + mov r4,r0 + add r6,r0 + sub r4,r5 + mov #11,r1 + cmp/hs r1,r6 + SL(bf, L_small, add #-1,r5) + mov r5,r3 + add r0,r3 + shlr r3 + SL(bt, L_even, + mov r4,r7) + mov.b @(r0,r5),r2 + add #-1,r3 + mov.b r2,@-r0 +L_even: + tst #1,r0 + add #-1,r5 + SL(bf, L_odddst, add #8,r7) + tst #2,r0 + bt L_al4dst + add #-1,r3 + mov.w @(r0,r5),r1 + mov.w r1,@-r0 +L_al4dst: + shlr r3 + bt L_al4both + mov.w @(r0,r5),r1 + swap.w r1,r1 + add #4,r7 + add #-4,r5 + .align 2 +L_2l_loop: + mov.l @(r0,r5),r2 + xtrct r2,r1 + mov.l r1,@-r0 + cmp/hs r7,r0 + mov.l @(r0,r5),r1 + xtrct r1,r2 + mov.l r2,@-r0 + bt L_2l_loop + bra L_cleanup + add #5,r5 + + nop ! avoid nop in executed code. +L_al4both: + add #-2,r5 + .align 2 +L_al4both_loop: + mov.l @(r0,r5),r1 + cmp/hs r7,r0 + SL(bt, L_al4both_loop, + mov.l r1,@-r0) + bra L_cleanup + add #3,r5 + + nop ! avoid nop in executed code. +L_odddst: + shlr r3 + bt L_al4src + mov.w @(r0,r5),r1 + mov.b r1,@-r0 + shlr8 r1 + mov.b r1,@-r0 +L_al4src: + add #-2,r5 + .align 2 +L_odd_loop: + mov.l @(r0,r5),r2 + cmp/hs r7,r0 + mov.b r2,@-r0 + shlr8 r2 + mov.w r2,@-r0 + shlr16 r2 + mov.b r2,@-r0 + bt L_odd_loop + + add #3,r5 +L_cleanup: +L_small: + cmp/eq r4,r0 + bt L_ready + add #1,r4 + .align 2 +L_cleanup_loop: + mov.b @(r0,r5),r2 + cmp/eq r4,r0 + mov.b r2,@-r0 + bf L_cleanup_loop +L_ready: + rts + nop +#endif diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/memset.S b/LAN/SRCS/dcload-ip/target-src/dcload/memset.S new file mode 100644 index 00000000..7352b414 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/memset.S @@ -0,0 +1,64 @@ +! +! Fast SH memset +! +! by Toshiyasu Morita (tm@netcom.com) +! +! Entry: r4: destination pointer +! r5: fill value +! r6: byte count +! +! Exit: r0-r3: trashed +! + +! This assumes that the first four bytes of the address space (0..3) are +! reserved - usually by the linker script. Otherwise, we would had to check +! for the case of objects of the size 12..15 at address 0..3 . + +#include "asm.h" + +ENTRY(memset) + mov #12,r0 ! Check for small number of bytes + cmp/gt r6,r0 + mov r4,r0 + SL(bt, L_store_byte_loop_check0, add r4,r6) + + tst #3,r0 ! Align destination + SL(bt, L_dup_bytes, extu.b r5,r5) + .balignw 4,0x0009 +L_align_loop: + mov.b r5,@r0 + add #1,r0 + tst #3,r0 + bf L_align_loop + +L_dup_bytes: + swap.b r5,r2 ! Duplicate bytes across longword + or r2,r5 + swap.w r5,r2 + or r2,r5 + + add #-16,r6 + + .balignw 4,0x0009 +L_store_long_loop: + mov.l r5,@r0 ! Store double longs to memory + cmp/hs r6,r0 + mov.l r5,@(4,r0) + SL(bf, L_store_long_loop, add #8,r0) + + add #16,r6 + +L_store_byte_loop_check0: + cmp/eq r6,r0 + bt L_exit + .balignw 4,0x0009 +L_store_byte_loop: + mov.b r5,@r0 ! Store bytes to memory + add #1,r0 + cmp/eq r6,r0 + bf L_store_byte_loop + +L_exit: + rts + mov r4,r0 + diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/net.c b/LAN/SRCS/dcload-ip/target-src/dcload/net.c new file mode 100644 index 00000000..b055c2ac --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/net.c @@ -0,0 +1,222 @@ +#include "commands.h" +#include "packet.h" +#include "adapter.h" +#include "scif.h" +#include "net.h" + +unsigned char broadcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; + +void process_broadcast(unsigned char *pkt, int len) +{ + ether_header_t *ether_header = (ether_header_t *)pkt; + arp_header_t *arp_header = (arp_header_t *)(pkt + ETHER_H_LEN); + unsigned char tmp[10]; + unsigned int ip = htonl(our_ip); + + if (ether_header->type[1] != 0x06) /* ARP */ + return; + + /* hardware address space = ethernet */ + if (arp_header->hw_addr_space != 0x0100) + return; + + /* protocol address space = IP */ + if (arp_header->proto_addr_space != 0x0008) + return; + + if (arp_header->opcode == 0x0100) { /* arp request */ + if (our_ip == 0) /* return if we don't know our ip */ + return; + if (!memcmp(arp_header->proto_target, &ip, 4)) { /* for us */ + /* put src hw address into dest hw address */ + memcpy(ether_header->dest, ether_header->src, 6); + /* put our hw address into src hw address */ + memcpy(ether_header->src, bb->mac, 6); + arp_header->opcode = 0x0200; /* arp reply */ + /* swap sender and target addresses */ + memcpy(tmp, arp_header->hw_sender, 10); + memcpy(arp_header->hw_sender, arp_header->hw_target, 10); + memcpy(arp_header->hw_target, tmp, 10); + /* put our hw address into sender hw address */ + memcpy(arp_header->hw_sender, bb->mac, 6); + /* transmit */ + bb->tx(pkt, ETHER_H_LEN + ARP_H_LEN); + } + } +} + +unsigned char pkt_buf[1514]; + +void process_icmp(ether_header_t *ether, ip_header_t *ip, icmp_header_t *icmp) +{ + unsigned int i; + unsigned char tmp[6]; + + memset(pkt_buf, 0, ntohs(ip->length) + (ntohs(ip->length)%2) - 4*(ip->version_ihl & 0x0f)); + + /* check icmp checksum */ + i = icmp->checksum; + icmp->checksum = 0; + memcpy(pkt_buf, icmp, ntohs(ip->length) - 4*(ip->version_ihl & 0x0f)); + icmp->checksum = checksum((unsigned short *)pkt_buf, (ntohs(ip->length)+1)/2 - 2*(ip->version_ihl & 0x0f)); + if (i != icmp->checksum) + return; + + if (icmp->type == 8) { /* echo request */ + icmp->type = 0; /* echo reply */ + /* swap src and dest hw addresses */ + memcpy(tmp, ether->dest, 6); + memcpy(ether->dest, ether->src, 6); + memcpy(ether->src, tmp, 6); + /* swap src and dest ip addresses */ + memcpy(&i, &ip->src, 4); + memcpy(&ip->src, &ip->dest, 4); + memcpy(&ip->dest, &i, 4); + /* recompute ip header checksum */ + ip->checksum = 0; + ip->checksum = checksum((unsigned short *)ip, 2*(ip->version_ihl & 0x0f)); + /* recompute icmp checksum */ + icmp->checksum = 0; + icmp->checksum = checksum((unsigned short *)icmp, ntohs(ip->length)/2 - 2*(ip->version_ihl & 0x0f)); + /* transmit */ + bb->tx(ether, ETHER_H_LEN + ntohs(ip->length)); + } +} + +typedef struct { + unsigned int load_address; + unsigned int load_size; + unsigned char map[16384]; +} bin_info_t; + +bin_info_t bin_info; + +void process_udp(ether_header_t *ether, ip_header_t *ip, udp_header_t *udp) +{ + ip_udp_pseudo_header_t *pseudo; + unsigned short i; + command_t *command; + + pseudo = (ip_udp_pseudo_header_t *)pkt_buf; + pseudo->src_ip = ip->src; + pseudo->dest_ip = ip->dest; + pseudo->zero = 0; + pseudo->protocol = ip->protocol; + pseudo->udp_length = udp->length; + pseudo->src_port = udp->src; + pseudo->dest_port = udp->dest; + pseudo->length = udp->length; + pseudo->checksum = 0; + memset(pseudo->data, 0, ntohs(udp->length) - 8 + (ntohs(udp->length)%2)); + memcpy(pseudo->data, udp->data, ntohs(udp->length) - 8); + + /* checksum == 0 means no checksum */ + if (udp->checksum != 0) + i = checksum((unsigned short *)pseudo, (sizeof(ip_udp_pseudo_header_t) + ntohs(udp->length) - 9 + 1)/2); + else + i = 0; + /* checksum == 0xffff means checksum was really 0 */ + if (udp->checksum == 0xffff) + udp->checksum = 0; + + if (i != udp->checksum) { +/* scif_puts("UDP CHECKSUM BAD\n"); */ + return; + } + + make_ether(ether->src, ether->dest, (ether_header_t *)pkt_buf); + + command = (command_t *)udp->data; + + if (!memcmp(command->id, CMD_EXECUTE, 4)) { + cmd_execute(ether, ip, udp, command); + } + + if (!memcmp(command->id, CMD_LOADBIN, 4)) { + cmd_loadbin(ip, udp, command); + } + + if (!memcmp(command->id, CMD_PARTBIN, 4)) { + cmd_partbin(ip, udp, command); + } + + if (!memcmp(command->id, CMD_DONEBIN, 4)) { + cmd_donebin(ip, udp, command); + } + + if (!memcmp(command->id, CMD_SENDBINQ, 4)) { + cmd_sendbinq(ip, udp, command); + } + + if (!memcmp(command->id, CMD_SENDBIN, 4)) { + cmd_sendbin(ip, udp, command); + } + + if (!memcmp(command->id, CMD_VERSION, 4)) { + cmd_version(ip, udp, command); + } + + if (!memcmp(command->id, CMD_RETVAL, 4)) { + cmd_retval(ip, udp, command); + } + + if (!memcmp(command->id, CMD_REBOOT, 4)) { + cmd_reboot(ip, udp, command); + } +} + +void process_mine(unsigned char *pkt, int len) +{ + ether_header_t *ether_header = (ether_header_t *)pkt; + ip_header_t *ip_header = (ip_header_t *)(pkt + 14); + icmp_header_t *icmp_header; + udp_header_t *udp_header; + ip_udp_pseudo_header_t *ip_udp_pseudo_header; + unsigned char tmp[6]; + int i; + + if (ether_header->type[1] != 0x00) + return; + + /* ignore fragmented packets */ + + if (ntohs(ip_header->flags_frag_offset) & 0x3fff) + return; + + /* check ip header checksum */ + i = ip_header->checksum; + ip_header->checksum = 0; + ip_header->checksum = checksum((unsigned short *)ip_header, 2*(ip_header->version_ihl & 0x0f)); + if (i != ip_header->checksum) + return; + + switch (ip_header->protocol) { + case 1: /* icmp */ + icmp_header = (icmp_header_t *)(pkt + ETHER_H_LEN + 4*(ip_header->version_ihl & 0x0f)); + process_icmp(ether_header, ip_header, icmp_header); + break; + case 17: /* udp */ + udp_header = (udp_header_t *)(pkt + ETHER_H_LEN + 4*(ip_header->version_ihl & 0x0f)); + process_udp(ether_header, ip_header, udp_header); + default: + break; + } +} + +void process_pkt(unsigned char *pkt, int len) +{ + ether_header_t *ether_header = (ether_header_t *)pkt; + + if (ether_header->type[0] != 0x08) + return; + + if (!memcmp(ether_header->dest, broadcast, 6)) { + process_broadcast(pkt, len); + return; + } + + if (!memcmp(ether_header->dest, bb->mac, 6)) { + process_mine(pkt, len); + return; + } +} diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/net.h b/LAN/SRCS/dcload-ip/target-src/dcload/net.h new file mode 100644 index 00000000..12db474c --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/net.h @@ -0,0 +1,14 @@ +#ifndef __NET_H__ +#define __NET_H__ + +void process_broadcast(unsigned char *pkt, int len); +void process_icmp(ether_header_t *ether, ip_header_t *ip, icmp_header_t *icmp); +void process_udp(ether_header_t *ether, ip_header_t *ip, udp_header_t *udp); +void process_mine(unsigned char *pkt, int len); +void process_pkt(unsigned char *pkt, int len); + +extern unsigned char pkt_buf[1514]; + +extern unsigned int our_ip; + +#endif diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/packet.c b/LAN/SRCS/dcload-ip/target-src/dcload/packet.c new file mode 100644 index 00000000..547d6fa8 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/packet.c @@ -0,0 +1,68 @@ +#include "packet.h" + +unsigned short checksum(unsigned short *buf, int count) +{ + unsigned long sum = 0; + + while (count--) { + sum += *buf++; + if (sum & 0xffff0000) { + sum &= 0xffff; + sum++; + } + } + return ~(sum & 0xffff); +} + +void make_ether(char *dest, char *src, ether_header_t *ether) +{ + memcpy(ether->dest, dest, 6); + memcpy(ether->src, src, 6); + ether->type[0] = 8; + ether->type[1] = 0; +} + +void make_ip(int dest, int src, int length, char protocol, ip_header_t *ip) +{ + ip->version_ihl = 0x45; + ip->tos = 0; + ip->length = htons(20 + length); + ip->packet_id = 0; + ip->flags_frag_offset = htons(0x4000); + ip->ttl = 0x40; + ip->protocol = protocol; + ip->checksum = 0; + ip->src = htonl(src); + ip->dest = htonl(dest); + + ip->checksum = checksum((unsigned short *)ip, sizeof(ip_header_t)/2); +} + +unsigned char crap[1514]; + +void make_udp(unsigned short dest, unsigned short src, unsigned char * data, int length, ip_header_t *ip, udp_header_t *udp) +{ + ip_udp_pseudo_header_t *pseudo = (ip_udp_pseudo_header_t *)crap; + + udp->src = htons(src); + udp->dest = htons(dest); + udp->length = htons(length + 8); + udp->checksum = 0; + memcpy(udp->data, data, length); + + pseudo->src_ip = ip->src; + pseudo->dest_ip = ip->dest; + pseudo->zero = 0; + pseudo->protocol = ip->protocol; + pseudo->udp_length = udp->length; + pseudo->src_port = udp->src; + pseudo->dest_port = udp->dest; + pseudo->length = udp->length; + pseudo->checksum = 0; + memset(pseudo->data, 0, length + (length%2)); + memcpy(pseudo->data, udp->data, length); + + udp->checksum = checksum((unsigned short *)pseudo, (sizeof(ip_udp_pseudo_header_t) + length)/2); + if (udp->checksum == 0) + udp->checksum = 0xffff; +} diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/packet.h b/LAN/SRCS/dcload-ip/target-src/dcload/packet.h new file mode 100644 index 00000000..01e1b01b --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/packet.h @@ -0,0 +1,80 @@ +#ifndef __PACKET_H__ +#define __PACKET_H__ + + +typedef struct { + unsigned char dest[6]; + unsigned char src[6]; + unsigned char type[2]; +} ether_header_t; + +typedef struct { + unsigned char version_ihl __attribute__ ((packed)); + unsigned char tos __attribute__ ((packed)); + unsigned short length __attribute__ ((packed)); + unsigned short packet_id __attribute__ ((packed)); + unsigned short flags_frag_offset __attribute__ ((packed)); + unsigned char ttl __attribute__ ((packed)); + unsigned char protocol __attribute__ ((packed)); + unsigned short checksum __attribute__ ((packed)); + unsigned int src __attribute__ ((packed)); + unsigned int dest __attribute__ ((packed)); +} ip_header_t; + +typedef struct { + unsigned short src __attribute__ ((packed)); + unsigned short dest __attribute__ ((packed)); + unsigned short length __attribute__ ((packed)); + unsigned short checksum __attribute__ ((packed)); + unsigned char data[1] __attribute__ ((packed)); +} udp_header_t; + +typedef struct { + unsigned char type __attribute__ ((packed)); + unsigned char code __attribute__ ((packed)); + unsigned short checksum __attribute__ ((packed)); + unsigned int misc __attribute__ ((packed)); +} icmp_header_t; + +typedef struct { + unsigned short hw_addr_space __attribute__ ((packed)); + unsigned short proto_addr_space __attribute__ ((packed)); + unsigned char hw_addr_len __attribute__ ((packed)); + unsigned char proto_addr_len __attribute__ ((packed)); + unsigned short opcode __attribute__ ((packed)); + unsigned char hw_sender[6] __attribute__ ((packed)); + unsigned char proto_sender[4] __attribute__ ((packed)); + unsigned char hw_target[6] __attribute__ ((packed)); + unsigned char proto_target[4] __attribute__ ((packed)); +} arp_header_t; + +typedef struct { + unsigned int src_ip __attribute__ ((packed)); + unsigned int dest_ip __attribute__ ((packed)); + unsigned char zero __attribute__ ((packed)); + unsigned char protocol __attribute__ ((packed)); + unsigned short udp_length __attribute__ ((packed)); + unsigned short src_port __attribute__ ((packed)); + unsigned short dest_port __attribute__ ((packed)); + unsigned short length __attribute__ ((packed)); + unsigned short checksum __attribute__ ((packed)); + unsigned char data[1] __attribute__ ((packed)); +} ip_udp_pseudo_header_t; + +unsigned short checksum(unsigned short *buf, int count); +void make_ether(char *dest, char *src, ether_header_t *ether); +void make_ip(int dest, int src, int length, char protocol, ip_header_t *ip); +void make_udp(unsigned short dest, unsigned short src, unsigned char * data, int length, ip_header_t *ip, udp_header_t *udp); + +#define ntohl bswap32 +#define htonl bswap32 +#define ntohs bswap16 +#define htons bswap16 + +#define ETHER_H_LEN 14 +#define IP_H_LEN 20 +#define UDP_H_LEN 8 +#define ICMP_H_LEN 8 +#define ARP_H_LEN 28 + +#endif diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/rtl8139.c b/LAN/SRCS/dcload-ip/target-src/dcload/rtl8139.c new file mode 100644 index 00000000..57efb226 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/rtl8139.c @@ -0,0 +1,325 @@ +#include "packet.h" +#include "net.h" +#include "rtl8139.h" +#include "dcload.h" + +static rtl_status_t rtl; + +// Defined below +extern adapter_t adapter_bba; + +/* 8, 16, and 32 bit access to the PCI I/O space (configured by GAPS) */ +static vuc * const nic8 = REGC(0xa1001700); +static vus * const nic16 = REGS(0xa1001700); +static vul * const nic32 = REGL(0xa1001700); + +/* 8, 16, and 32 bit access to the PCI MEMMAP space (configured by GAPS) */ +static vuc * const mem8 = REGC(0xa1840000); +static vus * const mem16 = REGS(0xa1840000); +static vul * const mem32 = REGL(0xa1840000); + +static int bb_detect() +{ + const char *str = (char*)REGC(0xa1001400); + if (!memcmp(str, "GAPSPCI_BRIDGE_2", 16)) + return 0; + else + return -1; +} + +static void rtl_init() +{ + unsigned int tmp; + + /* Soft-reset the chip */ + nic8[RT_CHIPCMD] = RT_CMD_RESET; + + /* Wait for it to come back */ + while (nic8[RT_CHIPCMD] & RT_CMD_RESET); + + /* Reset CONFIG1 */ + nic8[RT_CONFIG1] = 0; + + /* Enable auto-negotiation and restart that process */ + nic16[RT_MII_BMCR/2] = 0x9200; + + /* Do another reset */ + nic8[RT_CHIPCMD] = RT_CMD_RESET; + + /* Wait for it to come back */ + while (nic8[RT_CHIPCMD] & RT_CMD_RESET); + + /* Enable writing to the config registers */ + nic8[RT_CFG9346] = 0xc0; + + /* Read MAC address */ + tmp = nic32[RT_IDR0]; + rtl.mac[0] = tmp & 0xff; + rtl.mac[1] = (tmp >> 8) & 0xff; + rtl.mac[2] = (tmp >> 16) & 0xff; + rtl.mac[3] = (tmp >> 24) & 0xff; + tmp = nic32[RT_IDR0+1]; + rtl.mac[4] = tmp & 0xff; + rtl.mac[5] = (tmp >> 8) & 0xff; + memcpy(adapter_bba.mac, rtl.mac, 6); + + /* Enable receive and transmit functions */ + nic8[RT_CHIPCMD] = RT_CMD_RX_ENABLE | RT_CMD_TX_ENABLE; + + /* Set Rx FIFO threashold to 16 bytes, Rx size to 16k+16, 1024 byte DMA burst */ + nic32[RT_RXCONFIG/4] = 0x00000e00; + + /* Set Tx 1024 byte DMA burst */ + nic32[RT_TXCONFIG/4] = 00000600; + + /* Turn off lan-wake and set the driver-loaded bit */ + nic8[RT_CONFIG1] = (nic8[RT_CONFIG1] & ~0x30) | 0x20; + + /* Enable FIFO auto-clear */ + nic8[RT_CONFIG4] |= 0x80; + + /* Switch back to normal operation mode */ + nic8[RT_CFG9346] = 0; + + /* Setup Rx and Tx buffers */ + nic32[RT_RXBUF/4] = 0x01840000; + nic32[RT_TXADDR0/4 + 0] = 0x01846000; + nic32[RT_TXADDR0/4 + 1] = 0x01846800; + nic32[RT_TXADDR0/4 + 2] = 0x01847000; + nic32[RT_TXADDR0/4 + 3] = 0x01847800; + + /* Reset RXMISSED counter */ + nic32[RT_RXMISSED/4] = 0; + + /* Enable receiving broadcast and physical match packets */ + nic32[RT_RXCONFIG/4] |= 0x0000000a; + + /* Filter out all multicast packets */ + nic32[RT_MAR0/4 + 0] = 0; + nic32[RT_MAR0/4 + 1] = 0; + + /* Disable all multi-interrupts */ + nic16[RT_MULTIINTR/2] = 0; + + /* clear all interrupts */ + nic16[RT_INTRSTATUS/2] = 0xffff; + + /* Enable RX/TX once more */ + nic8[RT_CHIPCMD] = RT_CMD_RX_ENABLE | RT_CMD_TX_ENABLE; + + /* Initialize status vars */ + rtl.cur_tx = 0; + rtl.cur_rx = 0; +} + +static int bb_init() +{ + vuc * const g28 = REGC(0xa1000000); + vus * const g216 = REGS(0xa1000000); + vul * const g232 = REGL(0xa1000000); + + int i; + unsigned int tmp; + + /* Initialize the "GAPS" PCI glue controller. + It ain't pretty but it works. */ + g232[0x1418/4] = 0x5a14a501; /* M */ + i = 10000; + while (!(g232[0x1418/4] & 1) && i > 0) + i--; + if (!(g232[0x1418/4] & 1)) { + return -1; + } + g232[0x1420/4] = 0x01000000; + g232[0x1424/4] = 0x01000000; + g232[0x1428/4] = 0x01840000; /* DMA Base */ + g232[0x142c/4] = 0x01840000 + 32*1024; /* DMA End */ + g232[0x1414/4] = 0x00000001; + g232[0x1434/4] = 0x00000001; + + /* Configure PCI bridge (very very hacky). If we wanted to be proper, + we ought to implement a full PCI subsystem. In this case that is + ridiculous for accessing a single card that will probably never + change. Considering that the DC is now out of production officially, + there is a VERY good chance it will never change. */ + g216[0x1606/2] = 0xf900; + g232[0x1630/4] = 0x00000000; + g28[0x163c] = 0x00; + g28[0x160d] = 0xf0; + (void)g216[0x04/2]; + g216[0x1604/2] = 0x0006; + g232[0x1614/4] = 0x01000000; + (void)g28[0x1650]; + + rtl_init(); + + return 0; +} + +static void bb_stop(void) +{ + nic32[RT_RXCONFIG/4] &= 0xfffffff5; +} + +static void bb_start(void) +{ + nic32[RT_RXCONFIG/4] |= 0x0000000a; +} + +static vuc * const txdesc[4] = { REGC(0xa1846000), + REGC(0xa1846800), + REGC(0xa1847000), + REGC(0xa1847800) }; + +static int bb_tx(unsigned char * pkt, int len) +{ + while (!(nic32[RT_TXSTATUS0/4 + rtl.cur_tx] & 0x2000)) + if (nic32[RT_TXSTATUS0/4 + rtl.cur_tx] & 0x40000000) + nic32[RT_TXSTATUS0/4 + rtl.cur_tx] |= 1; + + memcpy(txdesc[rtl.cur_tx], pkt, len); + if (len < 60) /* 8139 doesn't auto-pad */ + len = 60; + nic32[RT_TXSTATUS0/4 + rtl.cur_tx] = len; + rtl.cur_tx = (rtl.cur_tx + 1) % 4; +} + +static void pktcpy(unsigned char *dest, unsigned char *src, int n) +{ + if (n > 1514) + return; + + if ((unsigned int)(src + n) < (unsigned int)(0xa1840000 + 16384)) + memcpy(dest, src, n); + else { + memcpy(dest, src, (0xa1840000 + 16384) - (unsigned int)src); + memcpy(dest + ((0xa1840000 + 16384) - (unsigned int)src), (unsigned char *)0xa1840000, (unsigned int)(src + n) - (0xa1840000 + 16384)); + } +} + +static int bb_rx() +{ + int avail; + int processed; + unsigned int rx_status; + int rx_size, pkt_size, ring_offset; + int i; + unsigned char *pkt; + + processed = 0; + + /* While we have frames left to process... */ + while (!(nic8[RT_CHIPCMD] & 1)) { + /* Get frame size and status */ + ring_offset = rtl.cur_rx % 16384; + rx_status = mem32[0x0000/4 + ring_offset/4]; + rx_size = (rx_status >> 16) & 0xffff; + pkt_size = rx_size - 4; + + /* apparently this means the rtl8139 is still copying */ + if (rx_size == 0xfff0) { + break; + } + + if ((rx_status & 1) && (pkt_size <= 1514)) { + pkt = (unsigned char*)(mem8 + 0x0000 + ring_offset + 4); + pktcpy(current_pkt, pkt, pkt_size); + process_pkt(current_pkt, pkt_size); + } + + rtl.cur_rx = (rtl.cur_rx + rx_size + 4 + 3) & ~3; + nic16[RT_RXBUFTAIL/2] = rtl.cur_rx - 16; + + // Ack it + i = nic16[RT_INTRSTATUS/2]; + if (i & RT_INT_RX_ACK) + nic16[RT_INTRSTATUS/2] = RT_INT_RX_ACK; + + processed++; + } + return processed; +} + +extern void uint_to_string(unsigned int foo, unsigned char *bar); + +static void bb_loop() +{ + unsigned int intr; + int i; + char value[256]; + + intr = 0; + + while(!escape_loop) { + + /* Check interrupt status */ + if (nic16[RT_INTRSTATUS/2] != intr) { + intr = nic16[RT_INTRSTATUS/2]; + nic16[RT_INTRSTATUS/2] = intr & ~RT_INT_RX_ACK; + } + + /* Did we receive some data? */ + if (intr & RT_INT_RX_ACK) { + i = bb_rx(); + } + + /* link change */ + if (intr & RT_INT_RXFIFO_UNDERRUN) { + + if (booted && !running) { + disp_status("link change..."); + } + + nic16[RT_MII_BMCR/2] = 0x9200; + + /* wait for valid link */ + while (!(nic16[RT_MII_BMSR/2] & 0x20)); + + /* wait for the additional link change interrupt that is coming */ + while (!(nic16[RT_INTRSTATUS/2] & RT_INT_RXFIFO_UNDERRUN)); + nic16[RT_INTRSTATUS/2] = RT_INT_RXFIFO_UNDERRUN; + + if (booted && !running) { + disp_status("idle..."); + } + + } + + /* Rx FIFO overflow */ + if (intr & RT_INT_RXFIFO_OVERFLOW) { + /* must clear Rx Buffer Overflow too for some reason */ + nic16[RT_INTRSTATUS/2] = RT_INT_RXBUF_OVERFLOW; + } + + /* Rx Buffer overflow */ + if (intr & RT_INT_RXBUF_OVERFLOW) { + rtl.cur_rx = nic16[RT_RXBUFHEAD]; + nic16[RT_RXBUFTAIL]= rtl.cur_rx - 16; + + rtl.cur_rx = 0; + nic8[RT_CHIPCMD] = RT_CMD_TX_ENABLE; + + nic32[RT_RXCONFIG/4] = 0x00000e0a; + + while ( !(nic8[RT_CHIPCMD] & RT_CMD_RX_ENABLE)) + nic8[RT_CHIPCMD] = RT_CMD_TX_ENABLE | RT_CMD_RX_ENABLE; + + nic32[RT_RXCONFIG/4] = 0x00000e0a; + + nic16[RT_INTRSTATUS/2] = 0xffff; + } + } + escape_loop = 0; +} + +// Pull together all the goodies +adapter_t adapter_bba = { + "Broadband Adapter (HIT-0400)", + { 0 }, // Mac address + bb_detect, + bb_init, + bb_start, + bb_stop, + bb_loop, + bb_tx +}; diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/rtl8139.h b/LAN/SRCS/dcload-ip/target-src/dcload/rtl8139.h new file mode 100644 index 00000000..dae37f27 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/rtl8139.h @@ -0,0 +1,99 @@ +#ifndef __RTL8139_H__ +#define __RTL8139_H__ + +#include "adapter.h" + +/* RTL8139C register definitions */ +#define RT_IDR0 0x00 /* Mac address */ +#define RT_MAR0 0x08 /* Multicast filter */ +#define RT_TXSTATUS0 0x10 /* Transmit status (4 32bit regs) */ +#define RT_TXADDR0 0x20 /* Tx descriptors (also 4 32bit) */ +#define RT_RXBUF 0x30 /* Receive buffer start address */ +#define RT_RXEARLYCNT 0x34 /* Early Rx byte count */ +#define RT_RXEARLYSTATUS 0x36 /* Early Rx status */ +#define RT_CHIPCMD 0x37 /* Command register */ +#define RT_RXBUFTAIL 0x38 /* Current address of packet read (queue tail) */ +#define RT_RXBUFHEAD 0x3A /* Current buffer address (queue head) */ +#define RT_INTRMASK 0x3C /* Interrupt mask */ +#define RT_INTRSTATUS 0x3E /* Interrupt status */ +#define RT_TXCONFIG 0x40 /* Tx config */ +#define RT_RXCONFIG 0x44 /* Rx config */ +#define RT_TIMER 0x48 /* A general purpose counter */ +#define RT_RXMISSED 0x4C /* 24 bits valid, write clears */ +#define RT_CFG9346 0x50 /* 93C46 command register */ +#define RT_CONFIG0 0x51 /* Configuration reg 0 */ +#define RT_CONFIG1 0x52 /* Configuration reg 1 */ +#define RT_TIMERINT 0x54 /* Timer interrupt register (32 bits) */ +#define RT_MEDIASTATUS 0x58 /* Media status register */ +#define RT_CONFIG3 0x59 /* Config register 3 */ +#define RT_CONFIG4 0x5A /* Config register 4 */ +#define RT_MULTIINTR 0x5C /* Multiple interrupt select */ +#define RT_MII_TSAD 0x60 /* Transmit status of all descriptors (16 bits) */ +#define RT_MII_BMCR 0x62 /* Basic Mode Control Register (16 bits) */ +#define RT_MII_BMSR 0x64 /* Basic Mode Status Register (16 bits) */ +#define RT_AS_ADVERT 0x66 /* Auto-negotiation advertisement reg (16 bits) */ +#define RT_AS_LPAR 0x68 /* Auto-negotiation link partner reg (16 bits) */ +#define RT_AS_EXPANSION 0x6A /* Auto-negotiation expansion reg (16 bits) */ + +/* RTL8193C command bits; or these together and write teh resulting value + into CHIPCMD to execute it. */ +#define RT_CMD_RESET 0x10 +#define RT_CMD_RX_ENABLE 0x08 +#define RT_CMD_TX_ENABLE 0x04 +#define RT_CMD_RX_BUF_EMPTY 0x01 + +/* RTL8139C interrupt status bits */ +#define RT_INT_PCIERR 0x8000 /* PCI Bus error */ +#define RT_INT_TIMEOUT 0x4000 /* Set when TCTR reaches TimerInt value */ +#define RT_INT_RXFIFO_OVERFLOW 0x0040 /* Rx FIFO overflow */ +#define RT_INT_RXFIFO_UNDERRUN 0x0020 /* Packet underrun / link change */ +#define RT_INT_RXBUF_OVERFLOW 0x0010 /* Rx BUFFER overflow */ +#define RT_INT_TX_ERR 0x0008 +#define RT_INT_TX_OK 0x0004 +#define RT_INT_RX_ERR 0x0002 +#define RT_INT_RX_OK 0x0001 + +/* Composite RX bits we check for while doing an RX interrupt */ +#define RT_INT_RX_ACK (RT_INT_RXFIFO_OVERFLOW | RT_INT_RXBUF_OVERFLOW | RT_INT_RX_OK) + +/* RTL8139C transmit status bits */ +#define RT_TX_CARRIER_LOST 0x80000000 /* Carrier sense lost */ +#define RT_TX_ABORTED 0x40000000 /* Transmission aborted */ +#define RT_TX_OUT_OF_WINDOW 0x20000000 /* Out of window collision */ +#define RT_TX_STATUS_OK 0x00008000 /* Status ok: a good packet was transmitted */ +#define RT_TX_UNDERRUN 0x00004000 /* Transmit FIFO underrun */ +#define RT_TX_HOST_OWNS 0x00002000 /* Set to 1 when DMA operation is completed */ +#define RT_TX_SIZE_MASK 0x00001fff /* Descriptor size mask */ + +/* RTL8139C receive status bits */ +#define RT_RX_MULTICAST 0x00008000 /* Multicast packet */ +#define RT_RX_PAM 0x00004000 /* Physical address matched */ +#define RT_RX_BROADCAST 0x00002000 /* Broadcast address matched */ +#define RT_RX_BAD_SYMBOL 0x00000020 /* Invalid symbol in 100TX packet */ +#define RT_RX_RUNT 0x00000010 /* Packet size is <64 bytes */ +#define RT_RX_TOO_LONG 0x00000008 /* Packet size is >4K bytes */ +#define RT_RX_CRC_ERR 0x00000004 /* CRC error */ +#define RT_RX_FRAME_ALIGN 0x00000002 /* Frame alignment error */ +#define RT_RX_STATUS_OK 0x00000001 /* Status ok: a good packet was received */ + +/* Convienence macros */ +#define REGL(a) (volatile unsigned long *)(a) +#define vul volatile unsigned long +#define REGS(a) (volatile unsigned short *)(a) +#define vus volatile unsigned short +#define REGC(a) (volatile unsigned char *)(a) +#define vuc volatile unsigned char + +/* Configuration definitions */ +#define RX_BUFFER_LEN 8192 + +/* RTL8139C Config/Status info */ +typedef struct { + unsigned short cur_rx; /* Current Rx read ptr */ + unsigned short cur_tx; /* Current available Tx slot */ + unsigned char mac[6]; /* Mac address */ +} rtl_status_t; + +extern adapter_t adapter_bba; + +#endif diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/scif.c b/LAN/SRCS/dcload-ip/target-src/dcload/scif.c new file mode 100644 index 00000000..8fc276d0 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/scif.c @@ -0,0 +1,99 @@ +/* + * This file is part of the dcload Dreamcast serial loader + * + * Copyright (C) 2000 Andrew Kieschnick + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include "scif.h" + +#define BORDER_FLASH +#define VIDBORDER (volatile unsigned int *)0xa05f8040 + +void scif_flush() +{ + int v; + + *SCFSR2 &= 0xbf; + while (!((v = *SCFSR2) & 0x40)); + *SCFSR2 = v & 0xbf; +} + +void scif_init(int bps) +{ + int i; + + *SCSCR2 = 0x0; /* clear TE and RE bits in SCSCR2 */ + *SCFCR2 = 0x6; /* set TFRST and RFRST bits in SCFCR2 */ + *SCSMR2 = 0x0; /* set data transfer format 8n1 */ + *SCBRR2 = (50 * 1000000) / (32 * bps) - 1; /* set bit rate */ + + for (i = 0; i < 100000; i++); /* delay at least 1 bit interval */ + + *SCFCR2 = 12; + *SCFCR2 = 0x8; /* set MCE in SCFCR2 */ + *SCSPTR2 = 0; + *SCFSR2 = 0x60; + *SCLSR2 = 0; + *SCSCR2 = 0x30; /* set TE and RE bits in SCSCR2 */ + + for (i = 0; i < 100000; i++); +} + +unsigned char scif_getchar(void) +{ + unsigned char foo; + +#ifdef BORDER_FLASH + *VIDBORDER = ~(*VIDBORDER & 0x00ffffff); +#endif + + while (!(*SCFSR2 & 0x2)); /* check RDF */ + foo = *SCFRDR2; /* read data */ + *SCFSR2 &= 0xfffd; /* clear RDF */ + return foo; + +} + +unsigned int scif_isdata(void) +{ + return (*SCFSR2 & 0x2); +} + +void scif_putchar(unsigned char foo) +{ + +#ifdef BORDER_FLASH + *VIDBORDER = ~(*VIDBORDER & 0x00ffffff); +#endif + + while (!(*SCFSR2 & 0x20)); /* check TDFE */ + *SCFTDR2 = foo; /* send data */ + *SCFSR2 &= 0xff9f; /* clear TDFE and TEND */ +} + +void scif_puts(unsigned char *foo) +{ + int i = 0; + + while (foo[i] != 0) { + scif_putchar(foo[i]); + if (foo[i] == '\n') + scif_putchar('\r'); + i++; + } +} diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/scif.h b/LAN/SRCS/dcload-ip/target-src/dcload/scif.h new file mode 100644 index 00000000..e9f9104a --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/scif.h @@ -0,0 +1,62 @@ +/* + * This file is part of the dcload Dreamcast serial loader + * + * Copyright (C) 2000 Andrew Kieschnick + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __SCIF_H__ +#define __SCIF_H__ + +/* serial mode register */ +#define SCSMR2 (volatile unsigned short *) 0xffe80000 + +/* bit rate register */ +#define SCBRR2 (volatile unsigned char *) 0xffe80004 + +/* serial control register */ +#define SCSCR2 (volatile unsigned short *) 0xffe80008 + +/* transmit fifo data register */ +#define SCFTDR2 (volatile unsigned char *) 0xffe8000c + +/* serial status register */ +#define SCFSR2 (volatile unsigned short *) 0xffe80010 + +/* receive fifo data register */ +#define SCFRDR2 (volatile unsigned char *) 0xffe80014 + +/* fifo control register */ +#define SCFCR2 (volatile unsigned short *) 0xffe80018 + +/* fifo data count register */ +#define SCFDR2 (volatile unsigned short *) 0xffe8001c + +/* serial port register */ +#define SCSPTR2 (volatile unsigned short *) 0xffe80020 + +/* line status register */ +#define SCLSR2 (volatile unsigned short *) 0xffe80024 + +void scif_flush(void); +void scif_init(int bps); +unsigned char scif_getchar(void); +unsigned int scif_isdata(void); +void scif_putchar(unsigned char foo); +void scif_puts(unsigned char *foo); + +#endif diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/syscalls.c b/LAN/SRCS/dcload-ip/target-src/dcload/syscalls.c new file mode 100644 index 00000000..301a4b61 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/syscalls.c @@ -0,0 +1,382 @@ +/* + * This file is part of the dcload Dreamcast ethernet loader + * + * Copyright (C) 2001 Andrew Kieschnick + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include "syscalls.h" +#include "packet.h" +#include "net.h" +#include "commands.h" +#include "scif.h" +#include "adapter.h" + +unsigned int syscall_retval; +unsigned char* syscall_data; + +ether_header_t * ether = (ether_header_t *)pkt_buf; +ip_header_t * ip = (ip_header_t *)(pkt_buf + ETHER_H_LEN); +udp_header_t * udp = (udp_header_t *)(pkt_buf + ETHER_H_LEN + IP_H_LEN); + +/* send command, enable bb, bb_loop(), then return */ + +int strlen(const char *s) +{ + int c = 0; + + while (s[c] != 0) + c++; + return c; +} + +void build_send_packet(int command_len) +{ + unsigned char * command = pkt_buf + ETHER_H_LEN + IP_H_LEN + UDP_H_LEN; +/* + scif_puts("build_send_packet\n"); + scif_putchar(command[0]); + scif_putchar(command[1]); + scif_putchar(command[2]); + scif_putchar(command[3]); + scif_puts("\n"); +*/ + make_ether(tool_mac, bb->mac, ether); + make_ip(tool_ip, our_ip, UDP_H_LEN + command_len, 17, ip); + make_udp(tool_port, 31313, command, command_len, ip, udp); + bb->start(); + bb->tx(pkt_buf, ETHER_H_LEN + IP_H_LEN + UDP_H_LEN + command_len); + +} + +void dcexit(void) +{ + command_t * command = (command_t *)(pkt_buf + ETHER_H_LEN + IP_H_LEN + UDP_H_LEN); + + memcpy(command->id, CMD_EXIT, 4); + command->address = htonl(0); + command->size = htonl(0); + build_send_packet(COMMAND_LEN); + bb->stop(); +} + +int read(int fd, void *buf, size_t count) +{ + command_3int_t * command = (command_3int_t *)(pkt_buf + ETHER_H_LEN + IP_H_LEN + UDP_H_LEN); + + memcpy(command->id, CMD_READ, 4); + command->value0 = htonl(fd); + command->value1 = htonl(buf); + command->value2 = htonl(count); + build_send_packet(sizeof(command_3int_t)); + bb->loop(); + + return syscall_retval; +} + +int write(int fd, const void *buf, size_t count) +{ + command_3int_t * command = (command_3int_t *)(pkt_buf + ETHER_H_LEN + IP_H_LEN + UDP_H_LEN); + + memcpy(command->id, CMD_WRITE, 4); + command->value0 = htonl(fd); + command->value1 = htonl(buf); + command->value2 = htonl(count); + build_send_packet(sizeof(command_3int_t)); + bb->loop(); + + return syscall_retval; +} + +int open(const char *pathname, int flags, ...) +{ + va_list ap; + command_2int_string_t * command = (command_2int_string_t *)(pkt_buf + ETHER_H_LEN + IP_H_LEN + UDP_H_LEN); + + int namelen = strlen(pathname); + + memcpy(command->id, CMD_OPEN, 4); + + va_start(ap, flags); + command->value0 = htonl(flags); + command->value1 = htonl(va_arg(ap, int)); + va_end(ap); + + memcpy(command->string, pathname, namelen+1); + + build_send_packet(sizeof(command_2int_string_t)+namelen); + bb->loop(); + + return syscall_retval; +} + +int close(int fd) +{ + command_int_t * command = (command_int_t *)(pkt_buf + ETHER_H_LEN + IP_H_LEN + UDP_H_LEN); + + memcpy(command->id, CMD_CLOSE, 4); + command->value0 = htonl(fd); + + build_send_packet(sizeof(command_int_t)); + bb->loop(); + + return syscall_retval; +} + +int creat(const char *pathname, mode_t mode) +{ + command_int_string_t * command = (command_int_string_t *)(pkt_buf + ETHER_H_LEN + IP_H_LEN + UDP_H_LEN); + + int namelen = strlen(pathname); + + memcpy(command->id, CMD_CREAT, 4); + + command->value0 = htonl(mode); + + memcpy(command->string, pathname, namelen+1); + + build_send_packet(sizeof(command_int_string_t)+namelen); + bb->loop(); + + return syscall_retval; +} + +int link(const char *oldpath, const char *newpath) +{ + command_string_t * command = (command_string_t *)(pkt_buf + ETHER_H_LEN + IP_H_LEN + UDP_H_LEN); + int namelen1 = strlen(oldpath); + int namelen2 = strlen(newpath); + + memcpy(command->id, CMD_LINK, 4); + + memcpy(command->string, oldpath, namelen1 + 1); + memcpy(command->string + namelen1 + 1, newpath, namelen2 + 1); + + build_send_packet(sizeof(command_string_t)+namelen1+namelen2+1); + bb->loop(); + + return syscall_retval; + +} + +int unlink(const char *pathname) +{ + command_string_t * command = (command_string_t *)(pkt_buf + ETHER_H_LEN + IP_H_LEN + UDP_H_LEN); + int namelen = strlen(pathname); + + memcpy(command->id, CMD_UNLINK, 4); + + memcpy(command->string, pathname, namelen + 1); + + build_send_packet(sizeof(command_string_t)+namelen); + bb->loop(); + + return syscall_retval; +} + +int chdir(const char *path) +{ + command_string_t * command = (command_string_t *)(pkt_buf + ETHER_H_LEN + IP_H_LEN + UDP_H_LEN); + int namelen = strlen(path); + + memcpy(command->id, CMD_CHDIR, 4); + + memcpy(command->string, path, namelen + 1); + + build_send_packet(sizeof(command_string_t)+namelen); + bb->loop(); + + return syscall_retval; +} + +int chmod(const char *path, mode_t mode) +{ + command_int_string_t * command = (command_int_string_t *)(pkt_buf + ETHER_H_LEN + IP_H_LEN + UDP_H_LEN); + + int namelen = strlen(path); + + memcpy(command->id, CMD_CHMOD, 4); + + command->value0 = htonl(mode); + + memcpy(command->string, path, namelen+1); + + build_send_packet(sizeof(command_int_string_t)+namelen); + bb->loop(); + + return syscall_retval; +} + +off_t lseek(int fildes, off_t offset, int whence) +{ + command_3int_t * command = (command_3int_t *)(pkt_buf + ETHER_H_LEN + IP_H_LEN + UDP_H_LEN); + + memcpy(command->id, CMD_LSEEK, 4); + command->value0 = htonl(fildes); + command->value1 = htonl(offset); + command->value2 = htonl(whence); + + build_send_packet(sizeof(command_3int_t)); + bb->loop(); + + return syscall_retval; +} + +int fstat(int filedes, struct stat *buf) +{ + command_3int_t * command = (command_3int_t *)(pkt_buf + ETHER_H_LEN + IP_H_LEN + UDP_H_LEN); + + memcpy(command->id, CMD_FSTAT, 4); + command->value0 = htonl(filedes); + command->value1 = htonl(buf); + command->value2 = htonl(sizeof(struct stat)); + + build_send_packet(sizeof(command_3int_t)); + bb->loop(); + + return syscall_retval; +} + +time_t time(time_t * t) +{ + command_int_t * command = (command_int_t *)(pkt_buf + ETHER_H_LEN + IP_H_LEN + UDP_H_LEN); + + + memcpy(command->id, CMD_TIME, 4); + build_send_packet(sizeof(command_int_t)); + bb->loop(); + + return syscall_retval; +} + +int stat(const char *file_name, struct stat *buf) +{ + command_2int_string_t * command = (command_2int_string_t *)(pkt_buf + ETHER_H_LEN + IP_H_LEN + UDP_H_LEN); + int namelen = strlen(file_name); + + memcpy(command->id, CMD_STAT, 4); + memcpy(command->string, file_name, namelen+1); + + command->value0 = htonl(buf); + command->value1 = htonl(sizeof(struct stat)); + + build_send_packet(sizeof(command_2int_string_t)+namelen); + bb->loop(); + + return syscall_retval; +} + +int utime(const char *filename, struct utimbuf *buf) +{ + command_3int_string_t * command = (command_3int_string_t *)(pkt_buf + ETHER_H_LEN + IP_H_LEN + UDP_H_LEN); + int namelen = strlen(filename); + + memcpy(command->id, CMD_UTIME, 4); + memcpy(command->string, filename, namelen+1); + + command->value0 = htonl(buf); + + if (!buf) { + command->value1 = htonl(buf->actime); + command->value2 = htonl(buf->modtime); + } + + build_send_packet(sizeof(command_3int_string_t)+namelen); + bb->loop(); + + return syscall_retval; +} + +DIR * opendir(const char *name) +{ + command_string_t * command = (command_string_t *)(pkt_buf + ETHER_H_LEN + IP_H_LEN + UDP_H_LEN); + int namelen = strlen(name); + + memcpy(command->id, CMD_OPENDIR, 4); + memcpy(command->string, name, namelen+1); + + build_send_packet(sizeof(command_string_t)+namelen); + bb->loop(); + + return (DIR *)syscall_retval; +} + +int closedir(DIR *dir) +{ + command_int_t * command = (command_int_t *)(pkt_buf + ETHER_H_LEN + IP_H_LEN + UDP_H_LEN); + + memcpy(command->id, CMD_CLOSEDIR, 4); + command->value0 = htonl(dir); + + build_send_packet(sizeof(command_int_t)); + bb->loop(); + + return syscall_retval; +} + +struct dirent our_dir; + +struct dirent *readdir(DIR *dir) +{ + command_3int_t * command = (command_3int_t *)(pkt_buf + ETHER_H_LEN + IP_H_LEN + UDP_H_LEN); + + memcpy(command->id, CMD_READDIR, 4); + command->value0 = htonl(dir); + command->value1 = htonl(&our_dir); + command->value2 = htonl(sizeof(struct dirent)); + + build_send_packet(sizeof(command_3int_t)); + bb->loop(); + + if (syscall_retval) + return &our_dir; + else + return 0; +} + +int gethostinfo(unsigned int *ip, unsigned int *port) +{ + *ip = tool_ip; + *port = tool_port; + + return our_ip; +} + +size_t gdbpacket(const char *in_buf, unsigned int size_pack, char* out_buf) +{ + size_t in_size = size_pack >> 16, out_size = size_pack & 0xffff; + command_2int_string_t * command = (command_2int_string_t *)(pkt_buf + ETHER_H_LEN + IP_H_LEN + UDP_H_LEN); + + memcpy(command->id, CMD_GDBPACKET, 4); + command->value0 = htonl(in_size); + command->value1 = htonl(out_size); + memcpy(command->string, in_buf, in_size); + build_send_packet(sizeof(command_2int_string_t)-1 + in_size); + bb->loop(); + + if (syscall_retval <= out_size) + memcpy(out_buf, syscall_data, syscall_retval); + + return syscall_retval; +} diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/syscalls.h b/LAN/SRCS/dcload-ip/target-src/dcload/syscalls.h new file mode 100644 index 00000000..2c4d081b --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/syscalls.h @@ -0,0 +1,90 @@ +/* + * This file is part of the dcload Dreamcast ethernet loader + * + * Copyright (C) 2001 Andrew Kieschnick + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __SYSCALLS_H__ +#define __SYSCALLS_H__ + +#define CMD_EXIT "DC00" +#define CMD_FSTAT "DC01" +#define CMD_WRITE "DD02" +#define CMD_READ "DC03" +#define CMD_OPEN "DC04" +#define CMD_CLOSE "DC05" +#define CMD_CREAT "DC06" +#define CMD_LINK "DC07" +#define CMD_UNLINK "DC08" +#define CMD_CHDIR "DC09" +#define CMD_CHMOD "DC10" +#define CMD_LSEEK "DC11" +#define CMD_TIME "DC12" +#define CMD_STAT "DC13" +#define CMD_UTIME "DC14" +#define CMD_BAD "DC15" +#define CMD_OPENDIR "DC16" +#define CMD_CLOSEDIR "DC17" +#define CMD_READDIR "DC18" +#define CMD_CDFSREAD "DC19" +#define CMD_GDBPACKET "DC20" + +extern unsigned int syscall_retval; +extern unsigned char* syscall_data; + +typedef struct { + unsigned char id[4] __attribute__ ((packed)); + unsigned int value0 __attribute__ ((packed)); + unsigned int value1 __attribute__ ((packed)); + unsigned int value2 __attribute__ ((packed)); +} command_3int_t; + +typedef struct { + unsigned char id[4] __attribute__ ((packed)); + unsigned int value0 __attribute__ ((packed)); + unsigned int value1 __attribute__ ((packed)); + unsigned char string[1] __attribute__ ((packed)); +} command_2int_string_t; + +typedef struct { + unsigned char id[4] __attribute__ ((packed)); + unsigned int value0 __attribute__ ((packed)); +} command_int_t; + +typedef struct { + unsigned char id[4] __attribute__ ((packed)); + unsigned int value0 __attribute__ ((packed)); + unsigned char string[1] __attribute__ ((packed)); +} command_int_string_t; + +typedef struct { + unsigned char id[4] __attribute__ ((packed)); + unsigned char string[1] __attribute__ ((packed)); +} command_string_t; + +typedef struct { + unsigned char id[4] __attribute__ ((packed)); + unsigned int value0 __attribute__ ((packed)); + unsigned int value1 __attribute__ ((packed)); + unsigned int value2 __attribute__ ((packed)); + unsigned char string[1] __attribute__ ((packed)); +} command_3int_string_t; + +void build_send_packet(int command_len); + +#endif diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/video.h b/LAN/SRCS/dcload-ip/target-src/dcload/video.h new file mode 100644 index 00000000..fcddd0c0 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/video.h @@ -0,0 +1,10 @@ +#ifndef __VIDEO_H__ +#define __VIDEO_H__ + +void draw_string(int x, int y, char *string, int colour); +void clrscr(int colour); +void init_video(int cabletype, int pixelmode); +int check_cable(void); +unsigned char *get_font_address(void); + +#endif diff --git a/LAN/SRCS/dcload-ip/target-src/dcload/video.s b/LAN/SRCS/dcload-ip/target-src/dcload/video.s new file mode 100644 index 00000000..87158446 --- /dev/null +++ b/LAN/SRCS/dcload-ip/target-src/dcload/video.s @@ -0,0 +1,348 @@ + + ! Video routines from Vide example + ! + + .globl _draw_string, _clrscr, _init_video, _check_cable + .globl _get_font_address + + .text + + + ! Draw a text string on screen + ! + ! Assumes a 640*480 screen with RGB555 or RGB565 pixels + + ! r4 = x + ! r5 = y + ! r6 = string + ! r7 = colour +_draw_string: + mov.l r14,@-r15 + sts pr,r14 + mov.l r13,@-r15 + mov.l r12,@-r15 + mov.l r11,@-r15 + mov.l r10,@-r15 + mov r4,r10 + mov r5,r11 + mov r6,r12 + mov r7,r13 +ds_loop: + mov.b @r12+,r6 + mov r10,r4 + mov r11,r5 + tst r6,r6 ! string is NUL terminated + bt ds_done + extu.b r6,r6 ! undo sign-extension of char + bsr draw_char12 + mov r13,r7 + bra ds_loop + add #12,r10 +ds_done: + mov.l @r15+,r10 + mov.l @r15+,r11 + mov.l @r15+,r12 + mov.l @r15+,r13 + lds r14,pr + rts + mov.l @r15+,r14 + + + ! Draw a "narrow" character on screen + ! + ! Assumes a 640*480 screen with RGB555 or RGB565 pixels + + ! r4 = x + ! r5 = y + ! r6 = char + ! r7 = colour +draw_char12: + ! First get the address of the ROM font + sts pr,r3 + bsr _get_font_address + nop + lds r3,pr + mov r0,r2 + + ! Then, compute the destination address + shll r4 + mov r5,r0 + shll2 r0 + add r5,r0 + shll8 r0 + add r4,r0 + mov.l vrambase,r1 + add r1,r0 + + ! Find right char in font + mov #32,r1 + cmp/gt r1,r6 + bt okchar1 + ! <= 32 = space or unprintable +blank: + mov #72,r6 ! Char # 72 in font is blank + bra decided + shll2 r6 +okchar1: + mov #127,r1 + cmp/ge r1,r6 + bf/s decided ! 33-126 = ASCII, Char # 1-94 in font + add #-32,r6 + cmp/gt r1,r6 + bf blank ! 127-159 = unprintable + add #-96,r6 + cmp/gt r1,r6 + bt blank ! 256- = ? + ! 160-255 = Latin 1, char # 96-191 in font + add #64,r6 + + ! Add offset of selected char to font addr +decided: + mov r6,r1 + shll2 r1 + shll r1 + add r6,r1 + shll2 r1 + add r2,r1 + + ! Copy ROM data into cache so we can access it as bytes + ! Char data is 36 bytes, so we need to fetch two cache lines + pref @r1 + mov r1,r2 + add #32,r2 + pref @r2 + + mov #24,r2 ! char is 24 lines high +drawy: + ! Each pixel line is stored as 1½ bytes, so we'll load + ! 3 bytes into r4 and draw two lines in one go + mov.b @r1+,r4 + shll8 r4 + mov.b @r1+,r5 + extu.b r5,r5 + or r5,r4 + shll8 r4 + mov.b @r1+,r5 + extu.b r5,r5 + or r5,r4 + shll8 r4 + ! Even line + mov #12,r3 +drawx1: + rotl r4 + bf/s nopixel1 + dt r3 + mov.w r7,@r0 ! Set pixel +nopixel1: + bf/s drawx1 + add #2,r0 + mov.w drawmod,r3 + dt r2 + add r3,r0 + ! Odd line + mov #12,r3 +drawx2: + rotl r4 + bf/s nopixel2 + dt r3 + mov.w r7,@r0 ! Set pixel +nopixel2: + bf/s drawx2 + add #2,r0 + mov.w drawmod,r3 + dt r2 + bf/s drawy + add r3,r0 + + rts + nop + +drawmod: + .word 2*(640-12) + + + ! Clear screen + ! + ! Assumes a 640*480 screen with RGB555 or RGB565 pixels + + ! r4 = pixel colour +_clrscr: + mov.l vrambase,r0 + mov.l clrcount,r1 +clrloop: + mov.w r4,@r0 ! clear one pixel + dt r1 + bf/s clrloop + add #2,r0 + rts + nop + + .align 4 +vrambase: + .long 0xa5000000 +clrcount: + .long 640*480 + + + + ! Set up video registers to the desired + ! video mode (only 640*480 supported right now) + ! + ! Note: This function does not currently initialize + ! all registers, but assume that the boot ROM + ! has set up reasonable defaults for syncs etc. + ! + ! TODO: PAL + + ! r4 = cabletype (0=VGA, 2=RGB, 3=Composite) + ! r5 = pixel mode (0=RGB555, 1=RGB565, 3=RGB888) +_init_video: + ! Look up bytes per pixel as shift value + mov #3,r1 + and r5,r1 + mova bppshifttab,r0 + mov.b @(r0,r1),r5 + ! Get video HW address + mov.l videobase,r0 + mov #0,r2 + mov.l r2,@(8,r0) + add #0x40,r0 + ! Set border colour + mov #0,r2 + mov.l r2,@r0 + ! Set pixel clock and colour mode + shll2 r1 + mov #240/2,r3 ! Non-VGA screen has 240 display lines + shll r3 + mov #2,r2 + tst r2,r4 + bf/s khz15 + add #1,r1 + shll r3 ! Double # of display lines for VGA + ! Set double pixel clock + mov #1,r2 + rotr r2 + shlr8 r2 + or r2,r1 +khz15: + mov.l r1,@(4,r0) + ! Set video base address + mov #0,r1 + mov.l r1,@(0x10,r0) + ! Video base address for short fields should be offset by one line + mov #640/16,r1 + shll2 r1 + shll2 r1 + shld r5,r1 + mov.l r1,@(0x14,r0) + ! Set screen size and modulo, and interlace flag + mov.l r4,@-r15 + mov #1,r2 + shll8 r2 + mov #640/16,r1 + shll2 r1 + shld r5,r1 + mov #2,r5 + tst r5,r4 + bt/s nonlace ! VGA => no interlace + mov #1,r4 + add r1,r4 ! add one line to offset => display every other line + add #0x50,r2 ! enable LACE +nonlace: + shll8 r4 + shll2 r4 + add r3,r4 + add #-1,r4 + shll8 r4 + shll2 r4 + add r1,r4 + add #-1,r4 + mov.l r4,@(0x1c,r0) + mov.l @r15+,r4 + add #0x7c,r0 + mov.l r2,@(0x14,r0) + ! Set vertical pos and border + mov #0x12,r1 + mov r1,r2 + shll16 r1 + or r2,r1 + mov.l r1,@(0x34,r0) + add r3,r1 + mov.l r1,@(0x20,r0) + ! Horizontal pos + mov.w hpos,r1 + mov.l r1,@(0x30,r0) + + ! Select RGB/CVBS + mov.l cvbsbase,r1 + rotr r4 + bf/s rgbmode + mov #0,r0 + mov #3,r0 +rgbmode: + shll8 r0 + mov.l r0,@r1 + + rts + nop + + .align 4 +videobase: + .long 0xa05f8000 +cvbsbase: + .long 0xa0702c00 +bppshifttab: + .byte 1,1,0,2 +hpos: + .word 0xa4 + + + + ! Check type of A/V cable connected + ! + ! 0 = VGA + ! 1 = --- + ! 2 = RGB + ! 3 = Composite + +_check_cable: + ! set PORT8 and PORT9 to input + mov.l porta,r0 + mov.l pctra_clr,r2 + mov.l @r0,r1 + mov.l pctra_set,r3 + and r2,r1 + or r3,r1 + mov.l r1,@r0 + ! read PORT8 and PORT9 + mov.w @(4,r0),r0 + shlr8 r0 + rts + and #3,r0 + + .align 4 +porta: + .long 0xff80002c +pctra_clr: + .long 0xfff0ffff +pctra_set: + .long 0x000a0000 + + + ! Return base address of ROM font + ! + +_get_font_address: + mov.l syscall_b4,r0 + mov.l @r0,r0 + jmp @r0 + mov #0,r1 + + .align 4 +syscall_b4: + .long 0x8c0000b4 + + + .end + + diff --git a/MODEM/ROMS/dcload-serial-104-alcohol/SiZiOUS.txt b/MODEM/ROMS/dcload-serial-104-alcohol/SiZiOUS.txt new file mode 100644 index 00000000..6ebcfeb6 --- /dev/null +++ b/MODEM/ROMS/dcload-serial-104-alcohol/SiZiOUS.txt @@ -0,0 +1,15 @@ + [big_fury] + 888888888 8888 888888888888 8888 888888888 8888 8888 888888888 + 8888888888888 8888 888888888888 8888 8888888888888 8888 8888 8888888888888 + 8888 8888 88888 8888 8888 8888 8888 8888 8888 + 888888888 8888 888888 8888 8888 8888 8888 8888 888888888 + 8888888888 8888 88888 8888 8888 8888 8888 8888 88888888888 + 888888 8888 88888 8888 8888 8888 8888 8888 888888 + 8888 8888 8888 88888 8888 8888 8888 8888 8888 8888 8888 + 8888888888888 8888 88888888888888 8888 8888888888888 888888888888 8888888888888 + 8888888888 8888 88888888888888 8888 888888888 8888888888 8888888888 + + +This CD image of "DC-LOAD-SERIAL v1.0.4" has been created by [big_fury]SiZiOUS. + +Get DC-TOOL GUI now at http://sbibuilder.shorturl.com/ \ No newline at end of file diff --git a/MODEM/ROMS/dcload-serial-104-alcohol/dcload-serial-104-alcohol.mdf b/MODEM/ROMS/dcload-serial-104-alcohol/dcload-serial-104-alcohol.mdf new file mode 100644 index 00000000..86dae7cb Binary files /dev/null and b/MODEM/ROMS/dcload-serial-104-alcohol/dcload-serial-104-alcohol.mdf differ diff --git a/MODEM/ROMS/dcload-serial-104-alcohol/dcload-serial-104-alcohol.mds b/MODEM/ROMS/dcload-serial-104-alcohol/dcload-serial-104-alcohol.mds new file mode 100644 index 00000000..c3a611b5 Binary files /dev/null and b/MODEM/ROMS/dcload-serial-104-alcohol/dcload-serial-104-alcohol.mds differ diff --git a/MODEM/ROMS/dcload-serial-104-alcohol/readme.txt b/MODEM/ROMS/dcload-serial-104-alcohol/readme.txt new file mode 100644 index 00000000..1b165c62 --- /dev/null +++ b/MODEM/ROMS/dcload-serial-104-alcohol/readme.txt @@ -0,0 +1,94 @@ +dcload 1.0.4 - a Dreamcast serial loader by + +Features + +* Compressed binary transfers (dc-tool supports loading elf, srec, and bin) +* PC I/O (read, write, etc to PC) +* Exception handler + +Building + +1. Edit Makefile.cfg for your system, and then run make + +Installation + +1. PC - run make install (installs dc-tool) +2. DC + a. cd make-cd, edit Makefile, insert blank cd-r, run make + b. take target-src/1st_read/1st_read.bin and stuff it on a cd yourself + (please use the IP.BIN from the make-cd directory if you are going + to distribute either cds or cd images) + +Testing + +1. cd example-src +2. dc-tool -x console-test.bin (tests some PC I/O) + (or dc-tool -x console-test, now that dc-tool can load ELF) +3. dc-tool -x exception-test.bin (generates an exception) + (or dc-tool -x exception-test, now that dc-tool can load ELF) + +KOS GDB-over-dcload + +To run a GNU debugger session over the dcload connection: + +1. Build/obtain an sh-elf targetted GNU debugger +2. Put a 'gdb_init()' call somewhere in the startup area of your + KOS-based program +3. Build your program with the '-g' GCC switch to include debugging info +4. Launch your program using 'dc-tool -g -x ' +5. Launch sh-elf-gdb and connect to the dc-tool using 'target remote :2159' +6. Squash bugs + +Notes + +* dcload and dc-tool (both IP and serial) are now maintained by the KOS + team. Please join the KallistiOS list for help with these tools. + http://sf.net/projects/cadcdev/ +* Now compiles with gcc-3.4.1, Binutils-2.15, newlib-1.12.0 +* Tested systems: Debian GNU/Linux 2.2; Gentoo/Linux 2.6.7; Cygwin; + Mac OSX 10.3.5 (Panther) +* 1.56M and 500K baud now supported with the FTDI USB-Serial driver. + note: currently works with FT232BM USB-Serial UART running at 6.144Mhz. + e.g.: + linux: dc-tool -t /dev/usb/tts/0 -b 1500000 -x + Cygwin: dc-tool -t COM4 -b 500000 -x +* As of 1.0.4, little-endian byte order is enforced in the host so dc-tool + should now run on big-endian systems like a Mac. +* As of 1.0.4, Changed cdrecord option -xa1 to -xa: i've made one too many + softdrink coasters since the authors of this tool changed the meaning of + that option. +* 115200 works fine for me. Apparently it doesn't for some people. +* As of 1.0.3, serial speed is changed at runtime rather than compile time. +* There is now a -e option that will enable an alternate 115200 (which + doesn't work for me). If it works for you, please email + andrewk@napalm-x.com, especially if it works better than the default 115200. +* Patches and improvements are welcome. + +Mac OSX Notes + +* This was tested on Panther 10.3.5 only. It may or may not work on any other + version of OSX. YMMV. +* Of course some sort of USB serial must be used. Standard RS232 adapters + work as does Axlen's USB coders' cable. +* OSX does *not* support non-standard baud rates, so speeds higher + than 115200 currently do not work. This is due to a limitation in the + IOSerialFamily kernel module so it can not be easily worked around at + this time. +* Compilation on OSX requires libintl, which must be installed with Fink + using the 'gettext' package. (Using 'fink' or 'apt-get' is fine). + http://fink.sf.net/ +* You may see duplicate symbol warnings at compile time, like _strncpy + in libiberty.dylib. You can safely ignore these. + +Credits + +* Minilzo was written by Markus Oberhumer +* There are some various files from newlib-1.8.2 here, and video.s was written + by Marcus Comstedt. +* win32 porting and implementation of -t by Florian 'Proff' Schulze +* bugfix and implementation of -b by The Gypsy +* fixes for cygwin by Florian 'Proff' Schulze +* Minor initialization fix in dcload for gcc-3.4.x. Serial protocol endian + fixes - Paul Boese a.k.a. Axlen +* Fixes for Mac OSX (and testing) by Dan Potter +* Fixes for libbfd segfaults by Atani diff --git a/MODEM/ROMS/dcload-serial-104-alcohol/version.txt b/MODEM/ROMS/dcload-serial-104-alcohol/version.txt new file mode 100644 index 00000000..14b5692f --- /dev/null +++ b/MODEM/ROMS/dcload-serial-104-alcohol/version.txt @@ -0,0 +1,6 @@ +iv compiled a cvs build of dctool and dcload as of todays 11/17/2005 with gcc 3.0.4 +since thats the last version that iv seen that has libbfd installed. + +http://www.dcemu.co.uk/vbulletin/showthread.php?t=14020 + +GPF \ No newline at end of file diff --git a/MODEM/ROMS/dcload-serial-104-dj4/SiZiOUS.txt b/MODEM/ROMS/dcload-serial-104-dj4/SiZiOUS.txt new file mode 100644 index 00000000..6ebcfeb6 --- /dev/null +++ b/MODEM/ROMS/dcload-serial-104-dj4/SiZiOUS.txt @@ -0,0 +1,15 @@ + [big_fury] + 888888888 8888 888888888888 8888 888888888 8888 8888 888888888 + 8888888888888 8888 888888888888 8888 8888888888888 8888 8888 8888888888888 + 8888 8888 88888 8888 8888 8888 8888 8888 8888 + 888888888 8888 888888 8888 8888 8888 8888 8888 888888888 + 8888888888 8888 88888 8888 8888 8888 8888 8888 88888888888 + 888888 8888 88888 8888 8888 8888 8888 8888 888888 + 8888 8888 8888 88888 8888 8888 8888 8888 8888 8888 8888 + 8888888888888 8888 88888888888888 8888 8888888888888 888888888888 8888888888888 + 8888888888 8888 88888888888888 8888 888888888 8888888888 8888888888 + + +This CD image of "DC-LOAD-SERIAL v1.0.4" has been created by [big_fury]SiZiOUS. + +Get DC-TOOL GUI now at http://sbibuilder.shorturl.com/ \ No newline at end of file diff --git a/MODEM/ROMS/dcload-serial-104-dj4/dcload-serial-104-dj4.cdi b/MODEM/ROMS/dcload-serial-104-dj4/dcload-serial-104-dj4.cdi new file mode 100644 index 00000000..2c16b090 Binary files /dev/null and b/MODEM/ROMS/dcload-serial-104-dj4/dcload-serial-104-dj4.cdi differ diff --git a/MODEM/ROMS/dcload-serial-104-dj4/readme.txt b/MODEM/ROMS/dcload-serial-104-dj4/readme.txt new file mode 100644 index 00000000..1b165c62 --- /dev/null +++ b/MODEM/ROMS/dcload-serial-104-dj4/readme.txt @@ -0,0 +1,94 @@ +dcload 1.0.4 - a Dreamcast serial loader by + +Features + +* Compressed binary transfers (dc-tool supports loading elf, srec, and bin) +* PC I/O (read, write, etc to PC) +* Exception handler + +Building + +1. Edit Makefile.cfg for your system, and then run make + +Installation + +1. PC - run make install (installs dc-tool) +2. DC + a. cd make-cd, edit Makefile, insert blank cd-r, run make + b. take target-src/1st_read/1st_read.bin and stuff it on a cd yourself + (please use the IP.BIN from the make-cd directory if you are going + to distribute either cds or cd images) + +Testing + +1. cd example-src +2. dc-tool -x console-test.bin (tests some PC I/O) + (or dc-tool -x console-test, now that dc-tool can load ELF) +3. dc-tool -x exception-test.bin (generates an exception) + (or dc-tool -x exception-test, now that dc-tool can load ELF) + +KOS GDB-over-dcload + +To run a GNU debugger session over the dcload connection: + +1. Build/obtain an sh-elf targetted GNU debugger +2. Put a 'gdb_init()' call somewhere in the startup area of your + KOS-based program +3. Build your program with the '-g' GCC switch to include debugging info +4. Launch your program using 'dc-tool -g -x ' +5. Launch sh-elf-gdb and connect to the dc-tool using 'target remote :2159' +6. Squash bugs + +Notes + +* dcload and dc-tool (both IP and serial) are now maintained by the KOS + team. Please join the KallistiOS list for help with these tools. + http://sf.net/projects/cadcdev/ +* Now compiles with gcc-3.4.1, Binutils-2.15, newlib-1.12.0 +* Tested systems: Debian GNU/Linux 2.2; Gentoo/Linux 2.6.7; Cygwin; + Mac OSX 10.3.5 (Panther) +* 1.56M and 500K baud now supported with the FTDI USB-Serial driver. + note: currently works with FT232BM USB-Serial UART running at 6.144Mhz. + e.g.: + linux: dc-tool -t /dev/usb/tts/0 -b 1500000 -x + Cygwin: dc-tool -t COM4 -b 500000 -x +* As of 1.0.4, little-endian byte order is enforced in the host so dc-tool + should now run on big-endian systems like a Mac. +* As of 1.0.4, Changed cdrecord option -xa1 to -xa: i've made one too many + softdrink coasters since the authors of this tool changed the meaning of + that option. +* 115200 works fine for me. Apparently it doesn't for some people. +* As of 1.0.3, serial speed is changed at runtime rather than compile time. +* There is now a -e option that will enable an alternate 115200 (which + doesn't work for me). If it works for you, please email + andrewk@napalm-x.com, especially if it works better than the default 115200. +* Patches and improvements are welcome. + +Mac OSX Notes + +* This was tested on Panther 10.3.5 only. It may or may not work on any other + version of OSX. YMMV. +* Of course some sort of USB serial must be used. Standard RS232 adapters + work as does Axlen's USB coders' cable. +* OSX does *not* support non-standard baud rates, so speeds higher + than 115200 currently do not work. This is due to a limitation in the + IOSerialFamily kernel module so it can not be easily worked around at + this time. +* Compilation on OSX requires libintl, which must be installed with Fink + using the 'gettext' package. (Using 'fink' or 'apt-get' is fine). + http://fink.sf.net/ +* You may see duplicate symbol warnings at compile time, like _strncpy + in libiberty.dylib. You can safely ignore these. + +Credits + +* Minilzo was written by Markus Oberhumer +* There are some various files from newlib-1.8.2 here, and video.s was written + by Marcus Comstedt. +* win32 porting and implementation of -t by Florian 'Proff' Schulze +* bugfix and implementation of -b by The Gypsy +* fixes for cygwin by Florian 'Proff' Schulze +* Minor initialization fix in dcload for gcc-3.4.x. Serial protocol endian + fixes - Paul Boese a.k.a. Axlen +* Fixes for Mac OSX (and testing) by Dan Potter +* Fixes for libbfd segfaults by Atani diff --git a/MODEM/ROMS/dcload-serial-104-dj4/version.txt b/MODEM/ROMS/dcload-serial-104-dj4/version.txt new file mode 100644 index 00000000..14b5692f --- /dev/null +++ b/MODEM/ROMS/dcload-serial-104-dj4/version.txt @@ -0,0 +1,6 @@ +iv compiled a cvs build of dctool and dcload as of todays 11/17/2005 with gcc 3.0.4 +since thats the last version that iv seen that has libbfd installed. + +http://www.dcemu.co.uk/vbulletin/showthread.php?t=14020 + +GPF \ No newline at end of file diff --git a/MODEM/ROMS/dcload-serial-104-nero6/SiZiOUS.txt b/MODEM/ROMS/dcload-serial-104-nero6/SiZiOUS.txt new file mode 100644 index 00000000..6ebcfeb6 --- /dev/null +++ b/MODEM/ROMS/dcload-serial-104-nero6/SiZiOUS.txt @@ -0,0 +1,15 @@ + [big_fury] + 888888888 8888 888888888888 8888 888888888 8888 8888 888888888 + 8888888888888 8888 888888888888 8888 8888888888888 8888 8888 8888888888888 + 8888 8888 88888 8888 8888 8888 8888 8888 8888 + 888888888 8888 888888 8888 8888 8888 8888 8888 888888888 + 8888888888 8888 88888 8888 8888 8888 8888 8888 88888888888 + 888888 8888 88888 8888 8888 8888 8888 8888 888888 + 8888 8888 8888 88888 8888 8888 8888 8888 8888 8888 8888 + 8888888888888 8888 88888888888888 8888 8888888888888 888888888888 8888888888888 + 8888888888 8888 88888888888888 8888 888888888 8888888888 8888888888 + + +This CD image of "DC-LOAD-SERIAL v1.0.4" has been created by [big_fury]SiZiOUS. + +Get DC-TOOL GUI now at http://sbibuilder.shorturl.com/ \ No newline at end of file diff --git a/MODEM/ROMS/dcload-serial-104-nero6/dcload-serial-104-nero6.nrg b/MODEM/ROMS/dcload-serial-104-nero6/dcload-serial-104-nero6.nrg new file mode 100644 index 00000000..225513c5 Binary files /dev/null and b/MODEM/ROMS/dcload-serial-104-nero6/dcload-serial-104-nero6.nrg differ diff --git a/MODEM/ROMS/dcload-serial-104-nero6/readme.txt b/MODEM/ROMS/dcload-serial-104-nero6/readme.txt new file mode 100644 index 00000000..1b165c62 --- /dev/null +++ b/MODEM/ROMS/dcload-serial-104-nero6/readme.txt @@ -0,0 +1,94 @@ +dcload 1.0.4 - a Dreamcast serial loader by + +Features + +* Compressed binary transfers (dc-tool supports loading elf, srec, and bin) +* PC I/O (read, write, etc to PC) +* Exception handler + +Building + +1. Edit Makefile.cfg for your system, and then run make + +Installation + +1. PC - run make install (installs dc-tool) +2. DC + a. cd make-cd, edit Makefile, insert blank cd-r, run make + b. take target-src/1st_read/1st_read.bin and stuff it on a cd yourself + (please use the IP.BIN from the make-cd directory if you are going + to distribute either cds or cd images) + +Testing + +1. cd example-src +2. dc-tool -x console-test.bin (tests some PC I/O) + (or dc-tool -x console-test, now that dc-tool can load ELF) +3. dc-tool -x exception-test.bin (generates an exception) + (or dc-tool -x exception-test, now that dc-tool can load ELF) + +KOS GDB-over-dcload + +To run a GNU debugger session over the dcload connection: + +1. Build/obtain an sh-elf targetted GNU debugger +2. Put a 'gdb_init()' call somewhere in the startup area of your + KOS-based program +3. Build your program with the '-g' GCC switch to include debugging info +4. Launch your program using 'dc-tool -g -x ' +5. Launch sh-elf-gdb and connect to the dc-tool using 'target remote :2159' +6. Squash bugs + +Notes + +* dcload and dc-tool (both IP and serial) are now maintained by the KOS + team. Please join the KallistiOS list for help with these tools. + http://sf.net/projects/cadcdev/ +* Now compiles with gcc-3.4.1, Binutils-2.15, newlib-1.12.0 +* Tested systems: Debian GNU/Linux 2.2; Gentoo/Linux 2.6.7; Cygwin; + Mac OSX 10.3.5 (Panther) +* 1.56M and 500K baud now supported with the FTDI USB-Serial driver. + note: currently works with FT232BM USB-Serial UART running at 6.144Mhz. + e.g.: + linux: dc-tool -t /dev/usb/tts/0 -b 1500000 -x + Cygwin: dc-tool -t COM4 -b 500000 -x +* As of 1.0.4, little-endian byte order is enforced in the host so dc-tool + should now run on big-endian systems like a Mac. +* As of 1.0.4, Changed cdrecord option -xa1 to -xa: i've made one too many + softdrink coasters since the authors of this tool changed the meaning of + that option. +* 115200 works fine for me. Apparently it doesn't for some people. +* As of 1.0.3, serial speed is changed at runtime rather than compile time. +* There is now a -e option that will enable an alternate 115200 (which + doesn't work for me). If it works for you, please email + andrewk@napalm-x.com, especially if it works better than the default 115200. +* Patches and improvements are welcome. + +Mac OSX Notes + +* This was tested on Panther 10.3.5 only. It may or may not work on any other + version of OSX. YMMV. +* Of course some sort of USB serial must be used. Standard RS232 adapters + work as does Axlen's USB coders' cable. +* OSX does *not* support non-standard baud rates, so speeds higher + than 115200 currently do not work. This is due to a limitation in the + IOSerialFamily kernel module so it can not be easily worked around at + this time. +* Compilation on OSX requires libintl, which must be installed with Fink + using the 'gettext' package. (Using 'fink' or 'apt-get' is fine). + http://fink.sf.net/ +* You may see duplicate symbol warnings at compile time, like _strncpy + in libiberty.dylib. You can safely ignore these. + +Credits + +* Minilzo was written by Markus Oberhumer +* There are some various files from newlib-1.8.2 here, and video.s was written + by Marcus Comstedt. +* win32 porting and implementation of -t by Florian 'Proff' Schulze +* bugfix and implementation of -b by The Gypsy +* fixes for cygwin by Florian 'Proff' Schulze +* Minor initialization fix in dcload for gcc-3.4.x. Serial protocol endian + fixes - Paul Boese a.k.a. Axlen +* Fixes for Mac OSX (and testing) by Dan Potter +* Fixes for libbfd segfaults by Atani diff --git a/MODEM/ROMS/dcload-serial-104-nero6/version.txt b/MODEM/ROMS/dcload-serial-104-nero6/version.txt new file mode 100644 index 00000000..14b5692f --- /dev/null +++ b/MODEM/ROMS/dcload-serial-104-nero6/version.txt @@ -0,0 +1,6 @@ +iv compiled a cvs build of dctool and dcload as of todays 11/17/2005 with gcc 3.0.4 +since thats the last version that iv seen that has libbfd installed. + +http://www.dcemu.co.uk/vbulletin/showthread.php?t=14020 + +GPF \ No newline at end of file diff --git a/MODEM/ROMS/dcloadserial104/1st_read.bin b/MODEM/ROMS/dcloadserial104/1st_read.bin new file mode 100644 index 00000000..e7a75912 Binary files /dev/null and b/MODEM/ROMS/dcloadserial104/1st_read.bin differ diff --git a/MODEM/ROMS/dcloadserial104/IP.BIN b/MODEM/ROMS/dcloadserial104/IP.BIN new file mode 100644 index 00000000..dc824048 Binary files /dev/null and b/MODEM/ROMS/dcloadserial104/IP.BIN differ diff --git a/MODEM/ROMS/dcloadserial104/dc-tool.exe b/MODEM/ROMS/dcloadserial104/dc-tool.exe new file mode 100644 index 00000000..e416ae97 Binary files /dev/null and b/MODEM/ROMS/dcloadserial104/dc-tool.exe differ diff --git a/MODEM/SRCS/dcload-serial/CHANGES b/MODEM/SRCS/dcload-serial/CHANGES new file mode 100644 index 00000000..73802ce8 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/CHANGES @@ -0,0 +1,56 @@ +WHATS NEW IN 1.0.4 + +* added 500000 and 1500000 baud for linux systems using ftdi ft232bm + (6.144mhz crystal) based usb-serial coders cables. under ms windows/cygwin + with the appropriate virtual comport drivers (vcp) + http://www.ftdichip.com/ftdriver.htm + a typical dc-tool command line under *nix might look + like this: (In this case under a linux 2.6 kernel) + dc-tool -t /dev/usb/tts/0 -b 1500000 -x + the usb device under linux seems to vary by version and distribution so + you will have to experiment and watch the system log files if you use a + usb-serial codes cable. +* serial protocol for uints now forces little-endian byte order. dc-tool + should work on a Mac now. +* increased the compression buffer size in dc-tool from 8k to 16k - ideally + I'd like to use a 64k buffer, but dcload does not have enough room for a + larger decompression buffer - this helps to increase throughput at the + higher bauds using a usb-serial based coders cable. +* added a time-to-transfer status line to dc-tool - e.g.: + 5.73 seconds to transfer 703023 bytes +* now compiles under current dc toolchain: gcc-3.4.1, binutils-2.15, + newlib-1.12.0 +* no need to burn a new dcload-serial boot cd. this version of dc-tool is + compatible with dcload 1.0.3 + +WHATS NEW IN 1.0.3 + +* proper baudrate changing - dcload and dc-tool should always be compiled + for 57600 now; use the -b option to switch to 115200 at runtime. +* experimental alternate 115200 setting - doesn't work for me, so please email + andrewk@napalm-x.com if it works for you (especially if it works better than + the default 115200). +* added O_BINARY to all open()s in dc-tool to help cygwin users +* included same IP.BIN (with logo/disclaimer) as found in dcload-ip. Please + use it if you distribute either cds or cd images. + +WHATS NEW IN 1.0.2 + +* dc-tool supports loading elf and srec (in addition to raw bin) + +WHATS NEW IN 1.0.1 + +* minor cleanup / bugfix + +* new disclaimer screen (in target-src/1st_read) + +WHATS NEW IN 1.0.0 + +* opendir(), closedir(), readdir() syscalls added + +* lame cdfs redirection (-i option to dc-tool) added + +* -t option to dc-tool added by Florian 'Proff' Schulze + +* -b option to dc-tool added by The Gypsy + diff --git a/MODEM/SRCS/dcload-serial/COPYING b/MODEM/SRCS/dcload-serial/COPYING new file mode 100644 index 00000000..d60c31a9 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/MODEM/SRCS/dcload-serial/Makefile b/MODEM/SRCS/dcload-serial/Makefile new file mode 100644 index 00000000..9466fd74 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/Makefile @@ -0,0 +1,32 @@ +include Makefile.cfg + +SUBDIRS = host-src target-src example-src +MAKE = make + +all: subdirs + +.PHONY : subdirs $(SUBDIRS) + +subdirs: $(SUBDIRS) + +$(SUBDIRS): + $(MAKE) -C $@ + +target-src: host-src + +.PHONY : install +install: + $(MAKE) -C host-src/tool install + +.PHONY : clean +clean: + for dir in $(SUBDIRS); do \ + $(MAKE) -C $$dir clean; \ + done + +.PHONY : distclean +distclean: + for dir in $(SUBDIRS) ; do \ + $(MAKE) -C $$dir distclean; \ + done + diff --git a/MODEM/SRCS/dcload-serial/Makefile.cfg b/MODEM/SRCS/dcload-serial/Makefile.cfg new file mode 100644 index 00000000..c8d41207 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/Makefile.cfg @@ -0,0 +1,61 @@ +# host compiler and flags +HOSTCC = gcc +#HOSTCFLAGS = -O2 # -Wall +# cygwin probably needs this +HOSTCFLAGS = -O2 -D_WIN32 + +# dc compiler prefix -- this is usually what you used for --prefix when +# building your compiler. +TARGETPREFIX = /usr/local/dc/sh-elf + +# you may have to change the paths for BFDLIB and BFDINCLUDE to +# the correct ones for your system + +# these must point to your sh-elf bfd, not the system one +BFDLIB = -L$(TARGETPREFIX)/lib -lbfd -liberty -lintl +BFDINCLUDE = $(TARGETPREFIX)/include + +# mac osx +# these must point to your sh-elf bfd, not the system one +# -lintl requires the 'gettext' package to be installed via fink +#BFDLIB = -L$(TARGETPREFIX)/lib -L/sw/lib -lbfd -liberty -lintl +#BFDINCLUDE = $(TARGETPREFIX)/include + +# cygwin +# these must point to your sh-elf bfd, not the system one +#BFDLIB = -L$(TARGETPREFIX)/lib -lbfd -liberty -lintl +#BFDINCLUDE = $(TARGETPREFIX)/include + +# sh-elf-stuff +# if your compiler doesn't have a -m2 target, you can probably replace +# it with -m4-single-only and be ok, but -m2 is less problematic. +#TARGETCC = sh-elf-gcc +#TARGETCFLAGS = -O2 -ml -m4-single-only +#TARGETOBJCOPY = sh-elf-objcopy -R .stack +#TARGETLD = sh-elf-ld +TARGETCC = $(TARGETPREFIX)/bin/sh-elf-gcc +TARGETCFLAGS = -O2 -ml -m4-single-only +TARGETOBJCOPY = $(TARGETPREFIX)/bin/sh-elf-objcopy -R .stack +TARGETLD = $(TARGETPREFIX)/bin/sh-elf-ld + +# this is the default port for dc-tool, it can be changed on the commandline +#SERIALDEVICE = /dev/ttyS0 + +# mac osx -- you'll need to go look in /dev to see what the actual device +# name is, and depending on the device, it must be plugged into the same +# port each time. +#SERIALDEVICE = /dev/cu.usbserial-5B24 + +# cygwin +SERIALDEVICE = COM1 + +# dir to install dc-tool in +TOOLINSTALLDIR = /usr/local/dc/dcload + +# uncomment this for cygwin +EXECUTABLEEXTENSION = .exe + + +# default serial speed - YOU DO NOT NEED TO CHANGE THIS +SERIALSPEED = 57600 + diff --git a/MODEM/SRCS/dcload-serial/README b/MODEM/SRCS/dcload-serial/README new file mode 100644 index 00000000..1b165c62 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/README @@ -0,0 +1,94 @@ +dcload 1.0.4 - a Dreamcast serial loader by + +Features + +* Compressed binary transfers (dc-tool supports loading elf, srec, and bin) +* PC I/O (read, write, etc to PC) +* Exception handler + +Building + +1. Edit Makefile.cfg for your system, and then run make + +Installation + +1. PC - run make install (installs dc-tool) +2. DC + a. cd make-cd, edit Makefile, insert blank cd-r, run make + b. take target-src/1st_read/1st_read.bin and stuff it on a cd yourself + (please use the IP.BIN from the make-cd directory if you are going + to distribute either cds or cd images) + +Testing + +1. cd example-src +2. dc-tool -x console-test.bin (tests some PC I/O) + (or dc-tool -x console-test, now that dc-tool can load ELF) +3. dc-tool -x exception-test.bin (generates an exception) + (or dc-tool -x exception-test, now that dc-tool can load ELF) + +KOS GDB-over-dcload + +To run a GNU debugger session over the dcload connection: + +1. Build/obtain an sh-elf targetted GNU debugger +2. Put a 'gdb_init()' call somewhere in the startup area of your + KOS-based program +3. Build your program with the '-g' GCC switch to include debugging info +4. Launch your program using 'dc-tool -g -x ' +5. Launch sh-elf-gdb and connect to the dc-tool using 'target remote :2159' +6. Squash bugs + +Notes + +* dcload and dc-tool (both IP and serial) are now maintained by the KOS + team. Please join the KallistiOS list for help with these tools. + http://sf.net/projects/cadcdev/ +* Now compiles with gcc-3.4.1, Binutils-2.15, newlib-1.12.0 +* Tested systems: Debian GNU/Linux 2.2; Gentoo/Linux 2.6.7; Cygwin; + Mac OSX 10.3.5 (Panther) +* 1.56M and 500K baud now supported with the FTDI USB-Serial driver. + note: currently works with FT232BM USB-Serial UART running at 6.144Mhz. + e.g.: + linux: dc-tool -t /dev/usb/tts/0 -b 1500000 -x + Cygwin: dc-tool -t COM4 -b 500000 -x +* As of 1.0.4, little-endian byte order is enforced in the host so dc-tool + should now run on big-endian systems like a Mac. +* As of 1.0.4, Changed cdrecord option -xa1 to -xa: i've made one too many + softdrink coasters since the authors of this tool changed the meaning of + that option. +* 115200 works fine for me. Apparently it doesn't for some people. +* As of 1.0.3, serial speed is changed at runtime rather than compile time. +* There is now a -e option that will enable an alternate 115200 (which + doesn't work for me). If it works for you, please email + andrewk@napalm-x.com, especially if it works better than the default 115200. +* Patches and improvements are welcome. + +Mac OSX Notes + +* This was tested on Panther 10.3.5 only. It may or may not work on any other + version of OSX. YMMV. +* Of course some sort of USB serial must be used. Standard RS232 adapters + work as does Axlen's USB coders' cable. +* OSX does *not* support non-standard baud rates, so speeds higher + than 115200 currently do not work. This is due to a limitation in the + IOSerialFamily kernel module so it can not be easily worked around at + this time. +* Compilation on OSX requires libintl, which must be installed with Fink + using the 'gettext' package. (Using 'fink' or 'apt-get' is fine). + http://fink.sf.net/ +* You may see duplicate symbol warnings at compile time, like _strncpy + in libiberty.dylib. You can safely ignore these. + +Credits + +* Minilzo was written by Markus Oberhumer +* There are some various files from newlib-1.8.2 here, and video.s was written + by Marcus Comstedt. +* win32 porting and implementation of -t by Florian 'Proff' Schulze +* bugfix and implementation of -b by The Gypsy +* fixes for cygwin by Florian 'Proff' Schulze +* Minor initialization fix in dcload for gcc-3.4.x. Serial protocol endian + fixes - Paul Boese a.k.a. Axlen +* Fixes for Mac OSX (and testing) by Dan Potter +* Fixes for libbfd segfaults by Atani diff --git a/MODEM/SRCS/dcload-serial/example-src/Makefile b/MODEM/SRCS/dcload-serial/example-src/Makefile new file mode 100644 index 00000000..81681b37 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/example-src/Makefile @@ -0,0 +1,39 @@ +include ../Makefile.cfg + +CC = $(TARGETCC) +INCLUDE = -I../target-inc +CFLAGS = $(TARGETCFLAGS) +OBJCOPY = $(TARGETOBJCOPY) + +OBJECTS = crt0.o dcload-syscall.o dcload-syscalls.o + +.c.o: + $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $< + +.S.o: + $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $< + +.s.o: + $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $< + +all: console-test.bin exception-test.bin + +console-test.bin: console-test + $(OBJCOPY) -O binary $< $@ + +exception-test.bin: exception-test + $(OBJCOPY) -O binary $< $@ + +console-test: $(OBJECTS) console-test.o + $(CC) $(CFLAGS) -Wl,-Tdc.x -nostartfiles -nostdlib $^ -o $@ -lgcc + +exception-test: $(OBJECTS) exception-test.o + $(CC) $(CFLAGS) -Wl,-Tdc.x -nostartfiles -nostdlib $^ -o $@ -lgcc + +.PHONY : clean +clean: + rm -f *.o console-test exception-test + +.PHONY : distclean +distclean: clean + rm -f *.bin diff --git a/MODEM/SRCS/dcload-serial/example-src/README b/MODEM/SRCS/dcload-serial/example-src/README new file mode 100644 index 00000000..b8011eab --- /dev/null +++ b/MODEM/SRCS/dcload-serial/example-src/README @@ -0,0 +1,11 @@ +crt0.S a version of crt0.S +dc.x a linker script for the Dreamcast +dcload-syscall.S assembly to call a dcload syscall +dcload-syscall.h lowlevel dcload syscall header +dcload-syscalls.c dcload syscall c source +dcload-syscalls.h dcload syscall header + +To use this stuff in your own code, #include "dcload-syscalls.h" and link with dcload-syscalls.o and dcload-syscall.o. + +You're welcome to use any of the code in this directory in any way you please. +I'm not responsible if it causes you to fart fire, grow a third eye, etc, etc. diff --git a/MODEM/SRCS/dcload-serial/example-src/console-test b/MODEM/SRCS/dcload-serial/example-src/console-test new file mode 100644 index 00000000..78c47cd4 Binary files /dev/null and b/MODEM/SRCS/dcload-serial/example-src/console-test differ diff --git a/MODEM/SRCS/dcload-serial/example-src/console-test.c b/MODEM/SRCS/dcload-serial/example-src/console-test.c new file mode 100644 index 00000000..3a71e725 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/example-src/console-test.c @@ -0,0 +1,36 @@ +#include "dcload-syscalls.h" + +int main(void) +{ + int fd; + unsigned char buffer[2048]; + int count; + unsigned char wrkmem[65536]; + + assign_wrkmem(wrkmem); + + write(1, "dcload console test program\n\n", 30); + + fd = open("console-test.c", O_RDONLY); + + if (fd == -1) { + write(1, "open failed!\n", 14); + exit(1); + } + + write(1, "Contents of console-test.c:\n\n", 30); + + count = read(fd, buffer, 2048); + + if (count == -1) { + write(1, "read failed!\n", 14); + exit(1); + } + + write(1, buffer, count); + + close(fd); + + exit(0); +} + diff --git a/MODEM/SRCS/dcload-serial/example-src/crt0.S b/MODEM/SRCS/dcload-serial/example-src/crt0.S new file mode 100644 index 00000000..c4ff866d --- /dev/null +++ b/MODEM/SRCS/dcload-serial/example-src/crt0.S @@ -0,0 +1,119 @@ + .section .text + .global start + .global ___exit + .global _atexit +start: + mov.l setup_cache_k,r0 + mov.l p2_mask,r1 + or r1,r0 + jmp @r0 + nop +setup_cache: + mov.l ccr_addr,r0 + mov.w ccr_data,r1 + mov.l r1,@r0 + mov.l start_2_k,r0 + nop + nop + nop + nop + nop + nop + nop + jmp @r0 + nop +start_2: + mov.l old_stack_k,r14 + mov.l r15,@r14 + mov.l old_pr_k,r14 + sts pr,r15 + mov.l r15,@r14 + mov.l stack_k,r15 + + ! zero out bss + mov.l edata_k,r0 + mov.l end_k,r1 + mov #0,r2 +start_l: + mov.l r2,@r0 + add #4,r0 + cmp/ge r0,r1 + bt start_l + +#if defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY) + mov.l set_fpscr_k, r1 + jsr @r1 + mov #0,r4 + lds r3,fpscr +#endif /* defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__) */ + + ! call the mainline + mov.l main_k,r0 + jsr @r0 + or r0,r0 + + ! call exit + mov r0,r4 + mov.l exit_k,r0 + jsr @r0 + or r0,r0 + +___exit: + mov.l old_pr_k,r14 + mov.l @r14,r15 + lds r15,pr + mov.l old_stack_k,r14 + mov.l @r14,r15 + rts + nop + +_atexit: + rts + nop + + .align 4 +#if defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__) +set_fpscr_k: + .long ___set_fpscr +#endif /* defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(SH4_SINGLE_ONLY) */ +stack_k: + .long _stack +edata_k: + .long _edata +end_k: + .long _end +main_k: + .long _main +exit_k: + .long _exit + +old_stack_k: + .long _old_stack +old_pr_k: + .long _old_pr + +_old_stack: + .long 0 +_old_pr: + .long 0 + +setup_cache_k: + .long setup_cache +start_2_k: + .long start_2 +p2_mask: + .long 0xa0000000 +ccr_addr: + .long 0xff00001c +ccr_data: + .word 0x090b + + .align 4 + +#ifdef __ELF__ + .section .stack,"aw" +#else + .section .stack +#endif +! _stack: .long 0xdeaddead + diff --git a/MODEM/SRCS/dcload-serial/example-src/dc.x b/MODEM/SRCS/dcload-serial/example-src/dc.x new file mode 100644 index 00000000..5ea23dcb --- /dev/null +++ b/MODEM/SRCS/dcload-serial/example-src/dc.x @@ -0,0 +1,228 @@ +/* Sega Dreamcast linker script */ + +OUTPUT_FORMAT("elf32-shl", "elf32-shl", + "elf32-shl") +OUTPUT_ARCH(sh) +ENTRY(start) + SEARCH_DIR(/usr/local/dcdev/sh-elf/lib); +/* Do we need any of these for elf? + __DYNAMIC = 0; */ + +MEMORY +{ + ram (rwx) : ORIGIN = 0x8c010000, LENGTH = 0xfe0000 +} + +SECTIONS +{ + /* Read-only sections, merged into text segment: */ +/* . = 0x1000;*/ + .interp : { *(.interp) } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .gnu.version : { *(.gnu.version) } + .gnu.version_d : { *(.gnu.version_d) } + .gnu.version_r : { *(.gnu.version_r) } + .rel.init : { *(.rel.init) } + .rela.init : { *(.rela.init) } + .rel.text : + { + *(.rel.text) + *(.rel.text.*) + *(.rel.gnu.linkonce.t*) + } + .rela.text : + { + *(.rela.text) + *(.rela.text.*) + *(.rela.gnu.linkonce.t*) + } + .rel.fini : { *(.rel.fini) } + .rela.fini : { *(.rela.fini) } + .rel.rodata : + { + *(.rel.rodata) + *(.rel.rodata.*) + *(.rel.gnu.linkonce.r*) + } + .rela.rodata : + { + *(.rela.rodata) + *(.rela.rodata.*) + *(.rela.gnu.linkonce.r*) + } + .rel.data : + { + *(.rel.data) + *(.rel.data.*) + *(.rel.gnu.linkonce.d*) + } + .rela.data : + { + *(.rela.data) + *(.rela.data.*) + *(.rela.gnu.linkonce.d*) + } + .rel.ctors : { *(.rel.ctors) } + .rela.ctors : { *(.rela.ctors) } + .rel.dtors : { *(.rel.dtors) } + .rela.dtors : { *(.rela.dtors) } + .rel.got : { *(.rel.got) } + .rela.got : { *(.rela.got) } + .rel.sdata : + { + *(.rel.sdata) + *(.rel.sdata.*) + *(.rel.gnu.linkonce.s*) + } + .rela.sdata : + { + *(.rela.sdata) + *(.rela.sdata.*) + *(.rela.gnu.linkonce.s*) + } + .rel.sbss : { *(.rel.sbss) } + .rela.sbss : { *(.rela.sbss) } + .rel.bss : { *(.rel.bss) } + .rela.bss : { *(.rela.bss) } + .rel.plt : { *(.rel.plt) } + .rela.plt : { *(.rela.plt) } + .init : + { + KEEP (*(.init)) + } =0 + .plt : { *(.plt) } + .text : + { + *(.text) + *(.text.*) + *(.stub) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + *(.gnu.linkonce.t*) + } =0 + _etext = .; + PROVIDE (etext = .); + .fini : + { + KEEP (*(.fini)) + } =0 + .rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) } + .rodata1 : { *(.rodata1) } + /* Adjust the address for the data segment. We want to adjust up to + the same address within the page on the next page up. */ + . = ALIGN(128) + (. & (128 - 1)); + .data : + { + *(.data) + *(.data.*) + *(.gnu.linkonce.d*) + SORT(CONSTRUCTORS) + } + .data1 : { *(.data1) } + .eh_frame : { *(.eh_frame) } + .gcc_except_table : { *(.gcc_except_table) } + .ctors ALIGN(4): + { + ___ctors = .; + /* gcc uses crtbegin.o to find the start of + the constructors, so we make sure it is + first. Because this is a wildcard, it + doesn't matter if the user does not + actually link against crtbegin.o; the + linker won't look for a file to match a + wildcard. The wildcard also means that it + doesn't matter which directory crtbegin.o + is in. */ + KEEP (*crtbegin.o(.ctors)) + /* We don't want to include the .ctor section from + from the crtend.o file until after the sorted ctors. + The .ctor section from the crtend file contains the + end of ctors marker and it must be last */ + KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + ___ctors_end = .; + } + .dtors : + { + ___dtors = .; + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + ___dtors_end = .; + } + .got : { *(.got.plt) *(.got) } + .dynamic : { *(.dynamic) } + /* We want the small data sections together, so single-instruction offsets + can access them all, and initialized data all before uninitialized, so + we can shorten the on-disk segment size. */ + .sdata : + { + *(.sdata) + *(.sdata.*) + *(.gnu.linkonce.s.*) + } + _edata = .; + PROVIDE (edata = .); + __bss_start = .; + .sbss : + { + *(.dynsbss) + *(.sbss) + *(.sbss.*) + *(.scommon) + } + .bss : + { + *(.dynbss) + *(.bss) + *(.bss.*) + *(COMMON) + /* Align here to ensure that the .bss section occupies space up to + _end. Align after .bss to ensure correct alignment even if the + .bss section disappears because there are no input sections. */ + . = ALIGN(32 / 8); + } + . = ALIGN(32 / 8); + _end = .; + PROVIDE (end = .); + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +/* .stack 0x8c00f400 : { _stack = .; *(.stack) }*/ + /* These must appear regardless of . */ +_stack = 0x8d000000; +} diff --git a/MODEM/SRCS/dcload-serial/example-src/dcload-syscall.h b/MODEM/SRCS/dcload-serial/example-src/dcload-syscall.h new file mode 100644 index 00000000..0361bf72 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/example-src/dcload-syscall.h @@ -0,0 +1,26 @@ +#ifndef __DCLOAD_SYSCALL_H__ +#define __DCLOAD_SYSCALL_H__ + +int dcloadsyscall(unsigned int syscall, ...); + +#define pcreadnr 0 +#define pcwritenr 1 +#define pcopennr 2 +#define pcclosenr 3 +#define pccreatnr 4 +#define pclinknr 5 +#define pcunlinknr 6 +#define pcchdirnr 7 +#define pcchmodnr 8 +#define pclseeknr 9 +#define pcfstatnr 10 +#define pctimenr 11 +#define pcstatnr 12 +#define pcutimenr 13 +#define pcassignwrkmem 14 +#define pcexitnr 15 + +#define DCLOADMAGICVALUE 0xdeadbeef +#define DCLOADMAGICADDR (unsigned int *)0x8c004004 + +#endif diff --git a/MODEM/SRCS/dcload-serial/example-src/dcload-syscall.s b/MODEM/SRCS/dcload-serial/example-src/dcload-syscall.s new file mode 100644 index 00000000..6a1b7960 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/example-src/dcload-syscall.s @@ -0,0 +1,10 @@ + .section .text + .global _dcloadsyscall +_dcloadsyscall: + mov.l dcloadsyscall_k,r0 + mov.l @r0,r0 + jmp @r0 + nop +.align 4 +dcloadsyscall_k: + .long 0x8c004008 diff --git a/MODEM/SRCS/dcload-serial/example-src/dcload-syscalls.c b/MODEM/SRCS/dcload-serial/example-src/dcload-syscalls.c new file mode 100644 index 00000000..c59a8bf1 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/example-src/dcload-syscalls.c @@ -0,0 +1,126 @@ +#include "dcload-syscall.h" + +int link (const char *oldpath, const char *newpath) +{ + if (*DCLOADMAGICADDR == DCLOADMAGICVALUE) + return dcloadsyscall(pclinknr, oldpath, newpath); + else + return -1; +} + +int read (int file, char *ptr, int len) +{ + if (*DCLOADMAGICADDR == DCLOADMAGICVALUE) + return dcloadsyscall(pcreadnr, file, ptr, len); + else + return -1; +} + +int lseek (int file, int ptr, int dir) +{ + if (*DCLOADMAGICADDR == DCLOADMAGICVALUE) + return dcloadsyscall(pclseeknr, file, ptr, dir); + else + return -1; +} + +int write ( int file, char *ptr, int len) +{ + if (*DCLOADMAGICADDR == DCLOADMAGICVALUE) + return dcloadsyscall(pcwritenr, file, ptr, len); + else + return -1; +} + +int close (int file) +{ + if (*DCLOADMAGICADDR == DCLOADMAGICVALUE) + return dcloadsyscall(pcclosenr, file); + else + return -1; +} + +int fstat (int file, struct stat *st) +{ + if (*DCLOADMAGICADDR == DCLOADMAGICVALUE) + return dcloadsyscall(pcfstatnr, file, st); + else + return -1; +} + +int open (const char *path, int flags) +{ + if (*DCLOADMAGICADDR == DCLOADMAGICVALUE) + return dcloadsyscall(pcopennr, path, flags); + else + return -1; +} + +int creat (const char *path, int mode) +{ + if (*DCLOADMAGICADDR == DCLOADMAGICVALUE) + return dcloadsyscall(pccreatnr, path, mode); + else + return -1; +} + +int unlink (const char *path) +{ + if (*DCLOADMAGICADDR == DCLOADMAGICVALUE) + return dcloadsyscall(pcunlinknr, path); + else + return -1; +} + +void exit (int status) +{ + if (*DCLOADMAGICADDR == DCLOADMAGICVALUE) + dcloadsyscall(pcexitnr); + __exit(status); +} + +int stat (const char *path, struct stat *st) +{ + if (*DCLOADMAGICADDR == DCLOADMAGICVALUE) + return dcloadsyscall(pcstatnr, path, st); + else + return -1; +} + +int chmod (const char *path, short mode) +{ + if (*DCLOADMAGICADDR == DCLOADMAGICVALUE) + return dcloadsyscall(pcchmodnr, path, mode); + else + return -1; +} + +int utime (const char *path, char *times) +{ + if (*DCLOADMAGICADDR == DCLOADMAGICVALUE) + return dcloadsyscall(pcutimenr, path, times); + else + return -1; +} + +int chdir (const char *path) +{ + if (*DCLOADMAGICADDR == DCLOADMAGICVALUE) + return dcloadsyscall(pcchdirnr, path); + else + return -1; +} + +long time(long *t) +{ + if (*DCLOADMAGICADDR == DCLOADMAGICVALUE) + return dcloadsyscall(pctimenr, t); + else + return -1; +} + +void assign_wrkmem(unsigned char *wrkmem) +{ + if (*DCLOADMAGICADDR == DCLOADMAGICVALUE) + dcloadsyscall(pcassignwrkmem, wrkmem); +} diff --git a/MODEM/SRCS/dcload-serial/example-src/dcload-syscalls.h b/MODEM/SRCS/dcload-serial/example-src/dcload-syscalls.h new file mode 100644 index 00000000..585cafb9 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/example-src/dcload-syscalls.h @@ -0,0 +1,25 @@ +#ifndef __DCLOAD_SYSCALLS_H__ +#define __DCLOAD_SYSCALLS_H__ + +#define O_RDONLY 0 +#define O_WRONLY 1 +#define O_RDWR 2 + +int link (const char *oldpath, const char *newpath); +int read (int file, char *ptr, int len); +int lseek (int file, int ptr, int dir); +int write ( int file, char *ptr, int len); +int close (int file); +int fstat (int file, struct stat *st); +int open (const char *path, int flags); +int creat (const char *path, int mode); +int unlink (const char *path); +void exit (int status); +int stat (const char *path, struct stat *st); +int chmod (const char *path, short mode); +int utime (const char *path, char *times); +int chdir (const char *path); +long time(long *t); +void assign_wrkmem(unsigned char *wrkmem); + +#endif diff --git a/MODEM/SRCS/dcload-serial/example-src/exception-test.c b/MODEM/SRCS/dcload-serial/example-src/exception-test.c new file mode 100644 index 00000000..c0c20367 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/example-src/exception-test.c @@ -0,0 +1,9 @@ +int main(void) +{ + int i; + + i = *((volatile unsigned int *)2); +} + + + diff --git a/MODEM/SRCS/dcload-serial/host-src/Makefile b/MODEM/SRCS/dcload-serial/host-src/Makefile new file mode 100644 index 00000000..1bb1d257 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/host-src/Makefile @@ -0,0 +1,22 @@ +SUBDIRS = misc tool +MAKE = make + +.PHONY : subdirs $(SUBDIRS) + +subdirs: $(SUBDIRS) + +$(SUBDIRS): + $(MAKE) -C $@ + +.PHONY : clean +clean: + for dir in $(SUBDIRS); do \ + $(MAKE) -C $$dir clean; \ + done + +.PHONY : distclean +distclean: + for dir in $(SUBDIRS) ; do \ + $(MAKE) -C $$dir distclean; \ + done + diff --git a/MODEM/SRCS/dcload-serial/host-src/misc/Makefile b/MODEM/SRCS/dcload-serial/host-src/misc/Makefile new file mode 100644 index 00000000..4f3db8ff --- /dev/null +++ b/MODEM/SRCS/dcload-serial/host-src/misc/Makefile @@ -0,0 +1,27 @@ +include ../../Makefile.cfg + +LZOPATH = ../../minilzo.106 + +CC = $(HOSTCC) +CFLAGS = $(HOSTCFLAGS) +INCLUDE = -I$(LZOPATH) +LZOFILES = $(LZOPATH)/minilzo.c $(LZOPATH)/minilzo.h $(LZOPATH)/lzoconf.h + +.c.o: + $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $< + +all: lzo + +lzo: lzo.c minilzo.o + $(CC) $(CFLAGS) $(INCLUDE) -o $@ $^ + +minilzo.o: $(LZOFILES) + $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $< + +.PHONY : clean +clean: + rm -f *.o + +.PHONY : distclean +distclean: clean + rm -f lzo \ No newline at end of file diff --git a/MODEM/SRCS/dcload-serial/host-src/misc/lzo.c b/MODEM/SRCS/dcload-serial/host-src/misc/lzo.c new file mode 100644 index 00000000..371ca862 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/host-src/misc/lzo.c @@ -0,0 +1,103 @@ +/* + * This file is part of the dcload Dreamcast serial loader + * + * Andrew Kieschnick + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include "minilzo.h" + +#define HEAP_ALLOC(var,size) \ + long __LZO_MMODEL var [ ((size) + (sizeof(long) - 1)) / sizeof(long) ] + +static HEAP_ALLOC(wrkmem,LZO1X_1_MEM_COMPRESS); + +void usage(void) +{ + printf("usage: lzo \n"); + exit(1); +} + +int main(int argc, char *argv[]) +{ + int in, out; + unsigned char * data; + unsigned char * cdata; + int r; + unsigned int length,clength; + + if (argc != 3) + usage(); + + in = open(argv[1], O_RDONLY); + + if (in < 0) { + perror(argv[1]); + exit(1); + } + + out = open(argv[2], O_WRONLY | O_CREAT | O_TRUNC, 0644); + + if (out < 0) { + perror(argv[2]); + exit(1); + } + + length = lseek(in, 0, SEEK_END); + lseek(in, 0, SEEK_SET); + + data = malloc(length); + cdata = malloc(length+length/64 + 16 + 3); + + read(in, data, length); + + if (lzo_init() != LZO_E_OK) + { + printf("lzo_init() failed !!!\n"); + exit(1); + } + + r = lzo1x_1_compress(data,length,cdata,&clength,wrkmem); + if (r == LZO_E_OK) + printf("compressed %lu bytes into %lu bytes\n", + (long) length, (long) clength); + else + { + /* this should NEVER happen */ + printf("internal error - compression failed: %d\n", r); + return 2; + } + /* check for an incompressible block */ + if (clength >= length) + { + printf("This block contains incompressible data.\n"); + return 0; + } + + write(out, cdata, clength); + + close(in); + close(out); + exit(0); +} + diff --git a/MODEM/SRCS/dcload-serial/host-src/tool/Makefile b/MODEM/SRCS/dcload-serial/host-src/tool/Makefile new file mode 100644 index 00000000..969e850c --- /dev/null +++ b/MODEM/SRCS/dcload-serial/host-src/tool/Makefile @@ -0,0 +1,35 @@ +include ../../Makefile.cfg + +LZOPATH = ../../minilzo.106 + +CC = $(HOSTCC) +CFLAGS = $(HOSTCFLAGS) -DBAUD_RATE=$(SERIALSPEED) -DSERIALDEVICE="\"$(SERIALDEVICE)\"" -DHAVE_GETOPT +INCLUDE = -I$(LZOPATH) -I$(BFDINCLUDE) + +DCTOOL = dc-tool$(EXECUTABLEEXTENSION) + +OBJECTS = dc-tool.o minilzo.o syscalls.o +LZOFILES = $(LZOPATH)/minilzo.c $(LZOPATH)/minilzo.h $(LZOPATH)/lzoconf.h + +.c.o: + $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $< + +all: $(DCTOOL) + +$(DCTOOL): $(OBJECTS) + $(CC) -o $@ $(OBJECTS) $(BFDLIB) + +minilzo.o: $(LZOFILES) + $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $< + +.PHONY : install +install: $(DCTOOL) + cp $(DCTOOL) $(TOOLINSTALLDIR) + +.PHONY : clean +clean: + rm -f $(OBJECTS) + +.PHONY : distclean +distclean: clean + rm -f $(DCTOOL) diff --git a/MODEM/SRCS/dcload-serial/host-src/tool/dc-io.h b/MODEM/SRCS/dcload-serial/host-src/tool/dc-io.h new file mode 100644 index 00000000..ba6dc3c9 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/host-src/tool/dc-io.h @@ -0,0 +1,11 @@ +#ifndef __DC_IO_H__ +#define __DC_IO_H__ + +int send_uint(unsigned int value); +unsigned int recv_uint(void); +void recv_data(void *data, unsigned int total, unsigned int verbose); +void send_data(unsigned char *addr, unsigned int size, unsigned int verbose); + +#endif + + diff --git a/MODEM/SRCS/dcload-serial/host-src/tool/dc-tool.c b/MODEM/SRCS/dcload-serial/host-src/tool/dc-tool.c new file mode 100644 index 00000000..28b39b78 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/host-src/tool/dc-tool.c @@ -0,0 +1,1130 @@ +/* + * dc-tool, a tool for use with the dcload serial loader + * + * Copyright (C) 2001 Andrew Kieschnick + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#ifdef _WIN32 +#include +#include +#else +#include +#endif +#include +#include +#include +#include +#include +#include "minilzo.h" +#include "syscalls.h" +#include "dc-io.h" + +int _nl_msg_cat_cntr; +int gdb_server_socket = -1; + +#define DCLOADBUFFER 16384 /* was 8192 */ +#ifdef _WIN32 +#define DATA_BITS 8 +#define PARITY_SET NOPARITY +#define STOP_BITS ONESTOPBIT +#endif + +#define VERSION "1.0.4" + +#ifndef O_BINARY +#define O_BINARY 0 +#endif + +#define HEAP_ALLOC(var,size) \ + long __LZO_MMODEL var [ ((size) + (sizeof(long) - 1)) / sizeof(long) ] + +static HEAP_ALLOC(wrkmem, LZO1X_1_MEM_COMPRESS); + +#ifndef HAVE_GETOPT +/* The following code for getopt is from the libc-source of FreeBSD, + * it might be changed a little bit. + * Florian Schulze (florian.proff.schulze@gmx.net) + */ + +/* + * Copyright (c) 1987, 1993, 1994 + * The Regents of the University of California. 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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. + */ + +int opterr = 1, /* if error message should be printed */ + optind = 1, /* index into parent argv vector */ + optopt, /* character checked for validity */ + optreset; /* reset getopt */ +char *optarg; /* argument associated with option */ + +#define BADCH (int)'?' +#define BADARG (int)':' +#define EMSG "" + +char *__progname="dc-tool"; + +/* + * getopt -- + * Parse argc/argv argument vector. + */ +int +getopt(nargc, nargv, ostr) +int nargc; +char * const *nargv; +const char *ostr; +{ + extern char *__progname; + static char *place = EMSG; /* option letter processing */ + char *oli; /* option letter list index */ + int ret; + + if (optreset || !*place) { /* update scanning pointer */ + optreset = 0; + if (optind >= nargc || *(place = nargv[optind]) != '-') { + place = EMSG; + return (-1); + } + if (place[1] && *++place == '-') { /* found "--" */ + ++optind; + place = EMSG; + return (-1); + } + } /* option letter okay? */ + if ((optopt = (int)*place++) == (int)':' || + !(oli = strchr(ostr, optopt))) { + /* + * if the user didn't specify '-' as an option, + * assume it means -1. + */ + if (optopt == (int)'-') + return (-1); + if (!*place) + ++optind; + if (opterr && *ostr != ':') + (void)fprintf(stderr, + "%s: illegal option -- %c\n", __progname, optopt); + return (BADCH); + } + if (*++oli != ':') { /* don't need argument */ + optarg = NULL; + if (!*place) + ++optind; + } + else { /* need an argument */ + if (*place) /* no white space */ + optarg = place; + else if (nargc <= ++optind) { /* no arg */ + place = EMSG; + if (*ostr == ':') + ret = BADARG; + else + ret = BADCH; + if (opterr) + (void)fprintf(stderr, + "%s: option requires an argument -- %c\n", + __progname, optopt); + return (ret); + } + else /* white space */ + optarg = nargv[optind]; + place = EMSG; + ++optind; + } + return (optopt); /* dump back option letter */ +} +#else +#include +#endif + +extern char *optarg; +#ifndef _WIN32 +int dcfd; +struct termios oldtio; +#else +HANDLE hCommPort; +#endif + +#ifdef _WIN32 +int serial_read(void *buffer, int count) +{ + BOOL fSuccess; + + fSuccess = ReadFile(hCommPort, buffer, count, (DWORD *)&count, NULL); + if( !fSuccess ) + return -1; + return count; +} + +int serial_write(void *buffer, int count) +{ + BOOL fSuccess; + + fSuccess = WriteFile(hCommPort, buffer, count, (DWORD *)&count, NULL); + if( !fSuccess ) + return -1; + return count; +} + +int serial_putc(char ch) +{ + BOOL fSuccess; + int count = 1; + + fSuccess = WriteFile(hCommPort, &ch, count, (DWORD *)&count, NULL); + if( !fSuccess ) + return -1; + return count; +} +#else +int serial_read(void *buffer, int count) +{ + return read(dcfd,buffer,count); +} + +int serial_write(void *buffer, int count) +{ + return write(dcfd,buffer,count); +} + +int serial_putc(char ch) +{ + return write(dcfd,&ch,1); +} +#endif + +/* read count bytes from dc into buf */ +void blread(void *buf, int count) +{ + int retval; + unsigned char *tmp = buf; + + while (count) { + retval = serial_read(tmp, count); + if (retval == -1) + printf("blread: read error!\n"); + else { + tmp += retval; + count -= retval; + } + } +} + +char serial_getc() +{ + int retval; + char tmp; + + retval = serial_read(&tmp, 1); + if (retval == -1) { + printf("serial_getc: read error!\n"); + tmp = (char)NULL; + } + return tmp; +} + +/* send 4 bytes */ +int send_uint(unsigned int value) +{ + unsigned int tmp = value; + + /* send little-endian */ + serial_putc((char)(tmp & 0xFF)); + serial_putc((char)((tmp >> 0x08) & 0xFF)); + serial_putc((char)((tmp >> 0x10) & 0xFF)); + serial_putc((char)((tmp >> 0x18) & 0xFF)); + + /* get little-endian */ + tmp = ((unsigned int) (serial_getc() & 0xFF)); + tmp |= ((unsigned int) (serial_getc() & 0xFF) << 0x08); + tmp |= ((unsigned int) (serial_getc() & 0xFF) << 0x10); + tmp |= ((unsigned int) (serial_getc() & 0xFF) << 0x18); + + if (tmp != value) + return 0; + + return 1; +} + +/* receive 4 bytes */ +unsigned int recv_uint(void) +{ + unsigned int tmp; + + /* get little-endian */ + tmp = ((unsigned int) (serial_getc() & 0xFF)); + tmp |= ((unsigned int) (serial_getc() & 0xFF) << 0x08); + tmp |= ((unsigned int) (serial_getc() & 0xFF) << 0x10); + tmp |= ((unsigned int) (serial_getc() & 0xFF) << 0x18); + + return (tmp); +} + +/* receive total bytes from dc and store in data */ +void recv_data(void *data, unsigned int total, unsigned int verbose) +{ + unsigned char type, sum, ok; + unsigned int size, newsize; + unsigned char *tmp; + + if (verbose) { + printf("recv_data: "); + fflush(stdout); + } + + while (total) { + + blread(&type, 1); + + size = recv_uint(); + + switch (type) { + case 'U': // uncompressed + if (verbose) { + printf("U"); + fflush(stdout); + } + blread(data, size); + blread(&sum, 1); + ok = 'G'; + serial_write(&ok, 1); + total -= size; + (unsigned char *) data += size; + break; + case 'C': // compressed + if (verbose) { + printf("C"); + fflush(stdout); + } + tmp = malloc(size); + blread(tmp, size); + blread(&sum, 1); + if (lzo1x_decompress(tmp, size, data, &newsize, 0) == LZO_E_OK) { + ok = 'G'; + serial_write(&ok, 1); + total -= newsize; + (unsigned char *) data += newsize; + } else { + ok = 'B'; + serial_write(&ok, 1); + printf("\nrecv_data: decompression failed!\n"); + } + free(tmp); + break; + default: + break; + } + } + if (verbose) { + printf("\n"); + fflush(stdout); + } +} + +/* send size bytes to dc from addr */ +void send_data(unsigned char * addr, unsigned int size, unsigned int verbose) +{ + unsigned int i; + unsigned char *location = (unsigned char *) addr; + unsigned char sum = 0; + unsigned char data; + unsigned int csize; + unsigned int sendsize; + unsigned char c; + unsigned char * buffer; + + buffer = malloc(DCLOADBUFFER + DCLOADBUFFER / 64 + 16 + 3); + + if (verbose) { + printf("send_data: "); + fflush(stdout); + } + + while (size) { + if (size > DCLOADBUFFER) + sendsize = DCLOADBUFFER; + else + sendsize = size; + lzo1x_1_compress((unsigned char *)addr, sendsize, buffer, &csize, wrkmem); + if (csize < sendsize) { + // send compressed + if (verbose) { + printf("C"); + fflush(stdout); + } + c = 'C'; + serial_write(&c, 1); + send_uint(csize); + data = 'B'; + while(data != 'G') { + location = buffer; + serial_write(location, csize); + sum = 0; + for (i = 0; i < csize; i++) { + data = *(location++); + sum ^= data; + } + serial_write(&sum, 1); + blread(&data, 1); + } + } else { + // send uncompressed + if (verbose) { + printf("U"); + fflush(stdout); + } + c = 'U'; + serial_write(&c, 1); + send_uint(sendsize); + serial_write((unsigned char *)addr, sendsize); + sum = 0; + for (i = 0; i < sendsize; i++) { + sum ^= ((unsigned char *)addr)[i]; + } + serial_write(&sum, 1); + blread(&data, 1); + } + size -= sendsize; + addr += sendsize; + } + if (verbose) { + printf("\n"); + fflush(stdout); + } +} + +#ifdef _WIN32 +void output_error(void) +{ + char *lpMsgBuf; + + FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + GetLastError(), + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + (LPTSTR) &lpMsgBuf, 0, NULL // Process any inserts in lpMsgBuf. + ); + printf("%s\n",(char *)lpMsgBuf); + LocalFree( (LPVOID) lpMsgBuf ); +} +#endif + +/* setup serial port */ +int open_serial(char *devicename, unsigned int speed, unsigned int *speedtest) +{ + *speedtest = speed; +#ifndef _WIN32 + struct termios newtio; + speed_t speedsel; + + dcfd = open(devicename, O_RDWR | O_NOCTTY); + if (dcfd < 0) { + perror(devicename); + exit(-1); + } + + tcgetattr(dcfd, &oldtio); // save current serial port settings + memset(&newtio, 0, sizeof(newtio)); // clear struct for new port settings + + newtio.c_cflag = CRTSCTS | CS8 | CLOCAL | CREAD; + newtio.c_iflag = IGNPAR; + newtio.c_oflag = 0; + newtio.c_lflag = 0; + newtio.c_cc[VTIME] = 0; // inter-character timer unused + newtio.c_cc[VMIN] = 1; // blocking read until 1 character arrives + + + for (speedsel=0; !speedsel;) { + switch(speed) { +#ifdef B1500000 + case 1500000: + speedsel = B1500000; + break; +#endif +#ifdef B500000 + case 500000: + speedsel = B500000; + break; +#endif + case 115200: + speedsel = B115200; + break; + case 57600: + speedsel = B57600; + break; + case 38400: + speedsel = B38400; + break; + case 19200: + speedsel = B19200; + break; + case 9600: + speedsel = B9600; + break; + default: + printf("Unsupported baudrate (%d) - switching to default (%d)\n", speed, BAUD_RATE); + *speedtest = speed = BAUD_RATE; + break; + } + } + + cfsetispeed(&newtio, speedsel); + cfsetospeed(&newtio, speedsel); + + // we don't error on these because it *may* still work + if (tcflush(dcfd, TCIFLUSH) < 0) { + perror("tcflush"); + } + if (tcsetattr(dcfd, TCSANOW, &newtio) < 0) { + perror("tcsetattr"); + printf("warning: your baud rate is likely set incorrectly\n"); + } + +#else + BOOL fSuccess; + COMMTIMEOUTS ctmoCommPort; + DCB dcbCommPort; + + /* Setup the com port */ + hCommPort = CreateFile(devicename, GENERIC_READ | GENERIC_WRITE, 0, + NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); + + if( hCommPort == INVALID_HANDLE_VALUE ) { + printf( "*Error opening com port\n"); + output_error(); + return -1; + } + + ctmoCommPort.ReadIntervalTimeout = MAXDWORD; + ctmoCommPort.ReadTotalTimeoutMultiplier = MAXDWORD; + ctmoCommPort.ReadTotalTimeoutConstant = MAXDWORD; + ctmoCommPort.WriteTotalTimeoutMultiplier = 0; + ctmoCommPort.WriteTotalTimeoutConstant = 0; + SetCommTimeouts( hCommPort, &ctmoCommPort ); + dcbCommPort.DCBlength = sizeof(DCB); + + fSuccess = GetCommState( hCommPort, &dcbCommPort ); + if( !fSuccess ) { + printf( "*Error getting com port state\n" ); + output_error(); + return -1; + } + + dcbCommPort.BaudRate = speed; + dcbCommPort.ByteSize = DATA_BITS; + dcbCommPort.Parity = PARITY_SET; + dcbCommPort.StopBits = STOP_BITS; + + fSuccess = SetCommState( hCommPort, &dcbCommPort ); + if( !fSuccess ) { + printf( "*Error setting com port state\n" ); + output_error(); + return -1; + } +#endif + return 0; +} + +/* prepare for program exit */ +void finish_serial(void) +{ +#ifdef _WIN32 + FlushFileBuffers(hCommPort); +#else + tcflush(dcfd, TCIOFLUSH); + tcsetattr(dcfd, TCSANOW, &oldtio); +#endif +} + +/* close the host serial port */ +void close_serial(void) +{ +#ifdef _WIN32 + FlushFileBuffers(hCommPort); + CloseHandle(hCommPort); +#else + tcflush(dcfd, TCIOFLUSH); + close(dcfd); +#endif +} + +int speedhack = 0; +/* speedhack controls whether dcload will use N=12 (normal, 4.3% error) or + * N=13 (alternate, -3.1% error) for 115200 + */ + +int change_speed(char *device_name, unsigned int speed) +{ + unsigned char c; + unsigned int dummy, rv = 0xdeadbeef; + + c = 'S'; + serial_write(&c, 1); + blread(&c, 1); + if (speedhack && (speed == 115200)) + send_uint(111600); /* get dcload to pick N=13 rather than N=12 */ + else + send_uint(speed); + printf("Changing speed to %d bps... ", speed); + close_serial(); + if (open_serial(device_name, speed, &dummy)<0) + return 1; + send_uint(rv); + rv = recv_uint(); + printf("done\n"); +} + +int open_gdb_socket(int port) +{ + struct sockaddr_in server_addr; + + server_addr.sin_family = AF_INET; + server_addr.sin_port = htons( port ); + server_addr.sin_addr.s_addr = htonl( INADDR_LOOPBACK ); + + if ( (gdb_server_socket = socket( PF_INET, SOCK_STREAM, IPPROTO_TCP )) < 0 ) { + perror( "error creating gdb server socket" ); + return -1; + } + + if ( bind( gdb_server_socket, (struct sockaddr*)&server_addr, sizeof( server_addr ) ) < 0 ) { + perror( "error binding gdb server socket" ); + return -1; + } + + if ( listen( gdb_server_socket, 0 ) < 0 ) { + perror( "error listening to gdb server socket" ); + return -1; + } +} + +void usage(void) +{ + printf("\ndc-tool %s by \n\n",VERSION); + printf("-x Upload and execute \n"); + printf("-u Upload \n"); + printf("-d Download to \n"); + printf("-a
Set address to
(default: 0x8c010000)\n"); + printf("-s Set size to \n"); + printf("-t Use to communicate with dc (default: %s)\n", SERIALDEVICE); + printf("-b Use (default: %d)\n", BAUD_RATE); + printf("-e Try alternate 115200 (must also use -b 115200)\n"); + printf("-n Do not attach console and fileserver\n"); + printf("-p Use dumb terminal rather than console/fileserver\n"); + printf("-q Do not clear screen before download\n"); + printf("-c Chroot to (must be super-user)\n"); + printf("-i Enable cdfs redirection using iso image \n"); + printf("-g Start a GDB server\n"); + printf("-h Usage information (you\'re looking at it)\n\n"); + exit(0); +} + +unsigned int upload(unsigned char *filename, unsigned int address) +{ + int inputfd; + int size; + unsigned char *inbuf; + struct timeval starttime, endtime; + unsigned char c; + double stime, etime; + bfd *somebfd; + + lzo_init(); + + somebfd = bfd_openr(filename, 0); + + if (somebfd) { /* try bfd first */ + if (bfd_check_format(somebfd, bfd_object)) { + asection *section; + + printf("File format is %s, ", somebfd->xvec->name); + address = somebfd->start_address; + size = 0; + printf("start address is 0x%x\n", address); + + gettimeofday(&starttime, 0); + + for (section = somebfd->sections; section != NULL; section = section->next) + if ((section->flags & SEC_HAS_CONTENTS) && (section->flags & SEC_LOAD)) { + printf("Section %s, ",section->name); + printf("lma 0x%x, ",section->lma); + printf("size %d\n",section->_raw_size); + if (section->_raw_size) { + size += section->_raw_size; + inbuf = malloc(section->_raw_size); + bfd_get_section_contents(somebfd, section, inbuf, 0, section->_raw_size); + + c = 'B'; + serial_write(&c, 1); + blread(&c, 1); + + send_uint(section->lma); + send_uint(section->_raw_size); + + send_data(inbuf, section->_raw_size, 1); + + free(inbuf); + } + } + bfd_close(somebfd); + } else { + +/* if that fails, send raw bin */ + + printf("File format is raw binary, start address is 0x%x\n", address); + inputfd = open(filename, O_RDONLY | O_BINARY); + + if (inputfd < 0) { + perror(filename); + exit(-1); + } + + size = lseek(inputfd, 0, SEEK_END); + lseek(inputfd, 0, SEEK_SET); + + inbuf = malloc(size); + + read(inputfd, inbuf, size); + + close(inputfd); + + gettimeofday(&starttime, 0); + + c = 'B'; + serial_write(&c, 1); + blread(&c, 1); + + send_uint(address); + send_uint(size); + + send_data(inbuf, size, 1); + + } + + gettimeofday(&endtime, 0); + + stime = starttime.tv_sec + starttime.tv_usec / 1000000.0; + etime = endtime.tv_sec + endtime.tv_usec / 1000000.0; + + printf("effective: %.2f bytes / sec\n", (double) size / (etime - stime)); + printf("%.2f seconds to transfer %d bytes\n", (etime - stime), size); + fflush(stdout); + + } + return address; +} + +void download(unsigned char *filename, unsigned int address, + unsigned int size, unsigned int quiet) +{ + int outputfd; + + unsigned char c; + unsigned int wrkmem = 0x8cff0000; + unsigned char *data; + struct timeval starttime, endtime; + double stime, etime; + + outputfd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644); + + if (outputfd < 0) { + perror(filename); + exit(-1); + } + + data = malloc(size); + + if (!quiet) + serial_write("F", 1); + else + serial_write("G", 1); + + serial_read(&c, 1); + + send_uint(address); + + send_uint(size); + + send_uint(wrkmem); + + gettimeofday(&starttime, 0); + + recv_data(data, size, 1); + + gettimeofday(&endtime, 0); + + printf("Received %d bytes\n", size); + + stime = starttime.tv_sec + starttime.tv_usec / 1000000.0; + etime = endtime.tv_sec + endtime.tv_usec / 1000000.0; + + printf("effective: %.2f bytes / sec\n", (double) size / (etime - stime)); + printf("%.2f seconds to transfer %d bytes\n", (etime - stime), size); + fflush(stdout); + + write(outputfd, data, size); + + close(outputfd); +} + +void execute(unsigned int address, unsigned int console) +{ + unsigned char c; + + printf("Sending execute command (0x%x, console=%d)...",address,console); + + serial_write("A", 1); + serial_read(&c, 1); + + send_uint(address); + send_uint(console); + + printf("executing\n"); +} + +void do_console(unsigned char *path, unsigned char *isofile) +{ + unsigned char command; + int isofd; + + if (isofile) { + isofd = open(isofile, O_RDONLY | O_BINARY); + if (isofd < 0) + perror(isofile); + } + + if (path) + if (chroot(path)) + perror(path); + + + while (1) { + fflush(stdout); + serial_read(&command, 1); + + switch (command) { + case 0: + finish_serial(); + exit(0); + break; + case 1: + dc_fstat(); + break; + case 2: + dc_write(); + break; + case 3: + dc_read(); + break; + case 4: + dc_open(); + break; + case 5: + dc_close(); + break; + case 6: + dc_creat(); + break; + case 7: + dc_link(); + break; + case 8: + dc_unlink(); + break; + case 9: + dc_chdir(); + break; + case 10: + dc_chmod(); + break; + case 11: + dc_lseek(); + break; + case 12: + dc_time(); + break; + case 13: + dc_stat(); + break; + case 14: + dc_utime(); + break; + case 15: + printf("command 15 should not happen... (but it did)\n"); + break; + case 16: + dc_opendir(); + break; + case 17: + dc_closedir(); + break; + case 18: + dc_readdir(); + break; + case 19: + dc_cdfs_redir_read_sectors(isofd); + break; + case 20: + dc_gdbpacket(); + break; + default: + printf("Unimplemented command (%d) \n", command); + printf("Assuming program has exited, or something...\n"); + finish_serial(); + exit(0); + break; + } + } + if (isofd) + close(isofd); +} + +/* dumb terminal mode + * for programs that don't use dcload I/O functions + * FIXME: should allow setting a different baud rate from what dcload uses + * FIXME: should allow input + */ + +void do_dumbterm(void) +{ + unsigned char c; + + printf("\nDumb terminal mode isn't implemented, so you get this half-assed one.\n\n"); + + fflush(stdout); + + while (1) { + blread(&c, 1); + printf("%c", c); + fflush(stdout); + } +} + +int main(int argc, char *argv[]) +{ + unsigned int address = 0x8c010000; + unsigned int size = 0; + unsigned char *filename = 0; + unsigned char *path = 0; + unsigned int console = 1; + unsigned int dumbterm = 0; + unsigned int quiet = 0; + unsigned char command = 0; + unsigned int dummy, speed = BAUD_RATE; + char *device_name = SERIALDEVICE; + unsigned int cdfs_redir = 0; + unsigned char *isofile = 0; + int someopt; + + if (argc < 2) + usage(); + + someopt = getopt(argc, argv, "x:u:d:a:s:t:b:c:i:npqheg"); + while (someopt > 0) { + switch (someopt) { + case 'x': + if (command) { + printf("You can only specify one of -x, -u, and -d\n"); + exit(0); + } + command = 'x'; + filename = malloc(strlen(optarg) + 1); + strcpy(filename, optarg); + break; + case 'u': + if (command) { + printf("You can only specify one of -x, -u, and -d\n"); + exit(0); + } + command = 'u'; + filename = malloc(strlen(optarg) + 1); + strcpy(filename, optarg); + break; + case 'd': + if (command) { + printf("You can only specify one of -x, -u, and -d\n"); + exit(0); + } + command = 'd'; + filename = malloc(strlen(optarg) + 1); + strcpy(filename, optarg); + break; + case 'c': + path = malloc(strlen(optarg) + 1); + strcpy(path, optarg); + break; + case 'i': + cdfs_redir = 1; + isofile = malloc(strlen(optarg) + 1); + strcpy(isofile, optarg); + break; + case 'a': + address = strtoul(optarg, NULL, 0); + break; + case 's': + size = strtoul(optarg, NULL, 0); + break; + case 't': + device_name = malloc(strlen(optarg) + 1); + strcpy(device_name, optarg); + break; + case 'b': + speed = strtoul(optarg, NULL, 0); + break; + case 'n': + console = 0; + break; + case 'p': + console = 0; + dumbterm = 1; + break; + case 'q': + quiet = 1; + break; + case 'h': + usage(); + break; + case 'e': + speedhack = 1; + break; + case 'g': + printf("Starting a GDB server on port 2159\n"); + open_gdb_socket(2159); + break; + default: + break; + } + someopt = getopt(argc, argv, "x:u:d:a:s:t:b:c:i:npqhe"); + } + + if ((command == 'x') || (command == 'u')) { + struct stat statbuf; + if(stat(filename, &statbuf)) { + perror(filename); + exit(1); + } + } + + if (console) + printf("Console enabled\n"); + + if (dumbterm) + printf("Dumb terminal enabled\n"); + + if (quiet) + printf("Quiet download\n"); + + if (path) + printf("Chroot enabled\n"); + + if (cdfs_redir) + printf("Cdfs redirection enabled\n"); + + if (speedhack) + printf("Alternate 115200 enabled\n"); + + /* test for resonable baud - this is for POSIX systems */ + if (speed != BAUD_RATE) { + if (open_serial(device_name, speed, &speed)<0) + return 1; + close_serial(); + } + + if (open_serial(device_name, BAUD_RATE, &dummy)<0) + return 1; + + if (speed != BAUD_RATE) + change_speed(device_name, speed); + + switch (command) { + case 'x': + if (cdfs_redir) { + unsigned char c; + c = 'H'; + serial_write(&c, 1); + blread(&c, 1); + } + printf("Upload <%s>\n", filename); + address = upload(filename, address); + printf("Executing at <0x%x>\n", address); + execute(address, console); + if (console) + do_console(path, isofile); + else if (dumbterm) + do_dumbterm(); + break; + case 'u': + printf("Upload <%s> at <0x%x>\n", filename, address); + upload(filename, address); + change_speed(device_name, BAUD_RATE); + break; + case 'd': + if (!size) { + printf("You must specify a size (-s ) with download (-d )\n"); + exit(0); + } + printf("Download %d bytes at <0x%x> to <%s>\n", size, address, + filename); + download(filename, address, size, quiet); + change_speed(device_name, BAUD_RATE); + break; + default: + if (dumbterm) + do_dumbterm(); + else + usage(); + break; + } + exit(0); +} diff --git a/MODEM/SRCS/dcload-serial/host-src/tool/syscalls.c b/MODEM/SRCS/dcload-serial/host-src/tool/syscalls.c new file mode 100644 index 00000000..ac4f48f0 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/host-src/tool/syscalls.c @@ -0,0 +1,481 @@ +/* + * This file is part of the dcload Dreamcast serial loader + * + * Copyright (C) 2001 Andrew Kieschnick + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "syscalls.h" +#include "dc-io.h" + +#ifndef O_BINARY +#define O_BINARY 0 +#endif + +void dc_fstat(void) +{ + int filedes; + struct stat filestat; + int retval; + + filedes = recv_uint(); + + retval = fstat(filedes, &filestat); + + send_uint(filestat.st_dev); + send_uint(filestat.st_ino); + send_uint(filestat.st_mode); + send_uint(filestat.st_nlink); + send_uint(filestat.st_uid); + send_uint(filestat.st_gid); + send_uint(filestat.st_rdev); + send_uint(filestat.st_size); + send_uint(filestat.st_blksize); + send_uint(filestat.st_blocks); + send_uint(filestat.st_atime); + send_uint(filestat.st_mtime); + send_uint(filestat.st_ctime); + + send_uint(retval); + +} + +void dc_write(void) +{ + int filedes; + unsigned char *data; + int retval; + int count; + + filedes = recv_uint(); + count = recv_uint(); + + data = malloc(count); + recv_data(data, count, 0); + + retval = write(filedes, data, count); + + send_uint(retval); + + free(data); + +} + +void dc_read(void) +{ + int filedes; + unsigned char *data; + int retval; + int count; + + filedes = recv_uint(); + count = recv_uint(); + + data = malloc(count); + retval = read(filedes, data, count); + + send_data(data, count, 0); + + send_uint(retval); + + free(data); +} + +void dc_open(void) +{ + int namelen; + unsigned char *pathname; + int retval; + int flags; + int ourflags = 0; + int mode; + + namelen = recv_uint(); + + pathname = malloc(namelen); + + recv_data(pathname, namelen, 0); + + flags = recv_uint(); + mode = recv_uint(); + + /* translate flags */ + + if (flags & 0x0001) + ourflags |= O_WRONLY; + if (flags & 0x0002) + ourflags |= O_RDWR; + if (flags & 0x0008) + ourflags |= O_APPEND; + if (flags & 0x0200) + ourflags |= O_CREAT; + if (flags & 0x0400) + ourflags |= O_TRUNC; + if (flags & 0x0800) + ourflags |= O_EXCL; + + retval = open(pathname, ourflags | O_BINARY, mode); + + send_uint(retval); + + free(pathname); +} + +void dc_close(void) +{ + int filedes; + int retval; + + filedes = recv_uint(); + + retval = close(filedes); + + send_uint(retval); +} + +void dc_creat(void) +{ + int namelen; + unsigned char *pathname; + int retval; + int mode; + + namelen = recv_uint(); + + pathname = malloc(namelen); + + recv_data(pathname, namelen, 0); + + mode = recv_uint(); + + retval = creat(pathname, mode); + + send_uint(retval); + + free(pathname); +} + +void dc_link(void) +{ + int namelen1, namelen2; + unsigned char *pathname1, *pathname2; + int retval; + + namelen1 = recv_uint(); + pathname1 = malloc(namelen1); + + recv_data(pathname1, namelen1, 0); + + namelen2 = recv_uint(); + pathname2 = malloc(namelen2); + + recv_data(pathname2, namelen2, 0); + + retval = link(pathname1, pathname2); + + send_uint(retval); + + free(pathname1); + free(pathname2); +} + +void dc_unlink(void) +{ + int namelen; + unsigned char *pathname; + int retval; + + namelen = recv_uint(); + + pathname = malloc(namelen); + + recv_data(pathname, namelen, 0); + + retval = unlink(pathname); + + send_uint(retval); + + free(pathname); +} + +void dc_chdir(void) +{ + int namelen; + unsigned char *pathname; + int retval; + + namelen = recv_uint(); + + pathname = malloc(namelen); + + recv_data(pathname, namelen, 0); + + retval = chdir(pathname); + + send_uint(retval); + + free(pathname); +} + +void dc_chmod(void) +{ + int namelen; + unsigned char *pathname; + int retval; + int mode; + + namelen = recv_uint(); + + pathname = malloc(namelen); + + recv_data(pathname, namelen, 0); + + mode = recv_uint(); + + retval = chmod(pathname, mode); + + send_uint(retval); + + free(pathname); +} + +void dc_lseek(void) +{ + int filedes; + int offset; + int whence; + int retval; + + filedes = recv_uint(); + offset = recv_uint(); + whence = recv_uint(); + + retval = lseek(filedes, offset, whence); + + send_uint(retval); +} + +void dc_time(void) +{ + time_t t; + + time(&t); + + send_uint(t); +} + +void dc_stat(void) +{ + int namelen; + unsigned char *filename; + struct stat filestat; + int retval; + + namelen = recv_uint(); + + filename = malloc(namelen); + + recv_data(filename, namelen, 0); + + retval = stat(filename, &filestat); + + send_uint(filestat.st_dev); + send_uint(filestat.st_ino); + send_uint(filestat.st_mode); + send_uint(filestat.st_nlink); + send_uint(filestat.st_uid); + send_uint(filestat.st_gid); + send_uint(filestat.st_rdev); + send_uint(filestat.st_size); + send_uint(filestat.st_blksize); + send_uint(filestat.st_blocks); + send_uint(filestat.st_atime); + send_uint(filestat.st_mtime); + send_uint(filestat.st_ctime); + + send_uint(retval); + + free(filename); +} + +void dc_utime(void) +{ + unsigned char *pathname; + int namelen; + struct utimbuf tbuf; + int foo; + int retval; + + namelen = recv_uint(); + + pathname = malloc(namelen); + + recv_data(pathname, namelen, 0); + + foo = recv_uint(); + + if (foo) { + + tbuf.actime = recv_uint(); + tbuf.modtime = recv_uint(); + + retval = utime(pathname, &tbuf); + } else { + retval = utime(pathname, 0); + } + send_uint(retval); + + free(pathname); +} + +void dc_opendir(void) +{ + DIR *somedir; + unsigned char *dirname; + int namelen; + + namelen = recv_uint(); + + dirname = malloc(namelen); + + recv_data(dirname, namelen, 0); + + somedir = opendir(dirname); + + send_uint((unsigned int)somedir); + + free(dirname); +} + +void dc_closedir(void) +{ + DIR *somedir; + int retval; + + somedir = (DIR *) recv_uint(); + + retval = closedir(somedir); + + send_uint(retval); +} + +void dc_readdir(void) +{ + DIR *somedir; + struct dirent *somedirent; + + somedir = (DIR *) recv_uint(); + + somedirent = readdir(somedir); + + if (somedirent) { + send_uint(1); + send_uint(somedirent->d_ino); +#ifdef _WIN32 + send_uint(0); + send_uint(0); + send_uint(0); +#else +#ifdef __APPLE_CC__ + send_uint(0); +#else + send_uint(somedirent->d_off); +#endif + send_uint(somedirent->d_reclen); + send_uint(somedirent->d_type); +#endif + send_uint(strlen(somedirent->d_name)+1); + send_data(somedirent->d_name, strlen(somedirent->d_name)+1, 0); + } else + send_uint(0); +} + +void dc_cdfs_redir_read_sectors(int isofd) +{ + int start; + int num; + unsigned char * buf; + + start = recv_uint(); + num = recv_uint(); + + start -= 150; + + lseek(isofd, start * 2048, SEEK_SET); + + buf = malloc(num * 2048); + + read(isofd, buf, num * 2048); + + send_data(buf, num * 2048, 0); +} + +#define GDBBUFSIZE 1024 +extern int gdb_server_socket; + +void dc_gdbpacket(void) +{ + size_t in_size, out_size; + + static int socket_fd = -1; + static char gdb_buf[GDBBUFSIZE]; + + int count, size, retval = 0; + + in_size = recv_uint(); + out_size = recv_uint(); + + if (in_size) + recv_data(gdb_buf, in_size > GDBBUFSIZE ? GDBBUFSIZE : in_size, 0); + + if (gdb_server_socket < 0) { + send_uint(-1); + return; + } + + if (socket_fd < 0) { + printf( "waiting for gdb client connection...\n" ); + if ( (socket_fd = accept( gdb_server_socket, NULL, NULL )) < 0) { + perror("error accepting gdb server connection"); + send_uint(-1); + return; + } + } + + if (in_size) + write(socket_fd, gdb_buf, in_size); + + if (out_size) { + retval = read(socket_fd, gdb_buf, out_size > GDBBUFSIZE ? GDBBUFSIZE : out_size); + if (retval == 0) + socket_fd = -1; + } + + send_uint(retval); + if (retval > 0) + send_data(gdb_buf, retval, 0); +} diff --git a/MODEM/SRCS/dcload-serial/host-src/tool/syscalls.h b/MODEM/SRCS/dcload-serial/host-src/tool/syscalls.h new file mode 100644 index 00000000..d954b945 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/host-src/tool/syscalls.h @@ -0,0 +1,48 @@ +/* + * This file is part of the dcload Dreamcast serial loader + * + * Copyright (C) 2001 Andrew Kieschnick + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __SYSCALLS_H__ +#define __SYSCALLS_H__ + +void dc_fstat(void); +void dc_write(void); +void dc_read(void); +void dc_open(void); +void dc_close(void); +void dc_creat(void); +void dc_link(void); +void dc_unlink(void); +void dc_chdir(void); +void dc_chmod(void); +void dc_lseek(void); +void dc_time(void); +void dc_stat(void); +void dc_utime(void); + +void dc_opendir(void); +void dc_readdir(void); +void dc_closedir(void); + +void dc_cdfs_redir_read_sectors(int isofd); + +void dc_gdbpacket(void); + +#endif diff --git a/MODEM/SRCS/dcload-serial/make-cd/IP.BIN b/MODEM/SRCS/dcload-serial/make-cd/IP.BIN new file mode 100644 index 00000000..dc824048 Binary files /dev/null and b/MODEM/SRCS/dcload-serial/make-cd/IP.BIN differ diff --git a/MODEM/SRCS/dcload-serial/make-cd/Makefile b/MODEM/SRCS/dcload-serial/make-cd/Makefile new file mode 100644 index 00000000..3fabfd33 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/make-cd/Makefile @@ -0,0 +1,39 @@ +CDRECORD = cdrecord dev=0,0,0 speed=8 +#CDRECORD = cdrecord dev=ATAPI:0,0,0 speed=8 +SCRAMBLE = scramble +DD = dd +CP = cp +MKISOFS = mkisofs +CAT = cat +TOUCH = touch +1ST_READ = ../target-src/1st_read/1st_read.bin + +all: $(1ST_READ) audio.raw burn-audio data.raw burn-data + +audio.raw: + $(DD) if=/dev/zero of=audio.raw bs=2352 count=300 + +burn-audio: audio.raw + $(CDRECORD) -multi -audio audio.raw + touch burn-audio + +1st_read.bin: $(1ST_READ) + $(SCRAMBLE) $(1ST_READ) 1st_read.bin + +data.raw: tmp.iso IP.BIN + ( cat IP.BIN ; dd if=tmp.iso bs=2048 skip=16 ) > data.raw + +tmp.iso: 1st_read.bin burn-audio + $(MKISOFS) -C `$(CDRECORD) -msinfo` -o tmp.iso 1st_read.bin + +burn-data: data.raw + $(CDRECORD) -xa data.raw + rm -f audio.raw data.raw burn-audio + +.PHONY : clean +clean: + rm -f tmp.iso burn-audio 1st_read.bin + +.PHONY : distclean +distclean: clean + rm -f audio.raw data.raw diff --git a/MODEM/SRCS/dcload-serial/minilzo.106/COPYING b/MODEM/SRCS/dcload-serial/minilzo.106/COPYING new file mode 100644 index 00000000..b4951ab7 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/minilzo.106/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/MODEM/SRCS/dcload-serial/minilzo.106/Makefile b/MODEM/SRCS/dcload-serial/minilzo.106/Makefile new file mode 100644 index 00000000..6abd2528 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/minilzo.106/Makefile @@ -0,0 +1,58 @@ +# +# a very simple Makefile for miniLZO +# +# Copyright (C) 1996-1999 Markus F.X.J. Oberhumer +# + +SOURCES = testmini.c minilzo.c + +default all: + @echo "Please choose one of the following targets:" + @echo " gcc gcc-i386 gcc-rs6000" + @echo " visualc watcomc watcomc16" + @echo " hpux hpux9" + + +# +# gcc +# +gcc: + gcc -Wall -O2 -s -o testmini $(SOURCES) + +gcc-i386: + gcc -Wall -O2 -fomit-frame-pointer -fno-strength-reduce -s -o testmini $(SOURCES) + +gcc-rs6000: + gcc -Wall -O2 -fno-schedule-insns -fno-schedule-insns2 -o testmini $(SOURCES) + + +# +# Windows +# +visualc: + cl -nologo -ML -W3 -O2 -GF $(SOURCES) + +watcomc: + wcl386 -zq -mf -5r -zc -wx -oneatx $(SOURCES) + +watcomc16: + wcl -zq -ml -5 -zc -wx -oneatx $(SOURCES) + + +# +# UNIX +# + +hpux: + cc -Ae -o testmini $(SOURCES) + +hpux9: + cc -Aa -D_HPUX_SOURCE -o testmini $(SOURCES) + + +# +# other targets +# +clean: + rm -f testmini testmini.exe *.err *.o *.obj core + diff --git a/MODEM/SRCS/dcload-serial/minilzo.106/README.LZO b/MODEM/SRCS/dcload-serial/minilzo.106/README.LZO new file mode 100644 index 00000000..9d13643f --- /dev/null +++ b/MODEM/SRCS/dcload-serial/minilzo.106/README.LZO @@ -0,0 +1,136 @@ +-----BEGIN PGP SIGNED MESSAGE----- + + + ============================================================================ + miniLZO -- mini subset of the LZO real-time data compression library + ============================================================================ + + Author : Markus Franz Xaver Johannes Oberhumer + + http://wildsau.idv.uni-linz.ac.at/mfx/lzo.html + Version : 1.06 + Date : 29-Nov-1999 + + I've created miniLZO for projects where it is inconvenient to + include (or require) the full LZO source code just because you + want to add a little bit of data compression to your application. + + miniLZO implements the LZO1X-1 compressor and both the standard and + safe LZO1X decompressor. Apart from fast compression it also useful + for situations where you want to use pre-compressed data files (which + must have been compressed with LZO1X-999). + + miniLZO consists of one C source file and two header files: + minilzo.c + minilzo.h + lzoconf.h + + To use miniLZO just copy these files into your source directory, add + minilzo.c to your Makefile and #include minilzo.h from your program. + Note: you also must distribute this file (`README.LZO') with your project. + + minilzo.o compiles to about 6 kB (using gcc or Watcom C on a i386), and + the sources are about 14 kB when packed with zip - so there's no more + excuse that your application doesn't support data compression :-) + + For more information, documentation, example programs and other support + files (like Makefiles and build scripts) please download the full LZO + package from + http://wildsau.idv.uni-linz.ac.at/mfx/lzo.html + + Have fun, + Markus + + + P.S. minilzo.c is generated automatically from the LZO sources and + therefore functionality is completely identical + + + Appendix A: building miniLZO + ---------------------------- + miniLZO is written such a way that it should compile and run + out-of-the-box on most machines. + + If you are running on a very unusual architecture and lzo_init() fails then + you should first recompile with `-DLZO_DEBUG' to see what causes the failure. + The most probable case is something like `sizeof(char *) != sizeof(long)'. + After identifying the problem you can compile by adding some defines + like `-DSIZEOF_CHAR_P=8' to your Makefile. + + The best solution is (of course) using Autoconf - if your project uses + Autoconf anyway just add `-DMINILZO_HAVE_CONFIG_H' to your compiler + flags when compiling minilzo.c. See the LZO distribution for an example + how to set up configure.in. + + + Appendix B: list of public functions available in miniLZO + --------------------------------------------------------- + Library initialization + lzo_init() + + Compression + lzo1x_1_compress() + + Decompression + lzo1x_decompress() + lzo1x_decompress_safe() + + Checksum functions + lzo_adler32() + + Version functions + lzo_version() + lzo_version_string() + lzo_version_date() + + Portable (but slow) string functions + lzo_memcmp() + lzo_memcpy() + lzo_memmove() + lzo_memset() + + + Appendix C: suggested macros for `configure.in' when using Autoconf + ------------------------------------------------------------------- + Checks for typedefs and structures + AC_CHECK_TYPE(ptrdiff_t,long) + AC_TYPE_SIZE_T + AC_CHECK_SIZEOF(unsigned short) + AC_CHECK_SIZEOF(unsigned) + AC_CHECK_SIZEOF(unsigned long) + AC_CHECK_SIZEOF(char *) + AC_CHECK_SIZEOF(ptrdiff_t) + AC_CHECK_SIZEOF(size_t) + + Checks for compiler characteristics + AC_C_CONST + + Checks for library functions + AC_CHECK_FUNCS(memcmp memcpy memmove memset) + + + Appendix D: Copyright + --------------------- + LZO and miniLZO are Copyright (C) 1996-1999 + Markus Franz Xaver Johannes Oberhumer + + LZO and miniLZO are distributed under the terms of the GNU General + Public License (GPL). See the file COPYING. + + Special licenses for commercial and other applications which + are not willing to accept the GNU General Public License + are available by contacting the author. + + + + +-----BEGIN PGP SIGNATURE----- +Version: 2.6.3ia +Charset: noconv + +iQCVAwUBOEK5Km10fyLu8beJAQE2oAQAovSZ1KDXJKdbfUmGHhRAoU/BdQXydYKr +tGDtC0i8EfC2cjrbJANbZq8GQM0PMZSAgyW9/BaUmRZ/d5pxpF0eBBpUp87i/ZM6 +BoPE3uu7Rwu05SSR3FRFe1lCrMDn/yHkyV9T+DUY6XaBLONdaPh7BayQ93MnCFoD +9gs3grhALsM= +=uuXN +-----END PGP SIGNATURE----- diff --git a/MODEM/SRCS/dcload-serial/minilzo.106/lzoconf.h b/MODEM/SRCS/dcload-serial/minilzo.106/lzoconf.h new file mode 100644 index 00000000..6065cb51 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/minilzo.106/lzoconf.h @@ -0,0 +1,369 @@ +/* lzoconf.h -- configuration for the LZO real-time data compression library + + This file is part of the LZO real-time data compression library. + + Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer + + The LZO library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + The LZO library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the LZO library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + Markus F.X.J. Oberhumer + + http://wildsau.idv.uni-linz.ac.at/mfx/lzo.html + */ + + +#ifndef __LZOCONF_H +#define __LZOCONF_H + +#define LZO_VERSION 0x1060 +#define LZO_VERSION_STRING "1.06" +#define LZO_VERSION_DATE "Nov 29 1999" + +/* internal Autoconf configuration file - only used when building LZO */ +#if defined(LZO_HAVE_CONFIG_H) +# include +#endif +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +/*********************************************************************** +// LZO requires a conforming +************************************************************************/ + +#if !defined(CHAR_BIT) || (CHAR_BIT != 8) +# error "invalid CHAR_BIT" +#endif +#if !defined(UCHAR_MAX) || !defined(UINT_MAX) || !defined(ULONG_MAX) +# error "check your compiler installation" +#endif +#if (USHRT_MAX < 1 ) || (UINT_MAX < 1) || (ULONG_MAX < 1) +# error "your limits.h macros are broken" +#endif + +/* workaround a cpp bug under hpux 10.20 */ +#define LZO_0xffffffffL 4294967295ul + + +/*********************************************************************** +// architecture defines +************************************************************************/ + +#if !defined(__LZO_WIN) && !defined(__LZO_DOS) && !defined(__LZO_OS2) +# if defined(__WINDOWS__) || defined(_WINDOWS) || defined(_Windows) +# define __LZO_WIN +# elif defined(__WIN32__) || defined(_WIN32) || defined(WIN32) +# define __LZO_WIN +# elif defined(__NT__) || defined(__NT_DLL__) || defined(__WINDOWS_386__) +# define __LZO_WIN +# elif defined(__DOS__) || defined(__MSDOS__) || defined(MSDOS) +# define __LZO_DOS +# elif defined(__OS2__) || defined(__OS2V2__) || defined(OS2) +# define __LZO_OS2 +# elif defined(__palmos__) +# define __LZO_PALMOS +# elif defined(__TOS__) || defined(__atarist__) +# define __LZO_TOS +# endif +#endif + +#if (UINT_MAX < LZO_0xffffffffL) +# if defined(__LZO_WIN) +# define __LZO_WIN16 +# elif defined(__LZO_DOS) +# define __LZO_DOS16 +# elif defined(__LZO_PALMOS) +# define __LZO_PALMOS16 +# elif defined(__LZO_TOS) +# define __LZO_TOS16 +# elif defined(__C166__) +# else +# error "16-bit target not supported - contact me for porting hints" +# endif +#endif + +#if !defined(__LZO_i386) +# if defined(__LZO_DOS) || defined(__LZO_WIN16) +# define __LZO_i386 +# elif defined(__i386__) || defined(__386__) || defined(_M_IX86) +# define __LZO_i386 +# endif +#endif + +#if defined(__LZO_STRICT_16BIT) +# if (UINT_MAX < LZO_0xffffffffL) +# include +# endif +#endif + + +/*********************************************************************** +// integral and pointer types +************************************************************************/ + +/* Integral types with 32 bits or more */ +#if !defined(LZO_UINT32_MAX) +# if (UINT_MAX >= LZO_0xffffffffL) + typedef unsigned int lzo_uint32; + typedef int lzo_int32; +# define LZO_UINT32_MAX UINT_MAX +# define LZO_INT32_MAX INT_MAX +# define LZO_INT32_MIN INT_MIN +# elif (ULONG_MAX >= LZO_0xffffffffL) + typedef unsigned long lzo_uint32; + typedef long lzo_int32; +# define LZO_UINT32_MAX ULONG_MAX +# define LZO_INT32_MAX LONG_MAX +# define LZO_INT32_MIN LONG_MIN +# else +# error "lzo_uint32" +# endif +#endif + +/* lzo_uint is used like size_t */ +#if !defined(LZO_UINT_MAX) +# if (UINT_MAX >= LZO_0xffffffffL) + typedef unsigned int lzo_uint; + typedef int lzo_int; +# define LZO_UINT_MAX UINT_MAX +# define LZO_INT_MAX INT_MAX +# define LZO_INT_MIN INT_MIN +# elif (ULONG_MAX >= LZO_0xffffffffL) + typedef unsigned long lzo_uint; + typedef long lzo_int; +# define LZO_UINT_MAX ULONG_MAX +# define LZO_INT_MAX LONG_MAX +# define LZO_INT_MIN LONG_MIN +# else +# error "lzo_uint" +# endif +#endif + + +/* Memory model that allows to access memory at offsets of lzo_uint. */ +#if !defined(__LZO_MMODEL) +# if (LZO_UINT_MAX <= UINT_MAX) +# define __LZO_MMODEL +# elif defined(__LZO_DOS16) || defined(__LZO_WIN16) +# define __LZO_MMODEL __huge +# define LZO_999_UNSUPPORTED +# elif defined(__LZO_PALMOS16) || defined(__LZO_TOS16) +# define __LZO_MMODEL +# else +# error "__LZO_MMODEL" +# endif +#endif + +/* no typedef here because of const-pointer issues */ +#define lzo_byte unsigned char __LZO_MMODEL +#define lzo_bytep unsigned char __LZO_MMODEL * +#define lzo_charp char __LZO_MMODEL * +#define lzo_voidp void __LZO_MMODEL * +#define lzo_shortp short __LZO_MMODEL * +#define lzo_ushortp unsigned short __LZO_MMODEL * +#define lzo_uint32p lzo_uint32 __LZO_MMODEL * +#define lzo_int32p lzo_int32 __LZO_MMODEL * +#define lzo_uintp lzo_uint __LZO_MMODEL * +#define lzo_intp lzo_int __LZO_MMODEL * +#define lzo_voidpp lzo_voidp __LZO_MMODEL * +#define lzo_bytepp lzo_bytep __LZO_MMODEL * + +typedef int lzo_bool; + +#ifndef lzo_sizeof_dict_t +# define lzo_sizeof_dict_t sizeof(lzo_bytep) +#endif + + +/*********************************************************************** +// function types +************************************************************************/ + +/* linkage */ +#if !defined(__LZO_EXTERN_C) +# ifdef __cplusplus +# define __LZO_EXTERN_C extern "C" +# else +# define __LZO_EXTERN_C extern +# endif +#endif + +/* calling conventions */ +#if !defined(__LZO_CDECL) +# if defined(__LZO_DOS16) || defined(__LZO_WIN16) +# define __LZO_CDECL __far __cdecl +# elif defined(__LZO_i386) && defined(_MSC_VER) +# define __LZO_CDECL __cdecl +# elif defined(__LZO_i386) && defined(__WATCOMC__) +# define __LZO_CDECL __near __cdecl +# else +# define __LZO_CDECL +# endif +#endif +#if !defined(__LZO_ENTRY) +# define __LZO_ENTRY __LZO_CDECL +#endif + +/* DLL export information */ +#if !defined(__LZO_EXPORT1) +# define __LZO_EXPORT1 +#endif +#if !defined(__LZO_EXPORT2) +# define __LZO_EXPORT2 +#endif + +/* calling convention for C functions */ +#if !defined(LZO_PUBLIC) +# define LZO_PUBLIC(_rettype) __LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_ENTRY +#endif +#if !defined(LZO_EXTERN) +# define LZO_EXTERN(_rettype) __LZO_EXTERN_C LZO_PUBLIC(_rettype) +#endif +#if !defined(LZO_PRIVATE) +# define LZO_PRIVATE(_rettype) static _rettype __LZO_ENTRY +#endif + +/* cdecl calling convention for assembler functions */ +#if !defined(LZO_PUBLIC_CDECL) +# define LZO_PUBLIC_CDECL(_rettype) \ + __LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_CDECL +#endif +#if !defined(LZO_EXTERN_CDECL) +# define LZO_EXTERN_CDECL(_rettype) __LZO_EXTERN_C LZO_PUBLIC_CDECL(_rettype) +#endif + + +typedef int +(__LZO_ENTRY *lzo_compress_t) ( const lzo_byte *src, lzo_uint src_len, + lzo_byte *dst, lzo_uint *dst_len, + lzo_voidp wrkmem ); + +typedef int +(__LZO_ENTRY *lzo_decompress_t) ( const lzo_byte *src, lzo_uint src_len, + lzo_byte *dst, lzo_uint *dst_len, + lzo_voidp wrkmem ); + +typedef int +(__LZO_ENTRY *lzo_optimize_t) ( lzo_byte *src, lzo_uint src_len, + lzo_byte *dst, lzo_uint *dst_len, + lzo_voidp wrkmem ); + +typedef int +(__LZO_ENTRY *lzo_compress_dict_t)(const lzo_byte *src, lzo_uint src_len, + lzo_byte *dst, lzo_uint *dst_len, + lzo_voidp wrkmem, + const lzo_byte *dict, lzo_uint dict_len ); + +typedef int +(__LZO_ENTRY *lzo_decompress_dict_t)(const lzo_byte *src, lzo_uint src_len, + lzo_byte *dst, lzo_uint *dst_len, + lzo_voidp wrkmem, + const lzo_byte *dict, lzo_uint dict_len ); + + +/* a progress indicator callback function */ +typedef void (__LZO_ENTRY *lzo_progress_callback_t) (lzo_uint, lzo_uint); + + +/*********************************************************************** +// error codes and prototypes +************************************************************************/ + +/* Error codes for the compression/decompression functions. Negative + * values are errors, positive values will be used for special but + * normal events. + */ +#define LZO_E_OK 0 +#define LZO_E_ERROR (-1) +#define LZO_E_OUT_OF_MEMORY (-2) /* not used right now */ +#define LZO_E_NOT_COMPRESSIBLE (-3) /* not used right now */ +#define LZO_E_INPUT_OVERRUN (-4) +#define LZO_E_OUTPUT_OVERRUN (-5) +#define LZO_E_LOOKBEHIND_OVERRUN (-6) +#define LZO_E_EOF_NOT_FOUND (-7) +#define LZO_E_INPUT_NOT_CONSUMED (-8) + + +/* lzo_init() should be the first function you call. + * Check the return code ! + * + * lzo_init() is a macro to allow checking that the library and the + * compiler's view of various types are consistent. + */ +#define lzo_init() __lzo_init2(LZO_VERSION,(int)sizeof(short),(int)sizeof(int),\ + (int)sizeof(long),(int)sizeof(lzo_uint32),(int)sizeof(lzo_uint),\ + (int)lzo_sizeof_dict_t,(int)sizeof(char *),(int)sizeof(lzo_voidp),\ + (int)sizeof(lzo_compress_t)) +LZO_EXTERN(int) __lzo_init2(unsigned,int,int,int,int,int,int,int,int,int); + +/* version functions (useful for shared libraries) */ +LZO_EXTERN(unsigned) lzo_version(void); +LZO_EXTERN(const char *) lzo_version_string(void); +LZO_EXTERN(const char *) lzo_version_date(void); +LZO_EXTERN(const lzo_charp) _lzo_version_string(void); +LZO_EXTERN(const lzo_charp) _lzo_version_date(void); + +/* string functions */ +LZO_EXTERN(int) +lzo_memcmp(const lzo_voidp _s1, const lzo_voidp _s2, lzo_uint _len); +LZO_EXTERN(lzo_voidp) +lzo_memcpy(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len); +LZO_EXTERN(lzo_voidp) +lzo_memmove(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len); +LZO_EXTERN(lzo_voidp) +lzo_memset(lzo_voidp _s, int _c, lzo_uint _len); + +/* checksum functions */ +LZO_EXTERN(lzo_uint32) +lzo_adler32(lzo_uint32 _adler, const lzo_byte *_buf, lzo_uint _len); +LZO_EXTERN(lzo_uint32) +lzo_crc32(lzo_uint32 _c, const lzo_byte *_buf, lzo_uint _len); + +/* memory allocation functions */ +LZO_EXTERN(lzo_bytep) lzo_alloc(lzo_uint _nelems, lzo_uint _size); +LZO_EXTERN(lzo_bytep) lzo_malloc(lzo_uint _size); +LZO_EXTERN(void) lzo_free(lzo_voidp _ptr); + +extern lzo_bytep (__LZO_ENTRY *lzo_alloc_hook) (lzo_uint,lzo_uint); +extern void (__LZO_ENTRY *lzo_free_hook) (lzo_voidp); + +/* misc. */ +LZO_EXTERN(lzo_bool) lzo_assert(int _expr); +LZO_EXTERN(int) _lzo_config_check(void); +typedef union { lzo_bytep p; lzo_uint u; } __lzo_pu_u; +typedef union { lzo_bytep p; lzo_uint32 u32; } __lzo_pu32_u; + +/* align a char pointer on a boundary that is a multiple of `size' */ +LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp _ptr, lzo_uint _size); +#define LZO_PTR_ALIGN_UP(_ptr,_size) \ + ((_ptr) + (lzo_uint) __lzo_align_gap((const lzo_voidp)(_ptr),(lzo_uint)(_size))) + +/* deprecated - only for backward compatibility */ +#define LZO_ALIGN(_ptr,_size) LZO_PTR_ALIGN_UP(_ptr,_size) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* already included */ + diff --git a/MODEM/SRCS/dcload-serial/minilzo.106/minilzo.c b/MODEM/SRCS/dcload-serial/minilzo.106/minilzo.c new file mode 100644 index 00000000..0a01e8ca --- /dev/null +++ b/MODEM/SRCS/dcload-serial/minilzo.106/minilzo.c @@ -0,0 +1,2846 @@ +/* minilzo.c -- mini subset of the LZO real-time data compression library + + This file is part of the LZO real-time data compression library. + + Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer + + The LZO library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + The LZO library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the LZO library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + Markus F.X.J. Oberhumer + + http://wildsau.idv.uni-linz.ac.at/mfx/lzo.html + */ + +/* + * NOTE: + * the full LZO package can be found at + * http://wildsau.idv.uni-linz.ac.at/mfx/lzo.html + */ + +#define __LZO_IN_MINILZO + +#ifdef MINILZO_HAVE_CONFIG_H +# include +#endif + +#undef LZO_HAVE_CONFIG_H +#include "minilzo.h" + +#if !defined(MINILZO_VERSION) || (MINILZO_VERSION != 0x1060) +# error "version mismatch in miniLZO source files" +#endif + +#ifdef MINILZO_HAVE_CONFIG_H +# define LZO_HAVE_CONFIG_H +#endif + +#if !defined(LZO_NO_SYS_TYPES_H) +# include +#endif +#include + +#ifndef __LZO_CONF_H +#define __LZO_CONF_H + +#if !defined(__LZO_IN_MINILZO) +# ifndef __LZOCONF_H +# include +# endif +#endif + +#if !defined(LZO_HAVE_CONFIG_H) +# include +# include +# if !defined(NO_STDLIB_H) +# include +# endif +# define HAVE_MEMCMP +# define HAVE_MEMCPY +# define HAVE_MEMMOVE +# define HAVE_MEMSET +#else +# include +# if defined(STDC_HEADERS) +# include +# include +# endif +# if defined(HAVE_STDDEF_H) +# include +# endif +# if defined(HAVE_MEMORY_H) +# include +# endif +#endif + +#if defined(__LZO_DOS16) || defined(__LZO_WIN16) +# define HAVE_MALLOC_H +# define HAVE_HALLOC +#endif + +#undef NDEBUG +#if !defined(LZO_DEBUG) +# define NDEBUG +#endif +#if defined(LZO_DEBUG) || !defined(NDEBUG) +# if !defined(NO_STDIO_H) +# include +# endif +#endif +#include + +#if defined(__BOUNDS_CHECKING_ON) +# include +#else +# define BOUNDS_CHECKING_OFF_DURING(stmt) stmt +# define BOUNDS_CHECKING_OFF_IN_EXPR(expr) (expr) +#endif + +#if !defined(LZO_UNUSED) +# define LZO_UNUSED(parm) (parm = parm) +#endif + +#if !defined(__inline__) && !defined(__GNUC__) +# if defined(__cplusplus) +# define __inline__ inline +# else +# define __inline__ +# endif +#endif + +#if defined(NO_MEMCMP) +# undef HAVE_MEMCMP +#endif + +#if !defined(HAVE_MEMCMP) +# undef memcmp +# define memcmp lzo_memcmp +#endif +#if !defined(HAVE_MEMCPY) +# undef memcpy +# define memcpy lzo_memcpy +#endif +#if !defined(HAVE_MEMMOVE) +# undef memmove +# define memmove lzo_memmove +#endif +#if !defined(HAVE_MEMSET) +# undef memset +# define memset lzo_memset +#endif + +#if 1 +# define LZO_BYTE(x) ((unsigned char) (x)) +#else +# define LZO_BYTE(x) ((unsigned char) ((x) & 0xff)) +#endif +#if 0 +# define LZO_USHORT(x) ((unsigned short) (x)) +#else +# define LZO_USHORT(x) ((unsigned short) ((x) & 0xffff)) +#endif + +#define LZO_MAX(a,b) ((a) >= (b) ? (a) : (b)) +#define LZO_MIN(a,b) ((a) <= (b) ? (a) : (b)) +#define LZO_MAX3(a,b,c) ((a) >= (b) ? LZO_MAX(a,c) : LZO_MAX(b,c)) +#define LZO_MIN3(a,b,c) ((a) <= (b) ? LZO_MIN(a,c) : LZO_MIN(b,c)) + +#define lzo_sizeof(type) ((lzo_uint) (sizeof(type))) + +#define LZO_HIGH(array) ((lzo_uint) (sizeof(array)/sizeof(*(array)))) + +#define LZO_SIZE(bits) (1u << (bits)) +#define LZO_MASK(bits) (LZO_SIZE(bits) - 1) + +#define LZO_LSIZE(bits) (1ul << (bits)) +#define LZO_LMASK(bits) (LZO_LSIZE(bits) - 1) + +#define LZO_USIZE(bits) ((lzo_uint) 1 << (bits)) +#define LZO_UMASK(bits) (LZO_USIZE(bits) - 1) + +#define LZO_STYPE_MAX(b) (((1l << (8*(b)-2)) - 1l) + (1l << (8*(b)-2))) +#define LZO_UTYPE_MAX(b) (((1ul << (8*(b)-1)) - 1ul) + (1ul << (8*(b)-1))) + +#if !defined(SIZEOF_UNSIGNED) +# if (UINT_MAX == 0xffff) +# define SIZEOF_UNSIGNED 2 +# elif (UINT_MAX == LZO_0xffffffffL) +# define SIZEOF_UNSIGNED 4 +# elif (UINT_MAX >= LZO_0xffffffffL) +# define SIZEOF_UNSIGNED 8 +# else +# error SIZEOF_UNSIGNED +# endif +#endif + +#if !defined(SIZEOF_UNSIGNED_LONG) +# if (ULONG_MAX == LZO_0xffffffffL) +# define SIZEOF_UNSIGNED_LONG 4 +# elif (ULONG_MAX >= LZO_0xffffffffL) +# define SIZEOF_UNSIGNED_LONG 8 +# else +# error SIZEOF_UNSIGNED_LONG +# endif +#endif + +#if !defined(SIZEOF_SIZE_T) +# define SIZEOF_SIZE_T SIZEOF_UNSIGNED +#endif +#if !defined(SIZE_T_MAX) +# define SIZE_T_MAX LZO_UTYPE_MAX(SIZEOF_SIZE_T) +#endif + +#if 1 && defined(__LZO_i386) && (UINT_MAX == LZO_0xffffffffL) +# if !defined(LZO_UNALIGNED_OK_2) && (USHRT_MAX == 0xffff) +# define LZO_UNALIGNED_OK_2 +# endif +# if !defined(LZO_UNALIGNED_OK_4) && (LZO_UINT32_MAX == LZO_0xffffffffL) +# define LZO_UNALIGNED_OK_4 +# endif +#endif + +#if defined(LZO_UNALIGNED_OK_2) || defined(LZO_UNALIGNED_OK_4) +# if !defined(LZO_UNALIGNED_OK) +# define LZO_UNALIGNED_OK +# endif +#endif + +#if defined(__LZO_NO_UNALIGNED) +# undef LZO_UNALIGNED_OK +# undef LZO_UNALIGNED_OK_2 +# undef LZO_UNALIGNED_OK_4 +#endif + +#if defined(LZO_UNALIGNED_OK_2) && (USHRT_MAX != 0xffff) +# error "LZO_UNALIGNED_OK_2 must not be defined on this system" +#endif +#if defined(LZO_UNALIGNED_OK_4) && (LZO_UINT32_MAX != LZO_0xffffffffL) +# error "LZO_UNALIGNED_OK_4 must not be defined on this system" +#endif + +#if defined(__LZO_NO_ALIGNED) +# undef LZO_ALIGNED_OK_4 +#endif + +#if defined(LZO_ALIGNED_OK_4) && (LZO_UINT32_MAX != LZO_0xffffffffL) +# error "LZO_ALIGNED_OK_4 must not be defined on this system" +#endif + +#define LZO_LITTLE_ENDIAN 1234 +#define LZO_BIG_ENDIAN 4321 +#define LZO_PDP_ENDIAN 3412 + +#if !defined(LZO_BYTE_ORDER) +# if defined(MFX_BYTE_ORDER) +# define LZO_BYTE_ORDER MFX_BYTE_ORDER +# elif defined(__LZO_i386) +# define LZO_BYTE_ORDER LZO_LITTLE_ENDIAN +# elif defined(BYTE_ORDER) +# define LZO_BYTE_ORDER BYTE_ORDER +# elif defined(__BYTE_ORDER) +# define LZO_BYTE_ORDER __BYTE_ORDER +# endif +#endif + +#if defined(LZO_BYTE_ORDER) +# if (LZO_BYTE_ORDER != LZO_LITTLE_ENDIAN) && \ + (LZO_BYTE_ORDER != LZO_BIG_ENDIAN) +# error "invalid LZO_BYTE_ORDER" +# endif +#endif + +#if defined(LZO_UNALIGNED_OK) && !defined(LZO_BYTE_ORDER) +# error "LZO_BYTE_ORDER is not defined" +#endif + +#define LZO_OPTIMIZE_GNUC_i386_IS_BUGGY + +#if defined(NDEBUG) && !defined(LZO_DEBUG) && !defined(__BOUNDS_CHECKING_ON) +# if defined(__GNUC__) && defined(__i386__) +# if !defined(LZO_OPTIMIZE_GNUC_i386_IS_BUGGY) +# define LZO_OPTIMIZE_GNUC_i386 +# endif +# endif +#endif + +__LZO_EXTERN_C int __lzo_init_done; +__LZO_EXTERN_C const lzo_byte __lzo_copyright[]; +LZO_EXTERN(const lzo_byte *) lzo_copyright(void); +__LZO_EXTERN_C const lzo_uint32 _lzo_crc32_table[256]; + +#define _LZO_STRINGIZE(x) #x +#define _LZO_MEXPAND(x) _LZO_STRINGIZE(x) + +#define _LZO_CONCAT2(a,b) a ## b +#define _LZO_CONCAT3(a,b,c) a ## b ## c +#define _LZO_CONCAT4(a,b,c,d) a ## b ## c ## d +#define _LZO_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e + +#define _LZO_ECONCAT2(a,b) _LZO_CONCAT2(a,b) +#define _LZO_ECONCAT3(a,b,c) _LZO_CONCAT3(a,b,c) +#define _LZO_ECONCAT4(a,b,c,d) _LZO_CONCAT4(a,b,c,d) +#define _LZO_ECONCAT5(a,b,c,d,e) _LZO_CONCAT5(a,b,c,d,e) + +#if 0 + +#define __LZO_IS_COMPRESS_QUERY(i,il,o,ol,w) ((lzo_voidp)(o) == (w)) +#define __LZO_QUERY_COMPRESS(i,il,o,ol,w,n,s) \ + (*ol = (n)*(s), LZO_E_OK) + +#define __LZO_IS_DECOMPRESS_QUERY(i,il,o,ol,w) ((lzo_voidp)(o) == (w)) +#define __LZO_QUERY_DECOMPRESS(i,il,o,ol,w,n,s) \ + (*ol = (n)*(s), LZO_E_OK) + +#define __LZO_IS_OPTIMIZE_QUERY(i,il,o,ol,w) ((lzo_voidp)(o) == (w)) +#define __LZO_QUERY_OPTIMIZE(i,il,o,ol,w,n,s) \ + (*ol = (n)*(s), LZO_E_OK) + +#endif + +#ifndef __LZO_PTR_H +#define __LZO_PTR_H + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__LZO_DOS16) || defined(__LZO_WIN16) +# include +# if 1 && defined(__WATCOMC__) +# include + __LZO_EXTERN_C unsigned char _HShift; +# define __LZO_HShift _HShift +# elif 1 && defined(_MSC_VER) + __LZO_EXTERN_C unsigned short __near _AHSHIFT; +# define __LZO_HShift ((unsigned) &_AHSHIFT) +# elif defined(__LZO_WIN16) +# define __LZO_HShift 3 +# else +# define __LZO_HShift 12 +# endif +# if !defined(_FP_SEG) && defined(FP_SEG) +# define _FP_SEG FP_SEG +# endif +# if !defined(_FP_OFF) && defined(FP_OFF) +# define _FP_OFF FP_OFF +# endif +#endif + +#if (UINT_MAX >= LZO_0xffffffffL) + typedef ptrdiff_t lzo_ptrdiff_t; +#else + typedef long lzo_ptrdiff_t; +#endif + +#if !defined(__LZO_HAVE_PTR_T) +# if defined(lzo_ptr_t) +# define __LZO_HAVE_PTR_T +# endif +#endif +#if !defined(__LZO_HAVE_PTR_T) +# if defined(SIZEOF_CHAR_P) && defined(SIZEOF_UNSIGNED_LONG) +# if (SIZEOF_CHAR_P == SIZEOF_UNSIGNED_LONG) + typedef unsigned long lzo_ptr_t; + typedef long lzo_sptr_t; +# define __LZO_HAVE_PTR_T +# endif +# endif +#endif +#if !defined(__LZO_HAVE_PTR_T) +# if defined(SIZEOF_CHAR_P) && defined(SIZEOF_UNSIGNED) +# if (SIZEOF_CHAR_P == SIZEOF_UNSIGNED) + typedef unsigned int lzo_ptr_t; + typedef int lzo_sptr_t; +# define __LZO_HAVE_PTR_T +# endif +# endif +#endif +#if !defined(__LZO_HAVE_PTR_T) +# if defined(SIZEOF_CHAR_P) && defined(SIZEOF_UNSIGNED_SHORT) +# if (SIZEOF_CHAR_P == SIZEOF_UNSIGNED_SHORT) + typedef unsigned short lzo_ptr_t; + typedef short lzo_sptr_t; +# define __LZO_HAVE_PTR_T +# endif +# endif +#endif +#if !defined(__LZO_HAVE_PTR_T) +# if defined(LZO_HAVE_CONFIG_H) || defined(SIZEOF_CHAR_P) +# error "no suitable type for lzo_ptr_t" +# else + typedef unsigned long lzo_ptr_t; + typedef long lzo_sptr_t; +# define __LZO_HAVE_PTR_T +# endif +#endif + +#if defined(__LZO_DOS16) || defined(__LZO_WIN16) +#define PTR(a) ((lzo_bytep) (a)) +#define PTR_ALIGNED_4(a) ((_FP_OFF(a) & 3) == 0) +#define PTR_ALIGNED2_4(a,b) (((_FP_OFF(a) | _FP_OFF(b)) & 3) == 0) +#else +#define PTR(a) ((lzo_ptr_t) (a)) +#define PTR_LINEAR(a) PTR(a) +#define PTR_ALIGNED_4(a) ((PTR_LINEAR(a) & 3) == 0) +#define PTR_ALIGNED_8(a) ((PTR_LINEAR(a) & 7) == 0) +#define PTR_ALIGNED2_4(a,b) (((PTR_LINEAR(a) | PTR_LINEAR(b)) & 3) == 0) +#define PTR_ALIGNED2_8(a,b) (((PTR_LINEAR(a) | PTR_LINEAR(b)) & 7) == 0) +#endif + +#define PTR_LT(a,b) (PTR(a) < PTR(b)) +#define PTR_GE(a,b) (PTR(a) >= PTR(b)) +#define PTR_DIFF(a,b) ((lzo_ptrdiff_t) (PTR(a) - PTR(b))) + +LZO_EXTERN(lzo_ptr_t) +__lzo_ptr_linear(const lzo_voidp ptr); + +typedef union +{ + char a_char; + unsigned char a_uchar; + short a_short; + unsigned short a_ushort; + int a_int; + unsigned int a_uint; + long a_long; + unsigned long a_ulong; + lzo_int a_lzo_int; + lzo_uint a_lzo_uint; + lzo_int32 a_lzo_int32; + lzo_uint32 a_lzo_uint32; + ptrdiff_t a_ptrdiff_t; + lzo_ptrdiff_t a_lzo_ptrdiff_t; + lzo_ptr_t a_lzo_ptr_t; + char * a_charp; + lzo_bytep a_lzo_bytep; + lzo_bytepp a_lzo_bytepp; +} +lzo_align_t; + +#ifdef __cplusplus +} +#endif + +#endif + +#define LZO_DETERMINISTIC + +#define LZO_DICT_USE_PTR +#if defined(__LZO_DOS16) || defined(__LZO_WIN16) || defined(__LZO_STRICT_16BIT) +# undef LZO_DICT_USE_PTR +#endif + +#if defined(LZO_DICT_USE_PTR) +# define lzo_dict_t const lzo_bytep +# define lzo_dict_p lzo_dict_t __LZO_MMODEL * +#else +# define lzo_dict_t lzo_uint +# define lzo_dict_p lzo_dict_t __LZO_MMODEL * +#endif + +#if !defined(lzo_moff_t) +#define lzo_moff_t lzo_uint +#endif + +#endif + +LZO_PUBLIC(lzo_ptr_t) +__lzo_ptr_linear(const lzo_voidp ptr) +{ + lzo_ptr_t p; + +#if defined(__LZO_DOS16) || defined(__LZO_WIN16) + p = (((lzo_ptr_t)(_FP_SEG(ptr))) << (16 - __LZO_HShift)) + (_FP_OFF(ptr)); +#else + p = PTR_LINEAR(ptr); +#endif + + return p; +} + +LZO_PUBLIC(unsigned) +__lzo_align_gap(const lzo_voidp ptr, lzo_uint size) +{ + lzo_ptr_t p, s, n; + + assert(size > 0); + + p = __lzo_ptr_linear(ptr); + s = (lzo_ptr_t) (size - 1); +#if 0 + assert((size & (size - 1)) == 0); + n = ((p + s) & ~s) - p; +#else + n = (((p + s) / size) * size) - p; +#endif + + assert((long)n >= 0); + assert(n <= s); + + return (unsigned)n; +} + +#ifndef __LZO_UTIL_H +#define __LZO_UTIL_H + +#ifndef __LZO_CONF_H +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#if 1 && defined(HAVE_MEMCPY) +#if !defined(__LZO_DOS16) && !defined(__LZO_WIN16) + +#define MEMCPY8_DS(dest,src,len) \ + memcpy(dest,src,len); \ + dest += len; \ + src += len + +#endif +#endif + +#if 0 && !defined(MEMCPY8_DS) + +#define MEMCPY8_DS(dest,src,len) \ + { do { \ + *dest++ = *src++; \ + *dest++ = *src++; \ + *dest++ = *src++; \ + *dest++ = *src++; \ + *dest++ = *src++; \ + *dest++ = *src++; \ + *dest++ = *src++; \ + *dest++ = *src++; \ + len -= 8; \ + } while (len > 0); } + +#endif + +#if !defined(MEMCPY8_DS) + +#define MEMCPY8_DS(dest,src,len) \ + { register lzo_uint __l = (len) / 8; \ + do { \ + *dest++ = *src++; \ + *dest++ = *src++; \ + *dest++ = *src++; \ + *dest++ = *src++; \ + *dest++ = *src++; \ + *dest++ = *src++; \ + *dest++ = *src++; \ + *dest++ = *src++; \ + } while (--__l > 0); } + +#endif + +#define MEMCPY_DS(dest,src,len) \ + do *dest++ = *src++; \ + while (--len > 0) + +#define MEMMOVE_DS(dest,src,len) \ + do *dest++ = *src++; \ + while (--len > 0) + +#if 0 && defined(LZO_OPTIMIZE_GNUC_i386) + +#define BZERO8_PTR(s,l,n) \ +__asm__ __volatile__( \ + "movl %0,%%eax \n" \ + "movl %1,%%edi \n" \ + "movl %2,%%ecx \n" \ + "cld \n" \ + "rep \n" \ + "stosl %%eax,(%%edi) \n" \ + : \ + :"g" (0),"g" (s),"g" (n) \ + :"eax","edi","ecx", "memory", "cc" \ +) + +#elif (LZO_UINT_MAX <= SIZE_T_MAX) && defined(HAVE_MEMSET) + +#if 1 +#define BZERO8_PTR(s,l,n) memset((s),0,(lzo_uint)(l)*(n)) +#else +#define BZERO8_PTR(s,l,n) memset((lzo_voidp)(s),0,(lzo_uint)(l)*(n)) +#endif + +#else + +#define BZERO8_PTR(s,l,n) \ + lzo_memset((lzo_voidp)(s),0,(lzo_uint)(l)*(n)) + +#endif + +#if 0 +#if defined(__GNUC__) && defined(__i386__) + +unsigned char lzo_rotr8(unsigned char value, int shift); +extern __inline__ unsigned char lzo_rotr8(unsigned char value, int shift) +{ + unsigned char result; + + __asm__ __volatile__ ("movb %b1, %b0; rorb %b2, %b0" + : "=a"(result) : "g"(value), "c"(shift)); + return result; +} + +unsigned short lzo_rotr16(unsigned short value, int shift); +extern __inline__ unsigned short lzo_rotr16(unsigned short value, int shift) +{ + unsigned short result; + + __asm__ __volatile__ ("movw %b1, %b0; rorw %b2, %b0" + : "=a"(result) : "g"(value), "c"(shift)); + return result; +} + +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +LZO_PUBLIC(lzo_bool) +lzo_assert(int expr) +{ + return (expr) ? 1 : 0; +} + +/* If you use the LZO library in a product, you *must* keep this + * copyright string in the executable of your product. + */ + +const lzo_byte __lzo_copyright[] = +#if !defined(__LZO_IN_MINLZO) + LZO_VERSION_STRING; +#else + "\n\n\n" + "LZO real-time data compression library.\n" + "Copyright (C) 1996, 1997, 1998, 1999 Markus Franz Xaver Johannes Oberhumer\n" + "\n" + "http://wildsau.idv.uni-linz.ac.at/mfx/lzo.html\n" + "\n" + "LZO version: v" LZO_VERSION_STRING ", " LZO_VERSION_DATE "\n" + "LZO build date: " __DATE__ " " __TIME__ "\n\n" + "LZO special compilation options:\n" +#ifdef __cplusplus + " __cplusplus\n" +#endif +#if defined(__PIC__) + " __PIC__\n" +#elif defined(__pic__) + " __pic__\n" +#endif +#if (UINT_MAX < LZO_0xffffffffL) + " 16BIT\n" +#endif +#if defined(__LZO_STRICT_16BIT) + " __LZO_STRICT_16BIT\n" +#endif +#if (UINT_MAX > LZO_0xffffffffL) + " UINT_MAX=" _LZO_MEXPAND(UINT_MAX) "\n" +#endif +#if (ULONG_MAX > LZO_0xffffffffL) + " ULONG_MAX=" _LZO_MEXPAND(ULONG_MAX) "\n" +#endif +#if defined(LZO_BYTE_ORDER) + " LZO_BYTE_ORDER=" _LZO_MEXPAND(LZO_BYTE_ORDER) "\n" +#endif +#if defined(LZO_UNALIGNED_OK_2) + " LZO_UNALIGNED_OK_2\n" +#endif +#if defined(LZO_UNALIGNED_OK_4) + " LZO_UNALIGNED_OK_4\n" +#endif +#if defined(LZO_ALIGNED_OK_4) + " LZO_ALIGNED_OK_4\n" +#endif +#if defined(LZO_DICT_USE_PTR) + " LZO_DICT_USE_PTR\n" +#endif +#if defined(__LZO_QUERY_COMPRESS) + " __LZO_QUERY_COMPRESS\n" +#endif +#if defined(__LZO_QUERY_DECOMPRESS) + " __LZO_QUERY_DECOMPRESS\n" +#endif +#if defined(__LZO_IN_MINILZO) + " __LZO_IN_MINILZO\n" +#endif + "\n\n" + "$Id: LZO " LZO_VERSION_STRING " built " __DATE__ " " __TIME__ +#if defined(__GNUC__) && defined(__VERSION__) + " by gcc " __VERSION__ +#elif defined(__BORLANDC__) + " by Borland C " _LZO_MEXPAND(__BORLANDC__) +#elif defined(_MSC_VER) + " by Microsoft C " _LZO_MEXPAND(_MSC_VER) +#elif defined(__PUREC__) + " by Pure C " _LZO_MEXPAND(__PUREC__) +#elif defined(__SC__) + " by Symantec C " _LZO_MEXPAND(__SC__) +#elif defined(__TURBOC__) + " by Turbo C " _LZO_MEXPAND(__TURBOC__) +#elif defined(__WATCOMC__) + " by Watcom C " _LZO_MEXPAND(__WATCOMC__) +#endif + " $\n" + "$Copyright: LZO (C) 1996, 1997, 1998, 1999 Markus Franz Xaver Johannes Oberhumer $\n"; +#endif + +LZO_PUBLIC(const lzo_byte *) +lzo_copyright(void) +{ + return __lzo_copyright; +} + +LZO_PUBLIC(unsigned) +lzo_version(void) +{ + return LZO_VERSION; +} + +LZO_PUBLIC(const char *) +lzo_version_string(void) +{ + return LZO_VERSION_STRING; +} + +LZO_PUBLIC(const char *) +lzo_version_date(void) +{ + return LZO_VERSION_DATE; +} + +LZO_PUBLIC(const lzo_charp) +_lzo_version_string(void) +{ + return LZO_VERSION_STRING; +} + +LZO_PUBLIC(const lzo_charp) +_lzo_version_date(void) +{ + return LZO_VERSION_DATE; +} + +#define LZO_BASE 65521u +#define LZO_NMAX 5552 + +#define LZO_DO1(buf,i) {s1 += buf[i]; s2 += s1;} +#define LZO_DO2(buf,i) LZO_DO1(buf,i); LZO_DO1(buf,i+1); +#define LZO_DO4(buf,i) LZO_DO2(buf,i); LZO_DO2(buf,i+2); +#define LZO_DO8(buf,i) LZO_DO4(buf,i); LZO_DO4(buf,i+4); +#define LZO_DO16(buf,i) LZO_DO8(buf,i); LZO_DO8(buf,i+8); + +LZO_PUBLIC(lzo_uint32) +lzo_adler32(lzo_uint32 adler, const lzo_byte *buf, lzo_uint len) +{ + lzo_uint32 s1 = adler & 0xffff; + lzo_uint32 s2 = (adler >> 16) & 0xffff; + int k; + + if (buf == NULL) + return 1; + + while (len > 0) + { + k = len < LZO_NMAX ? (int) len : LZO_NMAX; + len -= k; + if (k >= 16) do + { + LZO_DO16(buf,0); + buf += 16; + k -= 16; + } while (k >= 16); + if (k != 0) do + { + s1 += *buf++; + s2 += s1; + } while (--k > 0); + s1 %= LZO_BASE; + s2 %= LZO_BASE; + } + return (s2 << 16) | s1; +} + +LZO_PUBLIC(int) +lzo_memcmp(const lzo_voidp s1, const lzo_voidp s2, lzo_uint len) +{ +#if (LZO_UINT_MAX <= SIZE_T_MAX) && defined(HAVE_MEMCMP) + return memcmp(s1,s2,len); +#else + const lzo_byte *p1 = (const lzo_byte *) s1; + const lzo_byte *p2 = (const lzo_byte *) s2; + int d; + + if (len > 0) do + { + d = *p1 - *p2; + if (d != 0) + return d; + p1++; + p2++; + } + while (--len > 0); + return 0; +#endif +} + +LZO_PUBLIC(lzo_voidp) +lzo_memcpy(lzo_voidp dest, const lzo_voidp src, lzo_uint len) +{ +#if (LZO_UINT_MAX <= SIZE_T_MAX) && defined(HAVE_MEMCPY) + return memcpy(dest,src,len); +#else + lzo_byte *p1 = (lzo_byte *) dest; + const lzo_byte *p2 = (const lzo_byte *) src; + + if (len <= 0 || p1 == p2) + return dest; + do + *p1++ = *p2++; + while (--len > 0); + return dest; +#endif +} + +LZO_PUBLIC(lzo_voidp) +lzo_memmove(lzo_voidp dest, const lzo_voidp src, lzo_uint len) +{ +#if (LZO_UINT_MAX <= SIZE_T_MAX) && defined(HAVE_MEMMOVE) + return memmove(dest,src,len); +#else + lzo_byte *p1 = (lzo_byte *) dest; + const lzo_byte *p2 = (const lzo_byte *) src; + + if (len <= 0 || p1 == p2) + return dest; + + if (p1 < p2) + { + do + *p1++ = *p2++; + while (--len > 0); + } + else + { + p1 += len; + p2 += len; + do + *--p1 = *--p2; + while (--len > 0); + } + return dest; +#endif +} + +LZO_PUBLIC(lzo_voidp) +lzo_memset(lzo_voidp s, int c, lzo_uint len) +{ +#if (LZO_UINT_MAX <= SIZE_T_MAX) && defined(HAVE_MEMSET) + return memset(s,c,len); +#else + lzo_byte *p = (lzo_byte *) s; + + if (len > 0) do + *p++ = LZO_BYTE(c); + while (--len > 0); + return s; +#endif +} + +#include + +#if 0 +# define IS_SIGNED(type) (((type) (1ul << (8 * sizeof(type) - 1))) < 0) +# define IS_UNSIGNED(type) (((type) (1ul << (8 * sizeof(type) - 1))) > 0) +#else +# define IS_SIGNED(type) (((type) (-1)) < ((type) 0)) +# define IS_UNSIGNED(type) (((type) (-1)) > ((type) 0)) +#endif + +static lzo_bool schedule_insns_bug(void); +static lzo_bool strength_reduce_bug(int *); + +#if 0 || defined(LZO_DEBUG) +static lzo_bool __lzo_assert_fail(const char *s, unsigned line) +{ +#if defined(__palmos__) + printf("LZO assertion failed in line %u: '%s'\n",line,s); +#else + fprintf(stderr,"LZO assertion failed in line %u: '%s'\n",line,s); +#endif + return 0; +} +# define __lzo_assert(x) ((x) ? 1 : __lzo_assert_fail(#x,__LINE__)) +#else +# define __lzo_assert(x) ((x) ? 1 : 0) +#endif + +static lzo_bool basic_integral_check(void) +{ + lzo_bool r = 1; + lzo_bool sanity; + + r &= __lzo_assert(CHAR_BIT == 8); + r &= __lzo_assert(sizeof(char) == 1); + r &= __lzo_assert(sizeof(short) >= 2); + r &= __lzo_assert(sizeof(long) >= 4); + r &= __lzo_assert(sizeof(int) >= sizeof(short)); + r &= __lzo_assert(sizeof(long) >= sizeof(int)); + + r &= __lzo_assert(sizeof(lzo_uint32) >= 4); + r &= __lzo_assert(sizeof(lzo_uint32) >= sizeof(unsigned)); +#if defined(__LZO_STRICT_16BIT) + r &= __lzo_assert(sizeof(lzo_uint) == 2); +#else + r &= __lzo_assert(sizeof(lzo_uint) >= 4); + r &= __lzo_assert(sizeof(lzo_uint) >= sizeof(unsigned)); +#endif + +#if defined(SIZEOF_UNSIGNED) + r &= __lzo_assert(SIZEOF_UNSIGNED == sizeof(unsigned)); +#endif +#if defined(SIZEOF_UNSIGNED_LONG) + r &= __lzo_assert(SIZEOF_UNSIGNED_LONG == sizeof(unsigned long)); +#endif +#if defined(SIZEOF_UNSIGNED_SHORT) + r &= __lzo_assert(SIZEOF_UNSIGNED_SHORT == sizeof(unsigned short)); +#endif +#if !defined(__LZO_IN_MINILZO) +#if defined(SIZEOF_SIZE_T) + r &= __lzo_assert(SIZEOF_SIZE_T == sizeof(size_t)); +#endif +#endif + + sanity = IS_UNSIGNED(unsigned short) && IS_UNSIGNED(unsigned) && + IS_UNSIGNED(unsigned long) && + IS_SIGNED(short) && IS_SIGNED(int) && IS_SIGNED(long); + if (sanity) + { + r &= __lzo_assert(IS_UNSIGNED(lzo_uint32)); + r &= __lzo_assert(IS_UNSIGNED(lzo_uint)); + r &= __lzo_assert(IS_SIGNED(lzo_int32)); + r &= __lzo_assert(IS_SIGNED(lzo_int)); + + r &= __lzo_assert(INT_MAX == LZO_STYPE_MAX(sizeof(int))); + r &= __lzo_assert(UINT_MAX == LZO_UTYPE_MAX(sizeof(unsigned))); + r &= __lzo_assert(LONG_MAX == LZO_STYPE_MAX(sizeof(long))); + r &= __lzo_assert(ULONG_MAX == LZO_UTYPE_MAX(sizeof(unsigned long))); + r &= __lzo_assert(SHRT_MAX == LZO_STYPE_MAX(sizeof(short))); + r &= __lzo_assert(USHRT_MAX == LZO_UTYPE_MAX(sizeof(unsigned short))); + r &= __lzo_assert(LZO_UINT32_MAX == LZO_UTYPE_MAX(sizeof(lzo_uint32))); + r &= __lzo_assert(LZO_UINT_MAX == LZO_UTYPE_MAX(sizeof(lzo_uint))); +#if !defined(__LZO_IN_MINILZO) + r &= __lzo_assert(SIZE_T_MAX == LZO_UTYPE_MAX(sizeof(size_t))); +#endif + } + +#if 0 + r &= __lzo_assert(LZO_BYTE(257) == 1); + r &= __lzo_assert(LZO_USHORT(65537L) == 1); +#endif + + return r; +} + +static lzo_bool basic_ptr_check(void) +{ + lzo_bool r = 1; + lzo_bool sanity; + + r &= __lzo_assert(sizeof(char *) >= sizeof(int)); + r &= __lzo_assert(sizeof(lzo_byte *) >= sizeof(char *)); + + r &= __lzo_assert(sizeof(lzo_voidp) == sizeof(lzo_byte *)); + r &= __lzo_assert(sizeof(lzo_voidp) == sizeof(lzo_voidpp)); + r &= __lzo_assert(sizeof(lzo_voidp) == sizeof(lzo_bytepp)); + r &= __lzo_assert(sizeof(lzo_voidp) >= sizeof(lzo_uint)); + + r &= __lzo_assert(sizeof(lzo_ptr_t) == sizeof(lzo_voidp)); + r &= __lzo_assert(sizeof(lzo_ptr_t) >= sizeof(lzo_uint)); + + r &= __lzo_assert(sizeof(lzo_ptrdiff_t) >= 4); + r &= __lzo_assert(sizeof(lzo_ptrdiff_t) >= sizeof(ptrdiff_t)); + +#if defined(SIZEOF_CHAR_P) + r &= __lzo_assert(SIZEOF_CHAR_P == sizeof(char *)); +#endif +#if defined(SIZEOF_PTRDIFF_T) + r &= __lzo_assert(SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t)); +#endif + + sanity = IS_UNSIGNED(unsigned short) && IS_UNSIGNED(unsigned) && + IS_UNSIGNED(unsigned long) && + IS_SIGNED(short) && IS_SIGNED(int) && IS_SIGNED(long); + if (sanity) + { + r &= __lzo_assert(IS_UNSIGNED(lzo_ptr_t)); + r &= __lzo_assert(IS_UNSIGNED(lzo_moff_t)); + r &= __lzo_assert(IS_SIGNED(lzo_ptrdiff_t)); + r &= __lzo_assert(IS_SIGNED(lzo_sptr_t)); + } + + return r; +} + +static lzo_bool ptr_check(void) +{ + lzo_bool r = 1; + int i; + char _wrkmem[10 * sizeof(lzo_byte *) + sizeof(lzo_align_t)]; + lzo_byte *wrkmem; + const lzo_bytepp dict; + unsigned char x[4 * sizeof(lzo_align_t)]; + long d; + lzo_align_t a; + + for (i = 0; i < (int) sizeof(x); i++) + x[i] = LZO_BYTE(i); + + wrkmem = (lzo_byte *) LZO_PTR_ALIGN_UP(_wrkmem,sizeof(lzo_align_t)); + dict = (const lzo_bytepp) wrkmem; + + d = (long) ((const lzo_bytep) dict - (const lzo_bytep) _wrkmem); + r &= __lzo_assert(d >= 0); + r &= __lzo_assert(d < (long) sizeof(lzo_align_t)); + + memset(&a,0xff,sizeof(a)); + r &= __lzo_assert(a.a_ushort == USHRT_MAX); + r &= __lzo_assert(a.a_uint == UINT_MAX); + r &= __lzo_assert(a.a_ulong == ULONG_MAX); + r &= __lzo_assert(a.a_lzo_uint == LZO_UINT_MAX); + + if (r == 1) + { + for (i = 0; i < 8; i++) + r &= __lzo_assert((const lzo_voidp) (&dict[i]) == (const lzo_voidp) (&wrkmem[i * sizeof(lzo_byte *)])); + } + + memset(&a,0,sizeof(a)); + r &= __lzo_assert(a.a_charp == NULL); + r &= __lzo_assert(a.a_lzo_bytep == NULL); + r &= __lzo_assert(NULL == 0); + if (r == 1) + { + for (i = 0; i < 10; i++) + dict[i] = wrkmem; + BZERO8_PTR(dict+1,sizeof(dict[0]),8); + r &= __lzo_assert(dict[0] == wrkmem); + for (i = 1; i < 9; i++) + r &= __lzo_assert(dict[i] == NULL); + r &= __lzo_assert(dict[9] == wrkmem); + } + + if (r == 1) + { + unsigned k = 1; + const unsigned n = (unsigned) sizeof(lzo_uint32); + lzo_byte *p0; + lzo_byte *p1; + + k += __lzo_align_gap(&x[k],n); + p0 = (lzo_bytep) &x[k]; +#if defined(PTR_LINEAR) + r &= __lzo_assert((PTR_LINEAR(p0) & (n-1)) == 0); +#else + r &= __lzo_assert(n == 4); + r &= __lzo_assert(PTR_ALIGNED_4(p0)); +#endif + + r &= __lzo_assert(k >= 1); + p1 = (lzo_bytep) &x[1]; + r &= __lzo_assert(PTR_GE(p0,p1)); + + r &= __lzo_assert(k < 1+n); + p1 = (lzo_bytep) &x[1+n]; + r &= __lzo_assert(PTR_LT(p0,p1)); + + if (r == 1) + { + lzo_uint32 v0 = * (lzo_uint32 *) &x[k]; + lzo_uint32 v1 = * (lzo_uint32 *) &x[k+n]; + + r &= __lzo_assert(v0 > 0); + r &= __lzo_assert(v1 > 0); + } + } + + return r; +} + +LZO_PUBLIC(int) +_lzo_config_check(void) +{ + lzo_bool r = 1; + int i; + union { + lzo_uint32 a; + unsigned short b; + lzo_uint32 aa[4]; + unsigned char x[4*sizeof(lzo_align_t)]; + } u; + +#if 0 + r &= __lzo_assert((const void *)&u == (const void *)&u.a); + r &= __lzo_assert((const void *)&u == (const void *)&u.b); + r &= __lzo_assert((const void *)&u == (const void *)&u.x[0]); + r &= __lzo_assert((const void *)&u == (const void *)&u.aa[0]); +#endif + + r &= basic_integral_check(); + r &= basic_ptr_check(); + if (r != 1) + return LZO_E_ERROR; + + for (i = 0; i < (int) sizeof(u.x); i++) + u.x[i] = LZO_BYTE(i); + +#if 0 + r &= __lzo_assert( (int) (unsigned char) ((char) -1) == 255); +#endif + +#if defined(LZO_BYTE_ORDER) + if (r == 1) + { +# if (LZO_BYTE_ORDER == LZO_LITTLE_ENDIAN) + lzo_uint32 a = (lzo_uint32) (u.a & LZO_0xffffffffL); + unsigned short b = (unsigned short) (u.b & 0xffff); + r &= __lzo_assert(a == 0x03020100L); + r &= __lzo_assert(b == 0x0100); +# elif (LZO_BYTE_ORDER == LZO_BIG_ENDIAN) + lzo_uint32 a = u.a >> (8 * sizeof(u.a) - 32); + unsigned short b = u.b >> (8 * sizeof(u.b) - 16); + r &= __lzo_assert(a == 0x00010203L); + r &= __lzo_assert(b == 0x0001); +# else +# error invalid LZO_BYTE_ORDER +# endif + } +#endif + +#if defined(LZO_UNALIGNED_OK_2) + r &= __lzo_assert(sizeof(short) == 2); + if (r == 1) + { + unsigned short b[4]; + + for (i = 0; i < 4; i++) + b[i] = * (const unsigned short *) &u.x[i]; + +# if (LZO_BYTE_ORDER == LZO_LITTLE_ENDIAN) + r &= __lzo_assert(b[0] == 0x0100); + r &= __lzo_assert(b[1] == 0x0201); + r &= __lzo_assert(b[2] == 0x0302); + r &= __lzo_assert(b[3] == 0x0403); +# elif (LZO_BYTE_ORDER == LZO_BIG_ENDIAN) + r &= __lzo_assert(b[0] == 0x0001); + r &= __lzo_assert(b[1] == 0x0102); + r &= __lzo_assert(b[2] == 0x0203); + r &= __lzo_assert(b[3] == 0x0304); +# endif + } +#endif + +#if defined(LZO_UNALIGNED_OK_4) + r &= __lzo_assert(sizeof(lzo_uint32) == 4); + if (r == 1) + { + lzo_uint32 a[4]; + + for (i = 0; i < 4; i++) + a[i] = * (const lzo_uint32 *) &u.x[i]; + +# if (LZO_BYTE_ORDER == LZO_LITTLE_ENDIAN) + r &= __lzo_assert(a[0] == 0x03020100L); + r &= __lzo_assert(a[1] == 0x04030201L); + r &= __lzo_assert(a[2] == 0x05040302L); + r &= __lzo_assert(a[3] == 0x06050403L); +# elif (LZO_BYTE_ORDER == LZO_BIG_ENDIAN) + r &= __lzo_assert(a[0] == 0x00010203L); + r &= __lzo_assert(a[1] == 0x01020304L); + r &= __lzo_assert(a[2] == 0x02030405L); + r &= __lzo_assert(a[3] == 0x03040506L); +# endif + } +#endif + +#if defined(LZO_ALIGNED_OK_4) + r &= __lzo_assert(sizeof(lzo_uint32) == 4); +#endif + + r &= __lzo_assert(lzo_sizeof_dict_t == sizeof(lzo_dict_t)); + +#if defined(__LZO_IN_MINLZO) + if (r == 1) + { + lzo_uint32 adler; + adler = lzo_adler32(0, NULL, 0); + adler = lzo_adler32(adler, lzo_copyright(), 200); + r &= __lzo_assert(adler == 0x7ea34377L); + } +#endif + + if (r == 1) + { + r &= __lzo_assert(!schedule_insns_bug()); + } + + if (r == 1) + { + static int x[3]; + static unsigned xn = 3; + register unsigned j; + + for (j = 0; j < xn; j++) + x[j] = (int)j - 3; + r &= __lzo_assert(!strength_reduce_bug(x)); + } + + if (r == 1) + { + r &= ptr_check(); + } + + return r == 1 ? LZO_E_OK : LZO_E_ERROR; +} + +static lzo_bool schedule_insns_bug(void) +{ +#if defined(__BOUNDS_CHECKING_ON) || defined(__CHECKER__) + return 0; +#else + const int clone[] = {1, 2, 0}; + const int *q; + q = clone; + return (*q) ? 0 : 1; +#endif +} + +static lzo_bool strength_reduce_bug(int *x) +{ + return x[0] != -3 || x[1] != -2 || x[2] != -1; +} + +int __lzo_init_done = 0; + +LZO_PUBLIC(int) +__lzo_init2(unsigned v, int s1, int s2, int s3, int s4, int s5, + int s6, int s7, int s8, int s9) +{ + int r; + + __lzo_init_done = 1; + + if (v == 0) + return LZO_E_ERROR; + + r = (s1 == -1 || s1 == (int) sizeof(short)) && + (s2 == -1 || s2 == (int) sizeof(int)) && + (s3 == -1 || s3 == (int) sizeof(long)) && + (s4 == -1 || s4 == (int) sizeof(lzo_uint32)) && + (s5 == -1 || s5 == (int) sizeof(lzo_uint)) && + (s6 == -1 || s6 == (int) lzo_sizeof_dict_t) && + (s7 == -1 || s7 == (int) sizeof(char *)) && + (s8 == -1 || s8 == (int) sizeof(lzo_voidp)) && + (s9 == -1 || s9 == (int) sizeof(lzo_compress_t)); + if (!r) + return LZO_E_ERROR; + + r = _lzo_config_check(); + if (r != LZO_E_OK) + return r; + + return r; +} + +#if !defined(__LZO_IN_MINILZO) + +LZO_EXTERN(int) +__lzo_init(unsigned v,int s1,int s2,int s3,int s4,int s5,int s6,int s7); + +LZO_PUBLIC(int) +__lzo_init(unsigned v,int s1,int s2,int s3,int s4,int s5,int s6,int s7) +{ + if (v == 0 || v > 0x1010) + return LZO_E_ERROR; + return __lzo_init2(v,s1,s2,s3,s4,s5,-1,-1,s6,s7); +} + +#endif + +#define do_compress _lzo1x_1_do_compress + +#define LZO_NEED_DICT_H +#define D_BITS 14 +#define D_INDEX1(d,p) d = DM((0x21*DX3(p,5,5,6)) >> 5) +#define D_INDEX2(d,p) d = (d & (D_MASK & 0x7ff)) ^ (D_HIGH | 0x1f) + +#ifndef __LZO_CONFIG1X_H +#define __LZO_CONFIG1X_H + +#if !defined(LZO1X) && !defined(LZO1Y) && !defined(LZO1Z) +# define LZO1X +#endif + +#if !defined(__LZO_IN_MINILZO) +#include +#endif + +#define LZO_EOF_CODE +#undef LZO_DETERMINISTIC + +#define M1_MAX_OFFSET 0x0400 +#ifndef M2_MAX_OFFSET +#define M2_MAX_OFFSET 0x0800 +#endif +#define M3_MAX_OFFSET 0x4000 +#define M4_MAX_OFFSET 0xbfff + +#define MX_MAX_OFFSET (M1_MAX_OFFSET + M2_MAX_OFFSET) + +#define M1_MIN_LEN 2 +#define M1_MAX_LEN 2 +#define M2_MIN_LEN 3 +#ifndef M2_MAX_LEN +#define M2_MAX_LEN 8 +#endif +#define M3_MIN_LEN 3 +#define M3_MAX_LEN 33 +#define M4_MIN_LEN 3 +#define M4_MAX_LEN 9 + +#define M1_MARKER 0 +#define M2_MARKER 64 +#define M3_MARKER 32 +#define M4_MARKER 16 + +#ifndef MIN_LOOKAHEAD +#define MIN_LOOKAHEAD (M2_MAX_LEN + 1) +#endif + +#if defined(LZO_NEED_DICT_H) + +#ifndef LZO_HASH +#define LZO_HASH LZO_HASH_LZO_INCREMENTAL_B +#endif +#define DL_MIN_LEN M2_MIN_LEN + +#ifndef __LZO_DICT_H +#define __LZO_DICT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(D_BITS) && defined(DBITS) +# define D_BITS DBITS +#endif +#if !defined(D_BITS) +# error D_BITS is not defined +#endif +#if (D_BITS < 16) +# define D_SIZE LZO_SIZE(D_BITS) +# define D_MASK LZO_MASK(D_BITS) +#else +# define D_SIZE LZO_USIZE(D_BITS) +# define D_MASK LZO_UMASK(D_BITS) +#endif +#define D_HIGH ((D_MASK >> 1) + 1) + +#if !defined(DD_BITS) +# define DD_BITS 0 +#endif +#define DD_SIZE LZO_SIZE(DD_BITS) +#define DD_MASK LZO_MASK(DD_BITS) + +#if !defined(DL_BITS) +# define DL_BITS (D_BITS - DD_BITS) +#endif +#if (DL_BITS < 16) +# define DL_SIZE LZO_SIZE(DL_BITS) +# define DL_MASK LZO_MASK(DL_BITS) +#else +# define DL_SIZE LZO_USIZE(DL_BITS) +# define DL_MASK LZO_UMASK(DL_BITS) +#endif + +#if (D_BITS != DL_BITS + DD_BITS) +# error D_BITS does not match +#endif +#if (D_BITS < 8 || D_BITS > 18) +# error invalid D_BITS +#endif +#if (DL_BITS < 8 || DL_BITS > 20) +# error invalid DL_BITS +#endif +#if (DD_BITS < 0 || DD_BITS > 6) +# error invalid DD_BITS +#endif + +#if !defined(DL_MIN_LEN) +# define DL_MIN_LEN 3 +#endif +#if !defined(DL_SHIFT) +# define DL_SHIFT ((DL_BITS + (DL_MIN_LEN - 1)) / DL_MIN_LEN) +#endif + +#define LZO_HASH_GZIP 1 +#define LZO_HASH_GZIP_INCREMENTAL 2 +#define LZO_HASH_LZO_INCREMENTAL_A 3 +#define LZO_HASH_LZO_INCREMENTAL_B 4 + +#if !defined(LZO_HASH) +# error choose a hashing strategy +#endif + +#if (DL_MIN_LEN == 3) +# define _DV2_A(p,shift1,shift2) \ + (((( (lzo_uint32)((p)[0]) << shift1) ^ (p)[1]) << shift2) ^ (p)[2]) +# define _DV2_B(p,shift1,shift2) \ + (((( (lzo_uint32)((p)[2]) << shift1) ^ (p)[1]) << shift2) ^ (p)[0]) +# define _DV3_B(p,shift1,shift2,shift3) \ + ((_DV2_B((p)+1,shift1,shift2) << (shift3)) ^ (p)[0]) +#elif (DL_MIN_LEN == 2) +# define _DV2_A(p,shift1,shift2) \ + (( (lzo_uint32)(p[0]) << shift1) ^ p[1]) +# define _DV2_B(p,shift1,shift2) \ + (( (lzo_uint32)(p[1]) << shift1) ^ p[2]) +#else +# error invalid DL_MIN_LEN +#endif +#define _DV_A(p,shift) _DV2_A(p,shift,shift) +#define _DV_B(p,shift) _DV2_B(p,shift,shift) +#define DA2(p,s1,s2) \ + (((((lzo_uint32)((p)[2]) << (s2)) + (p)[1]) << (s1)) + (p)[0]) +#define DS2(p,s1,s2) \ + (((((lzo_uint32)((p)[2]) << (s2)) - (p)[1]) << (s1)) - (p)[0]) +#define DX2(p,s1,s2) \ + (((((lzo_uint32)((p)[2]) << (s2)) ^ (p)[1]) << (s1)) ^ (p)[0]) +#define DA3(p,s1,s2,s3) ((DA2((p)+1,s2,s3) << (s1)) + (p)[0]) +#define DS3(p,s1,s2,s3) ((DS2((p)+1,s2,s3) << (s1)) - (p)[0]) +#define DX3(p,s1,s2,s3) ((DX2((p)+1,s2,s3) << (s1)) ^ (p)[0]) +#define DMS(v,s) ((lzo_uint) (((v) & (D_MASK >> (s))) << (s))) +#define DM(v) DMS(v,0) + +#if (LZO_HASH == LZO_HASH_GZIP) +# define _DINDEX(dv,p) (_DV_A((p),DL_SHIFT)) + +#elif (LZO_HASH == LZO_HASH_GZIP_INCREMENTAL) +# define __LZO_HASH_INCREMENTAL +# define DVAL_FIRST(dv,p) dv = _DV_A((p),DL_SHIFT) +# define DVAL_NEXT(dv,p) dv = (((dv) << DL_SHIFT) ^ p[2]) +# define _DINDEX(dv,p) (dv) +# define DVAL_LOOKAHEAD DL_MIN_LEN + +#elif (LZO_HASH == LZO_HASH_LZO_INCREMENTAL_A) +# define __LZO_HASH_INCREMENTAL +# define DVAL_FIRST(dv,p) dv = _DV_A((p),5) +# define DVAL_NEXT(dv,p) \ + dv ^= (lzo_uint32)(p[-1]) << (2*5); dv = (((dv) << 5) ^ p[2]) +# define _DINDEX(dv,p) ((0x9f5f * (dv)) >> 5) +# define DVAL_LOOKAHEAD DL_MIN_LEN + +#elif (LZO_HASH == LZO_HASH_LZO_INCREMENTAL_B) +# define __LZO_HASH_INCREMENTAL +# define DVAL_FIRST(dv,p) dv = _DV_B((p),5) +# define DVAL_NEXT(dv,p) \ + dv ^= p[-1]; dv = (((dv) >> 5) ^ ((lzo_uint32)(p[2]) << (2*5))) +# define _DINDEX(dv,p) ((0x9f5f * (dv)) >> 5) +# define DVAL_LOOKAHEAD DL_MIN_LEN + +#else +# error choose a hashing strategy +#endif + +#ifndef DINDEX +#define DINDEX(dv,p) ((lzo_uint)((_DINDEX(dv,p)) & DL_MASK) << DD_BITS) +#endif +#if !defined(DINDEX1) && defined(D_INDEX1) +#define DINDEX1 D_INDEX1 +#endif +#if !defined(DINDEX2) && defined(D_INDEX2) +#define DINDEX2 D_INDEX2 +#endif + +#if !defined(__LZO_HASH_INCREMENTAL) +# define DVAL_FIRST(dv,p) ((void) 0) +# define DVAL_NEXT(dv,p) ((void) 0) +# define DVAL_LOOKAHEAD 0 +#endif + +#if !defined(DVAL_ASSERT) +#if defined(__LZO_HASH_INCREMENTAL) && !defined(NDEBUG) +static void DVAL_ASSERT(lzo_uint32 dv, const lzo_byte *p) +{ + lzo_uint32 df; + DVAL_FIRST(df,(p)); + assert(DINDEX(dv,p) == DINDEX(df,p)); +} +#else +# define DVAL_ASSERT(dv,p) ((void) 0) +#endif +#endif + +#if defined(LZO_DICT_USE_PTR) +# define DENTRY(p,in) (p) +# define GINDEX(m_pos,m_off,dict,dindex,in) m_pos = dict[dindex] +#else +# define DENTRY(p,in) ((lzo_uint) ((p)-(in))) +# define GINDEX(m_pos,m_off,dict,dindex,in) m_off = dict[dindex] +#endif + +#if (DD_BITS == 0) + +# define UPDATE_D(dict,drun,dv,p,in) dict[ DINDEX(dv,p) ] = DENTRY(p,in) +# define UPDATE_I(dict,drun,index,p,in) dict[index] = DENTRY(p,in) +# define UPDATE_P(ptr,drun,p,in) (ptr)[0] = DENTRY(p,in) + +#else + +# define UPDATE_D(dict,drun,dv,p,in) \ + dict[ DINDEX(dv,p) + drun++ ] = DENTRY(p,in); drun &= DD_MASK +# define UPDATE_I(dict,drun,index,p,in) \ + dict[ (index) + drun++ ] = DENTRY(p,in); drun &= DD_MASK +# define UPDATE_P(ptr,drun,p,in) \ + (ptr) [ drun++ ] = DENTRY(p,in); drun &= DD_MASK + +#endif + +#if defined(LZO_DICT_USE_PTR) + +#define LZO_CHECK_MPOS_DET(m_pos,m_off,in,ip,max_offset) \ + (m_pos == NULL || (m_off = (lzo_moff_t) (ip - m_pos)) > max_offset) + +#define LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,max_offset) \ + (BOUNDS_CHECKING_OFF_IN_EXPR( \ + (PTR_LT(m_pos,in) || \ + (m_off = (lzo_moff_t) PTR_DIFF(ip,m_pos)) <= 0 || \ + m_off > max_offset) )) + +#else + +#define LZO_CHECK_MPOS_DET(m_pos,m_off,in,ip,max_offset) \ + (m_off == 0 || \ + ((m_off = (lzo_moff_t) ((ip)-(in)) - m_off) > max_offset) || \ + (m_pos = (ip) - (m_off), 0) ) + +#define LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,max_offset) \ + ((lzo_moff_t) ((ip)-(in)) <= m_off || \ + ((m_off = (lzo_moff_t) ((ip)-(in)) - m_off) > max_offset) || \ + (m_pos = (ip) - (m_off), 0) ) + +#endif + +#if defined(LZO_DETERMINISTIC) +# define LZO_CHECK_MPOS LZO_CHECK_MPOS_DET +#else +# define LZO_CHECK_MPOS LZO_CHECK_MPOS_NON_DET +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#endif + +#endif + +#define DO_COMPRESS lzo1x_1_compress + +static +lzo_uint do_compress ( const lzo_byte *in , lzo_uint in_len, + lzo_byte *out, lzo_uint *out_len, + lzo_voidp wrkmem ) +{ +#if 0 && defined(__GNUC__) && defined(__i386__) + register const lzo_byte *ip __asm__("%esi"); +#else + register const lzo_byte *ip; +#endif + lzo_byte *op; + const lzo_byte * const in_end = in + in_len; + const lzo_byte * const ip_end = in + in_len - M2_MAX_LEN - 5; + const lzo_byte *ii; + lzo_dict_p const dict = (lzo_dict_p) wrkmem; + + op = out; + ip = in; + ii = ip; + + ip += 4; + for (;;) + { +#if 0 && defined(__GNUC__) && defined(__i386__) + register const lzo_byte *m_pos __asm__("%edi"); +#else + register const lzo_byte *m_pos; +#endif + lzo_moff_t m_off; + lzo_uint m_len; + lzo_uint dindex; + + DINDEX1(dindex,ip); + GINDEX(m_pos,m_off,dict,dindex,in); + if (LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,M4_MAX_OFFSET)) + goto literal; +#if 1 + if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3]) + goto try_match; + DINDEX2(dindex,ip); +#endif + GINDEX(m_pos,m_off,dict,dindex,in); + if (LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,M4_MAX_OFFSET)) + goto literal; + if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3]) + goto try_match; + goto literal; + +try_match: +#if 1 && defined(LZO_UNALIGNED_OK_2) + if (* (const lzo_ushortp) m_pos != * (const lzo_ushortp) ip) +#else + if (m_pos[0] != ip[0] || m_pos[1] != ip[1]) +#endif + { + } + else + { + if (m_pos[2] == ip[2]) + { +#if 0 + if (m_off <= M2_MAX_OFFSET) + goto match; + if (lit <= 3) + goto match; + if (lit == 3) + { + assert(op - 2 > out); op[-2] |= LZO_BYTE(3); + *op++ = *ii++; *op++ = *ii++; *op++ = *ii++; + goto code_match; + } + if (m_pos[3] == ip[3]) +#endif + goto match; + } + else + { +#if 0 +#if 0 + if (m_off <= M1_MAX_OFFSET && lit > 0 && lit <= 3) +#else + if (m_off <= M1_MAX_OFFSET && lit == 3) +#endif + { + register lzo_uint t; + + t = lit; + assert(op - 2 > out); op[-2] |= LZO_BYTE(t); + do *op++ = *ii++; while (--t > 0); + assert(ii == ip); + m_off -= 1; + *op++ = LZO_BYTE(M1_MARKER | ((m_off & 3) << 2)); + *op++ = LZO_BYTE(m_off >> 2); + ip += 2; + goto match_done; + } +#endif + } + } + +literal: + UPDATE_I(dict,0,dindex,ip,in); + ++ip; + if (ip >= ip_end) + break; + continue; + +match: + UPDATE_I(dict,0,dindex,ip,in); + if (ip - ii > 0) + { + register lzo_uint t = ip - ii; + + if (t <= 3) + { + assert(op - 2 > out); + op[-2] |= LZO_BYTE(t); + } + else if (t <= 18) + *op++ = LZO_BYTE(t - 3); + else + { + register lzo_uint tt = t - 18; + + *op++ = 0; + while (tt > 255) + { + tt -= 255; + *op++ = 0; + } + assert(tt > 0); + *op++ = LZO_BYTE(tt); + } + do *op++ = *ii++; while (--t > 0); + } + + assert(ii == ip); + ip += 3; + if (m_pos[3] != *ip++ || m_pos[4] != *ip++ || m_pos[5] != *ip++ || + m_pos[6] != *ip++ || m_pos[7] != *ip++ || m_pos[8] != *ip++ +#ifdef LZO1Y + || m_pos[ 9] != *ip++ || m_pos[10] != *ip++ || m_pos[11] != *ip++ + || m_pos[12] != *ip++ || m_pos[13] != *ip++ || m_pos[14] != *ip++ +#endif + ) + { + --ip; + m_len = ip - ii; + assert(m_len >= 3); assert(m_len <= M2_MAX_LEN); + + if (m_off <= M2_MAX_OFFSET) + { + m_off -= 1; +#if defined(LZO1X) + *op++ = LZO_BYTE(((m_len - 1) << 5) | ((m_off & 7) << 2)); + *op++ = LZO_BYTE(m_off >> 3); +#elif defined(LZO1Y) + *op++ = LZO_BYTE(((m_len + 1) << 4) | ((m_off & 3) << 2)); + *op++ = LZO_BYTE(m_off >> 2); +#endif + } + else if (m_off <= M3_MAX_OFFSET) + { + m_off -= 1; + *op++ = LZO_BYTE(M3_MARKER | (m_len - 2)); + goto m3_m4_offset; + } + else +#if defined(LZO1X) + { + m_off -= 0x4000; + assert(m_off > 0); assert(m_off <= 0x7fff); + *op++ = LZO_BYTE(M4_MARKER | + ((m_off & 0x4000) >> 11) | (m_len - 2)); + goto m3_m4_offset; + } +#elif defined(LZO1Y) + goto m4_match; +#endif + } + else + { + { + const lzo_byte *end = in_end; + const lzo_byte *m = m_pos + M2_MAX_LEN + 1; + while (ip < end && *m == *ip) + m++, ip++; + m_len = (ip - ii); + } + assert(m_len > M2_MAX_LEN); + + if (m_off <= M3_MAX_OFFSET) + { + m_off -= 1; + if (m_len <= 33) + *op++ = LZO_BYTE(M3_MARKER | (m_len - 2)); + else + { + m_len -= 33; + *op++ = M3_MARKER | 0; + goto m3_m4_len; + } + } + else + { +#if defined(LZO1Y) +m4_match: +#endif + m_off -= 0x4000; + assert(m_off > 0); assert(m_off <= 0x7fff); + if (m_len <= M4_MAX_LEN) + *op++ = LZO_BYTE(M4_MARKER | + ((m_off & 0x4000) >> 11) | (m_len - 2)); + else + { + m_len -= M4_MAX_LEN; + *op++ = LZO_BYTE(M4_MARKER | ((m_off & 0x4000) >> 11)); +m3_m4_len: + while (m_len > 255) + { + m_len -= 255; + *op++ = 0; + } + assert(m_len > 0); + *op++ = LZO_BYTE(m_len); + } + } + +m3_m4_offset: + *op++ = LZO_BYTE((m_off & 63) << 2); + *op++ = LZO_BYTE(m_off >> 6); + } + +#if 0 +match_done: +#endif + ii = ip; + if (ip >= ip_end) + break; + } + + *out_len = op - out; + return (lzo_uint) (in_end - ii); +} + +LZO_PUBLIC(int) +DO_COMPRESS ( const lzo_byte *in , lzo_uint in_len, + lzo_byte *out, lzo_uint *out_len, + lzo_voidp wrkmem ) +{ + lzo_byte *op = out; + lzo_uint t; + +#if defined(__LZO_QUERY_COMPRESS) + if (__LZO_IS_COMPRESS_QUERY(in,in_len,out,out_len,wrkmem)) + return __LZO_QUERY_COMPRESS(in,in_len,out,out_len,wrkmem,D_SIZE,lzo_sizeof(lzo_dict_t)); +#endif + + if (in_len <= M2_MAX_LEN + 5) + t = in_len; + else + { + t = do_compress(in,in_len,op,out_len,wrkmem); + op += *out_len; + } + + if (t > 0) + { + const lzo_byte *ii = in + in_len - t; + + if (op == out && t <= 238) + *op++ = LZO_BYTE(17 + t); + else if (t <= 3) + op[-2] |= LZO_BYTE(t); + else if (t <= 18) + *op++ = LZO_BYTE(t - 3); + else + { + lzo_uint tt = t - 18; + + *op++ = 0; + while (tt > 255) + { + tt -= 255; + *op++ = 0; + } + assert(tt > 0); + *op++ = LZO_BYTE(tt); + } + do *op++ = *ii++; while (--t > 0); + } + + *op++ = M4_MARKER | 1; + *op++ = 0; + *op++ = 0; + + *out_len = op - out; + return LZO_E_OK; +} + +#undef do_compress +#undef DO_COMPRESS +#undef LZO_HASH + +#undef LZO_TEST_DECOMPRESS_OVERRUN +#undef LZO_TEST_DECOMPRESS_OVERRUN_INPUT +#undef LZO_TEST_DECOMPRESS_OVERRUN_OUTPUT +#undef LZO_TEST_DECOMPRESS_OVERRUN_LOOKBEHIND +#undef DO_DECOMPRESS +#define DO_DECOMPRESS lzo1x_decompress + +#if defined(LZO_TEST_DECOMPRESS_OVERRUN) +# if !defined(LZO_TEST_DECOMPRESS_OVERRUN_INPUT) +# define LZO_TEST_DECOMPRESS_OVERRUN_INPUT 2 +# endif +# if !defined(LZO_TEST_DECOMPRESS_OVERRUN_OUTPUT) +# define LZO_TEST_DECOMPRESS_OVERRUN_OUTPUT 2 +# endif +# if !defined(LZO_TEST_DECOMPRESS_OVERRUN_LOOKBEHIND) +# define LZO_TEST_DECOMPRESS_OVERRUN_LOOKBEHIND +# endif +#endif + +#undef TEST_IP +#undef TEST_OP +#undef TEST_LOOKBEHIND +#undef NEED_IP +#undef NEED_OP +#undef HAVE_TEST_IP +#undef HAVE_TEST_OP +#undef HAVE_NEED_IP +#undef HAVE_NEED_OP +#undef HAVE_ANY_IP +#undef HAVE_ANY_OP + +#if defined(LZO_TEST_DECOMPRESS_OVERRUN_INPUT) +# if (LZO_TEST_DECOMPRESS_OVERRUN_INPUT >= 1) +# define TEST_IP (ip < ip_end) +# endif +# if (LZO_TEST_DECOMPRESS_OVERRUN_INPUT >= 2) +# define NEED_IP(x) \ + if ((lzo_uint)(ip_end - ip) < (lzo_uint)(x)) goto input_overrun +# endif +#endif + +#if defined(LZO_TEST_DECOMPRESS_OVERRUN_OUTPUT) +# if (LZO_TEST_DECOMPRESS_OVERRUN_OUTPUT >= 1) +# define TEST_OP (op <= op_end) +# endif +# if (LZO_TEST_DECOMPRESS_OVERRUN_OUTPUT >= 2) +# undef TEST_OP +# define NEED_OP(x) \ + if ((lzo_uint)(op_end - op) < (lzo_uint)(x)) goto output_overrun +# endif +#endif + +#if defined(LZO_TEST_DECOMPRESS_OVERRUN_LOOKBEHIND) +# define TEST_LOOKBEHIND(m_pos,out) if (m_pos < out) goto lookbehind_overrun +#else +# define TEST_LOOKBEHIND(m_pos,op) ((void) 0) +#endif + +#if !defined(LZO_EOF_CODE) && !defined(TEST_IP) +# define TEST_IP (ip < ip_end) +#endif + +#if defined(TEST_IP) +# define HAVE_TEST_IP +#else +# define TEST_IP 1 +#endif +#if defined(TEST_OP) +# define HAVE_TEST_OP +#else +# define TEST_OP 1 +#endif + +#if defined(NEED_IP) +# define HAVE_NEED_IP +#else +# define NEED_IP(x) ((void) 0) +#endif +#if defined(NEED_OP) +# define HAVE_NEED_OP +#else +# define NEED_OP(x) ((void) 0) +#endif + +#if defined(HAVE_TEST_IP) || defined(HAVE_NEED_IP) +# define HAVE_ANY_IP +#endif +#if defined(HAVE_TEST_OP) || defined(HAVE_NEED_OP) +# define HAVE_ANY_OP +#endif + +#if defined(DO_DECOMPRESS) +LZO_PUBLIC(int) +DO_DECOMPRESS ( const lzo_byte *in , lzo_uint in_len, + lzo_byte *out, lzo_uint *out_len, + lzo_voidp wrkmem ) +#endif +{ + register lzo_byte *op; + register const lzo_byte *ip; + register lzo_uint t; +#if defined(COPY_DICT) + lzo_uint m_off; + const lzo_byte *dict_end; +#else + register const lzo_byte *m_pos; +#endif + + const lzo_byte * const ip_end = in + in_len; +#if defined(HAVE_ANY_OP) + lzo_byte * const op_end = out + *out_len; +#endif +#if defined(LZO1Z) + lzo_uint last_m_off = 0; +#endif + + LZO_UNUSED(wrkmem); + +#if defined(__LZO_QUERY_DECOMPRESS) + if (__LZO_IS_DECOMPRESS_QUERY(in,in_len,out,out_len,wrkmem)) + return __LZO_QUERY_DECOMPRESS(in,in_len,out,out_len,wrkmem,0,0); +#endif + +#if defined(COPY_DICT) + if (dict) + { + if (dict_len > M4_MAX_OFFSET) + { + dict += dict_len - M4_MAX_OFFSET; + dict_len = M4_MAX_OFFSET; + } + dict_end = dict + dict_len; + } + else + { + dict_len = 0; + dict_end = NULL; + } +#endif + + *out_len = 0; + + op = out; + ip = in; + + if (*ip > 17) + { + t = *ip++ - 17; + if (t < 4) + goto match_next; + assert(t > 0); NEED_OP(t); NEED_IP(t+1); + do *op++ = *ip++; while (--t > 0); + goto first_literal_run; + } + + while (TEST_IP && TEST_OP) + { + t = *ip++; + if (t >= 16) + goto match; + if (t == 0) + { + NEED_IP(1); + while (*ip == 0) + { + t += 255; + ip++; + NEED_IP(1); + } + t += 15 + *ip++; + } + assert(t > 0); NEED_OP(t+3); NEED_IP(t+4); +#if defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) +#if !defined(LZO_UNALIGNED_OK_4) + if (PTR_ALIGNED2_4(op,ip)) + { +#endif + * (lzo_uint32p) op = * (const lzo_uint32p) ip; + op += 4; ip += 4; + if (--t > 0) + { + if (t >= 4) + { + do { + * (lzo_uint32p) op = * (const lzo_uint32p) ip; + op += 4; ip += 4; t -= 4; + } while (t >= 4); + if (t > 0) do *op++ = *ip++; while (--t > 0); + } + else + do *op++ = *ip++; while (--t > 0); + } +#if !defined(LZO_UNALIGNED_OK_4) + } + else +#endif +#endif +#if !defined(LZO_UNALIGNED_OK_4) + { + *op++ = *ip++; *op++ = *ip++; *op++ = *ip++; + do *op++ = *ip++; while (--t > 0); + } +#endif + +first_literal_run: + + t = *ip++; + if (t >= 16) + goto match; +#if defined(COPY_DICT) +#if defined(LZO1Z) + m_off = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2); + last_m_off = m_off; +#else + m_off = (1 + M2_MAX_OFFSET) + (t >> 2) + (*ip++ << 2); +#endif + NEED_OP(3); + t = 3; COPY_DICT(t,m_off) +#else +#if defined(LZO1Z) + t = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2); + m_pos = op - t; + last_m_off = t; +#else + m_pos = op - (1 + M2_MAX_OFFSET); + m_pos -= t >> 2; + m_pos -= *ip++ << 2; +#endif + TEST_LOOKBEHIND(m_pos,out); NEED_OP(3); + *op++ = *m_pos++; *op++ = *m_pos++; *op++ = *m_pos; +#endif + goto match_done; + + while (TEST_IP && TEST_OP) + { +match: + if (t >= 64) + { +#if defined(COPY_DICT) +#if defined(LZO1X) + m_off = 1 + ((t >> 2) & 7) + (*ip++ << 3); + t = (t >> 5) - 1; +#elif defined(LZO1Y) + m_off = 1 + ((t >> 2) & 3) + (*ip++ << 2); + t = (t >> 4) - 3; +#elif defined(LZO1Z) + m_off = t & 0x1f; + if (m_off >= 0x1c) + m_off = last_m_off; + else + { + m_off = 1 + (m_off << 6) + (*ip++ >> 2); + last_m_off = m_off; + } + t = (t >> 5) - 1; +#endif +#else +#if defined(LZO1X) + m_pos = op - 1; + m_pos -= (t >> 2) & 7; + m_pos -= *ip++ << 3; + t = (t >> 5) - 1; +#elif defined(LZO1Y) + m_pos = op - 1; + m_pos -= (t >> 2) & 3; + m_pos -= *ip++ << 2; + t = (t >> 4) - 3; +#elif defined(LZO1Z) + { + lzo_uint off = t & 0x1f; + m_pos = op; + if (off >= 0x1c) + { + assert(last_m_off > 0); + m_pos -= last_m_off; + } + else + { + off = 1 + (off << 6) + (*ip++ >> 2); + m_pos -= off; + last_m_off = off; + } + } + t = (t >> 5) - 1; +#endif + TEST_LOOKBEHIND(m_pos,out); assert(t > 0); NEED_OP(t+3-1); + goto copy_match; +#endif + } + else if (t >= 32) + { + t &= 31; + if (t == 0) + { + NEED_IP(1); + while (*ip == 0) + { + t += 255; + ip++; + NEED_IP(1); + } + t += 31 + *ip++; + } +#if defined(COPY_DICT) +#if defined(LZO1Z) + m_off = 1 + (ip[0] << 6) + (ip[1] >> 2); + last_m_off = m_off; +#else + m_off = 1 + (ip[0] >> 2) + (ip[1] << 6); +#endif +#else +#if defined(LZO1Z) + { + lzo_uint off = 1 + (ip[0] << 6) + (ip[1] >> 2); + m_pos = op - off; + last_m_off = off; + } +#elif defined(LZO_UNALIGNED_OK_2) && (LZO_BYTE_ORDER == LZO_LITTLE_ENDIAN) + m_pos = op - 1; + m_pos -= (* (const lzo_ushortp) ip) >> 2; +#else + m_pos = op - 1; + m_pos -= (ip[0] >> 2) + (ip[1] << 6); +#endif +#endif + ip += 2; + } + else if (t >= 16) + { +#if defined(COPY_DICT) + m_off = (t & 8) << 11; +#else + m_pos = op; + m_pos -= (t & 8) << 11; +#endif + t &= 7; + if (t == 0) + { + NEED_IP(1); + while (*ip == 0) + { + t += 255; + ip++; + NEED_IP(1); + } + t += 7 + *ip++; + } +#if defined(COPY_DICT) +#if defined(LZO1Z) + m_off += (ip[0] << 6) + (ip[1] >> 2); +#else + m_off += (ip[0] >> 2) + (ip[1] << 6); +#endif + ip += 2; + if (m_off == 0) + goto eof_found; + m_off += 0x4000; +#if defined(LZO1Z) + last_m_off = m_off; +#endif +#else +#if defined(LZO1Z) + m_pos -= (ip[0] << 6) + (ip[1] >> 2); +#elif defined(LZO_UNALIGNED_OK_2) && (LZO_BYTE_ORDER == LZO_LITTLE_ENDIAN) + m_pos -= (* (const lzo_ushortp) ip) >> 2; +#else + m_pos -= (ip[0] >> 2) + (ip[1] << 6); +#endif + ip += 2; + if (m_pos == op) + goto eof_found; + m_pos -= 0x4000; +#if defined(LZO1Z) + last_m_off = op - m_pos; +#endif +#endif + } + else + { +#if defined(COPY_DICT) +#if defined(LZO1Z) + m_off = 1 + (t << 6) + (*ip++ >> 2); + last_m_off = m_off; +#else + m_off = 1 + (t >> 2) + (*ip++ << 2); +#endif + NEED_OP(2); + t = 2; COPY_DICT(t,m_off) +#else +#if defined(LZO1Z) + t = 1 + (t << 6) + (*ip++ >> 2); + m_pos = op - t; + last_m_off = t; +#else + m_pos = op - 1; + m_pos -= t >> 2; + m_pos -= *ip++ << 2; +#endif + TEST_LOOKBEHIND(m_pos,out); NEED_OP(2); + *op++ = *m_pos++; *op++ = *m_pos; +#endif + goto match_done; + } + +#if defined(COPY_DICT) + + NEED_OP(t+3-1); + t += 3-1; COPY_DICT(t,m_off) + +#else + + TEST_LOOKBEHIND(m_pos,out); assert(t > 0); NEED_OP(t+3-1); +#if defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) +#if !defined(LZO_UNALIGNED_OK_4) + if (t >= 2 * 4 - (3 - 1) && PTR_ALIGNED2_4(op,m_pos)) + { + assert((op - m_pos) >= 4); +#else + if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4) + { +#endif + * (lzo_uint32p) op = * (const lzo_uint32p) m_pos; + op += 4; m_pos += 4; t -= 4 - (3 - 1); + do { + * (lzo_uint32p) op = * (const lzo_uint32p) m_pos; + op += 4; m_pos += 4; t -= 4; + } while (t >= 4); + if (t > 0) do *op++ = *m_pos++; while (--t > 0); + } + else +#endif + { +copy_match: + *op++ = *m_pos++; *op++ = *m_pos++; + do *op++ = *m_pos++; while (--t > 0); + } + +#endif + +match_done: +#if defined(LZO1Z) + t = ip[-1] & 3; +#else + t = ip[-2] & 3; +#endif + if (t == 0) + break; + +match_next: + assert(t > 0); NEED_OP(t); NEED_IP(t+1); + do *op++ = *ip++; while (--t > 0); + t = *ip++; + } + } + +#if defined(HAVE_TEST_IP) || defined(HAVE_TEST_OP) + *out_len = op - out; + return LZO_E_EOF_NOT_FOUND; +#endif + +eof_found: + assert(t == 1); + *out_len = op - out; + return (ip == ip_end ? LZO_E_OK : + (ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN)); + +#if defined(HAVE_NEED_IP) +input_overrun: + *out_len = op - out; + return LZO_E_INPUT_OVERRUN; +#endif + +#if defined(HAVE_NEED_OP) +output_overrun: + *out_len = op - out; + return LZO_E_OUTPUT_OVERRUN; +#endif + +#if defined(LZO_TEST_DECOMPRESS_OVERRUN_LOOKBEHIND) +lookbehind_overrun: + *out_len = op - out; + return LZO_E_LOOKBEHIND_OVERRUN; +#endif +} + +#define LZO_TEST_DECOMPRESS_OVERRUN +#undef DO_DECOMPRESS +#define DO_DECOMPRESS lzo1x_decompress_safe + +#if defined(LZO_TEST_DECOMPRESS_OVERRUN) +# if !defined(LZO_TEST_DECOMPRESS_OVERRUN_INPUT) +# define LZO_TEST_DECOMPRESS_OVERRUN_INPUT 2 +# endif +# if !defined(LZO_TEST_DECOMPRESS_OVERRUN_OUTPUT) +# define LZO_TEST_DECOMPRESS_OVERRUN_OUTPUT 2 +# endif +# if !defined(LZO_TEST_DECOMPRESS_OVERRUN_LOOKBEHIND) +# define LZO_TEST_DECOMPRESS_OVERRUN_LOOKBEHIND +# endif +#endif + +#undef TEST_IP +#undef TEST_OP +#undef TEST_LOOKBEHIND +#undef NEED_IP +#undef NEED_OP +#undef HAVE_TEST_IP +#undef HAVE_TEST_OP +#undef HAVE_NEED_IP +#undef HAVE_NEED_OP +#undef HAVE_ANY_IP +#undef HAVE_ANY_OP + +#if defined(LZO_TEST_DECOMPRESS_OVERRUN_INPUT) +# if (LZO_TEST_DECOMPRESS_OVERRUN_INPUT >= 1) +# define TEST_IP (ip < ip_end) +# endif +# if (LZO_TEST_DECOMPRESS_OVERRUN_INPUT >= 2) +# define NEED_IP(x) \ + if ((lzo_uint)(ip_end - ip) < (lzo_uint)(x)) goto input_overrun +# endif +#endif + +#if defined(LZO_TEST_DECOMPRESS_OVERRUN_OUTPUT) +# if (LZO_TEST_DECOMPRESS_OVERRUN_OUTPUT >= 1) +# define TEST_OP (op <= op_end) +# endif +# if (LZO_TEST_DECOMPRESS_OVERRUN_OUTPUT >= 2) +# undef TEST_OP +# define NEED_OP(x) \ + if ((lzo_uint)(op_end - op) < (lzo_uint)(x)) goto output_overrun +# endif +#endif + +#if defined(LZO_TEST_DECOMPRESS_OVERRUN_LOOKBEHIND) +# define TEST_LOOKBEHIND(m_pos,out) if (m_pos < out) goto lookbehind_overrun +#else +# define TEST_LOOKBEHIND(m_pos,op) ((void) 0) +#endif + +#if !defined(LZO_EOF_CODE) && !defined(TEST_IP) +# define TEST_IP (ip < ip_end) +#endif + +#if defined(TEST_IP) +# define HAVE_TEST_IP +#else +# define TEST_IP 1 +#endif +#if defined(TEST_OP) +# define HAVE_TEST_OP +#else +# define TEST_OP 1 +#endif + +#if defined(NEED_IP) +# define HAVE_NEED_IP +#else +# define NEED_IP(x) ((void) 0) +#endif +#if defined(NEED_OP) +# define HAVE_NEED_OP +#else +# define NEED_OP(x) ((void) 0) +#endif + +#if defined(HAVE_TEST_IP) || defined(HAVE_NEED_IP) +# define HAVE_ANY_IP +#endif +#if defined(HAVE_TEST_OP) || defined(HAVE_NEED_OP) +# define HAVE_ANY_OP +#endif + +#if defined(DO_DECOMPRESS) +LZO_PUBLIC(int) +DO_DECOMPRESS ( const lzo_byte *in , lzo_uint in_len, + lzo_byte *out, lzo_uint *out_len, + lzo_voidp wrkmem ) +#endif +{ + register lzo_byte *op; + register const lzo_byte *ip; + register lzo_uint t; +#if defined(COPY_DICT) + lzo_uint m_off; + const lzo_byte *dict_end; +#else + register const lzo_byte *m_pos; +#endif + + const lzo_byte * const ip_end = in + in_len; +#if defined(HAVE_ANY_OP) + lzo_byte * const op_end = out + *out_len; +#endif +#if defined(LZO1Z) + lzo_uint last_m_off = 0; +#endif + + LZO_UNUSED(wrkmem); + +#if defined(__LZO_QUERY_DECOMPRESS) + if (__LZO_IS_DECOMPRESS_QUERY(in,in_len,out,out_len,wrkmem)) + return __LZO_QUERY_DECOMPRESS(in,in_len,out,out_len,wrkmem,0,0); +#endif + +#if defined(COPY_DICT) + if (dict) + { + if (dict_len > M4_MAX_OFFSET) + { + dict += dict_len - M4_MAX_OFFSET; + dict_len = M4_MAX_OFFSET; + } + dict_end = dict + dict_len; + } + else + { + dict_len = 0; + dict_end = NULL; + } +#endif + + *out_len = 0; + + op = out; + ip = in; + + if (*ip > 17) + { + t = *ip++ - 17; + if (t < 4) + goto match_next; + assert(t > 0); NEED_OP(t); NEED_IP(t+1); + do *op++ = *ip++; while (--t > 0); + goto first_literal_run; + } + + while (TEST_IP && TEST_OP) + { + t = *ip++; + if (t >= 16) + goto match; + if (t == 0) + { + NEED_IP(1); + while (*ip == 0) + { + t += 255; + ip++; + NEED_IP(1); + } + t += 15 + *ip++; + } + assert(t > 0); NEED_OP(t+3); NEED_IP(t+4); +#if defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) +#if !defined(LZO_UNALIGNED_OK_4) + if (PTR_ALIGNED2_4(op,ip)) + { +#endif + * (lzo_uint32p) op = * (const lzo_uint32p) ip; + op += 4; ip += 4; + if (--t > 0) + { + if (t >= 4) + { + do { + * (lzo_uint32p) op = * (const lzo_uint32p) ip; + op += 4; ip += 4; t -= 4; + } while (t >= 4); + if (t > 0) do *op++ = *ip++; while (--t > 0); + } + else + do *op++ = *ip++; while (--t > 0); + } +#if !defined(LZO_UNALIGNED_OK_4) + } + else +#endif +#endif +#if !defined(LZO_UNALIGNED_OK_4) + { + *op++ = *ip++; *op++ = *ip++; *op++ = *ip++; + do *op++ = *ip++; while (--t > 0); + } +#endif + +first_literal_run: + + t = *ip++; + if (t >= 16) + goto match; +#if defined(COPY_DICT) +#if defined(LZO1Z) + m_off = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2); + last_m_off = m_off; +#else + m_off = (1 + M2_MAX_OFFSET) + (t >> 2) + (*ip++ << 2); +#endif + NEED_OP(3); + t = 3; COPY_DICT(t,m_off) +#else +#if defined(LZO1Z) + t = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2); + m_pos = op - t; + last_m_off = t; +#else + m_pos = op - (1 + M2_MAX_OFFSET); + m_pos -= t >> 2; + m_pos -= *ip++ << 2; +#endif + TEST_LOOKBEHIND(m_pos,out); NEED_OP(3); + *op++ = *m_pos++; *op++ = *m_pos++; *op++ = *m_pos; +#endif + goto match_done; + + while (TEST_IP && TEST_OP) + { +match: + if (t >= 64) + { +#if defined(COPY_DICT) +#if defined(LZO1X) + m_off = 1 + ((t >> 2) & 7) + (*ip++ << 3); + t = (t >> 5) - 1; +#elif defined(LZO1Y) + m_off = 1 + ((t >> 2) & 3) + (*ip++ << 2); + t = (t >> 4) - 3; +#elif defined(LZO1Z) + m_off = t & 0x1f; + if (m_off >= 0x1c) + m_off = last_m_off; + else + { + m_off = 1 + (m_off << 6) + (*ip++ >> 2); + last_m_off = m_off; + } + t = (t >> 5) - 1; +#endif +#else +#if defined(LZO1X) + m_pos = op - 1; + m_pos -= (t >> 2) & 7; + m_pos -= *ip++ << 3; + t = (t >> 5) - 1; +#elif defined(LZO1Y) + m_pos = op - 1; + m_pos -= (t >> 2) & 3; + m_pos -= *ip++ << 2; + t = (t >> 4) - 3; +#elif defined(LZO1Z) + { + lzo_uint off = t & 0x1f; + m_pos = op; + if (off >= 0x1c) + { + assert(last_m_off > 0); + m_pos -= last_m_off; + } + else + { + off = 1 + (off << 6) + (*ip++ >> 2); + m_pos -= off; + last_m_off = off; + } + } + t = (t >> 5) - 1; +#endif + TEST_LOOKBEHIND(m_pos,out); assert(t > 0); NEED_OP(t+3-1); + goto copy_match; +#endif + } + else if (t >= 32) + { + t &= 31; + if (t == 0) + { + NEED_IP(1); + while (*ip == 0) + { + t += 255; + ip++; + NEED_IP(1); + } + t += 31 + *ip++; + } +#if defined(COPY_DICT) +#if defined(LZO1Z) + m_off = 1 + (ip[0] << 6) + (ip[1] >> 2); + last_m_off = m_off; +#else + m_off = 1 + (ip[0] >> 2) + (ip[1] << 6); +#endif +#else +#if defined(LZO1Z) + { + lzo_uint off = 1 + (ip[0] << 6) + (ip[1] >> 2); + m_pos = op - off; + last_m_off = off; + } +#elif defined(LZO_UNALIGNED_OK_2) && (LZO_BYTE_ORDER == LZO_LITTLE_ENDIAN) + m_pos = op - 1; + m_pos -= (* (const lzo_ushortp) ip) >> 2; +#else + m_pos = op - 1; + m_pos -= (ip[0] >> 2) + (ip[1] << 6); +#endif +#endif + ip += 2; + } + else if (t >= 16) + { +#if defined(COPY_DICT) + m_off = (t & 8) << 11; +#else + m_pos = op; + m_pos -= (t & 8) << 11; +#endif + t &= 7; + if (t == 0) + { + NEED_IP(1); + while (*ip == 0) + { + t += 255; + ip++; + NEED_IP(1); + } + t += 7 + *ip++; + } +#if defined(COPY_DICT) +#if defined(LZO1Z) + m_off += (ip[0] << 6) + (ip[1] >> 2); +#else + m_off += (ip[0] >> 2) + (ip[1] << 6); +#endif + ip += 2; + if (m_off == 0) + goto eof_found; + m_off += 0x4000; +#if defined(LZO1Z) + last_m_off = m_off; +#endif +#else +#if defined(LZO1Z) + m_pos -= (ip[0] << 6) + (ip[1] >> 2); +#elif defined(LZO_UNALIGNED_OK_2) && (LZO_BYTE_ORDER == LZO_LITTLE_ENDIAN) + m_pos -= (* (const lzo_ushortp) ip) >> 2; +#else + m_pos -= (ip[0] >> 2) + (ip[1] << 6); +#endif + ip += 2; + if (m_pos == op) + goto eof_found; + m_pos -= 0x4000; +#if defined(LZO1Z) + last_m_off = op - m_pos; +#endif +#endif + } + else + { +#if defined(COPY_DICT) +#if defined(LZO1Z) + m_off = 1 + (t << 6) + (*ip++ >> 2); + last_m_off = m_off; +#else + m_off = 1 + (t >> 2) + (*ip++ << 2); +#endif + NEED_OP(2); + t = 2; COPY_DICT(t,m_off) +#else +#if defined(LZO1Z) + t = 1 + (t << 6) + (*ip++ >> 2); + m_pos = op - t; + last_m_off = t; +#else + m_pos = op - 1; + m_pos -= t >> 2; + m_pos -= *ip++ << 2; +#endif + TEST_LOOKBEHIND(m_pos,out); NEED_OP(2); + *op++ = *m_pos++; *op++ = *m_pos; +#endif + goto match_done; + } + +#if defined(COPY_DICT) + + NEED_OP(t+3-1); + t += 3-1; COPY_DICT(t,m_off) + +#else + + TEST_LOOKBEHIND(m_pos,out); assert(t > 0); NEED_OP(t+3-1); +#if defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) +#if !defined(LZO_UNALIGNED_OK_4) + if (t >= 2 * 4 - (3 - 1) && PTR_ALIGNED2_4(op,m_pos)) + { + assert((op - m_pos) >= 4); +#else + if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4) + { +#endif + * (lzo_uint32p) op = * (const lzo_uint32p) m_pos; + op += 4; m_pos += 4; t -= 4 - (3 - 1); + do { + * (lzo_uint32p) op = * (const lzo_uint32p) m_pos; + op += 4; m_pos += 4; t -= 4; + } while (t >= 4); + if (t > 0) do *op++ = *m_pos++; while (--t > 0); + } + else +#endif + { +copy_match: + *op++ = *m_pos++; *op++ = *m_pos++; + do *op++ = *m_pos++; while (--t > 0); + } + +#endif + +match_done: +#if defined(LZO1Z) + t = ip[-1] & 3; +#else + t = ip[-2] & 3; +#endif + if (t == 0) + break; + +match_next: + assert(t > 0); NEED_OP(t); NEED_IP(t+1); + do *op++ = *ip++; while (--t > 0); + t = *ip++; + } + } + +#if defined(HAVE_TEST_IP) || defined(HAVE_TEST_OP) + *out_len = op - out; + return LZO_E_EOF_NOT_FOUND; +#endif + +eof_found: + assert(t == 1); + *out_len = op - out; + return (ip == ip_end ? LZO_E_OK : + (ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN)); + +#if defined(HAVE_NEED_IP) +input_overrun: + *out_len = op - out; + return LZO_E_INPUT_OVERRUN; +#endif + +#if defined(HAVE_NEED_OP) +output_overrun: + *out_len = op - out; + return LZO_E_OUTPUT_OVERRUN; +#endif + +#if defined(LZO_TEST_DECOMPRESS_OVERRUN_LOOKBEHIND) +lookbehind_overrun: + *out_len = op - out; + return LZO_E_LOOKBEHIND_OVERRUN; +#endif +} + +/***** End of minilzo.c *****/ + diff --git a/MODEM/SRCS/dcload-serial/minilzo.106/minilzo.h b/MODEM/SRCS/dcload-serial/minilzo.106/minilzo.h new file mode 100644 index 00000000..dca00251 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/minilzo.106/minilzo.h @@ -0,0 +1,96 @@ +/* minilzo.h -- mini subset of the LZO real-time data compression library + + This file is part of the LZO real-time data compression library. + + Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer + + The LZO library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + The LZO library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the LZO library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + Markus F.X.J. Oberhumer + + http://wildsau.idv.uni-linz.ac.at/mfx/lzo.html + */ + +/* + * NOTE: + * the full LZO package can be found at + * http://wildsau.idv.uni-linz.ac.at/mfx/lzo.html + */ + + +#ifndef __MINILZO_H +#define __MINILZO_H + +#define MINILZO_VERSION 0x1060 + +#ifdef __LZOCONF_H +# error "you cannot use both LZO and miniLZO" +#endif + +#undef LZO_HAVE_CONFIG_H +#include "lzoconf.h" + +#if !defined(LZO_VERSION) || (LZO_VERSION != MINILZO_VERSION) +# error "version mismatch in header files" +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + + +/*********************************************************************** +// +************************************************************************/ + +/* Memory required for the wrkmem parameter. + * When the required size is 0, you can also pass a NULL pointer. + */ + +#define LZO1X_MEM_COMPRESS LZO1X_1_MEM_COMPRESS +#define LZO1X_1_MEM_COMPRESS ((lzo_uint32) (16384L * lzo_sizeof_dict_t)) +#define LZO1X_MEM_DECOMPRESS (0) + + +/* compression */ +LZO_EXTERN(int) +lzo1x_1_compress ( const lzo_byte *src, lzo_uint src_len, + lzo_byte *dst, lzo_uint *dst_len, + lzo_voidp wrkmem ); + +/* decompression */ +LZO_EXTERN(int) +lzo1x_decompress ( const lzo_byte *src, lzo_uint src_len, + lzo_byte *dst, lzo_uint *dst_len, + lzo_voidp wrkmem /* NOT USED */ ); + +/* safe decompression with overrun testing */ +LZO_EXTERN(int) +lzo1x_decompress_safe ( const lzo_byte *src, lzo_uint src_len, + lzo_byte *dst, lzo_uint *dst_len, + lzo_voidp wrkmem /* NOT USED */ ); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* already included */ + diff --git a/MODEM/SRCS/dcload-serial/minilzo.106/testmini.c b/MODEM/SRCS/dcload-serial/minilzo.106/testmini.c new file mode 100644 index 00000000..49fd9054 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/minilzo.106/testmini.c @@ -0,0 +1,154 @@ +/* testmini.c -- very simple test program for the miniLZO library + + This file is part of the LZO real-time data compression library. + + Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer + + The LZO library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + The LZO library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the LZO library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + Markus F.X.J. Oberhumer + markus.oberhumer@jk.uni-linz.ac.at + */ + + +#include +#include + + +/************************************************************************* +// This program shows the basic usage of the LZO library. +// We will compress a block of data and decompress again. +// +// For more information, documentation, example programs and other support +// files (like Makefiles and build scripts) please download the full LZO +// package from +// http://wildsau.idv.uni-linz.ac.at/mfx/lzo.html +**************************************************************************/ + +/* First let's include "minizo.h". */ + +#include "minilzo.h" + + +/* We want to compress the data block at `in' with length `IN_LEN' to + * the block at `out'. Because the input block may be incompressible, + * we must provide a little more output space in case that compression + * is not possible. + */ + +#define IN_LEN (128*1024L) +#define OUT_LEN (IN_LEN + IN_LEN / 64 + 16 + 3) + +static lzo_byte in [ IN_LEN ]; +static lzo_byte out [ OUT_LEN ]; + + +/* Work-memory needed for compression. Allocate memory in units + * of `long' (instead of `char') to make sure it is properly aligned. + */ + +#define HEAP_ALLOC(var,size) \ + long __LZO_MMODEL var [ ((size) + (sizeof(long) - 1)) / sizeof(long) ] + +static HEAP_ALLOC(wrkmem,LZO1X_1_MEM_COMPRESS); + + +/************************************************************************* +// +**************************************************************************/ + +int main(int argc, char *argv[]) +{ + int r; + lzo_uint in_len; + lzo_uint out_len; + lzo_uint new_len; + +#if defined(__EMX__) + _response(&argc,&argv); + _wildcard(&argc,&argv); +#endif + + if (argc < 0 && argv == NULL) /* avoid warning about unused args */ + return 0; + + printf("\nLZO real-time data compression library (v%s, %s).\n", + LZO_VERSION_STRING, LZO_VERSION_DATE); + printf("Copyright (C) 1996, 1997, 1998 Markus Franz Xaver Johannes Oberhumer\n\n"); + + +/* + * Step 1: initialize the LZO library + */ + if (lzo_init() != LZO_E_OK) + { + printf("lzo_init() failed !!!\n"); + return 3; + } + +/* + * Step 2: prepare the input block that will get compressed. + * We just fill it with zeros in this example program, + * but you would use your real-world data here. + */ + in_len = IN_LEN; + lzo_memset(in,0,in_len); + +/* + * Step 3: compress from `in' to `out' with LZO1X-1 + */ + r = lzo1x_1_compress(in,in_len,out,&out_len,wrkmem); + if (r == LZO_E_OK) + printf("compressed %lu bytes into %lu bytes\n", + (long) in_len, (long) out_len); + else + { + /* this should NEVER happen */ + printf("internal error - compression failed: %d\n", r); + return 2; + } + /* check for an incompressible block */ + if (out_len >= in_len) + { + printf("This block contains incompressible data.\n"); + return 0; + } + +/* + * Step 4: decompress again, now going from `out' to `in' + */ + r = lzo1x_decompress(out,out_len,in,&new_len,NULL); + if (r == LZO_E_OK && new_len == in_len) + printf("decompressed %lu bytes back into %lu bytes\n", + (long) out_len, (long) in_len); + else + { + /* this should NEVER happen */ + printf("internal error - decompression failed: %d\n", r); + return 1; + } + + printf("\nminiLZO simple compression test passed.\n"); + return 0; +} + +/* +vi:ts=4 +*/ + diff --git a/MODEM/SRCS/dcload-serial/target-inc/_ansi.h b/MODEM/SRCS/dcload-serial/target-inc/_ansi.h new file mode 100644 index 00000000..b4dc0110 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/_ansi.h @@ -0,0 +1,71 @@ +/* Provide support for both ANSI and non-ANSI environments. */ + +/* Some ANSI environments are "broken" in the sense that __STDC__ cannot be + relied upon to have it's intended meaning. Therefore we must use our own + concoction: _HAVE_STDC. Always use _HAVE_STDC instead of __STDC__ in newlib + sources! + + To get a strict ANSI C environment, define macro __STRICT_ANSI__. This will + "comment out" the non-ANSI parts of the ANSI header files (non-ANSI header + files aren't affected). */ + +#ifndef _ANSIDECL_H_ +#define _ANSIDECL_H_ + +#include + +/* First try to figure out whether we really are in an ANSI C environment. */ +/* FIXME: This probably needs some work. Perhaps sys/config.h can be + prevailed upon to give us a clue. */ + +#ifdef __STDC__ +#define _HAVE_STDC +#endif + +#ifdef _HAVE_STDC +#define _PTR void * +#define _AND , +#define _NOARGS void +#define _CONST const +#define _VOLATILE volatile +#define _SIGNED signed +#define _DOTS , ... +#define _VOID void +#define _EXFUN(name, proto) name proto +#define _DEFUN(name, arglist, args) name(args) +#define _DEFUN_VOID(name) name(_NOARGS) +#define _CAST_VOID (void) +#ifndef _LONG_DOUBLE +#define _LONG_DOUBLE long double +#endif +#ifndef _PARAMS +#define _PARAMS(paramlist) paramlist +#endif +#else +#define _PTR char * +#define _AND ; +#define _NOARGS +#define _CONST +#define _VOLATILE +#define _SIGNED +#define _DOTS +#define _VOID void +#define _EXFUN(name, proto) name() +#define _DEFUN(name, arglist, args) name arglist args; +#define _DEFUN_VOID(name) name() +#define _CAST_VOID +#define _LONG_DOUBLE double +#ifndef _PARAMS +#define _PARAMS(paramlist) () +#endif +#endif + +/* Support gcc's __attribute__ facility. */ + +#ifdef __GNUC__ +#define _ATTRIBUTE(attrs) __attribute__ (attrs) +#else +#define _ATTRIBUTE(attrs) +#endif + +#endif /* _ANSIDECL_H_ */ diff --git a/MODEM/SRCS/dcload-serial/target-inc/_syslist.h b/MODEM/SRCS/dcload-serial/target-inc/_syslist.h new file mode 100644 index 00000000..fa552fb6 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/_syslist.h @@ -0,0 +1,29 @@ +/* internal use only -- mapping of "system calls" for libraries that lose + and only provide C names, so that we end up in violation of ANSI */ +#ifndef __SYSLIST_H +#define __SYSLIST_H +#ifdef MISSING_SYSCALL_NAMES +#define _close close +#define _execve execve +#define _fcntl fcntl +#define _fork fork +#define _fstat fstat +#define _getpid getpid +#define _gettimeofday gettimeofday +#define _kill kill +#define _link link +#define _lseek lseek +#define _open open +#define _read read +#define _sbrk sbrk +#define _stat stat +#define _times times +#define _unlink unlink +#define _wait wait +#define _write write +/* functions not yet sysfaked */ +#define _opendir opendir +#define _readdir readdir +#define _closedir closedir +#endif +#endif diff --git a/MODEM/SRCS/dcload-serial/target-inc/ar.h b/MODEM/SRCS/dcload-serial/target-inc/ar.h new file mode 100644 index 00000000..ac2e4ca9 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/ar.h @@ -0,0 +1,69 @@ +/* $NetBSD: ar.h,v 1.4 1994/10/26 00:55:43 cgd Exp $ */ + +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * This code is derived from software contributed to Berkeley by + * Hugh Smith at The University of Guelph. + * + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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. + * + * @(#)ar.h 8.2 (Berkeley) 1/21/94 + */ + +#ifndef _AR_H_ +#define _AR_H_ + +/* Pre-4BSD archives had these magic numbers in them. */ +#define OARMAG1 0177555 +#define OARMAG2 0177545 + +#define ARMAG "!\n" /* ar "magic number" */ +#define SARMAG 8 /* strlen(ARMAG); */ + +#define AR_EFMT1 "#1/" /* extended format #1 */ + +struct ar_hdr { + char ar_name[16]; /* name */ + char ar_date[12]; /* modification time */ + char ar_uid[6]; /* user id */ + char ar_gid[6]; /* group id */ + char ar_mode[8]; /* octal file permissions */ + char ar_size[10]; /* size in bytes */ +#define ARFMAG "`\n" + char ar_fmag[2]; /* consistency check */ +}; + +#endif /* !_AR_H_ */ diff --git a/MODEM/SRCS/dcload-serial/target-inc/assert.h b/MODEM/SRCS/dcload-serial/target-inc/assert.h new file mode 100644 index 00000000..b681a851 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/assert.h @@ -0,0 +1,29 @@ +/* + assert.h +*/ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "_ansi.h" + +#undef assert + +#ifdef NDEBUG /* required by ANSI standard */ +#define assert(p) ((void)0) +#else + +#ifdef __STDC__ +#define assert(e) ((e) ? (void)0 : __assert(__FILE__, __LINE__, #e)) +#else /* PCC */ +#define assert(e) ((e) ? (void)0 : __assert(__FILE__, __LINE__, "e")) +#endif + +#endif /* NDEBUG */ + +void _EXFUN(__assert,(const char *, int, const char *)); + +#ifdef __cplusplus +} +#endif diff --git a/MODEM/SRCS/dcload-serial/target-inc/ctype.h b/MODEM/SRCS/dcload-serial/target-inc/ctype.h new file mode 100644 index 00000000..224b703a --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/ctype.h @@ -0,0 +1,73 @@ +#ifndef _CTYPE_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _CTYPE_H_ + +#include "_ansi.h" + +int _EXFUN(isalnum, (int __c)); +int _EXFUN(isalpha, (int __c)); +int _EXFUN(iscntrl, (int __c)); +int _EXFUN(isdigit, (int __c)); +int _EXFUN(isgraph, (int __c)); +int _EXFUN(islower, (int __c)); +int _EXFUN(isprint, (int __c)); +int _EXFUN(ispunct, (int __c)); +int _EXFUN(isspace, (int __c)); +int _EXFUN(isupper, (int __c)); +int _EXFUN(isxdigit,(int __c)); +int _EXFUN(tolower, (int __c)); +int _EXFUN(toupper, (int __c)); + +#ifndef __STRICT_ANSI__ +int _EXFUN(isascii, (int __c)); +int _EXFUN(toascii, (int __c)); +int _EXFUN(_tolower, (int __c)); +int _EXFUN(_toupper, (int __c)); +#endif + +#define _U 01 +#define _L 02 +#define _N 04 +#define _S 010 +#define _P 020 +#define _C 040 +#define _X 0100 +#define _B 0200 + +#if !defined(__CYGWIN32__) || defined(__INSIDE_CYGWIN__) || defined(_COMPILING_NEWLIB) +extern _CONST char _ctype_[]; +#else +extern _CONST char _ctype_[] __declspec(dllimport); +#endif + +#define isalpha(c) ((_ctype_+1)[(unsigned)(c)]&(_U|_L)) +#define isupper(c) ((_ctype_+1)[(unsigned)(c)]&_U) +#define islower(c) ((_ctype_+1)[(unsigned)(c)]&_L) +#define isdigit(c) ((_ctype_+1)[(unsigned)(c)]&_N) +#define isxdigit(c) ((_ctype_+1)[(unsigned)(c)]&(_X|_N)) +#define isspace(c) ((_ctype_+1)[(unsigned)(c)]&_S) +#define ispunct(c) ((_ctype_+1)[(unsigned)(c)]&_P) +#define isalnum(c) ((_ctype_+1)[(unsigned)(c)]&(_U|_L|_N)) +#define isprint(c) ((_ctype_+1)[(unsigned)(c)]&(_P|_U|_L|_N|_B)) +#define isgraph(c) ((_ctype_+1)[(unsigned)(c)]&(_P|_U|_L|_N)) +#define iscntrl(c) ((_ctype_+1)[(unsigned)(c)]&_C) +/* Non-gcc versions will get the library versions, and will be + slightly slower */ +#ifdef __GNUC__ +# define toupper(c) \ + ({ int __x = (c); islower(__x) ? (__x - 'a' + 'A') : __x;}) +# define tolower(c) \ + ({ int __x = (c); isupper(__x) ? (__x - 'A' + 'a') : __x;}) +#endif + +#ifndef __STRICT_ANSI__ +#define isascii(c) ((unsigned)(c)<=0177) +#define toascii(c) ((c)&0177) +#endif + +#ifdef __cplusplus +} +#endif +#endif /* _CTYPE_H_ */ diff --git a/MODEM/SRCS/dcload-serial/target-inc/dirent.h b/MODEM/SRCS/dcload-serial/target-inc/dirent.h new file mode 100644 index 00000000..eaa4c190 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/dirent.h @@ -0,0 +1,7 @@ +#ifdef __cplusplus +extern "C" { +#endif +#include +#ifdef __cplusplus +} +#endif diff --git a/MODEM/SRCS/dcload-serial/target-inc/errno.h b/MODEM/SRCS/dcload-serial/target-inc/errno.h new file mode 100644 index 00000000..fa8efb7f --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/errno.h @@ -0,0 +1 @@ +#include diff --git a/MODEM/SRCS/dcload-serial/target-inc/fastmath.h b/MODEM/SRCS/dcload-serial/target-inc/fastmath.h new file mode 100644 index 00000000..95eea5f3 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/fastmath.h @@ -0,0 +1,13 @@ +#ifndef _FASTMATH_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _FASTMATH_H_ + +#include +#include + +#ifdef __cplusplus +} +#endif +#endif /* _FASTMATH_H_ */ diff --git a/MODEM/SRCS/dcload-serial/target-inc/fcntl.h b/MODEM/SRCS/dcload-serial/target-inc/fcntl.h new file mode 100644 index 00000000..86a91677 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/fcntl.h @@ -0,0 +1 @@ +#include diff --git a/MODEM/SRCS/dcload-serial/target-inc/grp.h b/MODEM/SRCS/dcload-serial/target-inc/grp.h new file mode 100644 index 00000000..b8680a5d --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/grp.h @@ -0,0 +1,85 @@ +/* $NetBSD: grp.h,v 1.7 1995/04/29 05:30:40 cgd Exp $ */ + +/*- + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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. + * + * @(#)grp.h 8.2 (Berkeley) 1/21/94 + */ + +#ifndef _GRP_H_ +#define _GRP_H_ + +#include + +#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE) +#define _PATH_GROUP "/etc/group" +#endif + +struct group { + char *gr_name; /* group name */ + char *gr_passwd; /* group password */ + gid_t gr_gid; /* group id */ + char **gr_mem; /* group members */ +}; + + +#ifdef __cplusplus +extern "C" { +#endif + +struct group *getgrgid (gid_t); +struct group *getgrnam (const char *); +int getgrnam_r (const char *, struct group *, + char *, size_t, struct group **); +int getgrgid_r (gid_t, struct group *, + char *, size_t, struct group **); +#ifndef _POSIX_SOURCE +struct group *getgrent (void); +void setgrent (void); +void endgrent (void); +void setgrfile (const char *); +#ifndef _XOPEN_SOURCE +char *group_from_gid (gid_t, int); +int setgroupent (int); +#endif /* !_XOPEN_SOURCE */ +#endif /* !_POSIX_SOURCE */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_GRP_H_ */ diff --git a/MODEM/SRCS/dcload-serial/target-inc/ieeefp.h b/MODEM/SRCS/dcload-serial/target-inc/ieeefp.h new file mode 100644 index 00000000..78bb5bf6 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/ieeefp.h @@ -0,0 +1,241 @@ +#ifndef _IEEE_FP_H_ +#define _IEEE_FP_H_ + +#include "_ansi.h" + +#include + +/* FIXME FIXME FIXME: + Neither of __ieee_{float,double}_shape_tape seem to be used anywhere + except in libm/test. If that is the case, please delete these from here. + If that is not the case, please insert documentation here describing why + they're needed. */ + +#ifdef __IEEE_BIG_ENDIAN + +typedef union +{ + double value; + struct + { + unsigned int sign : 1; + unsigned int exponent: 11; + unsigned int fraction0:4; + unsigned int fraction1:16; + unsigned int fraction2:16; + unsigned int fraction3:16; + + } number; + struct + { + unsigned int sign : 1; + unsigned int exponent: 11; + unsigned int quiet:1; + unsigned int function0:3; + unsigned int function1:16; + unsigned int function2:16; + unsigned int function3:16; + } nan; + struct + { + unsigned long msw; + unsigned long lsw; + } parts; + long aslong[2]; +} __ieee_double_shape_type; + +#endif + +#ifdef __IEEE_LITTLE_ENDIAN + +typedef union +{ + double value; + struct + { +#ifdef __SMALL_BITFIELDS + unsigned int fraction3:16; + unsigned int fraction2:16; + unsigned int fraction1:16; + unsigned int fraction0: 4; +#else + unsigned int fraction1:32; + unsigned int fraction0:20; +#endif + unsigned int exponent :11; + unsigned int sign : 1; + } number; + struct + { +#ifdef __SMALL_BITFIELDS + unsigned int function3:16; + unsigned int function2:16; + unsigned int function1:16; + unsigned int function0:3; +#else + unsigned int function1:32; + unsigned int function0:19; +#endif + unsigned int quiet:1; + unsigned int exponent: 11; + unsigned int sign : 1; + } nan; + struct + { + unsigned long lsw; + unsigned long msw; + } parts; + + long aslong[2]; + +} __ieee_double_shape_type; + +#endif + +#ifdef __IEEE_BIG_ENDIAN + +typedef union +{ + float value; + struct + { + unsigned int sign : 1; + unsigned int exponent: 8; + unsigned int fraction0: 7; + unsigned int fraction1: 16; + } number; + struct + { + unsigned int sign:1; + unsigned int exponent:8; + unsigned int quiet:1; + unsigned int function0:6; + unsigned int function1:16; + } nan; + long p1; + +} __ieee_float_shape_type; + +#endif + +#ifdef __IEEE_LITTLE_ENDIAN + +typedef union +{ + float value; + struct + { + unsigned int fraction0: 7; + unsigned int fraction1: 16; + unsigned int exponent: 8; + unsigned int sign : 1; + } number; + struct + { + unsigned int function1:16; + unsigned int function0:6; + unsigned int quiet:1; + unsigned int exponent:8; + unsigned int sign:1; + } nan; + long p1; + +} __ieee_float_shape_type; + +#endif + + + + + +/* FLOATING ROUNDING */ + +typedef int fp_rnd; +#define FP_RN 0 /* Round to nearest */ +#define FP_RM 1 /* Round down */ +#define FP_RP 2 /* Round up */ +#define FP_RZ 3 /* Round to zero (trunate) */ + +fp_rnd _EXFUN(fpgetround,(void)); +fp_rnd _EXFUN(fpsetround, (fp_rnd)); + +/* EXCEPTIONS */ + +typedef int fp_except; +#define FP_X_INV 0x10 /* Invalid operation */ +#define FP_X_DX 0x80 /* Divide by zero */ +#define FP_X_OFL 0x04 /* Overflow exception */ +#define FP_X_UFL 0x02 /* Underflow exception */ +#define FP_X_IMP 0x01 /* imprecise exception */ + +fp_except _EXFUN(fpgetmask,(void)); +fp_except _EXFUN(fpsetmask,(fp_except)); +fp_except _EXFUN(fpgetsticky,(void)); +fp_except _EXFUN(fpsetsticky, (fp_except)); + +/* INTEGER ROUNDING */ + +typedef int fp_rdi; +#define FP_RDI_TOZ 0 /* Round to Zero */ +#define FP_RDI_RD 1 /* Follow float mode */ + +fp_rdi _EXFUN(fpgetroundtoi,(void)); +fp_rdi _EXFUN(fpsetroundtoi,(fp_rdi)); + +int _EXFUN(isnan, (double)); +int _EXFUN(isinf, (double)); +int _EXFUN(finite, (double)); + + + +int _EXFUN(isnanf, (float)); +int _EXFUN(isinff, (float)); +int _EXFUN(finitef, (float)); + +#define __IEEE_DBL_EXPBIAS 1023 +#define __IEEE_FLT_EXPBIAS 127 + +#define __IEEE_DBL_EXPLEN 11 +#define __IEEE_FLT_EXPLEN 8 + + +#define __IEEE_DBL_FRACLEN (64 - (__IEEE_DBL_EXPLEN + 1)) +#define __IEEE_FLT_FRACLEN (32 - (__IEEE_FLT_EXPLEN + 1)) + +#define __IEEE_DBL_MAXPOWTWO ((double)(1L << 32 - 2) * (1L << (32-11) - 32 + 1)) +#define __IEEE_FLT_MAXPOWTWO ((float)(1L << (32-8) - 1)) + +#define __IEEE_DBL_NAN_EXP 0x7ff +#define __IEEE_FLT_NAN_EXP 0xff + + +#define isnanf(x) (((*(long *)&(x) & 0x7f800000L)==0x7f800000L) && \ + ((*(long *)&(x) & 0x007fffffL)!=0000000000L)) + +#define isinff(x) (((*(long *)&(x) & 0x7f800000L)==0x7f800000L) && \ + ((*(long *)&(x) & 0x007fffffL)==0000000000L)) + +#define finitef(x) (((*(long *)&(x) & 0x7f800000L)!=0x7f800000L)) + +#ifdef _DOUBLE_IS_32BITS +#undef __IEEE_DBL_EXPBIAS +#define __IEEE_DBL_EXPBIAS __IEEE_FLT_EXPBIAS + +#undef __IEEE_DBL_EXPLEN +#define __IEEE_DBL_EXPLEN __IEEE_FLT_EXPLEN + +#undef __IEEE_DBL_FRACLEN +#define __IEEE_DBL_FRACLEN __IEEE_FLT_FRACLEN + +#undef __IEEE_DBL_MAXPOWTWO +#define __IEEE_DBL_MAXPOWTWO __IEEE_FLT_MAXPOWTWO + +#undef __IEEE_DBL_NAN_EXP +#define __IEEE_DBL_NAN_EXP __IEEE_FLT_NAN_EXP + +#undef __ieee_double_shape_type +#define __ieee_double_shape_type __ieee_float_shape_type + +#endif /* _DOUBLE_IS_32BITS */ + +#endif /* _IEEE_FP_H_ */ diff --git a/MODEM/SRCS/dcload-serial/target-inc/locale.h b/MODEM/SRCS/dcload-serial/target-inc/locale.h new file mode 100644 index 00000000..38a196f6 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/locale.h @@ -0,0 +1,60 @@ +/* + locale.h + Values appropriate for the formatting of monetary and other + numberic quantities. +*/ + +#ifndef _LOCALE_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _LOCALE_H_ + +#include "_ansi.h" + +#ifndef NULL +#define NULL 0L +#endif + +#define LC_ALL 0 +#define LC_COLLATE 1 +#define LC_CTYPE 2 +#define LC_MONETARY 3 +#define LC_NUMERIC 4 +#define LC_TIME 5 + +struct lconv +{ + char *decimal_point; + char *thousands_sep; + char *grouping; + char *int_curr_symbol; + char *currency_symbol; + char *mon_decimal_point; + char *mon_thousands_sep; + char *mon_grouping; + char *positive_sign; + char *negative_sign; + char int_frac_digits; + char frac_digits; + char p_cs_precedes; + char p_sep_by_space; + char n_cs_precedes; + char n_sep_by_space; + char p_sign_posn; + char n_sign_posn; +}; + +#ifndef _REENT_ONLY +char *_EXFUN(setlocale,(int category, const char *locale)); +struct lconv *_EXFUN(localeconv,(void)); +#endif + +struct _reent; +char *_EXFUN(_setlocale_r,(struct _reent *, int category, const char *locale)); +struct lconv *_EXFUN(_localeconv_r,(struct _reent *)); + +#ifdef __cplusplus +} +#endif +#endif /* _LOCALE_H_ */ diff --git a/MODEM/SRCS/dcload-serial/target-inc/machine/fastmath.h b/MODEM/SRCS/dcload-serial/target-inc/machine/fastmath.h new file mode 100644 index 00000000..b13befa2 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/machine/fastmath.h @@ -0,0 +1,100 @@ +#ifdef __sysvnecv70_target +double EXFUN(fast_sin,(double)); +double EXFUN(fast_cos,(double)); +double EXFUN(fast_tan,(double)); + +double EXFUN(fast_asin,(double)); +double EXFUN(fast_acos,(double)); +double EXFUN(fast_atan,(double)); + +double EXFUN(fast_sinh,(double)); +double EXFUN(fast_cosh,(double)); +double EXFUN(fast_tanh,(double)); + +double EXFUN(fast_asinh,(double)); +double EXFUN(fast_acosh,(double)); +double EXFUN(fast_atanh,(double)); + +double EXFUN(fast_abs,(double)); +double EXFUN(fast_sqrt,(double)); +double EXFUN(fast_exp2,(double)); +double EXFUN(fast_exp10,(double)); +double EXFUN(fast_expe,(double)); +double EXFUN(fast_log10,(double)); +double EXFUN(fast_log2,(double)); +double EXFUN(fast_loge,(double)); + + +#define sin(x) fast_sin(x) +#define cos(x) fast_cos(x) +#define tan(x) fast_tan(x) +#define asin(x) fast_asin(x) +#define acos(x) fast_acos(x) +#define atan(x) fast_atan(x) +#define sinh(x) fast_sinh(x) +#define cosh(x) fast_cosh(x) +#define tanh(x) fast_tanh(x) +#define asinh(x) fast_asinh(x) +#define acosh(x) fast_acosh(x) +#define atanh(x) fast_atanh(x) +#define abs(x) fast_abs(x) +#define sqrt(x) fast_sqrt(x) +#define exp2(x) fast_exp2(x) +#define exp10(x) fast_exp10(x) +#define expe(x) fast_expe(x) +#define log10(x) fast_log10(x) +#define log2(x) fast_log2(x) +#define loge(x) fast_loge(x) + +#ifdef _HAVE_STDC +/* These functions are in assembler, they really do take floats. This + can only be used with a real ANSI compiler */ + +float EXFUN(fast_sinf,(float)); +float EXFUN(fast_cosf,(float)); +float EXFUN(fast_tanf,(float)); + +float EXFUN(fast_asinf,(float)); +float EXFUN(fast_acosf,(float)); +float EXFUN(fast_atanf,(float)); + +float EXFUN(fast_sinhf,(float)); +float EXFUN(fast_coshf,(float)); +float EXFUN(fast_tanhf,(float)); + +float EXFUN(fast_asinhf,(float)); +float EXFUN(fast_acoshf,(float)); +float EXFUN(fast_atanhf,(float)); + +float EXFUN(fast_absf,(float)); +float EXFUN(fast_sqrtf,(float)); +float EXFUN(fast_exp2f,(float)); +float EXFUN(fast_exp10f,(float)); +float EXFUN(fast_expef,(float)); +float EXFUN(fast_log10f,(float)); +float EXFUN(fast_log2f,(float)); +float EXFUN(fast_logef,(float)); +#define sinf(x) fast_sinf(x) +#define cosf(x) fast_cosf(x) +#define tanf(x) fast_tanf(x) +#define asinf(x) fast_asinf(x) +#define acosf(x) fast_acosf(x) +#define atanf(x) fast_atanf(x) +#define sinhf(x) fast_sinhf(x) +#define coshf(x) fast_coshf(x) +#define tanhf(x) fast_tanhf(x) +#define asinhf(x) fast_asinhf(x) +#define acoshf(x) fast_acoshf(x) +#define atanhf(x) fast_atanhf(x) +#define absf(x) fast_absf(x) +#define sqrtf(x) fast_sqrtf(x) +#define exp2f(x) fast_exp2f(x) +#define exp10f(x) fast_exp10f(x) +#define expef(x) fast_expef(x) +#define log10f(x) fast_log10f(x) +#define log2f(x) fast_log2f(x) +#define logef(x) fast_logef(x) +#endif +/* Override the functions defined in math.h */ +#endif /* __sysvnecv70_target */ + diff --git a/MODEM/SRCS/dcload-serial/target-inc/machine/ieeefp.h b/MODEM/SRCS/dcload-serial/target-inc/machine/ieeefp.h new file mode 100644 index 00000000..ce8f0ffc --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/machine/ieeefp.h @@ -0,0 +1,157 @@ +#ifndef __IEEE_BIG_ENDIAN +#ifndef __IEEE_LITTLE_ENDIAN + +#if defined(__arm__) || defined(__thumb__) +/* ARM always has big-endian words. Within those words the byte ordering + appears to be big or little endian. Newlib doesn't seem to care about + the byte ordering within words. */ +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef __hppa__ +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef __sparc__ +#ifdef __LITTLE_ENDIAN_DATA__ +#define __IEEE_LITTLE_ENDIAN +#else +#define __IEEE_BIG_ENDIAN +#endif +#endif + +#if defined(__m68k__) || defined(__mc68000__) +#define __IEEE_BIG_ENDIAN +#endif + +#if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__) +#define __IEEE_BIG_ENDIAN +#define __SMALL_BITFIELDS +#define _DOUBLE_IS_32BITS +#endif + +#ifdef __H8500__ +#define __IEEE_BIG_ENDIAN +#define __SMALL_BITFIELDS +#define _DOUBLE_IS_32BITS +#endif + +#ifdef __sh__ +#ifdef __LITTLE_ENDIAN__ +#define __IEEE_LITTLE_ENDIAN +#else +#define __IEEE_BIG_ENDIAN +#endif +#if defined(__SH3E__) || defined(__SH4_SINGLE_ONLY__) +#define _DOUBLE_IS_32BITS +#endif +#endif + +#ifdef _AM29K +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef _WIN32 +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __i386__ +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __i960__ +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __M32R__ +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef __TIC80__ +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __MIPSEL__ +#define __IEEE_LITTLE_ENDIAN +#endif +#ifdef __MIPSEB__ +#define __IEEE_BIG_ENDIAN +#endif + +/* necv70 was __IEEE_LITTLE_ENDIAN. */ + +#ifdef __W65__ +#define __IEEE_LITTLE_ENDIAN +#define __SMALL_BITFIELDS +#define _DOUBLE_IS_32BITS +#endif + +#if defined(__Z8001__) || defined(__Z8002__) +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef __m88k__ +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef __mn10300__ +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __mn10200__ +#define __IEEE_LITTLE_ENDIAN +#define __SMALL_BITFIELDS +#define _DOUBLE_IS_32BITS +#endif + +#ifdef __v800 +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __v850 +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __D10V__ +#define __IEEE_BIG_ENDIAN +#define _DOUBLE_IS_32BITS +#define __SMALL_BITFIELDS +#endif + +#ifdef __PPC__ +#if (defined(_BIG_ENDIAN) && _BIG_ENDIAN) || (defined(_AIX) && _AIX) +#define __IEEE_BIG_ENDIAN +#else +#if (defined(_LITTLE_ENDIAN) && _LITTLE_ENDIAN) || (defined(__sun__) && __sun__) || (defined(_WIN32) && _WIN32) +#define __IEEE_LITTLE_ENDIAN +#endif +#endif +#endif + +#ifdef __arc__ +#ifdef __big_endian__ +#define __IEEE_BIG_ENDIAN +#else +#define __IEEE_LITTLE_ENDIAN +#endif +#endif + +#ifdef __fr30__ +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef __mcore__ +#define __IEEE_BIG_ENDIAN +#endif + + + +#ifndef __IEEE_BIG_ENDIAN +#ifndef __IEEE_LITTLE_ENDIAN +#error Endianess not declared!! +#endif /* not __IEEE_LITTLE_ENDIAN */ +#endif /* not __IEEE_BIG_ENDIAN */ + +#endif /* not __IEEE_LITTLE_ENDIAN */ +#endif /* not __IEEE_BIG_ENDIAN */ + diff --git a/MODEM/SRCS/dcload-serial/target-inc/machine/setjmp-dj.h b/MODEM/SRCS/dcload-serial/target-inc/machine/setjmp-dj.h new file mode 100644 index 00000000..0243f7e7 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/machine/setjmp-dj.h @@ -0,0 +1,44 @@ +/* +** Copyright (C) 1991 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954 +** +** This file is distributed under the terms listed in the document +** "copying.dj", available from DJ Delorie at the address above. +** A copy of "copying.dj" should accompany this file; if not, a copy +** should be available from where this file was obtained. This file +** may not be distributed without a verbatim copy of "copying.dj". +** +** This file is distributed WITHOUT ANY WARRANTY; without even the implied +** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +/* Modified to use SETJMP_DJ_H rather than SETJMP_H to avoid + conflicting with setjmp.h. Ian Taylor, Cygnus support, April, + 1993. */ + +#ifndef _SETJMP_DJ_H_ +#define _SETJMP_DJ_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + unsigned long eax; + unsigned long ebx; + unsigned long ecx; + unsigned long edx; + unsigned long esi; + unsigned long edi; + unsigned long ebp; + unsigned long esp; + unsigned long eip; +} jmp_buf[1]; + +extern int setjmp(jmp_buf); +extern void longjmp(jmp_buf, int); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MODEM/SRCS/dcload-serial/target-inc/machine/setjmp.h b/MODEM/SRCS/dcload-serial/target-inc/machine/setjmp.h new file mode 100644 index 00000000..4656c0ff --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/machine/setjmp.h @@ -0,0 +1,168 @@ +#if defined(__arm__) || defined(__thumb__) +/* + * All callee preserved registers: + * v1 - v7, fp, ip, sp, lr, f4, f5, f6, f7 + */ +#define _JBLEN 23 +#endif + +#ifdef __sparc__ +/* + * onsstack,sigmask,sp,pc,npc,psr,g1,o0,wbcnt (sigcontext). + * All else recovered by under/over(flow) handling. + */ +#define _JBLEN 13 +#endif + +/* necv70 was 9 as well. */ + +#ifdef __mc68000__ +/* + * onsstack,sigmask,sp,pc,psl,d2-d7,a2-a6, + * fp2-fp7 for 68881. + * All else recovered by under/over(flow) handling. + */ +#define _JBLEN 34 +#endif + +#if defined(__Z8001__) || defined(__Z8002__) +/* 16 regs + pc */ +#define _JBLEN 20 +#endif + +#ifdef _AM29K +/* + * onsstack,sigmask,sp,pc,npc,psr,g1,o0,wbcnt (sigcontext). + * All else recovered by under/over(flow) handling. + */ +#define _JBLEN 9 +#endif + +#if defined(__CYGWIN__) && !defined (_JBLEN) +#define _JBLEN (13 * 4) +#elif defined (__i386__) +#ifdef __unix__ +# define _JBLEN 36 +#else +#include "setjmp-dj.h" +#endif +#endif + +#ifdef __i960__ +#define _JBLEN 35 +#endif + +#ifdef __M32R__ +/* Only 8 words are currently needed. 10 gives us some slop if we need + to expand. */ +#define _JBLEN 10 +#endif + +#ifdef __mips__ +#define _JBLEN 11 +#endif + +#ifdef __m88000__ +#define _JBLEN 21 +#endif + +#ifdef __H8300__ +#define _JBLEN 5 +typedef int jmp_buf[_JBLEN]; +#endif + +#ifdef __H8300H__ +/* same as H8/300 but registers are twice as big */ +#define _JBLEN 5 +#define _JBTYPE long +#endif + +#ifdef __H8300S__ +/* same as H8/300 but registers are twice as big */ +#define _JBLEN 5 +#define _JBTYPE long +#endif + +#ifdef __H8500__ +#define _JBLEN 4 +#endif + +#ifdef __sh__ +#define _JBLEN 20 +#endif + +#ifdef __v800 +#define _JBLEN 28 +#endif + +#ifdef __PPC__ +#define _JBLEN 32 +#define _JBTYPE double +#endif + +#ifdef __hppa__ +/* %r30, %r2-%r18, %r27, pad, %fr12-%fr15. + Note space exists for the FP registers, but they are not + saved. */ +#define _JBLEN 28 +#endif + +#if defined(__mn10300__) || defined(__mn10200__) +/* A guess */ +#define _JBLEN 10 +#endif + +#ifdef __v850 +/* I think our setjmp is saving 15 regs at the moment. Gives us one word + slop if we need to expand. */ +#define _JBLEN 16 +#endif + +#ifdef __TIC80__ +#define _JBLEN 13 +#endif + +#ifdef __D10V__ +#define _JBLEN 8 +#endif + +#ifdef __D30V__ +#define _JBLEN ((64 /* GPR */ + (2*2) /* ACs */ + 18 /* CRs */) / 2) +#define _JBTYPE double +#endif + + +#ifdef __fr30__ +#define _JBLEN 10 +#endif + +#ifdef __mcore__ +#define _JBLEN 16 +#endif + +#ifdef _JBLEN +#ifdef _JBTYPE +typedef _JBTYPE jmp_buf[_JBLEN]; +#else +typedef int jmp_buf[_JBLEN]; +#endif + +#if defined(__CYGWIN32__) || defined(__rtems__) +#include + +/* POSIX sigsetjmp/siglongjmp macros */ +typedef int sigjmp_buf[_JBLEN+2]; + +#define _SAVEMASK _JBLEN +#define _SIGMASK (_JBLEN+1) + +#define sigsetjmp(env, savemask) (env[_SAVEMASK] = savemask,\ + sigprocmask (SIG_SETMASK, 0, (sigset_t *) &env[_SIGMASK]),\ + setjmp (env)) + +#define siglongjmp(env, val) (((env[_SAVEMASK])?\ + sigprocmask (SIG_SETMASK, (sigset_t *) &env[_SIGMASK], 0):0),\ + longjmp (env, val)) + +#endif /* __CYGWIN32__ or __rtems__ */ +#endif diff --git a/MODEM/SRCS/dcload-serial/target-inc/machine/time.h b/MODEM/SRCS/dcload-serial/target-inc/machine/time.h new file mode 100644 index 00000000..13857bfd --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/machine/time.h @@ -0,0 +1,10 @@ +#ifndef _MACHTIME_H_ +#define _MACHTIME_H_ + +#if defined(__arm__) || defined(__thumb__) +#define _CLOCKS_PER_SEC_ 100 +#endif + +#endif /* _MACHTIME_H_ */ + + diff --git a/MODEM/SRCS/dcload-serial/target-inc/machine/types.h b/MODEM/SRCS/dcload-serial/target-inc/machine/types.h new file mode 100644 index 00000000..b71a67f5 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/machine/types.h @@ -0,0 +1,9 @@ +#ifndef _MACHTYPES_H_ +#define _MACHTYPES_H_ + +#define _CLOCK_T_ unsigned long /* clock() */ +#define _TIME_T_ long /* time() */ + +#endif /* _MACHTYPES_H_ */ + + diff --git a/MODEM/SRCS/dcload-serial/target-inc/malloc.h b/MODEM/SRCS/dcload-serial/target-inc/malloc.h new file mode 100644 index 00000000..64abe91c --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/malloc.h @@ -0,0 +1,97 @@ +/* malloc.h -- header file for memory routines. */ + +#ifndef _INCLUDE_MALLOC_H_ +#define _INCLUDE_MALLOC_H_ + +#include <_ansi.h> +#include + +#define __need_size_t +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* This version of struct mallinfo must match the one in + libc/stdlib/mallocr.c. */ + +struct mallinfo { + int arena; /* total space allocated from system */ + int ordblks; /* number of non-inuse chunks */ + int smblks; /* unused -- always zero */ + int hblks; /* number of mmapped regions */ + int hblkhd; /* total space in mmapped regions */ + int usmblks; /* unused -- always zero */ + int fsmblks; /* unused -- always zero */ + int uordblks; /* total allocated space */ + int fordblks; /* total non-inuse space */ + int keepcost; /* top-most, releasable (via malloc_trim) space */ +}; + +/* The routines. */ + +extern _PTR malloc _PARAMS ((size_t)); +extern _PTR _malloc_r _PARAMS ((struct _reent *, size_t)); + +extern _VOID free _PARAMS ((_PTR)); +extern _VOID _free_r _PARAMS ((struct _reent *, _PTR)); + +extern _PTR realloc _PARAMS ((_PTR, size_t)); +extern _PTR _realloc_r _PARAMS ((struct _reent *, _PTR, size_t)); + +extern _PTR calloc _PARAMS ((size_t, size_t)); +extern _PTR _calloc_r _PARAMS ((struct _reent *, size_t, size_t)); + +extern _PTR memalign _PARAMS ((size_t, size_t)); +extern _PTR _memalign_r _PARAMS ((struct _reent *, size_t, size_t)); + +extern struct mallinfo mallinfo _PARAMS ((void)); +extern struct mallinfo _mallinfo_r _PARAMS ((struct _reent *)); + +extern void malloc_stats _PARAMS ((void)); +extern void _malloc_stats_r _PARAMS ((struct _reent *)); + +extern int mallopt _PARAMS ((int, int)); +extern int _mallopt_r _PARAMS ((struct _reent *, int, int)); + +extern size_t malloc_usable_size _PARAMS ((_PTR)); +extern size_t _malloc_usable_size_r _PARAMS ((struct _reent *, _PTR)); + +/* These aren't too useful on an embedded system, but we define them + anyhow. */ + +extern _PTR valloc _PARAMS ((size_t)); +extern _PTR _valloc_r _PARAMS ((struct _reent *, size_t)); + +extern _PTR pvalloc _PARAMS ((size_t)); +extern _PTR _pvalloc_r _PARAMS ((struct _reent *, size_t)); + +extern int malloc_trim _PARAMS ((size_t)); +extern int _malloc_trim_r _PARAMS ((struct _reent *, size_t)); + +/* Some systems provide this, so do too for compatibility. */ + +extern void cfree _PARAMS ((_PTR)); + +/* A compatibility routine for an earlier version of the allocator. */ + +extern _VOID mstats _PARAMS ((char *)); +extern _VOID _mstats_r _PARAMS ((struct _reent *, char *)); + +#ifdef __CYGWIN32__ + +/* Cygwin32 needs to be able to copy all the malloc information from + the parent to the child. However, cygwin32 does not normally copy + any data in the DLL data section. This routine handles copying + that information. */ + +extern int __malloc_copy _PARAMS ((int (*) (void *, void *, void *, int), + void *, int)); +#endif /* __CYGWIN32 */ + +#ifdef __cplusplus +} +#endif + +#endif /* _INCLUDE_MALLOC_H_ */ diff --git a/MODEM/SRCS/dcload-serial/target-inc/math.h b/MODEM/SRCS/dcload-serial/target-inc/math.h new file mode 100644 index 00000000..d3f2e99a --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/math.h @@ -0,0 +1,273 @@ +/* math.h -- Definitions for the math floating point package. */ + +#ifndef _MATH_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _MATH_H_ + +#include +#include +#include "_ansi.h" + +#ifndef HUGE_VAL + +/* Define HUGE_VAL as infinity, unless HUGE_VAL is already defined + (which might have been done by something like math-68881.h). */ + +union __dmath +{ + __uint32_t i[2]; + double d; +}; + +extern const union __dmath __infinity; + +#define HUGE_VAL (__infinity.d) + +#endif /* ! defined (HUGE_VAL) */ + +/* Reentrant ANSI C functions. */ + +#ifndef __math_68881 +extern double atan _PARAMS((double)); +extern double cos _PARAMS((double)); +extern double sin _PARAMS((double)); +extern double tan _PARAMS((double)); +extern double tanh _PARAMS((double)); +extern double frexp _PARAMS((double, int *)); +extern double modf _PARAMS((double, double *)); +extern double ceil _PARAMS((double)); +extern double fabs _PARAMS((double)); +extern double floor _PARAMS((double)); +#endif /* ! defined (__math_68881) */ + +/* Non reentrant ANSI C functions. */ + +#ifndef _REENT_ONLY +#ifndef __math_6881 +extern double acos _PARAMS((double)); +extern double asin _PARAMS((double)); +extern double atan2 _PARAMS((double, double)); +extern double cosh _PARAMS((double)); +extern double sinh _PARAMS((double)); +extern double exp _PARAMS((double)); +extern double ldexp _PARAMS((double, int)); +extern double log _PARAMS((double)); +extern double log10 _PARAMS((double)); +extern double pow _PARAMS((double, double)); +extern double sqrt _PARAMS((double)); +extern double fmod _PARAMS((double, double)); +#endif /* ! defined (__math_68881) */ +#endif /* ! defined (_REENT_ONLY) */ + +#ifndef __STRICT_ANSI__ + +/* Non ANSI double precision functions. */ + +extern double infinity _PARAMS((void)); +extern double nan _PARAMS((void)); +extern int isnan _PARAMS((double)); +extern int isinf _PARAMS((double)); +extern int finite _PARAMS((double)); +extern double copysign _PARAMS((double, double)); +extern int ilogb _PARAMS((double)); + +extern double asinh _PARAMS((double)); +extern double cbrt _PARAMS((double)); +extern double nextafter _PARAMS((double, double)); +extern double rint _PARAMS((double)); +extern double scalbn _PARAMS((double, int)); + +#ifndef __math_68881 +extern double log1p _PARAMS((double)); +extern double expm1 _PARAMS((double)); +#endif /* ! defined (__math_68881) */ + +#ifndef _REENT_ONLY +extern double acosh _PARAMS((double)); +extern double atanh _PARAMS((double)); +extern double remainder _PARAMS((double, double)); +extern double gamma _PARAMS((double)); +extern double gamma_r _PARAMS((double, int *)); +extern double lgamma _PARAMS((double)); +extern double lgamma_r _PARAMS((double, int *)); +extern double erf _PARAMS((double)); +extern double erfc _PARAMS((double)); +extern double y0 _PARAMS((double)); +extern double y1 _PARAMS((double)); +extern double yn _PARAMS((int, double)); +extern double j0 _PARAMS((double)); +extern double j1 _PARAMS((double)); +extern double jn _PARAMS((int, double)); +#define log2(x) (log (x) / M_LOG2_E) + +#ifndef __math_68881 +extern double hypot _PARAMS((double, double)); +#endif + +extern double cabs(); +extern double drem _PARAMS((double, double)); + +#endif /* ! defined (_REENT_ONLY) */ + +/* Single precision versions of ANSI functions. */ + +extern float atanf _PARAMS((float)); +extern float cosf _PARAMS((float)); +extern float sinf _PARAMS((float)); +extern float tanf _PARAMS((float)); +extern float tanhf _PARAMS((float)); +extern float frexpf _PARAMS((float, int *)); +extern float modff _PARAMS((float, float *)); +extern float ceilf _PARAMS((float)); +extern float fabsf _PARAMS((float)); +extern float floorf _PARAMS((float)); + +#ifndef _REENT_ONLY +extern float acosf _PARAMS((float)); +extern float asinf _PARAMS((float)); +extern float atan2f _PARAMS((float, float)); +extern float coshf _PARAMS((float)); +extern float sinhf _PARAMS((float)); +extern float expf _PARAMS((float)); +extern float ldexpf _PARAMS((float, int)); +extern float logf _PARAMS((float)); +extern float log10f _PARAMS((float)); +extern float powf _PARAMS((float, float)); +extern float sqrtf _PARAMS((float)); +extern float fmodf _PARAMS((float, float)); +#endif /* ! defined (_REENT_ONLY) */ + +/* Other single precision functions. */ + +extern float infinityf _PARAMS((void)); +extern float nanf _PARAMS((void)); +extern int isnanf _PARAMS((float)); +extern int isinff _PARAMS((float)); +extern int finitef _PARAMS((float)); +extern float copysignf _PARAMS((float, float)); +extern int ilogbf _PARAMS((float)); + +extern float asinhf _PARAMS((float)); +extern float cbrtf _PARAMS((float)); +extern float nextafterf _PARAMS((float, float)); +extern float rintf _PARAMS((float)); +extern float scalbnf _PARAMS((float, int)); +extern float log1pf _PARAMS((float)); +extern float expm1f _PARAMS((float)); + +#ifndef _REENT_ONLY +extern float acoshf _PARAMS((float)); +extern float atanhf _PARAMS((float)); +extern float remainderf _PARAMS((float, float)); +extern float gammaf _PARAMS((float)); +extern float gammaf_r _PARAMS((float, int *)); +extern float lgammaf _PARAMS((float)); +extern float lgammaf_r _PARAMS((float, int *)); +extern float erff _PARAMS((float)); +extern float erfcf _PARAMS((float)); +extern float y0f _PARAMS((float)); +extern float y1f _PARAMS((float)); +extern float ynf _PARAMS((int, float)); +extern float j0f _PARAMS((float)); +extern float j1f _PARAMS((float)); +extern float jnf _PARAMS((int, float)); +#define log2f(x) (logf (x) / (float) M_LOG2_E) +extern float hypotf _PARAMS((float, float)); + +extern float cabsf(); +extern float dremf _PARAMS((float, float)); + +#endif /* ! defined (_REENT_ONLY) */ + +/* The gamma functions use a global variable, signgam. */ + +extern int signgam; + +/* The exception structure passed to the matherr routine. */ + +#ifdef __cplusplus +struct __exception +#else +struct exception +#endif +{ + int type; + char *name; + double arg1; + double arg2; + double retval; + int err; +}; + +#ifdef __cplusplus +extern int matherr _PARAMS((struct __exception *e)); +#else +extern int matherr _PARAMS((struct exception *e)); +#endif + +/* Values for the type field of struct exception. */ + +#define DOMAIN 1 +#define SING 2 +#define OVERFLOW 3 +#define UNDERFLOW 4 +#define TLOSS 5 +#define PLOSS 6 + +/* Useful constants. */ + +#define M_E 2.7182818284590452354 +#define M_LOG2E 1.4426950408889634074 +#define M_LOG10E 0.43429448190325182765 +#define M_LN2 0.69314718055994530942 +#define M_LN10 2.30258509299404568402 +#define M_PI 3.14159265358979323846 +#define M_TWOPI (M_PI * 2.0) +#define M_PI_2 1.57079632679489661923 +#define M_PI_4 0.78539816339744830962 +#define M_3PI_4 2.3561944901923448370E0 +#define M_SQRTPI 1.77245385090551602792981 +#define M_1_PI 0.31830988618379067154 +#define M_2_PI 0.63661977236758134308 +#define M_2_SQRTPI 1.12837916709551257390 +#define M_SQRT2 1.41421356237309504880 +#define M_SQRT1_2 0.70710678118654752440 +#define M_LN2LO 1.9082149292705877000E-10 +#define M_LN2HI 6.9314718036912381649E-1 +#define M_SQRT3 1.73205080756887719000 +#define M_IVLN10 0.43429448190325182765 /* 1 / log(10) */ +#define M_LOG2_E 0.693147180559945309417 +#define M_INVLN2 1.4426950408889633870E0 /* 1 / log(2) */ + +/* Global control over fdlibm error handling. */ + +enum __fdlibm_version +{ + __fdlibm_ieee = -1, + __fdlibm_svid, + __fdlibm_xopen, + __fdlibm_posix +}; + +#define _LIB_VERSION_TYPE enum __fdlibm_version +#define _LIB_VERSION __fdlib_version + +extern _CONST _LIB_VERSION_TYPE _LIB_VERSION; + +#define _IEEE_ __fdlibm_ieee +#define _SVID_ __fdlibm_svid +#define _XOPEN_ __fdlibm_xopen +#define _POSIX_ __fdlibm_posix + +#endif /* ! defined (__STRICT_ANSI__) */ + +#ifdef __FAST_MATH__ +#include +#endif + +#ifdef __cplusplus +} +#endif +#endif /* _MATH_H_ */ diff --git a/MODEM/SRCS/dcload-serial/target-inc/paths.h b/MODEM/SRCS/dcload-serial/target-inc/paths.h new file mode 100644 index 00000000..36cf78a9 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/paths.h @@ -0,0 +1,7 @@ +#ifndef _PATHS_H_ +#define _PATHS_H_ + +#define _PATH_DEV "/dev/" +#define _PATH_BSHELL "/bin/sh" + +#endif /* _PATHS_H_ */ diff --git a/MODEM/SRCS/dcload-serial/target-inc/process.h b/MODEM/SRCS/dcload-serial/target-inc/process.h new file mode 100644 index 00000000..ca5b451c --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/process.h @@ -0,0 +1,60 @@ +/* process.h. This file comes with MSDOS and WIN32 systems. */ + +#ifndef __PROCESS_H_ +#define __PROCESS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +int execl(const char *path, const char *argv0, ...); +int execle(const char *path, const char *argv0, ... /*, char * const *envp */); +int execlp(const char *path, const char *argv0, ...); +int execlpe(const char *path, const char *argv0, ... /*, char * const *envp */); + +int execv(const char *path, char * const *argv); +int execve(const char *path, char * const *argv, char * const *envp); +int execvp(const char *path, char * const *argv); +int execvpe(const char *path, char * const *argv, char * const *envp); + +int spawnl(int mode, const char *path, const char *argv0, ...); +int spawnle(int mode, const char *path, const char *argv0, ... /*, char * const *envp */); +int spawnlp(int mode, const char *path, const char *argv0, ...); +int spawnlpe(int mode, const char *path, const char *argv0, ... /*, char * const *envp */); + +int spawnv(int mode, const char *path, const char * const *argv); +int spawnve(int mode, const char *path, char * const *argv, const char * const *envp); +int spawnvp(int mode, const char *path, const char * const *argv); +int spawnvpe(int mode, const char *path, const char * const *argv, const char * const *envp); + +#ifdef __CYGWIN32__ +/* Secure exec() functions family */ +/* The first arg should really be a HANDLE which is a void *. But we + can't include windows.h here so... */ +#include +pid_t sexecl(void *, const char *path, const char *argv0, ...); +pid_t sexecle(void *, const char *path, const char *argv0, ... /*, char * const *envp */); +pid_t sexeclp(void *, const char *path, const char *argv0, ...); +pid_t sexeclpe(void *, const char *path, const char *argv0, ... /*, char * const *envp */); + +pid_t sexecv(void *, const char *path, const char * const *argv); +pid_t sexecve(void *, const char *path, const char * const *argv, const char * const *envp); +pid_t sexecvp(void *, const char *path, const char * const *argv); +pid_t sexecvpe(void *, const char *path, const char * const *argv, const char * const *envp); +#endif + +int cwait(int *, int, int); + +#define _P_WAIT 1 +#define _P_NOWAIT 2 /* always generates error */ +#define _P_OVERLAY 3 +#define _P_NOWAITO 4 +#define _P_DETACH 5 + +#define WAIT_CHILD 1 + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MODEM/SRCS/dcload-serial/target-inc/pwd.h b/MODEM/SRCS/dcload-serial/target-inc/pwd.h new file mode 100644 index 00000000..59d6ab55 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/pwd.h @@ -0,0 +1,76 @@ +/*- + * Copyright (c) 1989 The Regents of the University of California. + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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. + * + * @(#)pwd.h 5.13 (Berkeley) 5/28/91 + */ + +#ifndef _PWD_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _PWD_H_ + +#include + +#ifndef _POSIX_SOURCE +#define _PATH_PASSWD "/etc/passwd" + +#define _PASSWORD_LEN 128 /* max length, not counting NULL */ +#endif + +struct passwd { + char *pw_name; /* user name */ + char *pw_passwd; /* encrypted password */ + int pw_uid; /* user uid */ + int pw_gid; /* user gid */ + char *pw_comment; /* comment */ + char *pw_gecos; /* Honeywell login info */ + char *pw_dir; /* home directory */ + char *pw_shell; /* default shell */ +}; + +struct passwd *getpwuid (uid_t); +struct passwd *getpwnam (const char *); +int getpwnam_r (const char *, struct passwd *, + char *, size_t , struct passwd **); +int getpwuid_r (uid_t, struct passwd *, char *, + size_t, struct passwd **); +#ifndef _POSIX_SOURCE +struct passwd *getpwent (void); +void setpwent (void); +void endpwent (void); +#endif + +#ifdef __cplusplus +} +#endif +#endif /* _PWD_H_ */ diff --git a/MODEM/SRCS/dcload-serial/target-inc/reent.h b/MODEM/SRCS/dcload-serial/target-inc/reent.h new file mode 100644 index 00000000..56fae91a --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/reent.h @@ -0,0 +1,87 @@ +/* This header file provides the reentrancy. */ + +/* The reentrant system calls here serve two purposes: + + 1) Provide reentrant versions of the system calls the ANSI C library + requires. + 2) Provide these system calls in a namespace clean way. + + It is intended that *all* system calls that the ANSI C library needs + be declared here. It documents them all in one place. All library access + to the system is via some form of these functions. + + There are three ways a target may provide the needed syscalls. + + 1) Define the reentrant versions of the syscalls directly. + (eg: _open_r, _close_r, etc.). Please keep the namespace clean. + When you do this, set "syscall_dir" to "syscalls" in configure.in, + and add -DREENTRANT_SYSCALLS_PROVIDED to target_cflags in configure.in. + + 2) Define namespace clean versions of the system calls by prefixing + them with '_' (eg: _open, _close, etc.). Technically, there won't be + true reentrancy at the syscall level, but the library will be namespace + clean. + When you do this, set "syscall_dir" to "syscalls" in configure.in. + + 3) Define or otherwise provide the regular versions of the syscalls + (eg: open, close, etc.). The library won't be reentrant nor namespace + clean, but at least it will work. + When you do this, add -DMISSING_SYSCALL_NAMES to target_cflags in + configure.in. + + Stubs of the reentrant versions of the syscalls exist in the libc/reent + source directory and are used if REENTRANT_SYSCALLS_PROVIDED isn't defined. + They use the native system calls: _open, _close, etc. if they're available + (MISSING_SYSCALL_NAMES is *not* defined), otherwise open, close, etc. + (MISSING_SYSCALL_NAMES *is* defined). */ + +/* WARNING: All identifiers here must begin with an underscore. This file is + included by stdio.h and others and we therefore must only use identifiers + in the namespace allotted to us. */ + +#ifndef _REENT_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _REENT_H_ + +#include +#include +#include + +#define __need_size_t +#include + +/* FIXME: not namespace clean */ +struct stat; +struct tms; +struct timeval; +struct timezone; + +/* Reentrant versions of system calls. */ + +extern int _close_r _PARAMS ((struct _reent *, int)); +extern int _execve_r _PARAMS ((struct _reent *, char *, char **, char **)); +extern int _fcntl_r _PARAMS ((struct _reent *, int, int, int)); +extern int _fork_r _PARAMS ((struct _reent *)); +extern int _fstat_r _PARAMS ((struct _reent *, int, struct stat *)); +extern int _getpid_r _PARAMS ((struct _reent *)); +extern int _kill_r _PARAMS ((struct _reent *, int, int)); +extern int _link_r _PARAMS ((struct _reent *, const char *, const char *)); +extern _off_t _lseek_r _PARAMS ((struct _reent *, int, _off_t, int)); +extern int _open_r _PARAMS ((struct _reent *, const char *, int, int)); +extern _ssize_t _read_r _PARAMS ((struct _reent *, int, void *, size_t)); +extern void *_sbrk_r _PARAMS ((struct _reent *, size_t)); +extern int _stat_r _PARAMS ((struct _reent *, const char *, struct stat *)); +extern _CLOCK_T_ _times_r _PARAMS ((struct _reent *, struct tms *)); +extern int _unlink_r _PARAMS ((struct _reent *, const char *)); +extern int _wait_r _PARAMS ((struct _reent *, int *)); +extern _ssize_t _write_r _PARAMS ((struct _reent *, int, const void *, size_t)); + +/* This one is not guaranteed to be available on all targets. */ +extern int _gettimeofday_r _PARAMS ((struct _reent *, struct timeval *tp, struct timezone *tzp)); + +#ifdef __cplusplus +} +#endif +#endif /* _REENT_H_ */ diff --git a/MODEM/SRCS/dcload-serial/target-inc/regdef.h b/MODEM/SRCS/dcload-serial/target-inc/regdef.h new file mode 100644 index 00000000..8cf144b8 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/regdef.h @@ -0,0 +1,7 @@ +/* regdef.h -- define register names. */ + +/* This is a standard include file for MIPS targets. Other target + probably don't define it, and attempts to include this file will + fail. */ + +#include diff --git a/MODEM/SRCS/dcload-serial/target-inc/setjmp.h b/MODEM/SRCS/dcload-serial/target-inc/setjmp.h new file mode 100644 index 00000000..53d0223f --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/setjmp.h @@ -0,0 +1,22 @@ +/* + setjmp.h + stubs for future use. +*/ + +#ifndef _SETJMP_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _SETJMP_H_ + +#include "_ansi.h" +#include + +void _EXFUN(longjmp,(jmp_buf __jmpb, int __retval)); +int _EXFUN(setjmp,(jmp_buf __jmpb)); + +#ifdef __cplusplus +} +#endif +#endif /* _SETJMP_H_ */ + diff --git a/MODEM/SRCS/dcload-serial/target-inc/signal.h b/MODEM/SRCS/dcload-serial/target-inc/signal.h new file mode 100644 index 00000000..31114914 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/signal.h @@ -0,0 +1,37 @@ +#ifndef _SIGNAL_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _SIGNAL_H_ + +#include "_ansi.h" +#include + +typedef int sig_atomic_t; /* Atomic entity type (ANSI) */ + +#if defined(__STDC__) || defined(__cplusplus) +#define SIG_DFL ((void (*)(int))0) /* Default action */ +#define SIG_IGN ((void (*)(int))1) /* Ignore action */ +#define SIG_ERR ((void (*)(int))-1) /* Error return */ +#else +#define SIG_DFL ((void (*)())0) /* Default action */ +#define SIG_IGN ((void (*)())1) /* Ignore action */ +#define SIG_ERR ((void (*)())-1) /* Error return */ +#endif + +typedef void (*_sig_func_ptr) (int); + +struct _reent; + +_sig_func_ptr _EXFUN(_signal_r, (struct _reent *, int, _sig_func_ptr)); +int _EXFUN(_raise_r, (struct _reent *, int)); + +#ifndef _REENT_ONLY +_sig_func_ptr _EXFUN(signal, (int, _sig_func_ptr)); +int _EXFUN(raise, (int)); +#endif + +#ifdef __cplusplus +} +#endif +#endif /* _SIGNAL_H_ */ diff --git a/MODEM/SRCS/dcload-serial/target-inc/stdio.h b/MODEM/SRCS/dcload-serial/target-inc/stdio.h new file mode 100644 index 00000000..2c2b46cf --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/stdio.h @@ -0,0 +1,313 @@ +/* + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the University of California, Berkeley. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * @(#)stdio.h 5.3 (Berkeley) 3/15/86 + */ + +/* + * NB: to fit things in six character monocase externals, the + * stdio code uses the prefix `__s' for stdio objects, typically + * followed by a three-character attempt at a mnemonic. + */ + +#ifndef _STDIO_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _STDIO_H_ + +#include "_ansi.h" + +#define _FSTDIO /* ``function stdio'' */ + +#define __need_size_t +#include + +#define __need___va_list +#include + +/* + * defines __sFILE, _fpos_t. + * They must be defined there because struct _reent needs them (and we don't + * want reent.h to include this file. + */ + +#include + +typedef _fpos_t fpos_t; + +typedef struct __sFILE FILE; + +#define __SLBF 0x0001 /* line buffered */ +#define __SNBF 0x0002 /* unbuffered */ +#define __SRD 0x0004 /* OK to read */ +#define __SWR 0x0008 /* OK to write */ + /* RD and WR are never simultaneously asserted */ +#define __SRW 0x0010 /* open for reading & writing */ +#define __SEOF 0x0020 /* found EOF */ +#define __SERR 0x0040 /* found error */ +#define __SMBF 0x0080 /* _buf is from malloc */ +#define __SAPP 0x0100 /* fdopen()ed in append mode - so must write to end */ +#define __SSTR 0x0200 /* this is an sprintf/snprintf string */ +#define __SOPT 0x0400 /* do fseek() optimisation */ +#define __SNPT 0x0800 /* do not do fseek() optimisation */ +#define __SOFF 0x1000 /* set iff _offset is in fact correct */ +#define __SMOD 0x2000 /* true => fgetline modified _p text */ + +/* + * The following three definitions are for ANSI C, which took them + * from System V, which stupidly took internal interface macros and + * made them official arguments to setvbuf(), without renaming them. + * Hence, these ugly _IOxxx names are *supposed* to appear in user code. + * + * Although these happen to match their counterparts above, the + * implementation does not rely on that (so these could be renumbered). + */ +#define _IOFBF 0 /* setvbuf should set fully buffered */ +#define _IOLBF 1 /* setvbuf should set line buffered */ +#define _IONBF 2 /* setvbuf should set unbuffered */ + +#ifndef NULL +#define NULL 0 +#endif + +#define BUFSIZ 1024 +#define EOF (-1) + +#define FOPEN_MAX 20 /* must be <= OPEN_MAX */ +#define FILENAME_MAX 1024 /* must be <= PATH_MAX */ +#define L_tmpnam 1024 /* XXX must be == PATH_MAX */ +#ifndef __STRICT_ANSI__ +#define P_tmpdir "/tmp" +#endif + +#ifndef SEEK_SET +#define SEEK_SET 0 /* set file offset to offset */ +#endif +#ifndef SEEK_CUR +#define SEEK_CUR 1 /* set file offset to current plus offset */ +#endif +#ifndef SEEK_END +#define SEEK_END 2 /* set file offset to EOF plus offset */ +#endif + +#define TMP_MAX 26 + +#define stdin (_impure_ptr->_stdin) +#define stdout (_impure_ptr->_stdout) +#define stderr (_impure_ptr->_stderr) + +#define _stdin_r(x) ((x)->_stdin) +#define _stdout_r(x) ((x)->_stdout) +#define _stderr_r(x) ((x)->_stderr) + +/* + * Functions defined in ANSI C standard. + */ + +#ifdef __GNUC__ +#define __VALIST __gnuc_va_list +#else +#define __VALIST char* +#endif + +#ifndef _REENT_ONLY +int _EXFUN(remove, (const char *)); +int _EXFUN(rename, (const char *, const char *)); +#endif +char * _EXFUN(tempnam, (const char *, const char *)); +FILE * _EXFUN(tmpfile, (void)); +char * _EXFUN(tmpnam, (char *)); +int _EXFUN(fclose, (FILE *)); +int _EXFUN(fflush, (FILE *)); +FILE * _EXFUN(freopen, (const char *, const char *, FILE *)); +void _EXFUN(setbuf, (FILE *, char *)); +int _EXFUN(setvbuf, (FILE *, char *, int, size_t)); +int _EXFUN(fprintf, (FILE *, const char *, ...)); +int _EXFUN(fscanf, (FILE *, const char *, ...)); +int _EXFUN(printf, (const char *, ...)); +int _EXFUN(scanf, (const char *, ...)); +int _EXFUN(sscanf, (const char *, const char *, ...)); +int _EXFUN(vfprintf, (FILE *, const char *, __VALIST)); +int _EXFUN(vprintf, (const char *, __VALIST)); +int _EXFUN(vsprintf, (char *, const char *, __VALIST)); +int _EXFUN(vsnprintf, (char *, size_t, const char *, __VALIST)); +int _EXFUN(fgetc, (FILE *)); +char * _EXFUN(fgets, (char *, int, FILE *)); +int _EXFUN(fputc, (int, FILE *)); +int _EXFUN(fputs, (const char *, FILE *)); +int _EXFUN(getc, (FILE *)); +int _EXFUN(getchar, (void)); +char * _EXFUN(gets, (char *)); +int _EXFUN(putc, (int, FILE *)); +int _EXFUN(putchar, (int)); +int _EXFUN(puts, (const char *)); +int _EXFUN(ungetc, (int, FILE *)); +size_t _EXFUN(fread, (_PTR, size_t _size, size_t _n, FILE *)); +size_t _EXFUN(fwrite, (const _PTR , size_t _size, size_t _n, FILE *)); +int _EXFUN(fgetpos, (FILE *, fpos_t *)); +int _EXFUN(fseek, (FILE *, long, int)); +int _EXFUN(fsetpos, (FILE *, const fpos_t *)); +long _EXFUN(ftell, ( FILE *)); +void _EXFUN(rewind, (FILE *)); +void _EXFUN(clearerr, (FILE *)); +int _EXFUN(feof, (FILE *)); +int _EXFUN(ferror, (FILE *)); +void _EXFUN(perror, (const char *)); +#ifndef _REENT_ONLY +FILE * _EXFUN(fopen, (const char *_name, const char *_type)); +int _EXFUN(sprintf, (char *, const char *, ...)); +int _EXFUN(snprintf, (char *, size_t, const char *, ...)); +#endif +#ifndef __STRICT_ANSI__ +int _EXFUN(vfiprintf, (FILE *, const char *, __VALIST)); +int _EXFUN(iprintf, (const char *, ...)); +int _EXFUN(fiprintf, (FILE *, const char *, ...)); +int _EXFUN(siprintf, (char *, const char *, ...)); +#endif + +/* + * Routines in POSIX 1003.1. + */ + +#ifndef __STRICT_ANSI__ +#ifndef _REENT_ONLY +FILE * _EXFUN(fdopen, (int, const char *)); +#endif +int _EXFUN(fileno, (FILE *)); +int _EXFUN(getw, (FILE *)); +int _EXFUN(pclose, (FILE *)); +FILE * _EXFUN(popen, (const char *, const char *)); +int _EXFUN(putw, (int, FILE *)); +void _EXFUN(setbuffer, (FILE *, char *, int)); +int _EXFUN(setlinebuf, (FILE *)); +#endif + +/* + * Recursive versions of the above. + */ + +FILE * _EXFUN(_fdopen_r, (struct _reent *, int, const char *)); +FILE * _EXFUN(_fopen_r, (struct _reent *, const char *, const char *)); +int _EXFUN(_getchar_r, (struct _reent *)); +char * _EXFUN(_gets_r, (struct _reent *, char *)); +int _EXFUN(_iprintf_r, (struct _reent *, const char *, ...)); +int _EXFUN(_mkstemp_r, (struct _reent *, char *)); +char * _EXFUN(_mktemp_r, (struct _reent *, char *)); +void _EXFUN(_perror_r, (struct _reent *, const char *)); +int _EXFUN(_printf_r, (struct _reent *, const char *, ...)); +int _EXFUN(_putchar_r, (struct _reent *, int)); +int _EXFUN(_puts_r, (struct _reent *, const char *)); +int _EXFUN(_remove_r, (struct _reent *, const char *)); +int _EXFUN(_rename_r, (struct _reent *, + const char *_old, const char *_new)); +int _EXFUN(_scanf_r, (struct _reent *, const char *, ...)); +int _EXFUN(_sprintf_r, (struct _reent *, char *, const char *, ...)); +int _EXFUN(_snprintf_r, (struct _reent *, char *, size_t, const char *, ...)); +char * _EXFUN(_tempnam_r, (struct _reent *, const char *, const char *)); +FILE * _EXFUN(_tmpfile_r, (struct _reent *)); +char * _EXFUN(_tmpnam_r, (struct _reent *, char *)); +int _EXFUN(_vfprintf_r, (struct _reent *, FILE *, const char *, __VALIST)); +int _EXFUN(_vprintf_r, (struct _reent *, const char *, __VALIST)); +int _EXFUN(_vsprintf_r, (struct _reent *, char *, const char *, __VALIST)); +int _EXFUN(_vsnprintf_r, (struct _reent *, char *, size_t, const char *, __VALIST)); + +/* + * Routines internal to the implementation. + */ + +int _EXFUN(__srget, (FILE *)); +int _EXFUN(__swbuf, (int, FILE *)); + +/* + * Stdio function-access interface. + */ + +#ifndef __STRICT_ANSI__ +FILE *_EXFUN(funopen,(const _PTR _cookie, + int (*readfn)(_PTR _cookie, char *_buf, int _n), + int (*writefn)(_PTR _cookie, const char *_buf, int _n), + fpos_t (*seekfn)(_PTR _cookie, fpos_t _off, int _whence), + int (*closefn)(_PTR _cookie))); + +#define fropen(cookie, fn) funopen(cookie, fn, (int (*)())0, (fpos_t (*)())0, (int (*)())0) +#define fwopen(cookie, fn) funopen(cookie, (int (*)())0, fn, (fpos_t (*)())0, (int (*)())0) +#endif + +/* + * The __sfoo macros are here so that we can + * define function versions in the C library. + */ +#define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++)) +#ifdef _never /* __GNUC__ */ +/* If this inline is actually used, then systems using coff debugging + info get hopelessly confused. 21sept93 rich@cygnus.com. */ +static __inline int __sputc(int _c, FILE *_p) { + if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n')) + return (*_p->_p++ = _c); + else + return (__swbuf(_c, _p)); +} +#else +/* + * This has been tuned to generate reasonable code on the vax using pcc + */ +#define __sputc(c, p) \ + (--(p)->_w < 0 ? \ + (p)->_w >= (p)->_lbfsize ? \ + (*(p)->_p = (c)), *(p)->_p != '\n' ? \ + (int)*(p)->_p++ : \ + __swbuf('\n', p) : \ + __swbuf((int)(c), p) : \ + (*(p)->_p = (c), (int)*(p)->_p++)) +#endif + +#define __sfeof(p) (((p)->_flags & __SEOF) != 0) +#define __sferror(p) (((p)->_flags & __SERR) != 0) +#define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF))) +#define __sfileno(p) ((p)->_file) + +#define feof(p) __sfeof(p) +#define ferror(p) __sferror(p) +#define clearerr(p) __sclearerr(p) + +#if 0 /*ndef __STRICT_ANSI__ - FIXME: must initialize stdio first, use fn */ +#define fileno(p) __sfileno(p) +#endif + +#ifndef lint +#define getc(fp) __sgetc(fp) +#define putc(x, fp) __sputc(x, fp) +#endif /* lint */ + +#define getchar() getc(stdin) +#define putchar(x) putc(x, stdout) + +#ifndef __STRICT_ANSI__ +/* fast always-buffered version, true iff error */ +#define fast_putc(x,p) (--(p)->_w < 0 ? \ + __swbuf((int)(x), p) == EOF : (*(p)->_p = (x), (p)->_p++, 0)) + +#define L_cuserid 9 /* posix says it goes in stdio.h :( */ +#ifdef __CYGWIN32__ +#define L_ctermid 16 +#endif +#endif + +#ifdef __cplusplus +} +#endif +#endif /* _STDIO_H_ */ diff --git a/MODEM/SRCS/dcload-serial/target-inc/stdlib.h b/MODEM/SRCS/dcload-serial/target-inc/stdlib.h new file mode 100644 index 00000000..5300663f --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/stdlib.h @@ -0,0 +1,140 @@ +/* + * stdlib.h + * + * Definitions for common types, variables, and functions. + */ + +#ifndef _STDLIB_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _STDLIB_H_ + +#include "_ansi.h" + +#define __need_size_t +#define __need_wchar_t +#include + +#include + +typedef struct +{ + int quot; /* quotient */ + int rem; /* remainder */ +} div_t; + +typedef struct +{ + long quot; /* quotient */ + long rem; /* remainder */ +} ldiv_t; + +#ifndef NULL +#define NULL 0 +#endif + +#define EXIT_FAILURE 1 +#define EXIT_SUCCESS 0 + +#define RAND_MAX 0x7fffffff + +#if (defined(__CYGWIN__) || defined(__CYGWIN32__)) && ! defined(_COMPILING_NEWLIB) +extern __declspec(dllimport) int __mb_cur_max; +#else +extern int __mb_cur_max; +#endif + +#define MB_CUR_MAX __mb_cur_max + +_VOID _EXFUN(abort,(_VOID) _ATTRIBUTE ((noreturn))); +int _EXFUN(abs,(int)); +int _EXFUN(atexit,(_VOID (*__func)(_VOID))); +double _EXFUN(atof,(const char *__nptr)); +#ifndef __STRICT_ANSI__ +float _EXFUN(atoff,(const char *__nptr)); +#endif +int _EXFUN(atoi,(const char *__nptr)); +long _EXFUN(atol,(const char *__nptr)); +_PTR _EXFUN(bsearch,(const _PTR __key, + const _PTR __base, + size_t __nmemb, + size_t __size, + int _EXFUN((*_compar),(const _PTR, const _PTR)))); +_PTR _EXFUN(calloc,(size_t __nmemb, size_t __size)); +div_t _EXFUN(div,(int __numer, int __denom)); +_VOID _EXFUN(exit,(int __status) _ATTRIBUTE ((noreturn))); +_VOID _EXFUN(free,(_PTR)); +char * _EXFUN(getenv,(const char *__string)); +char * _EXFUN(_getenv_r,(struct _reent *, const char *__string)); +char * _EXFUN(_findenv,(_CONST char *, int *)); +char * _EXFUN(_findenv_r,(struct _reent *, _CONST char *, int *)); +long _EXFUN(labs,(long)); +ldiv_t _EXFUN(ldiv,(long __numer, long __denom)); +_PTR _EXFUN(malloc,(size_t __size)); +int _EXFUN(mblen,(const char *, size_t)); +int _EXFUN(_mblen_r,(struct _reent *, const char *, size_t, int *)); +int _EXFUN(mbtowc,(wchar_t *, const char *, size_t)); +int _EXFUN(_mbtowc_r,(struct _reent *, wchar_t *, const char *, size_t, int *)); +int _EXFUN(wctomb,(char *, wchar_t)); +int _EXFUN(_wctomb_r,(struct _reent *, char *, wchar_t, int *)); +size_t _EXFUN(mbstowcs,(wchar_t *, const char *, size_t)); +size_t _EXFUN(_mbstowcs_r,(struct _reent *, wchar_t *, const char *, size_t, int *)); +size_t _EXFUN(wcstombs,(char *, const wchar_t *, size_t)); +size_t _EXFUN(_wcstombs_r,(struct _reent *, char *, const wchar_t *, size_t, int *)); +_VOID _EXFUN(qsort,(_PTR __base, size_t __nmemb, size_t __size, int(*_compar)(const _PTR, const _PTR))); +int _EXFUN(rand,(_VOID)); +_PTR _EXFUN(realloc,(_PTR __r, size_t __size)); +_VOID _EXFUN(srand,(unsigned __seed)); +double _EXFUN(strtod,(const char *__n, char **_end_PTR)); +#ifndef __STRICT_ANSI__ +float _EXFUN(strtodf,(const char *__n, char **_end_PTR)); +#endif +long _EXFUN(strtol,(const char *__n, char **_end_PTR, int __base)); +unsigned long _EXFUN(strtoul,(const char *_n_PTR, char **_end_PTR, int __base)); +unsigned long _EXFUN(_strtoul_r,(struct _reent *,const char *_n_PTR, char **_end_PTR, int __base)); +int _EXFUN(system,(const char *__string)); + +#ifndef __STRICT_ANSI__ +_VOID _EXFUN(cfree,(_PTR)); +int _EXFUN(putenv,(const char *__string)); +int _EXFUN(setenv,(const char *__string, const char *__value, int __overwrite)); +int _EXFUN(_setenv_r,(struct _reent *, const char *__string, const char *__value, int __overwrite)); + +char * _EXFUN(gcvt,(double,int,char *)); +char * _EXFUN(gcvtf,(float,int,char *)); +char * _EXFUN(fcvt,(double,int,int *,int *)); +char * _EXFUN(fcvtf,(float,int,int *,int *)); +char * _EXFUN(ecvt,(double,int,int *,int *)); +char * _EXFUN(ecvtbuf,(double, int, int*, int*, char *)); +char * _EXFUN(fcvtbuf,(double, int, int*, int*, char *)); +char * _EXFUN(ecvtf,(float,int,int *,int *)); +char * _EXFUN(dtoa,(double, int, int, int *, int*, char**)); +int _EXFUN(rand_r,(unsigned *__seed)); + +#ifdef __CYGWIN32__ +char * _EXFUN(realpath,(const char *, char *)); +void _EXFUN(unsetenv,(const char *__string)); +int _EXFUN(random,(_VOID)); +long _EXFUN(srandom,(unsigned __seed)); +char * _EXFUN(ptsname, (int)); +int _EXFUN(grantpt, (int)); +int _EXFUN(unlockpt,(int)); +#endif + +#endif /* ! __STRICT_ANSI__ */ + +char * _EXFUN(_dtoa_r,(struct _reent *, double, int, int, int *, int*, char**)); +_PTR _EXFUN(_malloc_r,(struct _reent *, size_t)); +_PTR _EXFUN(_calloc_r,(struct _reent *, size_t, size_t)); +_VOID _EXFUN(_free_r,(struct _reent *, _PTR)); +_PTR _EXFUN(_realloc_r,(struct _reent *, _PTR, size_t)); +_VOID _EXFUN(_mstats_r,(struct _reent *, char *)); +int _EXFUN(_system_r,(struct _reent *, const char *)); + +_VOID _EXFUN(__eprintf,(const char *, const char *, unsigned int, const char *)); + +#ifdef __cplusplus +} +#endif +#endif /* _STDLIB_H_ */ diff --git a/MODEM/SRCS/dcload-serial/target-inc/string.h b/MODEM/SRCS/dcload-serial/target-inc/string.h new file mode 100644 index 00000000..40ba5440 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/string.h @@ -0,0 +1,90 @@ +/* + * string.h + * + * Definitions for memory and string functions. + */ + +#ifndef _STRING_H_ +#define _STRING_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "_ansi.h" + +#define __need_size_t +#include + +#ifndef NULL +#define NULL 0 +#endif + +_PTR _EXFUN(memchr,(const _PTR, int, size_t)); +int _EXFUN(memcmp,(const _PTR, const _PTR, size_t)); +_PTR _EXFUN(memcpy,(_PTR, const _PTR, size_t)); +_PTR _EXFUN(memmove,(_PTR, const _PTR, size_t)); +_PTR _EXFUN(memset,(_PTR, int, size_t)); +char *_EXFUN(strcat,(char *, const char *)); +char *_EXFUN(strchr,(const char *, int)); +int _EXFUN(strcmp,(const char *, const char *)); +int _EXFUN(strcoll,(const char *, const char *)); +char *_EXFUN(strcpy,(char *, const char *)); +size_t _EXFUN(strcspn,(const char *, const char *)); +char *_EXFUN(strerror,(int)); +size_t _EXFUN(strlen,(const char *)); +char *_EXFUN(strncat,(char *, const char *, size_t)); +int _EXFUN(strncmp,(const char *, const char *, size_t)); +char *_EXFUN(strncpy,(char *, const char *, size_t)); +char *_EXFUN(strpbrk,(const char *, const char *)); +char *_EXFUN(strrchr,(const char *, int)); +size_t _EXFUN(strspn,(const char *, const char *)); +char *_EXFUN(strstr,(const char *, const char *)); + +#ifndef _REENT_ONLY +char *_EXFUN(strtok,(char *, const char *)); +#endif + +size_t _EXFUN(strxfrm,(char *, const char *, size_t)); + +#ifndef __STRICT_ANSI__ +char *_EXFUN(strtok_r,(char *, const char *, char **)); + +int _EXFUN(bcmp,(const char *, const char *, size_t)); +void _EXFUN(bcopy,(const char *, char *, size_t)); +void _EXFUN(bzero,(char *, size_t)); +int _EXFUN(ffs,(int)); +char *_EXFUN(index,(const char *, int)); +_PTR _EXFUN(memccpy,(_PTR, const _PTR, int, size_t)); +char *_EXFUN(rindex,(const char *, int)); +int _EXFUN(strcasecmp,(const char *, const char *)); +char *_EXFUN(strdup,(const char *)); +int _EXFUN(strncasecmp,(const char *, const char *, size_t)); +char *_EXFUN(strsep,(char **, const char *)); +char *_EXFUN(strlwr,(char *)); +char *_EXFUN(strupr,(char *)); +#ifdef __CYGWIN32__ +char *_EXFUN(strsignal, (int __signo)); +int _EXFUN(strtosigno, (const char *__name)); +#endif + +/* These function names are used on Windows and perhaps other systems. */ +#ifndef strcmpi +#define strcmpi strcasecmp +#endif +#ifndef stricmp +#define stricmp strcasecmp +#endif +#ifndef strncmpi +#define strncmpi strncasecmp +#endif +#ifndef strnicmp +#define strnicmp strncasecmp +#endif + +#endif /* ! __STRICT_ANSI__ */ + +#ifdef __cplusplus +} +#endif +#endif /* _STRING_H_ */ diff --git a/MODEM/SRCS/dcload-serial/target-inc/sys/_types.h b/MODEM/SRCS/dcload-serial/target-inc/sys/_types.h new file mode 100644 index 00000000..8186f2d9 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/sys/_types.h @@ -0,0 +1,15 @@ +/* ANSI C namespace clean utility typedefs */ + +/* This file defines various typedefs needed by the system calls that support + the C library. Basically, they're just the POSIX versions with an '_' + prepended. This file lives in the `sys' directory so targets can provide + their own if desired (or they can put target dependant conditionals here). +*/ + +#ifndef _SYS__TYPES_H +#define _SYS__TYPES_H + +typedef long _off_t; +typedef long _ssize_t; + +#endif /* _SYS__TYPES_H */ diff --git a/MODEM/SRCS/dcload-serial/target-inc/sys/config.h b/MODEM/SRCS/dcload-serial/target-inc/sys/config.h new file mode 100644 index 00000000..e274119b --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/sys/config.h @@ -0,0 +1,115 @@ +#ifndef __SYS_CONFIG_H__ +#define __SYS_CONFIG_H__ + +/* exceptions first */ +/* ??? Why is much of this stuff duplicated with machine/ieeefp.h? */ +#if defined(__H8300__) || defined(__H8500__) || defined (__H8300H__) || defined(__W65__) || defined (__H8300S__) +#define _FLOAT_ARG float +#define __SMALL_BITFIELDS +#define _DOUBLE_IS_32BITS +#define __IEEE_BIG_ENDIAN +/* ??? This conditional is true for the h8500 and the w65, defining H8300 + in those cases probably isn't the right thing to do. */ +#define H8300 1 +#endif + +#ifdef __W65__ +#define _DOUBLE_IS_32BITS +#define __SMALL_BITFIELDS +#define __IEEE_BIG_ENDIAN +#undef INT_MAX +#undef UINT_MAX +#define INT_MAX 32767 +#define UINT_MAX 65535 + +#endif + +/* 16 bit integer machines */ +#if defined(__Z8001__) || defined(__Z8002__) || defined(__H8300__) || defined(__H8500__) || defined(__W65__) || defined (__H8300H__) || defined (__H8300S__) || defined (__mn10200__) + +#undef INT_MAX +#undef UINT_MAX +#define INT_MAX 32767 +#define UINT_MAX 65535 +#endif + +#if defined(__D10V__) +#undef INT_MAX +#undef UINT_MAX +#define INT_MAX __INT_MAX__ +#define UINT_MAX (__INT_MAX__ * 2U + 1) +#define _DOUBLE_IS_32BITS +#define _POINTER_INT short +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef ___AM29K__ +#define _FLOAT_RET double +#endif + +#ifdef __i386__ +#ifndef __unix__ +/* in other words, go32 */ +#define _FLOAT_RET double +#endif +#endif + +#ifdef __M32R__ +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef __m68k__ +/* This is defined in machine/ieeefp.h; need to check is it redundant here? */ +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef __mn10300__ +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __mn10200__ +#define _DOUBLE_IS_32BITS +#define __SMALL_BITFIELDS +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __TIC80__ +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __v850 +#define __IEEE_LITTLE_ENDIAN +#define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__sda__)) +#endif + +#ifdef __D30V__ +#define __IEEE_BIG_ENDIAN +#endif + +/* For the PowerPC eabi, force the _impure_ptr to be in .sdata */ +#if defined(__PPC__) && defined(_CALL_SYSV) +#define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__section__(".sdata"))) +#endif + +#ifdef __sparc__ +#ifdef __LITTLE_ENDIAN_DATA__ +#define __IEEE_LITTLE_ENDIAN +#else +#define __IEEE_BIG_ENDIAN +#endif +#endif + +#if INT_MAX == 32767 +typedef long int __int32_t; +typedef unsigned long int __uint32_t; +#else +typedef int __int32_t; +typedef unsigned int __uint32_t; +#endif + +#ifndef _POINTER_INT +#define _POINTER_INT long +#endif + + +#endif /* __SYS_CONFIG_H__ */ diff --git a/MODEM/SRCS/dcload-serial/target-inc/sys/dirent.h b/MODEM/SRCS/dcload-serial/target-inc/sys/dirent.h new file mode 100644 index 00000000..1fb30087 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/sys/dirent.h @@ -0,0 +1,21 @@ +#ifdef __cplusplus +extern "C" { +#endif + +struct dirent { + long d_ino; /* inode number */ + off_t d_off; /* offset to the next dirent */ + unsigned short d_reclen;/* length of this record */ + unsigned char d_type; /* type of file */ + char d_name[256]; /* filename */ +}; + +typedef int DIR; + +DIR *opendir(const char *name); +int closedir(DIR *dir); +struct dirent *readdir(DIR *dir); + +#ifdef __cplusplus +} +#endif diff --git a/MODEM/SRCS/dcload-serial/target-inc/sys/errno.h b/MODEM/SRCS/dcload-serial/target-inc/sys/errno.h new file mode 100644 index 00000000..0247fa23 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/sys/errno.h @@ -0,0 +1,154 @@ +/* errno is not a global variable, because that would make using it + non-reentrant. Instead, its address is returned by the function + __errno. */ + +#ifndef _SYS_ERRNO_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _SYS_ERRNO_H_ + +#include + +#ifndef _REENT_ONLY +#define errno (*__errno()) +extern int *__errno _PARAMS ((void)); +#endif + +#if !defined(__CYGWIN32__) || defined(__INSIDE_CYGWIN__) +extern _CONST char * _CONST _sys_errlist[]; +extern int _sys_nerr; +#else +extern _CONST char * _CONST _sys_errlist[] __declspec(dllimport); +extern int _sys_nerr __declspec(dllimport); +#endif + +#define __errno_r(ptr) ((ptr)->_errno) + +#define EPERM 1 /* Not super-user */ +#define ENOENT 2 /* No such file or directory */ +#define ESRCH 3 /* No such process */ +#define EINTR 4 /* Interrupted system call */ +#define EIO 5 /* I/O error */ +#define ENXIO 6 /* No such device or address */ +#define E2BIG 7 /* Arg list too long */ +#define ENOEXEC 8 /* Exec format error */ +#define EBADF 9 /* Bad file number */ +#define ECHILD 10 /* No children */ +#define EAGAIN 11 /* No more processes */ +#define ENOMEM 12 /* Not enough core */ +#define EACCES 13 /* Permission denied */ +#define EFAULT 14 /* Bad address */ +#define ENOTBLK 15 /* Block device required */ +#define EBUSY 16 /* Mount device busy */ +#define EEXIST 17 /* File exists */ +#define EXDEV 18 /* Cross-device link */ +#define ENODEV 19 /* No such device */ +#define ENOTDIR 20 /* Not a directory */ +#define EISDIR 21 /* Is a directory */ +#define EINVAL 22 /* Invalid argument */ +#define ENFILE 23 /* Too many open files in system */ +#define EMFILE 24 /* Too many open files */ +#define ENOTTY 25 /* Not a typewriter */ +#define ETXTBSY 26 /* Text file busy */ +#define EFBIG 27 /* File too large */ +#define ENOSPC 28 /* No space left on device */ +#define ESPIPE 29 /* Illegal seek */ +#define EROFS 30 /* Read only file system */ +#define EMLINK 31 /* Too many links */ +#define EPIPE 32 /* Broken pipe */ +#define EDOM 33 /* Math arg out of domain of func */ +#define ERANGE 34 /* Math result not representable */ +#define ENOMSG 35 /* No message of desired type */ +#define EIDRM 36 /* Identifier removed */ +#define ECHRNG 37 /* Channel number out of range */ +#define EL2NSYNC 38 /* Level 2 not synchronized */ +#define EL3HLT 39 /* Level 3 halted */ +#define EL3RST 40 /* Level 3 reset */ +#define ELNRNG 41 /* Link number out of range */ +#define EUNATCH 42 /* Protocol driver not attached */ +#define ENOCSI 43 /* No CSI structure available */ +#define EL2HLT 44 /* Level 2 halted */ +#define EDEADLK 45 /* Deadlock condition */ +#define ENOLCK 46 /* No record locks available */ +#define EBADE 50 /* Invalid exchange */ +#define EBADR 51 /* Invalid request descriptor */ +#define EXFULL 52 /* Exchange full */ +#define ENOANO 53 /* No anode */ +#define EBADRQC 54 /* Invalid request code */ +#define EBADSLT 55 /* Invalid slot */ +#define EDEADLOCK 56 /* File locking deadlock error */ +#define EBFONT 57 /* Bad font file fmt */ +#define ENOSTR 60 /* Device not a stream */ +#define ENODATA 61 /* No data (for no delay io) */ +#define ETIME 62 /* Timer expired */ +#define ENOSR 63 /* Out of streams resources */ +#define ENONET 64 /* Machine is not on the network */ +#define ENOPKG 65 /* Package not installed */ +#define EREMOTE 66 /* The object is remote */ +#define ENOLINK 67 /* The link has been severed */ +#define EADV 68 /* Advertise error */ +#define ESRMNT 69 /* Srmount error */ +#define ECOMM 70 /* Communication error on send */ +#define EPROTO 71 /* Protocol error */ +#define EMULTIHOP 74 /* Multihop attempted */ +#define ELBIN 75 /* Inode is remote (not really error) */ +#define EDOTDOT 76 /* Cross mount point (not really error) */ +#define EBADMSG 77 /* Trying to read unreadable message */ +#define ENOTUNIQ 80 /* Given log. name not unique */ +#define EBADFD 81 /* f.d. invalid for this operation */ +#define EREMCHG 82 /* Remote address changed */ +#define ELIBACC 83 /* Can't access a needed shared lib */ +#define ELIBBAD 84 /* Accessing a corrupted shared lib */ +#define ELIBSCN 85 /* .lib section in a.out corrupted */ +#define ELIBMAX 86 /* Attempting to link in too many libs */ +#define ELIBEXEC 87 /* Attempting to exec a shared library */ +#define ENOSYS 88 /* Function not implemented */ +#define ENMFILE 89 /* No more files */ +#define ENOTEMPTY 90 /* Directory not empty */ +#define ENAMETOOLONG 91 /* File or path name too long */ +#define ELOOP 92 /* Too many symbolic links */ +#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ +#define EPFNOSUPPORT 96 /* Protocol family not supported */ +#define ECONNRESET 104 /* Connection reset by peer */ +#define ENOBUFS 105 /* No buffer space available */ +#define EAFNOSUPPORT 106 +#define EPROTOTYPE 107 +#define ENOTSOCK 108 +#define ENOPROTOOPT 109 +#define ESHUTDOWN 110 +#define ECONNREFUSED 111 /* Connection refused */ +#define EADDRINUSE 112 /* Address already in use */ +#define ECONNABORTED 113 /* Connection aborted */ +#define ENETUNREACH 114 +#define ENETDOWN 115 +#define ETIMEDOUT 116 +#define EHOSTDOWN 117 +#define EHOSTUNREACH 118 +#define EINPROGRESS 119 +#define EALREADY 120 +#define EDESTADDRREQ 121 +#define EMSGSIZE 122 +#define EPROTONOSUPPORT 123 +#define ESOCKTNOSUPPORT 124 +#define EADDRNOTAVAIL 125 +#define ENETRESET 126 +#define EISCONN 127 +#define ENOTCONN 128 +#define ETOOMANYREFS 129 +#define EPROCLIM 130 +#define EUSERS 131 +#define EDQUOT 132 +#define ESTALE 133 +#define ENOTSUP 134 +#define ENOMEDIUM 135 + +/* From cygwin32. */ +#define EWOULDBLOCK EAGAIN /* Operation would block */ + +#define __ELASTERROR 2000 /* Users can add values starting here */ + +#ifdef __cplusplus +} +#endif +#endif /* _SYS_ERRNO_H */ diff --git a/MODEM/SRCS/dcload-serial/target-inc/sys/fcntl.h b/MODEM/SRCS/dcload-serial/target-inc/sys/fcntl.h new file mode 100644 index 00000000..ed32fab9 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/sys/fcntl.h @@ -0,0 +1,178 @@ + +#ifndef _FCNTL_ +#ifdef __cplusplus +extern "C" { +#endif +#define _FCNTL_ +#include <_ansi.h> +#define _FOPEN (-1) /* from sys/file.h, kernel use only */ +#define _FREAD 0x0001 /* read enabled */ +#define _FWRITE 0x0002 /* write enabled */ +#define _FNDELAY 0x0004 /* non blocking I/O (4.2 style) */ +#define _FAPPEND 0x0008 /* append (writes guaranteed at the end) */ +#define _FMARK 0x0010 /* internal; mark during gc() */ +#define _FDEFER 0x0020 /* internal; defer for next gc pass */ +#define _FASYNC 0x0040 /* signal pgrp when data ready */ +#define _FSHLOCK 0x0080 /* BSD flock() shared lock present */ +#define _FEXLOCK 0x0100 /* BSD flock() exclusive lock present */ +#define _FCREAT 0x0200 /* open with file create */ +#define _FTRUNC 0x0400 /* open with truncation */ +#define _FEXCL 0x0800 /* error on open if file exists */ +#define _FNBIO 0x1000 /* non blocking I/O (sys5 style) */ +#define _FSYNC 0x2000 /* do all writes synchronously */ +#define _FNONBLOCK 0x4000 /* non blocking I/O (POSIX style) */ +#define _FNOCTTY 0x8000 /* don't assign a ctty on this open */ + +#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) + +/* + * Flag values for open(2) and fcntl(2) + * The kernel adds 1 to the open modes to turn it into some + * combination of FREAD and FWRITE. + */ +#define O_RDONLY 0 /* +1 == FREAD */ +#define O_WRONLY 1 /* +1 == FWRITE */ +#define O_RDWR 2 /* +1 == FREAD|FWRITE */ +#define O_APPEND _FAPPEND +#define O_CREAT _FCREAT +#define O_TRUNC _FTRUNC +#define O_EXCL _FEXCL +/* O_SYNC _FSYNC not posix, defined below */ +/* O_NDELAY _FNDELAY set in include/fcntl.h */ +/* O_NDELAY _FNBIO set in 5include/fcntl.h */ +#define O_NONBLOCK _FNONBLOCK +#define O_NOCTTY _FNOCTTY +/* For machines which care - */ +#if defined (_WIN32) || defined (__CYGWIN__) +#define _FBINARY 0x10000 +#define _FTEXT 0x20000 +#define _FNOINHERIT 0x40000 + +#define O_BINARY _FBINARY +#define O_TEXT _FTEXT +#define O_NOINHERIT _FNOINHERIT + +/* The windows header files define versions with a leading underscore. */ +#define _O_RDONLY O_RDONLY +#define _O_WRONLY O_WRONLY +#define _O_RDWR O_RDWR +#define _O_APPEND O_APPEND +#define _O_CREAT O_CREAT +#define _O_TRUNC O_TRUNC +#define _O_EXCL O_EXCL +#define _O_TEXT O_TEXT +#define _O_BINARY O_BINARY +#define _O_RAW O_BINARY +#define _O_NOINHERIT O_NOINHERIT +#endif + +#ifndef _POSIX_SOURCE + +#define O_SYNC _FSYNC + +/* + * Flags that work for fcntl(fd, F_SETFL, FXXXX) + */ +#define FAPPEND _FAPPEND +#define FSYNC _FSYNC +#define FASYNC _FASYNC +#define FNBIO _FNBIO +#define FNONBIO _FNONBLOCK /* XXX fix to be NONBLOCK everywhere */ +#define FNDELAY _FNDELAY + +/* + * Flags that are disallowed for fcntl's (FCNTLCANT); + * used for opens, internal state, or locking. + */ +#define FREAD _FREAD +#define FWRITE _FWRITE +#define FMARK _FMARK +#define FDEFER _FDEFER +#define FSHLOCK _FSHLOCK +#define FEXLOCK _FEXLOCK + +/* + * The rest of the flags, used only for opens + */ +#define FOPEN _FOPEN +#define FCREAT _FCREAT +#define FTRUNC _FTRUNC +#define FEXCL _FEXCL +#define FNOCTTY _FNOCTTY + +#endif /* !_POSIX_SOURCE */ + +/* XXX close on exec request; must match UF_EXCLOSE in user.h */ +#define FD_CLOEXEC 1 /* posix */ + +/* fcntl(2) requests */ +#define F_DUPFD 0 /* Duplicate fildes */ +#define F_GETFD 1 /* Get fildes flags (close on exec) */ +#define F_SETFD 2 /* Set fildes flags (close on exec) */ +#define F_GETFL 3 /* Get file flags */ +#define F_SETFL 4 /* Set file flags */ +#ifndef _POSIX_SOURCE +#define F_GETOWN 5 /* Get owner - for ASYNC */ +#define F_SETOWN 6 /* Set owner - for ASYNC */ +#endif /* !_POSIX_SOURCE */ +#define F_GETLK 7 /* Get record-locking information */ +#define F_SETLK 8 /* Set or Clear a record-lock (Non-Blocking) */ +#define F_SETLKW 9 /* Set or Clear a record-lock (Blocking) */ +#ifndef _POSIX_SOURCE +#define F_RGETLK 10 /* Test a remote lock to see if it is blocked */ +#define F_RSETLK 11 /* Set or unlock a remote lock */ +#define F_CNVT 12 /* Convert a fhandle to an open fd */ +#define F_RSETLKW 13 /* Set or Clear remote record-lock(Blocking) */ +#endif /* !_POSIX_SOURCE */ + +/* fcntl(2) flags (l_type field of flock structure) */ +#define F_RDLCK 1 /* read lock */ +#define F_WRLCK 2 /* write lock */ +#define F_UNLCK 3 /* remove lock(s) */ +#ifndef _POSIX_SOURCE +#define F_UNLKSYS 4 /* remove remote locks for a given system */ +#endif /* !_POSIX_SOURCE */ + +/*#include */ + +/* file segment locking set data type - information passed to system by user */ +struct flock { + short l_type; /* F_RDLCK, F_WRLCK, or F_UNLCK */ + short l_whence; /* flag to choose starting offset */ + long l_start; /* relative offset, in bytes */ + long l_len; /* length, in bytes; 0 means lock to EOF */ + short l_pid; /* returned with F_GETLK */ + short l_xxx; /* reserved for future use */ +}; + +#ifndef _POSIX_SOURCE +/* extended file segment locking set data type */ +struct eflock { + short l_type; /* F_RDLCK, F_WRLCK, or F_UNLCK */ + short l_whence; /* flag to choose starting offset */ + long l_start; /* relative offset, in bytes */ + long l_len; /* length, in bytes; 0 means lock to EOF */ + short l_pid; /* returned with F_GETLK */ + short l_xxx; /* reserved for future use */ + long l_rpid; /* Remote process id wanting this lock */ + long l_rsys; /* Remote system id wanting this lock */ +}; +#endif /* !_POSIX_SOURCE */ + + +#include +#include /* sigh. for the mode bits for open/creat */ + +extern int open _PARAMS ((const char *, int, ...)); +extern int creat _PARAMS ((const char *, mode_t)); +extern int fcntl _PARAMS ((int, int, ...)); + +/* Provide _ prototypes for functions provided by some versions + of newlib. */ +extern int _open _PARAMS ((const char *, int, ...)); +extern int _fcntl _PARAMS ((int, int, ...)); + +#ifdef __cplusplus +} +#endif +#endif /* !_FCNTL_ */ diff --git a/MODEM/SRCS/dcload-serial/target-inc/sys/file.h b/MODEM/SRCS/dcload-serial/target-inc/sys/file.h new file mode 100644 index 00000000..58d4fac3 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/sys/file.h @@ -0,0 +1,2 @@ + +#include diff --git a/MODEM/SRCS/dcload-serial/target-inc/sys/param.h b/MODEM/SRCS/dcload-serial/target-inc/sys/param.h new file mode 100644 index 00000000..3470ef5d --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/sys/param.h @@ -0,0 +1,18 @@ +/* This is a dummy file, not customized for any + particular system. If there is a param.h in libc/sys/SYSDIR/sys, + it will override this one. */ + +#ifndef _SYS_PARAM_H +# define _SYS_PARAM_H + +# define HZ (60) +# define NOFILE (60) +# define PATHSIZE (1024) + +#ifdef __i386__ +#define BIG_ENDIAN 4321 +#define LITTLE_ENDIAN 1234 +#define BYTE_ORDER LITTLE_ENDIAN +#endif + +#endif diff --git a/MODEM/SRCS/dcload-serial/target-inc/sys/reent.h b/MODEM/SRCS/dcload-serial/target-inc/sys/reent.h new file mode 100644 index 00000000..11049367 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/sys/reent.h @@ -0,0 +1,238 @@ +/* This header file provides the reentrancy. */ + +/* WARNING: All identifiers here must begin with an underscore. This file is + included by stdio.h and others and we therefore must only use identifiers + in the namespace allotted to us. */ + +#ifndef _SYS_REENT_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _SYS_REENT_H_ + +#include <_ansi.h> +#include + +#ifndef __Long +#if __LONG_MAX__ == 2147483647L +#define __Long long +typedef unsigned __Long __ULong; +#elif __INT_MAX__ == 2147483647 +#define __Long int +typedef unsigned __Long __ULong; +#endif +#endif + +#ifndef __Long +#define __Long __int32_t +typedef __uint32_t __ULong; +#endif + +struct _glue +{ + struct _glue *_next; + int _niobs; + struct __sFILE *_iobs; +}; + +struct _Bigint +{ + struct _Bigint *_next; + int _k, _maxwds, _sign, _wds; + __ULong _x[1]; +}; + +/* + * atexit() support + */ + +#define _ATEXIT_SIZE 32 /* must be at least 32 to guarantee ANSI conformance */ + +struct _atexit { + struct _atexit *_next; /* next in list */ + int _ind; /* next index in this table */ + void (*_fns[_ATEXIT_SIZE])(void); /* the table itself */ +}; + +/* + * Stdio buffers. + * + * This and __sFILE are defined here because we need them for struct _reent, + * but we don't want stdio.h included when stdlib.h is. + */ + +struct __sbuf { + unsigned char *_base; + int _size; +}; + +/* + * We need fpos_t for the following, but it doesn't have a leading "_", + * so we use _fpos_t instead. + */ + +typedef long _fpos_t; /* XXX must match off_t in */ + /* (and must be `long' for now) */ + +/* + * Stdio state variables. + * + * The following always hold: + * + * if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR), + * _lbfsize is -_bf._size, else _lbfsize is 0 + * if _flags&__SRD, _w is 0 + * if _flags&__SWR, _r is 0 + * + * This ensures that the getc and putc macros (or inline functions) never + * try to write or read from a file that is in `read' or `write' mode. + * (Moreover, they can, and do, automatically switch from read mode to + * write mode, and back, on "r+" and "w+" files.) + * + * _lbfsize is used only to make the inline line-buffered output stream + * code as compact as possible. + * + * _ub, _up, and _ur are used when ungetc() pushes back more characters + * than fit in the current _bf, or when ungetc() pushes back a character + * that does not match the previous one in _bf. When this happens, + * _ub._base becomes non-nil (i.e., a stream has ungetc() data iff + * _ub._base!=NULL) and _up and _ur save the current values of _p and _r. + */ + +struct __sFILE { + unsigned char *_p; /* current position in (some) buffer */ + int _r; /* read space left for getc() */ + int _w; /* write space left for putc() */ + short _flags; /* flags, below; this FILE is free if 0 */ + short _file; /* fileno, if Unix descriptor, else -1 */ + struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */ + int _lbfsize; /* 0 or -_bf._size, for inline putc */ + + /* operations */ + _PTR _cookie; /* cookie passed to io functions */ + + int _EXFUN((*_read),(_PTR _cookie, char *_buf, int _n)); + int _EXFUN((*_write),(_PTR _cookie, const char *_buf, int _n)); + _fpos_t _EXFUN((*_seek),(_PTR _cookie, _fpos_t _offset, int _whence)); + int _EXFUN((*_close),(_PTR _cookie)); + + /* separate buffer for long sequences of ungetc() */ + struct __sbuf _ub; /* ungetc buffer */ + unsigned char *_up; /* saved _p when _p is doing ungetc data */ + int _ur; /* saved _r when _r is counting ungetc data */ + + /* tricks to meet minimum requirements even when malloc() fails */ + unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */ + unsigned char _nbuf[1]; /* guarantee a getc() buffer */ + + /* separate buffer for fgetline() when line crosses buffer boundary */ + struct __sbuf _lb; /* buffer for fgetline() */ + + /* Unix stdio files get aligned to block boundaries on fseek() */ + int _blksize; /* stat.st_blksize (may be != _bf._size) */ + int _offset; /* current lseek offset */ + + struct _reent *_data; +}; + +/* + * struct _reent + * + * This structure contains *all* globals needed by the library. + * It's raison d'etre is to facilitate threads by making all library routines + * reentrant. IE: All state information is contained here. + */ + +struct _reent +{ + /* local copy of errno */ + int _errno; + + /* FILE is a big struct and may change over time. To try to achieve binary + compatibility with future versions, put stdin,stdout,stderr here. + These are pointers into member __sf defined below. */ + struct __sFILE *_stdin, *_stdout, *_stderr; + + int _inc; /* used by tmpnam */ + char _emergency[25]; + + int _current_category; /* used by setlocale */ + _CONST char *_current_locale; + + int __sdidinit; /* 1 means stdio has been init'd */ + + void _EXFUN((*__cleanup),(struct _reent *)); + + /* used by mprec routines */ + struct _Bigint *_result; + int _result_k; + struct _Bigint *_p5s; + struct _Bigint **_freelist; + + /* used by some fp conversion routines */ + int _cvtlen; /* should be size_t */ + char *_cvtbuf; + + union + { + struct + { + unsigned int _rand_next; + char * _strtok_last; + char _asctime_buf[26]; + struct tm _localtime_buf; + int _gamma_signgam; + } _reent; + /* Two next two fields were once used by malloc. They are no longer + used. They are used to preserve the space used before so as to + allow addition of new reent fields and keep binary compatibility. */ + struct + { +#define _N_LISTS 30 + unsigned char * _nextf[_N_LISTS]; + unsigned int _nmalloc[_N_LISTS]; + } _unused; + } _new; + + /* atexit stuff */ + struct _atexit *_atexit; /* points to head of LIFO stack */ + struct _atexit _atexit0; /* one guaranteed table, required by ANSI */ + + /* signal info */ + void (**(_sig_func))(int); + + /* These are here last so that __sFILE can grow without changing the offsets + of the above members (on the off chance that future binary compatibility + would be broken otherwise). */ + struct _glue __sglue; /* root of glue chain */ + struct __sFILE __sf[3]; /* first three file descriptors */ +}; + +#define _REENT_INIT(var) \ + { 0, &var.__sf[0], &var.__sf[1], &var.__sf[2], 0, "", 0, "C", \ + 0, NULL, NULL, 0, NULL, NULL, 0, NULL, { {1, NULL, "", \ + { 0,0,0,0,0,0,0,0}, 0 } } } + +/* + * All references to struct _reent are via this pointer. + * Internally, newlib routines that need to reference it should use _REENT. + */ + +#ifndef __ATTRIBUTE_IMPURE_PTR__ +#define __ATTRIBUTE_IMPURE_PTR__ +#endif + +extern struct _reent *_impure_ptr __ATTRIBUTE_IMPURE_PTR__; + +void _reclaim_reent _PARAMS ((struct _reent *)); + +/* #define _REENT_ONLY define this to get only reentrant routines */ + +#ifndef _REENT_ONLY +#define _REENT _impure_ptr +#endif + +#ifdef __cplusplus +} +#endif +#endif /* _SYS_REENT_H_ */ diff --git a/MODEM/SRCS/dcload-serial/target-inc/sys/resource.h b/MODEM/SRCS/dcload-serial/target-inc/sys/resource.h new file mode 100644 index 00000000..eb827552 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/sys/resource.h @@ -0,0 +1,15 @@ +#ifndef _SYS_RESOURCE_H_ +#define _SYS_RESOURCE_H_ + +#include + +#define RUSAGE_SELF 0 /* calling process */ +#define RUSAGE_CHILDREN -1 /* terminated child processes */ + +struct rusage { + struct timeval ru_utime; /* user time used */ + struct timeval ru_stime; /* system time used */ +}; + +#endif + diff --git a/MODEM/SRCS/dcload-serial/target-inc/sys/signal.h b/MODEM/SRCS/dcload-serial/target-inc/sys/signal.h new file mode 100644 index 00000000..00d25ead --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/sys/signal.h @@ -0,0 +1,182 @@ +/* sys/signal.h */ + +#ifndef _SYS_SIGNAL_H +#define _SYS_SIGNAL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "_ansi.h" + +#ifndef __STRICT_ANSI__ +typedef unsigned long sigset_t; +struct sigaction +{ + void (*sa_handler)(int); + sigset_t sa_mask; + int sa_flags; +}; +#define SA_NOCLDSTOP 1 /* only value supported now for sa_flags */ +#define SIG_SETMASK 0 /* set mask with sigprocmask() */ +#define SIG_BLOCK 1 /* set of signals to block */ +#define SIG_UNBLOCK 2 /* set of signals to, well, unblock */ + +/* These depend upon the type of sigset_t, which right now + is always a long.. They're in the POSIX namespace, but + are not ANSI. */ +#define sigaddset(what,sig) (*(what) |= (1<<(sig))) +#define sigemptyset(what) (*(what) = 0) + +int sigprocmask (int __how, const sigset_t *__a, sigset_t *__b); + +/* protos for functions found in winsup sources */ +#if defined(__CYGWIN32__) +#undef sigaddset +#undef sigemptyset +/* The first argument to kill should be pid_t. Right now + always defines pid_t to be int. If that ever + changes, then we will need to do something else, perhaps along the + lines of . */ +int _EXFUN(kill, (int, int)); +int _EXFUN(sigaction, (int, const struct sigaction *, struct sigaction *)); +int _EXFUN(sigaddset, (sigset_t *, const int)); +int _EXFUN(sigdelset, (sigset_t *, const int)); +int _EXFUN(sigismember, (const sigset_t *, int)); +int _EXFUN(sigfillset, (sigset_t *)); +int _EXFUN(sigemptyset, (sigset_t *)); +int _EXFUN(sigpending, (sigset_t *)); +int _EXFUN(sigsuspend, (const sigset_t *)); +int _EXFUN(sigpause, (int)); +#endif + +#endif /* __STRICT_ANSI__ */ + +#if defined(___AM29K__) +/* These all need to be defined for ANSI C, but I don't think they are + meaningful. */ +#define SIGABRT 1 +#define SIGFPE 1 +#define SIGILL 1 +#define SIGINT 1 +#define SIGSEGV 1 +#define SIGTERM 1 +/* These need to be defined for POSIX, and some others do too. */ +#define SIGHUP 1 +#define SIGQUIT 1 +#define NSIG 2 +#elif defined(__GO32__) +#define SIGINT 1 +#define SIGKILL 2 +#define SIGPIPE 3 +#define SIGFPE 4 +#define SIGHUP 5 +#define SIGTERM 6 +#define SIGSEGV 7 +#define SIGTSTP 8 +#define SIGQUIT 9 +#define SIGTRAP 10 +#define SIGILL 11 +#define SIGEMT 12 +#define SIGALRM 13 +#define SIGBUS 14 +#define SIGLOST 15 +#define SIGSTOP 16 +#define SIGABRT 17 +#define SIGUSR1 18 +#define SIGUSR2 19 +#define NSIG 20 +#elif defined(__CYGWIN32__) /* BSD signals symantics */ +#define SIGHUP 1 /* hangup */ +#define SIGINT 2 /* interrupt */ +#define SIGQUIT 3 /* quit */ +#define SIGILL 4 /* illegal instruction (not reset when caught) */ +#define SIGTRAP 5 /* trace trap (not reset when caught) */ +#define SIGABRT 6 /* used by abort */ +#define SIGEMT 7 /* EMT instruction */ +#define SIGFPE 8 /* floating point exception */ +#define SIGKILL 9 /* kill (cannot be caught or ignored) */ +#define SIGBUS 10 /* bus error */ +#define SIGSEGV 11 /* segmentation violation */ +#define SIGSYS 12 /* bad argument to system call */ +#define SIGPIPE 13 /* write on a pipe with no one to read it */ +#define SIGALRM 14 /* alarm clock */ +#define SIGTERM 15 /* software termination signal from kill */ +#define SIGURG 16 /* urgent condition on IO channel */ +#define SIGSTOP 17 /* sendable stop signal not from tty */ +#define SIGTSTP 18 /* stop signal from tty */ +#define SIGCONT 19 /* continue a stopped process */ +#define SIGCHLD 20 /* to parent on child stop or exit */ +#define SIGCLD 20 /* System V name for SIGCHLD */ +#define SIGTTIN 21 /* to readers pgrp upon background tty read */ +#define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */ +#define SIGIO 23 /* input/output possible signal */ +#define SIGPOLL SIGIO /* System V name for SIGIO */ +#define SIGXCPU 24 /* exceeded CPU time limit */ +#define SIGXFSZ 25 /* exceeded file size limit */ +#define SIGVTALRM 26 /* virtual time alarm */ +#define SIGPROF 27 /* profiling time alarm */ +#define SIGWINCH 28 /* window changed */ +#define SIGLOST 29 /* resource lost (eg, record-lock lost) */ +#define SIGUSR1 30 /* user defined signal 1 */ +#define SIGUSR2 31 /* user defined signal 2 */ +#define NSIG 32 /* signal 0 implied */ +#else +#define SIGHUP 1 /* hangup */ +#define SIGINT 2 /* interrupt */ +#define SIGQUIT 3 /* quit */ +#define SIGILL 4 /* illegal instruction (not reset when caught) */ +#define SIGTRAP 5 /* trace trap (not reset when caught) */ +#define SIGIOT 6 /* IOT instruction */ +#define SIGABRT 6 /* used by abort, replace SIGIOT in the future */ +#define SIGEMT 7 /* EMT instruction */ +#define SIGFPE 8 /* floating point exception */ +#define SIGKILL 9 /* kill (cannot be caught or ignored) */ +#define SIGBUS 10 /* bus error */ +#define SIGSEGV 11 /* segmentation violation */ +#define SIGSYS 12 /* bad argument to system call */ +#define SIGPIPE 13 /* write on a pipe with no one to read it */ +#define SIGALRM 14 /* alarm clock */ +#define SIGTERM 15 /* software termination signal from kill */ + +#if defined(__svr4__) +/* svr4 specifics. different signals above 15, and sigaction. */ +#define SIGUSR1 16 +#define SIGUSR2 17 +#define SIGCLD 18 +#define SIGPWR 19 +#define SIGWINCH 20 +#define SIGPOLL 22 /* 20 for x.out binaries!!!! */ +#define SIGSTOP 23 /* sendable stop signal not from tty */ +#define SIGTSTP 24 /* stop signal from tty */ +#define SIGCONT 25 /* continue a stopped process */ +#define SIGTTIN 26 /* to readers pgrp upon background tty read */ +#define SIGTTOU 27 /* like TTIN for output if (tp->t_local<OSTOP) */ +#define NSIG 28 +#else +#define SIGURG 16 /* urgent condition on IO channel */ +#define SIGSTOP 17 /* sendable stop signal not from tty */ +#define SIGTSTP 18 /* stop signal from tty */ +#define SIGCONT 19 /* continue a stopped process */ +#define SIGCHLD 20 /* to parent on child stop or exit */ +#define SIGCLD 20 /* System V name for SIGCHLD */ +#define SIGTTIN 21 /* to readers pgrp upon background tty read */ +#define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */ +#define SIGIO 23 /* input/output possible signal */ +#define SIGPOLL SIGIO /* System V name for SIGIO */ +#define SIGXCPU 24 /* exceeded CPU time limit */ +#define SIGXFSZ 25 /* exceeded file size limit */ +#define SIGVTALRM 26 /* virtual time alarm */ +#define SIGPROF 27 /* profiling time alarm */ +#define SIGWINCH 28 /* window changed */ +#define SIGLOST 29 /* resource lost (eg, record-lock lost) */ +#define SIGUSR1 30 /* user defined signal 1 */ +#define SIGUSR2 31 /* user defined signal 2 */ +#define NSIG 32 /* signal 0 implied */ +#endif +#endif + +#ifdef __cplusplus +} +#endif +#endif /* _SYS_SIGNAL_H */ diff --git a/MODEM/SRCS/dcload-serial/target-inc/sys/stat-dj.h b/MODEM/SRCS/dcload-serial/target-inc/sys/stat-dj.h new file mode 100644 index 00000000..b533a167 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/sys/stat-dj.h @@ -0,0 +1,59 @@ +/* This is file STAT.H */ +/* +** Copyright (C) 1991 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954 +** +** This file is distributed under the terms listed in the document +** "copying.dj", available from DJ Delorie at the address above. +** A copy of "copying.dj" should accompany this file; if not, a copy +** should be available from where this file was obtained. This file +** may not be distributed without a verbatim copy of "copying.dj". +** +** This file is distributed WITHOUT ANY WARRANTY; without even the implied +** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +#ifndef _STAT_H_ +#define _STAT_H_ + +struct stat { + short st_dev; + short st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + short st_rdev; + short st_align_for_word32; + long st_size; + long st_atime; + long st_mtime; + long st_ctime; + long st_blksize; +}; + +#define S_IFMT 0xF000 /* file type mask */ +#define S_IFDIR 0x4000 /* directory */ +#define S_IFIFO 0x1000 /* FIFO special */ +#define S_IFCHR 0x2000 /* character special */ +#define S_IFBLK 0x3000 /* block special */ +#define S_IFREG 0x8000 /* or just 0x0000, regular */ +#define S_IREAD 0x0100 /* owner may read */ +#define S_IWRITE 0x0080 /* owner may write */ +#define S_IEXEC 0x0040 /* owner may execute */ + +#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) +#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) +#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) + +#ifdef __cplusplus +extern "C" { +#endif +int stat(const char *, struct stat *); +int fstat(int, struct stat *); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MODEM/SRCS/dcload-serial/target-inc/sys/stat.h b/MODEM/SRCS/dcload-serial/target-inc/sys/stat.h new file mode 100644 index 00000000..31dfaf49 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/sys/stat.h @@ -0,0 +1,149 @@ +#ifndef _SYS_STAT_H +#define _SYS_STAT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <_ansi.h> +#include +#include + +#ifdef __i386__ +#ifdef __MSDOS__ +#include "stat-dj.h" +#endif +#endif + +/* dj's stat defines _STAT_H_ */ +#ifndef _STAT_H_ + +/* It is intended that the layout of this structure not change when the + sizes of any of the basic types change (short, int, long) [via a compile + time option]. */ + +struct stat +{ + dev_t st_dev; + ino_t st_ino; + mode_t st_mode; + nlink_t st_nlink; + uid_t st_uid; + gid_t st_gid; + dev_t st_rdev; + off_t st_size; + /* SysV/sco doesn't have the rest... But Solaris, eabi does. */ +#if defined(__svr4__) && !defined(__PPC__) && !defined(__sun__) + time_t st_atime; + time_t st_mtime; + time_t st_ctime; +#else + time_t st_atime; + long st_spare1; + time_t st_mtime; + long st_spare2; + time_t st_ctime; + long st_spare3; + long st_blksize; + long st_blocks; + long st_spare4[2]; +#endif +}; + +#define _IFMT 0170000 /* type of file */ +#define _IFDIR 0040000 /* directory */ +#define _IFCHR 0020000 /* character special */ +#define _IFBLK 0060000 /* block special */ +#define _IFREG 0100000 /* regular */ +#define _IFLNK 0120000 /* symbolic link */ +#define _IFSOCK 0140000 /* socket */ +#define _IFIFO 0010000 /* fifo */ + +#define S_BLKSIZE 1024 /* size of a block */ + +#define S_ISUID 0004000 /* set user id on execution */ +#define S_ISGID 0002000 /* set group id on execution */ +#ifndef _POSIX_SOURCE +#define S_ISVTX 0001000 /* save swapped text even after use */ +#define S_IREAD 0000400 /* read permission, owner */ +#define S_IWRITE 0000200 /* write permission, owner */ +#define S_IEXEC 0000100 /* execute/search permission, owner */ + +#define S_ENFMT 0002000 /* enforcement-mode locking */ + +#define S_IFMT _IFMT +#define S_IFDIR _IFDIR +#define S_IFCHR _IFCHR +#define S_IFBLK _IFBLK +#define S_IFREG _IFREG +#define S_IFLNK _IFLNK +#define S_IFSOCK _IFSOCK +#define S_IFIFO _IFIFO +#endif /* !_POSIX_SOURCE */ + +#ifdef _WIN32 +/* The Windows header files define _S_ forms of these, so we do too + for easier portability. */ +#define _S_IFMT _IFMT +#define _S_IFDIR _IFDIR +#define _S_IFCHR _IFCHR +#define _S_IFIFO _IFIFO +#define _S_IFREG _IFREG +#define _S_IREAD 0000400 +#define _S_IWRITE 0000200 +#define _S_IEXEC 0000100 +#endif + +#define S_IRWXU 0000700 /* rwx, owner */ +#define S_IRUSR 0000400 /* read permission, owner */ +#define S_IWUSR 0000200 /* write permission, owner */ +#define S_IXUSR 0000100 /* execute/search permission, owner */ +#define S_IRWXG 0000070 /* rwx, group */ +#define S_IRGRP 0000040 /* read permission, group */ +#define S_IWGRP 0000020 /* write permission, grougroup */ +#define S_IXGRP 0000010 /* execute/search permission, group */ +#define S_IRWXO 0000007 /* rwx, other */ +#define S_IROTH 0000004 /* read permission, other */ +#define S_IWOTH 0000002 /* write permission, other */ +#define S_IXOTH 0000001 /* execute/search permission, other */ + +#define S_ISBLK(m) (((m)&_IFMT) == _IFBLK) +#define S_ISCHR(m) (((m)&_IFMT) == _IFCHR) +#define S_ISDIR(m) (((m)&_IFMT) == _IFDIR) +#define S_ISFIFO(m) (((m)&_IFMT) == _IFIFO) +#define S_ISREG(m) (((m)&_IFMT) == _IFREG) +#define S_ISLNK(m) (((m)&_IFMT) == _IFLNK) +#define S_ISSOCK(m) (((m)&_IFMT) == _IFSOCK) + + +int _EXFUN(chmod,( const char *__path, mode_t __mode )); +int _EXFUN(fchmod,(int __fd, mode_t __mode)); +int _EXFUN(fstat,( int __fd, struct stat *__sbuf )); +int _EXFUN(mkdir,( const char *_path, mode_t __mode )); +int _EXFUN(mkfifo,( const char *__path, mode_t __mode )); +int _EXFUN(stat,( const char *__path, struct stat *__sbuf )); +mode_t _EXFUN(umask,( mode_t __mask )); + +#if defined(__rtems__) +int _EXFUN(mknod,( const char *_path, mode_t _mode, dev_t dev )); +#endif + +/* Provide prototypes for most of the _ names that are + provided in newlib for some compilers. */ +int _EXFUN(_fstat,( int __fd, struct stat *__sbuf )); +int _EXFUN(_stat,( const char *__path, struct stat *__sbuf )); + +#ifdef __CYGWIN32__ +int _EXFUN(lstat,( const char *__path, struct stat *__buf )); +#endif + +#if defined(__rtems__) +int _EXFUN(mknod,( const char *_path, mode_t _mode, dev_t dev )); +int _EXFUN(lstat,( const char *_path, struct stat *_sbuf )); +#endif + +#endif /* !_STAT_H_ */ +#ifdef __cplusplus +} +#endif +#endif /* _SYS_STAT_H */ diff --git a/MODEM/SRCS/dcload-serial/target-inc/sys/syscall.h b/MODEM/SRCS/dcload-serial/target-inc/sys/syscall.h new file mode 100644 index 00000000..f141df76 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/sys/syscall.h @@ -0,0 +1,31 @@ +#define SYS_exit 1 +#define SYS_fork 2 + +#define SYS_read 3 +#define SYS_write 4 +#define SYS_open 5 +#define SYS_close 6 +#define SYS_wait4 7 +#define SYS_creat 8 +#define SYS_link 9 +#define SYS_unlink 10 +#define SYS_execv 11 +#define SYS_chdir 12 +#define SYS_mknod 14 +#define SYS_chmod 15 +#define SYS_chown 16 +#define SYS_lseek 19 +#define SYS_getpid 20 +#define SYS_isatty 21 +#define SYS_fstat 22 +#define SYS_time 23 + + +#define SYS_ARG 24 +#define SYS_stat 38 + +#define SYS_pipe 42 +#define SYS_execve 59 + +#define SYS_utime 201 /* not really a system call */ +#define SYS_wait 202 /* nor is this */ diff --git a/MODEM/SRCS/dcload-serial/target-inc/sys/time.h b/MODEM/SRCS/dcload-serial/target-inc/sys/time.h new file mode 100644 index 00000000..bc08820a --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/sys/time.h @@ -0,0 +1,51 @@ +/* time.h -- An implementation of the standard Unix file. + Written by Geoffrey Noer + Public domain; no rights reserved. */ + +#ifndef _SYS_TIME_H_ +#define _SYS_TIME_H_ + +#include <_ansi.h> +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _WINSOCK_H +struct timeval { + long tv_sec; + long tv_usec; +}; + +struct timezone { + int tz_minuteswest; + int tz_dsttime; +}; + +#ifdef __CYGWIN32__ +#include +#endif /* __CYGWIN32__ */ + +#endif /* _WINSOCK_H */ + +#define ITIMER_REAL 0 +#define ITIMER_VIRTUAL 1 +#define ITIMER_PROF 2 + +struct itimerval { + struct timeval it_interval; + struct timeval it_value; +}; + +int _EXFUN(gettimeofday, (struct timeval *__p, struct timezone *__z)); +int _EXFUN(settimeofday, (const struct timeval *, const struct timezone *)); +int _EXFUN(utimes, (const char *__path, struct timeval *__tvp)); +int _EXFUN(getitimer, (int __which, struct itimerval *__value)); +int _EXFUN(setitimer, (int __which, const struct itimerval *__value, + struct itimerval *__ovalue)); + +#ifdef __cplusplus +} +#endif +#endif /* _SYS_TIME_H_ */ diff --git a/MODEM/SRCS/dcload-serial/target-inc/sys/timeb.h b/MODEM/SRCS/dcload-serial/target-inc/sys/timeb.h new file mode 100644 index 00000000..0a2c3de8 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/sys/timeb.h @@ -0,0 +1,39 @@ +/* timeb.h -- An implementation of the standard Unix file. + Written by Ian Lance Taylor + Public domain; no rights reserved. + + declares the structure used by the ftime function, as + well as the ftime function itself. Newlib does not provide an + implementation of ftime. */ + +#ifndef _SYS_TIMEB_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define _SYS_TIMEB_H + +#include <_ansi.h> +#include + +#ifndef __time_t_defined +typedef _TIME_T_ time_t; +#define __time_t_defined +#endif + +struct timeb +{ + time_t time; + unsigned short millitm; + short timezone; + short dstflag; +}; + +extern int ftime _PARAMS ((struct timeb *)); + +#ifdef __cplusplus +} +#endif + +#endif /* ! defined (_SYS_TIMEB_H) */ diff --git a/MODEM/SRCS/dcload-serial/target-inc/sys/times.h b/MODEM/SRCS/dcload-serial/target-inc/sys/times.h new file mode 100644 index 00000000..c973ae1b --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/sys/times.h @@ -0,0 +1,27 @@ +#ifndef _SYS_TIMES_H +#ifdef __cplusplus +extern "C" { +#endif +#define _SYS_TIMES_H + +#include <_ansi.h> +#include + +#ifndef __clock_t_defined +typedef _CLOCK_T_ clock_t; +#define __clock_t_defined +#endif + +struct tms { + clock_t tms_utime; /* user time */ + clock_t tms_stime; /* system time */ + clock_t tms_cutime; /* user time, children */ + clock_t tms_cstime; /* system time, children */ +}; + +clock_t _EXFUN(times,(struct tms *)); + +#ifdef __cplusplus +} +#endif +#endif /* !_SYS_TIMES_H */ diff --git a/MODEM/SRCS/dcload-serial/target-inc/sys/types.h b/MODEM/SRCS/dcload-serial/target-inc/sys/types.h new file mode 100644 index 00000000..7d2e5246 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/sys/types.h @@ -0,0 +1,174 @@ +/* unified sys/types.h: + start with sef's sysvi386 version. + merge go32 version -- a few ifdefs. + h8300hms, h8300xray, and sysvnecv70 disagree on the following types: + + typedef int gid_t; + typedef int uid_t; + typedef int dev_t; + typedef int ino_t; + typedef int mode_t; + typedef int caddr_t; + + however, these aren't "reasonable" values, the sysvi386 ones make far + more sense, and should work sufficiently well (in particular, h8300 + doesn't have a stat, and the necv70 doesn't matter.) -- eichin + */ + +#ifndef _SYS_TYPES_H +#define _SYS_TYPES_H + +#if defined (_WIN32) || defined (__CYGWIN__) +#define __MS_types__ +#endif + +#ifdef __i386__ +#if defined (GO32) || defined (__MSDOS__) +#define __MS_types__ +#endif +#endif + +# include +# include + +/* To ensure the stat struct's layout doesn't change when sizeof(int), etc. + changes, we assume sizeof short and long never change and have all types + used to define struct stat use them and not int where possible. + Where not possible, _ST_INTxx are used. It would be preferable to not have + such assumptions, but until the extra fluff is necessary, it's avoided. + No 64 bit targets use stat yet. What to do about them is postponed + until necessary. */ +#ifdef __GNUC__ +#define _ST_INT32 __attribute__ ((__mode__ (__SI__))) +#else +#define _ST_INT32 +#endif + +# ifndef _POSIX_SOURCE + +# define physadr physadr_t +# define quad quad_t + +#ifndef _WINSOCK_H +typedef unsigned char u_char; +typedef unsigned short u_short; +typedef unsigned int u_int; +typedef unsigned long u_long; +#endif + +typedef unsigned short ushort; /* System V compatibility */ +typedef unsigned int uint; /* System V compatibility */ +# endif /*!_POSIX_SOURCE */ + +#ifndef __time_t_defined +typedef _TIME_T_ time_t; +#define __time_t_defined +#endif + +typedef long daddr_t; +typedef char * caddr_t; + +#ifdef __MS_types__ +typedef unsigned long ino_t; +#else +#ifdef __sparc__ +typedef unsigned long ino_t; +#else +typedef unsigned short ino_t; +#endif +#endif + +#ifdef __MS_types__ +typedef unsigned long vm_offset_t; +typedef unsigned long vm_size_t; + +#define __BIT_TYPES_DEFINED__ + +typedef char int8_t; +typedef unsigned char u_int8_t; +typedef short int16_t; +typedef unsigned short u_int16_t; +typedef int int32_t; +typedef unsigned int u_int32_t; +typedef long long int64_t; +typedef unsigned long long u_int64_t; +typedef int32_t register_t; +#endif /* __MS_types__ */ + +/* + * All these should be machine specific - right now they are all broken. + * However, for all of Cygnus' embedded targets, we want them to all be + * the same. Otherwise things like sizeof (struct stat) might depend on + * how the file was compiled (e.g. -mint16 vs -mint32, etc.). + */ + +typedef short dev_t; + +typedef long off_t; + +typedef unsigned short uid_t; +typedef unsigned short gid_t; +typedef int pid_t; +typedef long key_t; +typedef long ssize_t; + +#ifdef __MS_types__ +typedef char * addr_t; +typedef int mode_t; +#else +#if defined (__sparc__) && !defined (__sparc_v9__) +#ifdef __svr4__ +typedef unsigned long mode_t; +#else +typedef unsigned short mode_t; +#endif +#else +typedef unsigned int mode_t _ST_INT32; +#endif +#endif /* ! __MS_types__ */ + +typedef unsigned short nlink_t; + +/* We don't define fd_set and friends if we are compiling POSIX + source, or if we have included the Windows Sockets.h header (which + defines Windows versions of them). Note that a program which + includes the Windows sockets.h header must know what it is doing; + it must not call the cygwin32 select function. */ +# if ! defined (_POSIX_SOURCE) && ! defined (_WINSOCK_H) + +# define NBBY 8 /* number of bits in a byte */ +/* + * Select uses bit masks of file descriptors in longs. + * These macros manipulate such bit fields (the filesystem macros use chars). + * FD_SETSIZE may be defined by the user, but the default here + * should be >= NOFILE (param.h). + */ +# ifndef FD_SETSIZE +# define FD_SETSIZE 64 +# endif + +typedef long fd_mask; +# define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */ +# ifndef howmany +# define howmany(x,y) (((x)+((y)-1))/(y)) +# endif + +/* We use a macro for fd_set so that including Sockets.h afterwards + can work. */ +typedef struct _types_fd_set { + fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; +} _types_fd_set; + +#define fd_set _types_fd_set + +# define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1L << ((n) % NFDBITS))) +# define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1L << ((n) % NFDBITS))) +# define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1L << ((n) % NFDBITS))) +# define FD_ZERO(p) bzero((caddr_t)(p), sizeof (*(p))) + +# endif /* ! defined (_POSIX_SOURCE) && ! defined (_WINSOCK_H) */ + +#undef __MS_types__ +#undef _ST_INT32 + +#endif /* _SYS_TYPES_H */ diff --git a/MODEM/SRCS/dcload-serial/target-inc/sys/unistd.h b/MODEM/SRCS/dcload-serial/target-inc/sys/unistd.h new file mode 100644 index 00000000..98d1e1f2 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/sys/unistd.h @@ -0,0 +1,175 @@ +#ifndef _SYS_UNISTD_H +#define _SYS_UNISTD_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <_ansi.h> +#include +#define __need_size_t +#include + +extern char **environ; + +void _EXFUN(_exit, (int __status ) _ATTRIBUTE ((noreturn))); + +int _EXFUN(access,(const char *__path, int __amode )); +unsigned _EXFUN(alarm, (unsigned __secs )); +int _EXFUN(chdir, (const char *__path )); +int _EXFUN(chmod, (const char *__path, mode_t __mode )); +int _EXFUN(chown, (const char *__path, uid_t __owner, gid_t __group )); +int _EXFUN(close, (int __fildes )); +char _EXFUN(*ctermid, (char *__s )); +char _EXFUN(*cuserid, (char *__s )); +int _EXFUN(dup, (int __fildes )); +int _EXFUN(dup2, (int __fildes, int __fildes2 )); +int _EXFUN(execl, (const char *__path, const char *, ... )); +int _EXFUN(execle, (const char *__path, const char *, ... )); +int _EXFUN(execlp, (const char *__file, const char *, ... )); +int _EXFUN(execv, (const char *__path, char * const __argv[] )); +int _EXFUN(execve, (const char *__path, char * const __argv[], char * const __envp[] )); +int _EXFUN(execvp, (const char *__file, char * const __argv[] )); +pid_t _EXFUN(fork, (void )); +long _EXFUN(fpathconf, (int __fd, int __name )); +int _EXFUN(fsync, (int __fd)); +char _EXFUN(*getcwd, (char *__buf, size_t __size )); +gid_t _EXFUN(getegid, (void )); +uid_t _EXFUN(geteuid, (void )); +gid_t _EXFUN(getgid, (void )); +int _EXFUN(getgroups, (int __gidsetsize, gid_t __grouplist[] )); +char _EXFUN(*getlogin, (void )); +char _EXFUN(*getpass, (__const char *__prompt)); +size_t _EXFUN(getpagesize, (void)); +pid_t _EXFUN(getpgrp, (void )); +pid_t _EXFUN(getpid, (void )); +pid_t _EXFUN(getppid, (void )); +uid_t _EXFUN(getuid, (void )); +int _EXFUN(isatty, (int __fildes )); +int _EXFUN(link, (const char *__path1, const char *__path2 )); +int _EXFUN(nice, (int __nice_value )); +off_t _EXFUN(lseek, (int __fildes, off_t __offset, int __whence )); +long _EXFUN(pathconf, (const char *__path, int __name )); +int _EXFUN(pause, (void )); +int _EXFUN(pipe, (int __fildes[2] )); +int _EXFUN(read, (int __fildes, void *__buf, size_t __nbyte )); +int _EXFUN(rmdir, (const char *__path )); +void * _EXFUN(sbrk, (size_t __incr)); +int _EXFUN(setgid, (gid_t __gid )); +int _EXFUN(setpgid, (pid_t __pid, pid_t __pgid )); +pid_t _EXFUN(setsid, (void )); +int _EXFUN(setuid, (uid_t __uid )); +unsigned _EXFUN(sleep, (unsigned int __seconds )); +void _EXFUN(swab, (const void *, void *, ssize_t)); +long _EXFUN(sysconf, (int __name )); +pid_t _EXFUN(tcgetpgrp, (int __fildes )); +int _EXFUN(tcsetpgrp, (int __fildes, pid_t __pgrp_id )); +char _EXFUN(*ttyname, (int __fildes )); +int _EXFUN(unlink, (const char *__path )); +int _EXFUN(write, (int __fildes, const void *__buf, size_t __nbyte )); + +/* Provide prototypes for most of the _ names that are + provided in newlib for some compilers. */ +int _EXFUN(_close, (int __fildes )); +pid_t _EXFUN(_fork, (void )); +pid_t _EXFUN(_getpid, (void )); +int _EXFUN(_link, (const char *__path1, const char *__path2 )); +off_t _EXFUN(_lseek, (int __fildes, off_t __offset, int __whence )); +int _EXFUN(_read, (int __fildes, void *__buf, size_t __nbyte )); +void * _EXFUN(_sbrk, (size_t __incr)); +int _EXFUN(_unlink, (const char *__path )); +int _EXFUN(_write, (int __fildes, const void *__buf, size_t __nbyte )); + +#if defined(__CYGWIN32__) || defined(__rtems__) +unsigned _EXFUN(usleep, (unsigned int __useconds)); +int _EXFUN(ftruncate, (int __fd, off_t __length)); +int _EXFUN(truncate, (const char *, off_t __length)); +int _EXFUN(gethostname, (char *__name, size_t __len)); +char * _EXFUN(mktemp, (char *)); +int _EXFUN(sync, (void)); +int _EXFUN(readlink, (const char *__path, char *__buf, int __buflen)); +int _EXFUN(symlink, (const char *__name1, const char *__name2)); +#endif + +# define F_OK 0 +# define R_OK 4 +# define W_OK 2 +# define X_OK 1 + +# define SEEK_SET 0 +# define SEEK_CUR 1 +# define SEEK_END 2 + +/* + * RTEMS adheres to a later version of POSIX -- 1003.1b. + * + * XXX this version string should change. + */ + +#ifdef __rtems__ +#ifndef _POSIX_JOB_CONTROL +# define _POSIX_JOB_CONTROL 1 +#endif +#ifndef _POSIX_SAVED_IDS +# define _POSIX_SAVED_IDS 1 +#endif +# define _POSIX_VERSION 199009L +#else +#ifdef __svr4__ +# define _POSIX_JOB_CONTROL 1 +# define _POSIX_SAVED_IDS 1 +# define _POSIX_VERSION 199009L +#endif +#endif + +#ifdef __CYGWIN32__ +# define _POSIX_JOB_CONTROL 1 +# define _POSIX_SAVED_IDS 0 +# define _POSIX_VERSION 199009L +#endif + +#define STDIN_FILENO 0 /* standard input file descriptor */ +#define STDOUT_FILENO 1 /* standard output file descriptor */ +#define STDERR_FILENO 2 /* standard error file descriptor */ + +long _EXFUN(sysconf, (int __name)); + +# define _SC_ARG_MAX 0 +# define _SC_CHILD_MAX 1 +# define _SC_CLK_TCK 2 +# define _SC_NGROUPS_MAX 3 +# define _SC_OPEN_MAX 4 +/* no _SC_STREAM_MAX */ +# define _SC_JOB_CONTROL 5 +# define _SC_SAVED_IDS 6 +# define _SC_VERSION 7 +# define _SC_PAGESIZE 8 + +# define _PC_LINK_MAX 0 +# define _PC_MAX_CANON 1 +# define _PC_MAX_INPUT 2 +# define _PC_NAME_MAX 3 +# define _PC_PATH_MAX 4 +# define _PC_PIPE_BUF 5 +# define _PC_CHOWN_RESTRICTED 6 +# define _PC_NO_TRUNC 7 +# define _PC_VDISABLE 8 +# define _PC_ASYNC_IO 9 +# define _PC_PRIO_IO 10 +# define _PC_SYNC_IO 11 + +# ifndef _POSIX_SOURCE +# define MAXNAMLEN 1024 +# endif /* _POSIX_SOURCE */ + +/* FIXME: This is temporary until winsup gets sorted out. */ +#ifdef __CYGWIN32__ +#define MAXPATHLEN (260 - 1 /* NUL */) +#else +# define MAXPATHLEN 1024 +#endif + +#ifdef __cplusplus +} +#endif +#endif /* _SYS_UNISTD_H */ diff --git a/MODEM/SRCS/dcload-serial/target-inc/sys/utime.h b/MODEM/SRCS/dcload-serial/target-inc/sys/utime.h new file mode 100644 index 00000000..5e937f10 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/sys/utime.h @@ -0,0 +1,22 @@ +#ifndef _SYS_UTIME_H +#define _SYS_UTIME_H + +/* This is a dummy file, not customized for any + particular system. If there is a utime.h in libc/sys/SYSDIR/sys, + it will override this one. */ + +#ifdef __cplusplus +extern "C" { +#endif + +struct utimbuf +{ + time_t actime; + time_t modtime; +}; + +#ifdef __cplusplus +}; +#endif + +#endif /* _SYS_UTIME_H */ diff --git a/MODEM/SRCS/dcload-serial/target-inc/sys/wait.h b/MODEM/SRCS/dcload-serial/target-inc/sys/wait.h new file mode 100644 index 00000000..0e4a3394 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/sys/wait.h @@ -0,0 +1,40 @@ +#ifndef _SYS_WAIT_H +#define _SYS_WAIT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define WNOHANG 1 +#define WUNTRACED 2 + +/* A status looks like: + <2 bytes info> <2 bytes code> + + == 0, child has exited, info is the exit value + == 1..7e, child has exited, info is the signal number. + == 7f, child has stopped, info was the signal number. + == 80, there was a core dump. +*/ + +#define WIFEXITED(w) (((w) & 0xff) == 0) +#define WIFSIGNALED(w) (((w) & 0x7f) > 0 && (((w) & 0x7f) < 0x7f)) +#define WIFSTOPPED(w) (((w) & 0xff) == 0x7f) +#define WEXITSTATUS(w) (((w) >> 8) & 0xff) +#define WTERMSIG(w) ((w) & 0x7f) +#define WSTOPSIG WEXITSTATUS + +pid_t wait (int *); +pid_t waitpid (pid_t, int *, int); + +/* Provide prototypes for most of the _ names that are + provided in newlib for some compilers. */ +pid_t _wait (int *); + +#ifdef __cplusplus +}; +#endif + +#endif diff --git a/MODEM/SRCS/dcload-serial/target-inc/termios.h b/MODEM/SRCS/dcload-serial/target-inc/termios.h new file mode 100644 index 00000000..ee1820ce --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/termios.h @@ -0,0 +1,7 @@ +#ifdef __cplusplus +extern "C" { +#endif +#include +#ifdef __cplusplus +} +#endif diff --git a/MODEM/SRCS/dcload-serial/target-inc/time.h b/MODEM/SRCS/dcload-serial/target-inc/time.h new file mode 100644 index 00000000..4a966177 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/time.h @@ -0,0 +1,90 @@ +/* + * time.h + * + * Struct and function declarations for dealing with time. + */ + +#ifndef _TIME_H_ +#define _TIME_H_ + +#include "_ansi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef NULL +#define NULL 0 +#endif + +/* Get _CLOCKS_PER_SEC_ */ +#include + +#ifndef _CLOCKS_PER_SEC_ +#define _CLOCKS_PER_SEC_ 1000 +#endif + +#define CLOCKS_PER_SEC _CLOCKS_PER_SEC_ +#define CLK_TCK CLOCKS_PER_SEC +#define __need_size_t +#include + +/* Get _CLOCK_T_ and _TIME_T_. */ +#include + +#ifndef __clock_t_defined +typedef _CLOCK_T_ clock_t; +#define __clock_t_defined +#endif + +#ifndef __time_t_defined +typedef _TIME_T_ time_t; +#define __time_t_defined +#endif + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; +}; + +clock_t _EXFUN(clock, (void)); +double _EXFUN(difftime, (time_t _time2, time_t _time1)); +time_t _EXFUN(mktime, (struct tm *_timeptr)); +time_t _EXFUN(time, (time_t *_timer)); +#ifndef _REENT_ONLY +char *_EXFUN(asctime, (const struct tm *_tblock)); +char *_EXFUN(ctime, (const time_t *_time)); +struct tm *_EXFUN(gmtime, (const time_t *_timer)); +struct tm *_EXFUN(localtime,(const time_t *_timer)); +#endif +size_t _EXFUN(strftime, (char *_s, size_t _maxsize, const char *_fmt, const struct tm *_t)); + +char *_EXFUN(asctime_r, (const struct tm *, char *)); +char *_EXFUN(ctime_r, (const time_t *, char *)); +struct tm *_EXFUN(gmtime_r, (const time_t *, struct tm *)); +struct tm *_EXFUN(localtime_r, (const time_t *, struct tm *)); + +#ifdef __CYGWIN32__ +#ifndef __STRICT_ANSI__ +extern time_t _timezone __declspec(dllimport); +extern int _daylight __declspec(dllimport); +extern char *_tzname[2] __declspec(dllimport); + +char *_EXFUN(timezone, (void)); +void _EXFUN(tzset, (void)); +#endif +#endif /* __CYGWIN32__ */ + +#ifdef __cplusplus +} +#endif +#endif /* _TIME_H_ */ + diff --git a/MODEM/SRCS/dcload-serial/target-inc/unctrl.h b/MODEM/SRCS/dcload-serial/target-inc/unctrl.h new file mode 100644 index 00000000..8205ea60 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/unctrl.h @@ -0,0 +1,46 @@ +/* From curses.h. */ +/* + * Copyright (c) 1981, 1993 + * The Regents of the University of California. 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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 _UNCTRL_H_ +#define _UNCTRL_H_ + +#include <_ansi.h> + +#define unctrl(c) __unctrl[(c) & 0xff] +#define unctrllen(ch) __unctrllen[(ch) & 0xff] + +extern _CONST char * _CONST __unctrl[256]; /* Control strings. */ +extern _CONST char __unctrllen[256]; /* Control strings length. */ + +#endif /* _UNCTRL_H_ */ diff --git a/MODEM/SRCS/dcload-serial/target-inc/unistd.h b/MODEM/SRCS/dcload-serial/target-inc/unistd.h new file mode 100644 index 00000000..f9fca847 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/unistd.h @@ -0,0 +1,6 @@ +#ifndef _UNISTD_H_ +#define _UNISTD_H_ + +# include + +#endif /* _UNISTD_H_ */ diff --git a/MODEM/SRCS/dcload-serial/target-inc/utime.h b/MODEM/SRCS/dcload-serial/target-inc/utime.h new file mode 100644 index 00000000..c05e08e9 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/utime.h @@ -0,0 +1,10 @@ +#ifdef __cplusplus +extern "C" { +#endif + +/* The utime function is defined in libc/sys//sys if it exists. */ +#include + +#ifdef __cplusplus +} +#endif diff --git a/MODEM/SRCS/dcload-serial/target-inc/utmp.h b/MODEM/SRCS/dcload-serial/target-inc/utmp.h new file mode 100644 index 00000000..88cf6f85 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-inc/utmp.h @@ -0,0 +1,8 @@ +#ifdef __cplusplus +extern "C" { +#endif +#include +#ifdef __cplusplus +} +#endif + diff --git a/MODEM/SRCS/dcload-serial/target-src/1st_read/1st_read.c b/MODEM/SRCS/dcload-serial/target-src/1st_read/1st_read.c new file mode 100644 index 00000000..6fe3df34 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-src/1st_read/1st_read.c @@ -0,0 +1,45 @@ +/* + * This file is part of the dcload Dreamcast serial loader + * + * Copyright (C) 2001 Andrew Kieschnick + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include "minilzo.h" + +extern char binary_dcload_lzo_start[]; +extern char binary_exception_lzo_start[]; +extern unsigned int binary_dcload_lzo_size[]; +extern unsigned int binary_exception_lzo_size[]; + +#define TARGET1 (char *)0x8c004000 +#define TARGET2 (char *)0x8c00f400 + +extern void disable_cache(void); + +int main(void) +{ + unsigned int n; + + lzo_init(); + + lzo1x_decompress(binary_dcload_lzo_start, binary_dcload_lzo_size, TARGET1, &n, 0); + lzo1x_decompress(binary_exception_lzo_start, binary_exception_lzo_size, TARGET2, &n, 0); + + disable_cache(); + (*(void (*)()) 0x8c004000) (); +} diff --git a/MODEM/SRCS/dcload-serial/target-src/1st_read/Makefile b/MODEM/SRCS/dcload-serial/target-src/1st_read/Makefile new file mode 100644 index 00000000..bf86ffbc --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-src/1st_read/Makefile @@ -0,0 +1,55 @@ +include ../../Makefile.cfg + +LZOPATH = ../../minilzo.106 + +CC = $(TARGETCC) +CFLAGS = $(TARGETCFLAGS) +INCLUDE = -I../dcload -I$(LZOPATH) -I../../target-inc +OBJCOPY = $(TARGETOBJCOPY) +LD = $(TARGETLD) + +OBJECTS = crt0.o 1st_read.o disable.o memcpy.o memset.o memmove.o memcmp.o minilzo.o dcload.o exception.o +LZOFILES = $(LZOPATH)/minilzo.c $(LZOPATH)/minilzo.h $(LZOPATH)/lzoconf.h + +.c.o: + $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $< + +.S.o: + $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $< + +.s.o: + $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $< + +all: 1st_read.bin 1st_read.srec + +1st_read.bin: 1st_read + $(OBJCOPY) -O binary $< $@ + +1st_read.srec: 1st_read + $(OBJCOPY) -O srec $< $@ + +1st_read: $(OBJECTS) + $(CC) $(CFLAGS) -Wl,-Tdc.x -nostartfiles -nostdlib $^ -o $@ -lgcc + +minilzo.o: $(LZOFILES) + $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $< + +dcload.lzo: ../dcload/dcload.lzo + cp $< $@ + +exception.lzo: ../dcload/exception.lzo + cp $< $@ + +dcload.o: dcload.lzo + $(LD) -A sh -b binary --oformat elf32-shl $< -o $@ -r -EL --no-warn-mismatch + +exception.o: exception.lzo + $(LD) -A sh -b binary --oformat elf32-shl $< -o $@ -r -EL --no-warn-mismatch + +.PHONY : clean +clean: + rm -f $(OBJECTS) 1st_read dcload.lzo exception.lzo + +.PHONY : distclean +distclean: clean + rm -f 1st_read.bin 1st_read.srec diff --git a/MODEM/SRCS/dcload-serial/target-src/1st_read/asm.h b/MODEM/SRCS/dcload-serial/target-src/1st_read/asm.h new file mode 100644 index 00000000..ed27fdb1 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-src/1st_read/asm.h @@ -0,0 +1,22 @@ +#ifdef __STDC__ +# define _C_LABEL(x) _ ## x +#else +# define _C_LABEL(x) _/**/x +#endif +#define _ASM_LABEL(x) x + +#define _ENTRY(name) \ + .text; .align 2; .globl name; name: + +#define ENTRY(name) \ + _ENTRY(_C_LABEL(name)) + +#if (defined (__sh2__) || defined (__sh3__) || defined (__SH3E__) \ + || defined (__SH4_SINGLE__) || defined (__SH4__)) || defined(__SH4_SINGLE_ONLY__) +#define DELAYED_BRANCHES +#define SL(branch, dest, in_slot, in_slot_arg2) \ + branch##.s dest; in_slot, in_slot_arg2 +#else +#define SL(branch, dest, in_slot, in_slot_arg2) \ + in_slot, in_slot_arg2; branch dest +#endif diff --git a/MODEM/SRCS/dcload-serial/target-src/1st_read/crt0.S b/MODEM/SRCS/dcload-serial/target-src/1st_read/crt0.S new file mode 100644 index 00000000..1af82cca --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-src/1st_read/crt0.S @@ -0,0 +1,99 @@ + .section .text + .global start + .global _atexit +start: + mov.l setup_cache_k,r0 + mov.l p2_mask,r1 + or r1,r0 + jmp @r0 + nop +setup_cache: + mov.l ccr_addr,r0 + mov.w ccr_data,r1 + mov.l r1,@r0 + mov.l start_2_k,r0 + nop + nop + nop + nop + nop + nop + nop + jmp @r0 + nop +start_2: + mov.l old_stack_k,r14 + mov.l r15,@r14 + mov.l old_pr_k,r14 + sts pr,r15 + mov.l r15,@r14 + mov.l stack_k,r15 + + ! zero out bss + mov.l edata_k,r0 + mov.l end_k,r1 + mov #0,r2 +start_l: + mov.l r2,@r0 + add #4,r0 + cmp/ge r0,r1 + bt start_l + + mov.l set_fpscr_k, r1 + jsr @r1 + mov #0,r4 + lds r3,fpscr + + ! call the mainline + mov.l main_k,r0 + jsr @r0 + nop + + mov.l old_pr_k,r14 + mov.l @r14,r15 + lds r15,pr + mov.l old_stack_k,r14 + mov.l @r14,r15 + +_atexit: + rts + nop + + .align 4 +set_fpscr_k: + .long ___set_fpscr +stack_k: + .long _stack +edata_k: + .long _edata +end_k: + .long _end +main_k: + .long _main +old_stack_k: + .long _old_stack +old_pr_k: + .long _old_pr +_old_stack: + .long 0 +_old_pr: + .long 0 +setup_cache_k: + .long setup_cache +start_2_k: + .long start_2 +p2_mask: + .long 0xa0000000 +ccr_addr: + .long 0xff00001c +ccr_data: + .word 0x090b + + .align 4 + +#ifdef __ELF__ + .section .stack,"aw" +#else + .section .stack +#endif + diff --git a/MODEM/SRCS/dcload-serial/target-src/1st_read/dc.x b/MODEM/SRCS/dcload-serial/target-src/1st_read/dc.x new file mode 100644 index 00000000..5ea23dcb --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-src/1st_read/dc.x @@ -0,0 +1,228 @@ +/* Sega Dreamcast linker script */ + +OUTPUT_FORMAT("elf32-shl", "elf32-shl", + "elf32-shl") +OUTPUT_ARCH(sh) +ENTRY(start) + SEARCH_DIR(/usr/local/dcdev/sh-elf/lib); +/* Do we need any of these for elf? + __DYNAMIC = 0; */ + +MEMORY +{ + ram (rwx) : ORIGIN = 0x8c010000, LENGTH = 0xfe0000 +} + +SECTIONS +{ + /* Read-only sections, merged into text segment: */ +/* . = 0x1000;*/ + .interp : { *(.interp) } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .gnu.version : { *(.gnu.version) } + .gnu.version_d : { *(.gnu.version_d) } + .gnu.version_r : { *(.gnu.version_r) } + .rel.init : { *(.rel.init) } + .rela.init : { *(.rela.init) } + .rel.text : + { + *(.rel.text) + *(.rel.text.*) + *(.rel.gnu.linkonce.t*) + } + .rela.text : + { + *(.rela.text) + *(.rela.text.*) + *(.rela.gnu.linkonce.t*) + } + .rel.fini : { *(.rel.fini) } + .rela.fini : { *(.rela.fini) } + .rel.rodata : + { + *(.rel.rodata) + *(.rel.rodata.*) + *(.rel.gnu.linkonce.r*) + } + .rela.rodata : + { + *(.rela.rodata) + *(.rela.rodata.*) + *(.rela.gnu.linkonce.r*) + } + .rel.data : + { + *(.rel.data) + *(.rel.data.*) + *(.rel.gnu.linkonce.d*) + } + .rela.data : + { + *(.rela.data) + *(.rela.data.*) + *(.rela.gnu.linkonce.d*) + } + .rel.ctors : { *(.rel.ctors) } + .rela.ctors : { *(.rela.ctors) } + .rel.dtors : { *(.rel.dtors) } + .rela.dtors : { *(.rela.dtors) } + .rel.got : { *(.rel.got) } + .rela.got : { *(.rela.got) } + .rel.sdata : + { + *(.rel.sdata) + *(.rel.sdata.*) + *(.rel.gnu.linkonce.s*) + } + .rela.sdata : + { + *(.rela.sdata) + *(.rela.sdata.*) + *(.rela.gnu.linkonce.s*) + } + .rel.sbss : { *(.rel.sbss) } + .rela.sbss : { *(.rela.sbss) } + .rel.bss : { *(.rel.bss) } + .rela.bss : { *(.rela.bss) } + .rel.plt : { *(.rel.plt) } + .rela.plt : { *(.rela.plt) } + .init : + { + KEEP (*(.init)) + } =0 + .plt : { *(.plt) } + .text : + { + *(.text) + *(.text.*) + *(.stub) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + *(.gnu.linkonce.t*) + } =0 + _etext = .; + PROVIDE (etext = .); + .fini : + { + KEEP (*(.fini)) + } =0 + .rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) } + .rodata1 : { *(.rodata1) } + /* Adjust the address for the data segment. We want to adjust up to + the same address within the page on the next page up. */ + . = ALIGN(128) + (. & (128 - 1)); + .data : + { + *(.data) + *(.data.*) + *(.gnu.linkonce.d*) + SORT(CONSTRUCTORS) + } + .data1 : { *(.data1) } + .eh_frame : { *(.eh_frame) } + .gcc_except_table : { *(.gcc_except_table) } + .ctors ALIGN(4): + { + ___ctors = .; + /* gcc uses crtbegin.o to find the start of + the constructors, so we make sure it is + first. Because this is a wildcard, it + doesn't matter if the user does not + actually link against crtbegin.o; the + linker won't look for a file to match a + wildcard. The wildcard also means that it + doesn't matter which directory crtbegin.o + is in. */ + KEEP (*crtbegin.o(.ctors)) + /* We don't want to include the .ctor section from + from the crtend.o file until after the sorted ctors. + The .ctor section from the crtend file contains the + end of ctors marker and it must be last */ + KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + ___ctors_end = .; + } + .dtors : + { + ___dtors = .; + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + ___dtors_end = .; + } + .got : { *(.got.plt) *(.got) } + .dynamic : { *(.dynamic) } + /* We want the small data sections together, so single-instruction offsets + can access them all, and initialized data all before uninitialized, so + we can shorten the on-disk segment size. */ + .sdata : + { + *(.sdata) + *(.sdata.*) + *(.gnu.linkonce.s.*) + } + _edata = .; + PROVIDE (edata = .); + __bss_start = .; + .sbss : + { + *(.dynsbss) + *(.sbss) + *(.sbss.*) + *(.scommon) + } + .bss : + { + *(.dynbss) + *(.bss) + *(.bss.*) + *(COMMON) + /* Align here to ensure that the .bss section occupies space up to + _end. Align after .bss to ensure correct alignment even if the + .bss section disappears because there are no input sections. */ + . = ALIGN(32 / 8); + } + . = ALIGN(32 / 8); + _end = .; + PROVIDE (end = .); + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +/* .stack 0x8c00f400 : { _stack = .; *(.stack) }*/ + /* These must appear regardless of . */ +_stack = 0x8d000000; +} diff --git a/MODEM/SRCS/dcload-serial/target-src/1st_read/dcload.lzo b/MODEM/SRCS/dcload-serial/target-src/1st_read/dcload.lzo new file mode 100644 index 00000000..f941a453 Binary files /dev/null and b/MODEM/SRCS/dcload-serial/target-src/1st_read/dcload.lzo differ diff --git a/MODEM/SRCS/dcload-serial/target-src/1st_read/disable.s b/MODEM/SRCS/dcload-serial/target-src/1st_read/disable.s new file mode 100644 index 00000000..c62a6647 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-src/1st_read/disable.s @@ -0,0 +1,37 @@ + .section .text + .global _disable_cache + +_disable_cache: + mov.l disable_cache_k,r0 + mov.l p2_mask,r1 + or r1,r0 + jmp @r0 + nop +disable_cache: + mov.l ccr_addr,r0 + mov.l ccr_data_k,r1 + mov.l @r1,r1 + mov.l r1,@r0 + nop + nop + nop + nop + nop + nop + nop + nop + rts + nop + + .align 4 + +disable_cache_k: + .long disable_cache +p2_mask: + .long 0xa0000000 +ccr_addr: + .long 0xff00001c +ccr_data_k: + .long ccr_data +ccr_data: + .long 0x00000808 diff --git a/MODEM/SRCS/dcload-serial/target-src/1st_read/exception.lzo b/MODEM/SRCS/dcload-serial/target-src/1st_read/exception.lzo new file mode 100644 index 00000000..67e8550d Binary files /dev/null and b/MODEM/SRCS/dcload-serial/target-src/1st_read/exception.lzo differ diff --git a/MODEM/SRCS/dcload-serial/target-src/1st_read/memcmp.c b/MODEM/SRCS/dcload-serial/target-src/1st_read/memcmp.c new file mode 100644 index 00000000..40b803d3 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-src/1st_read/memcmp.c @@ -0,0 +1,105 @@ +/* +FUNCTION + <>---compare two memory areas + +INDEX + memcmp + +ANSI_SYNOPSIS + #include + int memcmp(const void *<[s1]>, const void *<[s2]>, size_t <[n]>); + +TRAD_SYNOPSIS + #include + int memcmp(<[s1]>, <[s2]>, <[n]>) + void *<[s1]>; + void *<[s2]>; + size_t <[n]>; + +DESCRIPTION + This function compares not more than <[n]> characters of the + object pointed to by <[s1]> with the object pointed to by <[s2]>. + + +RETURNS + The function returns an integer greater than, equal to or + less than zero according to whether the object pointed to by + <[s1]> is greater than, equal to or less than the object + pointed to by <[s2]>. + +PORTABILITY +<> is ANSI C. + +<> requires no supporting OS subroutines. + +QUICKREF + memcmp ansi pure +*/ + +#include + + +/* Nonzero if either X or Y is not aligned on a "long" boundary. */ +#define UNALIGNED(X, Y) \ + (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1))) + +/* How many bytes are copied each iteration of the word copy loop. */ +#define LBLOCKSIZE (sizeof (long)) + +/* Threshhold for punting to the byte copier. */ +#define TOO_SMALL(LEN) ((LEN) < LBLOCKSIZE) + +int +_DEFUN(memcmp, (m1, m2, n), + _CONST _PTR m1 _AND _CONST _PTR m2 _AND size_t n) +{ +#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) + unsigned char *s1 = (unsigned char *) m1; + unsigned char *s2 = (unsigned char *) m2; + + while (n--) { + if (*s1 != *s2) { + return *s1 - *s2; + } + s1++; + s2++; + } + return 0; +#else + unsigned char *s1 = (unsigned char *) m1; + unsigned char *s2 = (unsigned char *) m2; + unsigned long *a1; + unsigned long *a2; + + /* If the size is too small, or either pointer is unaligned, + then we punt to the byte compare loop. Hopefully this will + not turn up in inner loops. */ + if (!TOO_SMALL(n) && !UNALIGNED(s1, s2)) { + /* Otherwise, load and compare the blocks of memory one + word at a time. */ + a1 = (unsigned long *) s1; + a2 = (unsigned long *) s2; + while (n >= LBLOCKSIZE) { + if (*a1 != *a2) + break; + a1++; + a2++; + n -= LBLOCKSIZE; + } + + /* check m mod LBLOCKSIZE remaining characters */ + + s1 = (char *) a1; + s2 = (char *) a2; + } + + while (n--) { + if (*s1 != *s2) + return *s1 - *s2; + s1++; + s2++; + } + + return 0; +#endif /* not PREFER_SIZE_OVER_SPEED */ +} diff --git a/MODEM/SRCS/dcload-serial/target-src/1st_read/memcpy.S b/MODEM/SRCS/dcload-serial/target-src/1st_read/memcpy.S new file mode 100644 index 00000000..4df72e37 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-src/1st_read/memcpy.S @@ -0,0 +1,221 @@ +! +! Fast SH memcpy +! +! by Toshiyasu Morita (tm@netcom.com) +! hacked by J"orn Rernnecke (amylaar@cygnus.co.uk) ("o for o-umlaut) +! +! Entry: r4: destination pointer +! r5: source pointer +! r6: byte count +! +! Exit: r0: destination pointer +! r1-r7: trashed +! +! Notes: Usually one wants to do small reads and write a longword, but +! unfortunately it is difficult in some cases to concatanate bytes +! into a longword on the SH, so this does a longword read and small +! writes. +! +! This implementation makes two assumptions about how it is called: +! +! 1.: If the byte count is nonzero, the address of the last byte to be +! copied is unsigned greater than the address of the first byte to +! be copied. This could be easily swapped for a signed comparison, +! but the algorithm used needs some comparison. +! +! 2.: When there are two or three bytes in the last word of an 11-or-bore +! bytes memory chunk to b copied, the rest of the word can be read +! without size effects. +! This could be easily changed by increasing the minumum size of +! a fast memcpy and the amount subtracted from r7 before L_2l_loop be 2, +! however, this would cost a few extra cyles on average. +! + +#include "asm.h" + +ENTRY(memcpy) +#ifdef __LITTLE_ENDIAN__ + ! Little endian version copies with increasing addresses. + mov r4,r3 ! Save return value + mov #11,r0 ! Check if small number of bytes + cmp/hs r0,r6 + ! r6 becomes src end address + SL(bf, L_small, add r5,r6) + mov #1,r1 + tst r1,r5 ! check if source even + SL(bt, L_even, mov r6,r7) + mov.b @r5+,r0 ! no, make it even. + mov.b r0,@r4 + add #1,r4 +L_even: tst r1,r4 ! check if destination is even + add #-3,r7 + SL(bf, L_odddst, mov #2,r1) + tst r1,r4 ! check if destination is 4-byte aligned + mov r4,r0 + SL(bt, L_al4dst, sub r5,r0) + mov.w @r5+,r2 + mov.w r2,@r4 + ! add #2,r4 r4 is dead here. +L_al4dst: + tst r1,r5 + bt L_al4both + mov.w @r5+,r1 + swap.w r1,r1 + add #-6,r0 + add #-6,r7 ! r7 := src end address minus 9. + .align 2 +L_2l_loop: + mov.l @r5+,r2 ! Read & write two longwords per iteration + xtrct r2,r1 + mov.l r1,@(r0,r5) + cmp/hs r7,r5 + mov.l @r5+,r1 + xtrct r1,r2 + mov.l r2,@(r0,r5) + bf L_2l_loop + add #-2,r5 + bra L_cleanup + add #5,r0 +L_al4both: + add #-4,r0 + .align 2 +L_al4both_loop: + mov.l @r5+,r4 ! Read longword, write longword per iteration + cmp/hs r7,r5 + SL(bf, L_al4both_loop, mov.l r4,@(r0,r5)) + + bra L_cleanup + add #3,r0 + +L_odddst: + tst r1,r5 + SL(bt, L_al4src, add #-1,r4) + mov.w @r5+,r0 + mov.b r0,@(1,r4) + shlr8 r0 + mov.b r0,@(2,r4) + add #2,r4 +L_al4src: + .align 2 +L_odd_loop: + mov.l @r5+,r0 ! Read longword, write byte, word, byte per iteration + cmp/hs r7,r5 + mov.b r0,@(1,r4) + shlr8 r0 + mov.w r0,@(2,r4) + shlr16 r0 + mov.b r0,@(4,r4) + SL(bf, L_odd_loop, add #4,r4) + .align 2 ! avoid nop in more frequently executed code. +L_cleanup2: + mov r4,r0 + sub r5,r0 +L_cleanup: + cmp/eq r6,r5 + bt L_ready + .align 2 +L_cleanup_loop: + mov.b @r5+,r1 + cmp/eq r6,r5 + mov.b r1,@(r0,r5) + bf L_cleanup_loop +L_ready: + rts + mov r3,r0 +L_small: + bra L_cleanup2 + add #-1,r4 +#else + ! Big endian version copies with decreasing addresses. + mov r4,r0 + add r6,r0 + sub r4,r5 + mov #11,r1 + cmp/hs r1,r6 + SL(bf, L_small, add #-1,r5) + mov r5,r3 + add r0,r3 + shlr r3 + SL(bt, L_even, + mov r4,r7) + mov.b @(r0,r5),r2 + add #-1,r3 + mov.b r2,@-r0 +L_even: + tst #1,r0 + add #-1,r5 + SL(bf, L_odddst, add #8,r7) + tst #2,r0 + bt L_al4dst + add #-1,r3 + mov.w @(r0,r5),r1 + mov.w r1,@-r0 +L_al4dst: + shlr r3 + bt L_al4both + mov.w @(r0,r5),r1 + swap.w r1,r1 + add #4,r7 + add #-4,r5 + .align 2 +L_2l_loop: + mov.l @(r0,r5),r2 + xtrct r2,r1 + mov.l r1,@-r0 + cmp/hs r7,r0 + mov.l @(r0,r5),r1 + xtrct r1,r2 + mov.l r2,@-r0 + bt L_2l_loop + bra L_cleanup + add #5,r5 + + nop ! avoid nop in executed code. +L_al4both: + add #-2,r5 + .align 2 +L_al4both_loop: + mov.l @(r0,r5),r1 + cmp/hs r7,r0 + SL(bt, L_al4both_loop, + mov.l r1,@-r0) + bra L_cleanup + add #3,r5 + + nop ! avoid nop in executed code. +L_odddst: + shlr r3 + bt L_al4src + mov.w @(r0,r5),r1 + mov.b r1,@-r0 + shlr8 r1 + mov.b r1,@-r0 +L_al4src: + add #-2,r5 + .align 2 +L_odd_loop: + mov.l @(r0,r5),r2 + cmp/hs r7,r0 + mov.b r2,@-r0 + shlr8 r2 + mov.w r2,@-r0 + shlr16 r2 + mov.b r2,@-r0 + bt L_odd_loop + + add #3,r5 +L_cleanup: +L_small: + cmp/eq r4,r0 + bt L_ready + add #1,r4 + .align 2 +L_cleanup_loop: + mov.b @(r0,r5),r2 + cmp/eq r4,r0 + mov.b r2,@-r0 + bf L_cleanup_loop +L_ready: + rts + nop +#endif diff --git a/MODEM/SRCS/dcload-serial/target-src/1st_read/memmove.c b/MODEM/SRCS/dcload-serial/target-src/1st_read/memmove.c new file mode 100644 index 00000000..bb4fbf2b --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-src/1st_read/memmove.c @@ -0,0 +1,128 @@ +/* +FUNCTION + <>---move possibly overlapping memory + +INDEX + memmove + +ANSI_SYNOPSIS + #include + void *memmove(void *<[dst]>, const void *<[src]>, size_t <[length]>); + +TRAD_SYNOPSIS + #include + void *memmove(<[dst]>, <[src]>, <[length]>) + void *<[dst]>; + void *<[src]>; + size_t <[length]>; + +DESCRIPTION + This function moves <[length]> characters from the block of + memory starting at <<*<[src]>>> to the memory starting at + <<*<[dst]>>>. <> reproduces the characters correctly + at <<*<[dst]>>> even if the two areas overlap. + + +RETURNS + The function returns <[dst]> as passed. + +PORTABILITY +<> is ANSI C. + +<> requires no supporting OS subroutines. + +QUICKREF + memmove ansi pure +*/ + +#include +#include <_ansi.h> +#include +#include + +/* Nonzero if either X or Y is not aligned on a "long" boundary. */ +#define UNALIGNED(X, Y) \ + (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1))) + +/* How many bytes are copied each iteration of the 4X unrolled loop. */ +#define BIGBLOCKSIZE (sizeof (long) << 2) + +/* How many bytes are copied each iteration of the word copy loop. */ +#define LITTLEBLOCKSIZE (sizeof (long)) + +/* Threshhold for punting to the byte copier. */ +#define TOO_SMALL(LEN) ((LEN) < BIGBLOCKSIZE) + +/*SUPPRESS 20*/ +_PTR +_DEFUN(memmove, (dst_void, src_void, length), + _PTR dst_void _AND _CONST _PTR src_void _AND size_t length) +{ +#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) + char *dst = dst_void; + _CONST char *src = src_void; + + if (src < dst && dst < src + length) { + /* Have to copy backwards */ + src += length; + dst += length; + while (length--) { + *--dst = *--src; + } + } else { + while (length--) { + *dst++ = *src++; + } + } + + return dst_void; +#else + char *dst = dst_void; + _CONST char *src = src_void; + long *aligned_dst; + _CONST long *aligned_src; + int len = length; + + if (src < dst && dst < src + len) { + /* Destructive overlap...have to copy backwards */ + src += len; + dst += len; + while (len--) { + *--dst = *--src; + } + } else { + /* Use optimizing algorithm for a non-destructive copy to closely + match memcpy. If the size is small or either SRC or DST is unaligned, + then punt into the byte copy loop. This should be rare. */ + if (!TOO_SMALL(len) && !UNALIGNED(src, dst)) { + aligned_dst = (long *) dst; + aligned_src = (long *) src; + + /* Copy 4X long words at a time if possible. */ + while (len >= BIGBLOCKSIZE) { + *aligned_dst++ = *aligned_src++; + *aligned_dst++ = *aligned_src++; + *aligned_dst++ = *aligned_src++; + *aligned_dst++ = *aligned_src++; + len -= BIGBLOCKSIZE; + } + + /* Copy one long word at a time if possible. */ + while (len >= LITTLEBLOCKSIZE) { + *aligned_dst++ = *aligned_src++; + len -= LITTLEBLOCKSIZE; + } + + /* Pick up any residual with a byte copier. */ + dst = (char *) aligned_dst; + src = (char *) aligned_src; + } + + while (len--) { + *dst++ = *src++; + } + } + + return dst_void; +#endif /* not PREFER_SIZE_OVER_SPEED */ +} diff --git a/MODEM/SRCS/dcload-serial/target-src/1st_read/memset.S b/MODEM/SRCS/dcload-serial/target-src/1st_read/memset.S new file mode 100644 index 00000000..7352b414 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-src/1st_read/memset.S @@ -0,0 +1,64 @@ +! +! Fast SH memset +! +! by Toshiyasu Morita (tm@netcom.com) +! +! Entry: r4: destination pointer +! r5: fill value +! r6: byte count +! +! Exit: r0-r3: trashed +! + +! This assumes that the first four bytes of the address space (0..3) are +! reserved - usually by the linker script. Otherwise, we would had to check +! for the case of objects of the size 12..15 at address 0..3 . + +#include "asm.h" + +ENTRY(memset) + mov #12,r0 ! Check for small number of bytes + cmp/gt r6,r0 + mov r4,r0 + SL(bt, L_store_byte_loop_check0, add r4,r6) + + tst #3,r0 ! Align destination + SL(bt, L_dup_bytes, extu.b r5,r5) + .balignw 4,0x0009 +L_align_loop: + mov.b r5,@r0 + add #1,r0 + tst #3,r0 + bf L_align_loop + +L_dup_bytes: + swap.b r5,r2 ! Duplicate bytes across longword + or r2,r5 + swap.w r5,r2 + or r2,r5 + + add #-16,r6 + + .balignw 4,0x0009 +L_store_long_loop: + mov.l r5,@r0 ! Store double longs to memory + cmp/hs r6,r0 + mov.l r5,@(4,r0) + SL(bf, L_store_long_loop, add #8,r0) + + add #16,r6 + +L_store_byte_loop_check0: + cmp/eq r6,r0 + bt L_exit + .balignw 4,0x0009 +L_store_byte_loop: + mov.b r5,@r0 ! Store bytes to memory + add #1,r0 + cmp/eq r6,r0 + bf L_store_byte_loop + +L_exit: + rts + mov r4,r0 + diff --git a/MODEM/SRCS/dcload-serial/target-src/Makefile b/MODEM/SRCS/dcload-serial/target-src/Makefile new file mode 100644 index 00000000..2d18d228 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-src/Makefile @@ -0,0 +1,24 @@ +SUBDIRS = 1st_read dcload +MAKE = make + +.PHONY : subdirs $(SUBDIRS) + +subdirs: $(SUBDIRS) + +$(SUBDIRS): + $(MAKE) -C $@ + +1st_read: dcload + +.PHONY : clean +clean: + for dir in $(SUBDIRS); do \ + $(MAKE) -C $$dir clean; \ + done + +.PHONY : distclean +distclean: + for dir in $(SUBDIRS) ; do \ + $(MAKE) -C $$dir distclean; \ + done + diff --git a/MODEM/SRCS/dcload-serial/target-src/dcload/Makefile b/MODEM/SRCS/dcload-serial/target-src/dcload/Makefile new file mode 100644 index 00000000..81d9e454 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-src/dcload/Makefile @@ -0,0 +1,53 @@ +include ../../Makefile.cfg + +LZOPATH = ../../minilzo.106 +LZO = ../../host-src/misc/lzo + +CC = $(TARGETCC) +CFLAGS = $(TARGETCFLAGS) -DSERIALSPEED=$(SERIALSPEED) +INCLUDE = -I$(LZOPATH) -I../../target-inc + +OBJCOPY = $(TARGETOBJCOPY) + +#DCLOBJECTS = dcload-crt0.o syscalls.o memcpy.o memset.o memmove.o memcmp.o scif.o disable.o go.o video.o minilzo.o dcload.o cdfs_redir.o cdfs_syscalls.o bswap.o +DCLOBJECTS = dcload-crt0.o syscalls.o memcpy.o memset.o memmove.o memcmp.o scif.o disable.o go.o video.o minilzo.o dcload.o cdfs_redir.o cdfs_syscalls.o +EXCOBJECTS = exception.o +LZOFILES = $(LZOPATH)/minilzo.c $(LZOPATH)/minilzo.h $(LZOPATH)/lzoconf.h + +.c.o: + $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $< +.s.o: + $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $< +.S.o: + $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $< + +all: dcload.lzo exception.lzo + +dcload.lzo: dcload.bin + $(LZO) $< $@ + +dcload.bin: dcload + $(OBJCOPY) -O binary $< $@ + +dcload: $(DCLOBJECTS) + $(CC) $(CFLAGS) -Wl,-Tdcload.x -nostartfiles -nostdlib $^ -o $@ -lgcc + +exception.lzo: exception.bin + $(LZO) $< $@ + +exception.bin: exception + $(OBJCOPY) -O binary $< $@ + +exception: $(EXCOBJECTS) + $(CC) $(CFLAGS) -Wl,-Ttext=0x8c00f400 -nostartfiles -nostdlib $^ -o $@ + +minilzo.o: $(LZOFILES) + $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $< + +.PHONY : clean +clean: + rm -f $(DCLOBJECTS) $(EXCOBJECTS) dcload exception dcload.bin exception.bin + +.PHONY : distclean +distclean: clean + rm -f *.lzo diff --git a/MODEM/SRCS/dcload-serial/target-src/dcload/asm.h b/MODEM/SRCS/dcload-serial/target-src/dcload/asm.h new file mode 100644 index 00000000..ed27fdb1 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-src/dcload/asm.h @@ -0,0 +1,22 @@ +#ifdef __STDC__ +# define _C_LABEL(x) _ ## x +#else +# define _C_LABEL(x) _/**/x +#endif +#define _ASM_LABEL(x) x + +#define _ENTRY(name) \ + .text; .align 2; .globl name; name: + +#define ENTRY(name) \ + _ENTRY(_C_LABEL(name)) + +#if (defined (__sh2__) || defined (__sh3__) || defined (__SH3E__) \ + || defined (__SH4_SINGLE__) || defined (__SH4__)) || defined(__SH4_SINGLE_ONLY__) +#define DELAYED_BRANCHES +#define SL(branch, dest, in_slot, in_slot_arg2) \ + branch##.s dest; in_slot, in_slot_arg2 +#else +#define SL(branch, dest, in_slot, in_slot_arg2) \ + in_slot, in_slot_arg2; branch dest +#endif diff --git a/MODEM/SRCS/dcload-serial/target-src/dcload/cdfs_redir.s b/MODEM/SRCS/dcload-serial/target-src/dcload/cdfs_redir.s new file mode 100644 index 00000000..895eebdf --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-src/dcload/cdfs_redir.s @@ -0,0 +1,83 @@ + .section .text + .global _cdfs_redir_enable + .global _cdfs_redir_disable + .global _cdfs_redir_save +.align 2 + +_cdfs_redir_save: + mov.l cdfs_saved_k, r0 + mov.l @r0, r0 + tst r0,r0 + bf already_saved + mov.l cdfs_entry_k, r0 + mov.l @r0,r0 + mov.l cdfs_saved_k, r1 + mov.l r0, @r1 +already_saved: + rts + nop + +_cdfs_redir_disable: + mov.l cdfs_saved_k, r0 + mov.l @r0, r0 + mov.l cdfs_entry_k, r1 + mov.l r0, @r1 + rts + nop + +_cdfs_redir_enable: + mov.l cdfs_entry_k, r0 + mov.l cdfs_redir_k, r1 + mov.l r1, @r0 + rts + nop + +.align 4 +cdfs_entry_k: + .long 0x8c0000bc +cdfs_saved_k: + .long cdfs_saved +cdfs_saved: + .long 0 +cdfs_redir_k: + .long cdfs_redir + +cdfs_redir: + mov r7,r0 + mov #10,r1 + cmp/hs r0,r1 + bf badsyscall + mov.l gd_first_k,r1 + shll2 r0 + mov.l @(r0,r1),r0 + jmp @r0 + nop +badsyscall: + mov #-1,r0 + rts + nop + +gd_first_k: + .long gdGdcReqCmd +gdGdcReqCmd: + .long _gdGdcReqCmd +gdGdcGetCmdStat: + .long _gdGdcGetCmdStat +gdGdcExecServer: + .long _gdGdcExecServer +gdGdcInitSystem: + .long _gdGdcInitSystem +gdGdcGetDrvStat: + .long _gdGdcGetDrvStat +gdGdcG1DmaEnd: + .long badsyscall +gdGdcReqDmaTrans: + .long badsyscall +gdGdcCheckDmaTrans: + .long badsyscall +gdGdcReadAbort: + .long badsyscall +gdGdcReset: + .long badsyscall +gdGdcChangeDataType: + .long _gdGdcChangeDataType diff --git a/MODEM/SRCS/dcload-serial/target-src/dcload/cdfs_syscalls.c b/MODEM/SRCS/dcload-serial/target-src/dcload/cdfs_syscalls.c new file mode 100644 index 00000000..0725948e --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-src/dcload/cdfs_syscalls.c @@ -0,0 +1,100 @@ +/* + * This file is part of the dcload Dreamcast serial loader + * + * Copyright (C) 2001 Andrew Kieschnick + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include "scif.h" + +extern void load_data_block_general(unsigned char *addr, + unsigned int size, unsigned int verbose); +extern unsigned int send_data_block_compressed(unsigned char * addr, + unsigned int size); +extern unsigned int get_uint(void); +extern int put_uint(unsigned int val); + +int gdStatus; + +struct TOC { + unsigned int entry[99]; + unsigned int first, last; + unsigned int dunno; +}; + +int gdGdcReqCmd(int cmd, int *param) +{ + struct TOC *toc; + int i; + + switch (cmd) { + case 16: /* read sectors */ + scif_putchar(19); + put_uint(param[0]); /* starting sector */ + put_uint(param[1]); /* number of sectors */ + load_data_block_general((unsigned char *)param[2], param[1]*2048, 0); + param[3] = 0; + gdStatus = 2; + return 0; + break; + case 19: /* read toc */ + toc = (struct TOC *)param[1]; + toc->entry[0] = 0x41000096; /* CTRL = 4, ADR = 1, LBA = 150 */ + for(i=1; i<99; i++) + toc->entry[i] = -1; + toc->first = 0x41010000; /* first = track 1 */ + toc->last = 0x41010000; /* last = track 1 */ + gdStatus = 2; + return 0; + break; + case 24: /* init disc */ + gdStatus = 2; + return 0; + break; + default: + gdStatus = 0; + return -1; + break; + } + +} + +void gdGdcExecServer(void) +{ +} + +int gdGdcGetCmdStat(int f, int *status) +{ + if (gdStatus == 0) + status[0] = 0; + return gdStatus; +} + +void gdGdcGetDrvStat(int *param) +{ + param[1] = 32; +} + +int gdGdcChangeDataType(int *param) +{ + return 0; +} + +void gdGdcInitSystem(void) +{ +} + diff --git a/MODEM/SRCS/dcload-serial/target-src/dcload/dcload-crt0.s b/MODEM/SRCS/dcload-serial/target-src/dcload/dcload-crt0.s new file mode 100644 index 00000000..0fb9cd2a --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-src/dcload/dcload-crt0.s @@ -0,0 +1,191 @@ +! crt0.s for dcload + + .section .text + .global start + .global _atexit + .global _dcloadsyscall +start: + bra realstart + nop + +! for checking if dcload is present + +dcloadmagic: + .long 0xdeadbeef + +! normal programs use this call + +dcloadsyscall_k: + .long _dcloadsyscall + +! exception handler uses these calls + +setup_video_k: + .long _setup_video +clrscr_k: + .long _clrscr +draw_string_k: + .long _draw_string +uint_to_string_k: + .long _uint_to_string +exc_to_string_k: + .long _exception_code_to_string + +realstart: + stc sr,r0 + mov.l sr_mask,r1 + and r1,r0 + or #0xf0,r0 + ldc r0,sr + mov.l setup_cache_k,r0 + mov.l p2_mask,r1 + or r1,r0 + jmp @r0 + nop + +setup_cache: + mov.l ccr_addr,r0 + mov.w ccr_data,r1 + mov.l r1,@r0 + mov.l start_2_k,r0 + mov #0,r1 + nop + nop + nop + nop + nop + nop + jmp @r0 + mov r1,r0 + +start_2: + mov.l stack_k,r15 + ! zero out bss + mov.l edata_k,r0 + mov.l end_k,r1 + mov #0,r2 + +start_l: + mov.l r2,@r0 + add #4,r0 + cmp/ge r0,r1 + bt start_l + + mov.l set_fpscr_k, r1 + jsr @r1 + mov #0,r4 + lds r3,fpscr + + ! call main + mov.l main_k,r0 + jsr @r0 + or r0,r0 + ! bootloader should never exit, but what the hell + bra realstart + nop + +_atexit: + rts + nop + + + .align 4 +sr_mask: + .long 0xefff7fff +set_fpscr_k: + .long ___set_fpscr +stack_k: + .long _stack +edata_k: + .long _edata +end_k: + .long _end +main_k: + .long _main +setup_cache_k: + .long setup_cache +start_2_k: + .long start_2 +p2_mask: + .long 0xa0000000 +ccr_addr: + .long 0xff00001c +ccr_data: + .word 0x090b + +_dcloadsyscall: + mov.l dcloadmagic_k,r1 + mov.l @r1,r1 + mov.l correctmagic,r0 + cmp/eq r0,r1 + bf badsyscall + + mov r4,r0 + mov r5,r4 + mov r6,r5 + mov r7,r6 + + mov #20,r1 + cmp/hs r0,r1 + bf badsyscall + + mov.l first_syscall,r1 + shll2 r0 + mov.l @(r0,r1),r0 + jmp @r0 + nop + +badsyscall: + mov #-1,r0 + rts + nop + +.align 4 +dcloadmagic_k: + .long dcloadmagic +correctmagic: + .long 0xdeadbeef +first_syscall: + .long read_k +read_k: + .long _read +write_k: + .long _write +open_k: + .long _open +close_k: + .long _close +creat_k: + .long _creat +link_k: + .long _link +unlink_k: + .long _unlink +chdir_k: + .long _chdir +chmod_k: + .long _chmod +lseek_k: + .long _lseek +fstat_k: + .long _fstat +time_k: + .long _time +stat_k: + .long _stat +utime_k: + .long _utime +assign_wrkmem_k: + .long _assign_wrkmem +exit_k: + .long _dcexit +opendir_k: + .long _opendir +closedir_k: + .long _closedir +readdir_k: + .long _readdir +unk19_k: + .long 0 +gdbpacket_k: + .long _gdbpacket diff --git a/MODEM/SRCS/dcload-serial/target-src/dcload/dcload.c b/MODEM/SRCS/dcload-serial/target-src/dcload/dcload.c new file mode 100644 index 00000000..00ca90a2 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-src/dcload/dcload.c @@ -0,0 +1,425 @@ +/* + * dcload, a Dreamcast serial loader + * + * Copyright (C) 2001 Andrew Kieschnick + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include "scif.h" +#include "minilzo.h" +#include "video.h" + +#define NAME "dcload-serial 1.0.4" + +#define VIDMODEREG (volatile unsigned int *)0xa05f8044 +#define VIDBORDER (volatile unsigned int *)0xa05f8040 + +extern void disable_cache(void); +extern void go(unsigned int addr); +extern void cdfs_redir_save(void); +extern void cdfs_redir_disable(void); +extern void cdfs_redir_enable(void); + +/* buffer for storing compressed data (16384 + 16384 / 64 + 16 + 3 bytes) */ +unsigned char *buffer = (unsigned char *) 0x8c009f6c; + +/* work memory for compressing data (65536 bytes) */ +unsigned char *wrkmem = 0; + +#define BOOTED 1 +#define NOT_BOOTED -1 +#define IS(a) ((a) == BOOTED) +#define IS_NOT(a) ((a) == NOT_BOOTED) +unsigned int booted = NOT_BOOTED; + +void assign_wrkmem(unsigned char *user_buffer) +{ + wrkmem = user_buffer; +} + +/* converts expevt value to description, used by exception handler */ +unsigned char * exception_code_to_string(unsigned int expevt) +{ + switch(expevt) { + case 0x1e0: + return "User break"; + break; + case 0x0e0: + return "Address error (read)"; + break; + case 0x040: + return "TLB miss exception (read)"; + break; + case 0x0a0: + return "TLB protection violation exception (read)"; + break; + case 0x180: + return "General illegal instruction exception"; + break; + case 0x1a0: + return "Slot illegal instruction exception"; + break; + case 0x800: + return "General FPU disable exception"; + break; + case 0x820: + return "Slot FPU disable exception"; + break; + case 0x100: + return "Address error (write)"; + break; + case 0x060: + return "TLB miss exception (write)"; + break; + case 0x0c0: + return "TLB protection violation exception (write)"; + break; + case 0x120: + return "FPU exception"; + break; + case 0x080: + return "Initial page write exception"; + break; + case 0x160: + return "Unconditional trap (TRAPA)"; + break; + default: + return "Unknown exception"; + break; + } +} + +void uint_to_string(unsigned int foo, unsigned char *bar) +{ + char hexdigit[16] = "0123456789abcdef"; + int i; + + for(i=7; i>=0; i--) { + bar[i] = hexdigit[(foo & 0x0f)]; + foo = foo >> 4; + } + bar[8] = 0; +} + +void put_uint(unsigned int val) +{ + scif_putchar(val & 0xff); + scif_putchar((val >> 8) & 0xff); + scif_putchar((val >> 16) & 0xff); + scif_putchar((val >> 24) & 0xff); +} + +/* set n lines starting at line y to value c */ +void clear_lines(unsigned int y, unsigned int n, unsigned int c) +{ + memset((unsigned int *)0xa5000000 + y * 640 / 2, c, n * 640 * 2); +} + +/* get an unsigned int from pc */ +unsigned int get_uint(void) +{ + unsigned int retval; + + retval = 0; + retval += (scif_getchar()) << 24; + retval >>= 8; + retval += (scif_getchar()) << 24; + retval >>= 8; + retval += (scif_getchar()) << 24; + retval >>= 8; + retval += (scif_getchar()) << 24; + + scif_putchar(retval & 0xff); + scif_putchar((retval >> 8) & 0xff); + scif_putchar((retval >> 16) & 0xff); + scif_putchar((retval >> 24) & 0xff); + + return retval; +} + +/* send an uncompressed data block to the pc from addr */ +unsigned int +send_data_block_uncompressed(unsigned char * addr, unsigned int size) +{ + unsigned int i; + unsigned char *location = addr; + unsigned char sum = 0; + unsigned char data; + + scif_putchar('U'); + put_uint(size); + + for (i = 0; i < size; i++) { + data = *(location++); + scif_putchar(data); + sum ^= data; + } + + scif_putchar(sum); + data = scif_getchar(); + + if (data == 'G') + return 1; + else + return 0; + +} + +/* send a compressed data block to the pc from addr + * falls back to uncompressed if compression unavailable or not beneficial + */ +unsigned int +send_data_block_compressed(unsigned char * addr, unsigned int size) +{ + unsigned int i; + unsigned char *location = addr; + unsigned char sum = 0; + unsigned char data; + unsigned int csize; + unsigned int sendsize; + + /* send uncompressed if no work memory provided */ + if (!wrkmem) + return(send_data_block_uncompressed(addr, size)); + + /* send uncompressed if too small to bother with */ + if (size < 19) + return(send_data_block_uncompressed(addr, size)); + + while (size) { + if (size > 8192) + sendsize = 8192; + else + sendsize = size; + lzo1x_1_compress(addr, sendsize, buffer, &csize, wrkmem); + if (csize < sendsize) { + /* send compressed */ + scif_putchar('C'); + put_uint(csize); + data = 'B'; + while(data != 'G') { + location = buffer; + for (i = 0; i < csize; i++) { + data = *(location++); + scif_putchar(data); + sum ^= data; + } + + scif_putchar(sum); + data = scif_getchar(); + } + } else { + /* send uncompressed */ + while(!(send_data_block_uncompressed(addr, sendsize))); + } + size -= sendsize; + addr += sendsize; + } + return 1; +} + +void draw_progress(unsigned int current, unsigned int total) +{ + unsigned char current_string[9]; + unsigned char total_string[9]; + + uint_to_string(total, total_string); + uint_to_string(current, current_string); + clear_lines(72, 24, 0); + draw_string(0, 72, "(", 0xffff); + draw_string(12, 72, current_string, 0xffff); + draw_string(108, 72, "/", 0xffff); + draw_string(120, 72, total_string, 0xffff); + draw_string(216, 72, ")", 0xffff); +} + +void +load_data_block_general(unsigned char * addr, unsigned int total, unsigned int verbose) +{ + unsigned char type, sum, ok; + unsigned int size, newsize, realtotal; + unsigned char *tmp = buffer; + int i; + unsigned char *data = addr; + + if (verbose) + realtotal = total; + + while (total) { + + if (verbose) + draw_progress(realtotal - total, realtotal); + + type = scif_getchar(); + + size = get_uint(); + + switch (type) { + case 'U': /* uncompressed */ + for(i=0; i @(0,r15) = addr of labels + ! r5 -> @(4,r15) = number of labels + ! r6 -> @(12,r15) = starting x-position + ! r7 -> @(8,r15)= starting y-position + + sts.l pr,@-r15 + add #-16,r15 +! loop init + mov.l r4,@(0,r15) + mov.l r7,@(8,r15) + mov.l r6,@(12,r15) + mov r5,r0 +disp_loop: +! display a label + mov.l r0,@(4,r15) + mov.l @(12,r15),r4 + mov.l @(8,r15),r5 + mov.l @(0,r15),r6 + mov #0xff,r7 + mov.l draw_k,r0 + mov.l @r0,r0 + jsr @r0 + nop +! increment / decrement / blahblahblah + mov.l @(8,r15),r0 + add #24,r0 + mov.l r0,@(8,r15) + mov.l @(0,r15),r0 + add #5,r0 + mov.l r0,@(0,r15) + mov.l @(4,r15),r0 + dt r0 + bf disp_loop + add #16,r15 + lds.l @r15+,pr + rts + nop + +disp_values: + ! r4 -> @(0,r15) = addr of values + ! r5 -> @(4,r15) = number of values + ! r6 -> @(12,r15) = starting x-position + ! r7 -> @(8,r15)= starting y-position + + sts.l pr,@-r15 + add #-16,r15 +! loop init + mov.l r4,@(0,r15) + mov.l r7,@(8,r15) + mov.l r6,@(12,r15) + mov r5,r0 +val_loop: + mov.l r0,@(4,r15) + mov.l @(0,r15),r4 + mov.l @r4,r4 +! convert string + mova misc_string,r0 + mov r0,r5 + mov.l uint_to_string_k,r0 + mov.l @r0,r0 + jsr @r0 + nop + mova misc_string,r0 + mov r0,r6 +! display string + mov.l @(12,r15),r4 + mov.l @(8,r15),r5 + mov #0xff,r7 + mov.l draw_k,r0 + mov.l @r0,r0 + jsr @r0 + nop +! increment / decrement + mov.l @(8,r15),r0 + add #24,r0 + mov.l r0,@(8,r15) + mov.l @(0,r15),r0 + add #4,r0 + mov.l r0,@(0,r15) + mov.l @(4,r15),r0 + dt r0 + bf val_loop + add #16,r15 + lds.l @r15+,pr + rts + nop + +.balign 0x100 + +! VBR + 0x100 +! general exceptions +general_1: +! assume the stack may be fux0red + mov.l stack_addr,r15 +! save and display registers + add #-66,r15 + add #-66,r15 + add #-66,r15 + add #-66,r15 + sts.l pr,@-r15 + mov.l r0,@-r15 + mov.l r1,@-r15 + mova regdump,r0 + jsr @r0 + nop + add #12,r15 + add #66,r15 + add #66,r15 + add #66,r15 + add #66,r15 +! display exception identifier string + mov.l expevt,r4 + mov.l @r4,r4 + mov.l exc_to_string_k,r0 + mov.l @r0,r0 + jsr @r0 + nop + mov #0,r4 + mov #24,r5 + mov r0,r6 + mov #0xff,r7 + mov.l draw_k,r0 + mov.l @r0,r0 + jsr @r0 + nop +! display "EXPEVT" + mov #0,r4 + mov #48,r5 + mova expevt_string,r0 + mov r0,r6 + mov #0xff,r7 + mov.l draw_k,r0 + mov.l @r0,r0 + jsr @r0 + nop +! convert expevt to string + mov.l expevt,r4 + mov.l @r4,r4 + mova misc_string,r0 + mov r0,r5 + mov.l uint_to_string_k,r0 + mov.l @r0,r0 + jsr @r0 + nop +! display expevt + mov #84,r4 + extu.b r4,r4 + mov #48,r5 + mova misc_string,r0 + mov r0,r6 + mov #0xff,r7 + mov.l draw_k,r0 + mov.l @r0,r0 + jsr @r0 + nop +! return to bootloader + mov.l entry_addr,r0 + jmp @r0 + nop +.align 4 +stack_addr: + .long 0x8d000000 +exc_to_string_k: + .long 0x8c00401c + +regdump: +! save registers for display +! caller has allocated 264 bytes on stack for regs +! caller has left r0,r1, and old pr on stack + sts.l pr,@-r15 + mov r15,r0 + add #16,r0 +! (s)pc, pr, (s)sr, gbr, vbr, dbr, mach, macl + stc spc,r1 + mov.l r1,@r0 + add #4,r0 + mov.l @(12,r15),r1 + mov.l r1,@r0 + add #4,r0 + stc ssr,r1 + mov.l r1,@r0 + add #4,r0 + stc gbr,r1 + mov.l r1,@r0 + add #4,r0 + stc vbr,r1 + mov.l r1,@r0 + add #4,r0 + stc dbr,r1 + mov.l r1,@r0 + add #4,r0 + sts mach,r1 + mov.l r1,@r0 + add #4,r0 + sts macl,r1 + mov.l r1,@r0 + add #4,r0 +! r0-r7 bank 0 + stc r0_bank,r1 + mov.l r1,@r0 + add #4,r0 + stc r1_bank,r1 + mov.l r1,@r0 + add #4,r0 + stc r2_bank,r1 + mov.l r1,@r0 + add #4,r0 + stc r3_bank,r1 + mov.l r1,@r0 + add #4,r0 + stc r4_bank,r1 + mov.l r1,@r0 + add #4,r0 + stc r5_bank,r1 + mov.l r1,@r0 + add #4,r0 + stc r6_bank,r1 + mov.l r1,@r0 + add #4,r0 + stc r7_bank,r1 + mov.l r1,@r0 + add #4,r0 +! r0-r7 bank 1 + mov.l @(8,r15),r1 + mov.l r1,@r0 + add #4,r0 + mov.l @(4,r15),r1 + mov.l r1,@r0 + add #4,r0 + mov.l r2,@r0 + add #4,r0 + mov.l r3,@r0 + add #4,r0 + mov.l r4,@r0 + add #4,r0 + mov.l r5,@r0 + add #4,r0 + mov.l r6,@r0 + add #4,r0 + mov.l r7,@r0 + add #4,r0 +! r8-r14 + mov.l r8,@r0 + add #4,r0 + mov.l r9,@r0 + add #4,r0 + mov.l r10,@r0 + add #4,r0 + mov.l r11,@r0 + add #4,r0 + mov.l r12,@r0 + add #4,r0 + mov.l r13,@r0 + add #4,r0 + mov.l r14,@r0 + add #4,r0 +! sgr (r15) + stc sgr,r1 + mov.l r1,@r0 + add #4,r0 +! fpscr + sts fpscr,r1 + mov.l r1,@r0 + add #4,r0 +! set fpscr.fr = 0, to get fr0-fr15 + mov.l fpscr_val_fr,r1 + lds r1,fpscr +! fr0-fr15 + fmov.s fr0,@r0 + add #4,r0 + fmov.s fr1,@r0 + add #4,r0 + fmov.s fr2,@r0 + add #4,r0 + fmov.s fr3,@r0 + add #4,r0 + fmov.s fr4,@r0 + add #4,r0 + fmov.s fr5,@r0 + add #4,r0 + fmov.s fr6,@r0 + add #4,r0 + fmov.s fr7,@r0 + add #4,r0 + fmov.s fr8,@r0 + add #4,r0 + fmov.s fr9,@r0 + add #4,r0 + fmov.s fr10,@r0 + add #4,r0 + fmov.s fr11,@r0 + add #4,r0 + fmov.s fr12,@r0 + add #4,r0 + fmov.s fr13,@r0 + add #4,r0 + fmov.s fr14,@r0 + add #4,r0 + fmov.s fr15,@r0 + add #4,r0 +! fpul + sts fpul,r1 + mov.l r1,@r0 + add #4,r0 +! set fpscr.fr = 1, to get xf0-xf15 + mov.l fpscr_val_xf,r1 + lds r1,fpscr +! xf0-xf15 + fmov.s fr0,@r0 + add #4,r0 + fmov.s fr1,@r0 + add #4,r0 + fmov.s fr2,@r0 + add #4,r0 + fmov.s fr3,@r0 + add #4,r0 + fmov.s fr4,@r0 + add #4,r0 + fmov.s fr5,@r0 + add #4,r0 + fmov.s fr6,@r0 + add #4,r0 + fmov.s fr7,@r0 + add #4,r0 + fmov.s fr8,@r0 + add #4,r0 + fmov.s fr9,@r0 + add #4,r0 + fmov.s fr10,@r0 + add #4,r0 + fmov.s fr11,@r0 + add #4,r0 + fmov.s fr12,@r0 + add #4,r0 + fmov.s fr13,@r0 + add #4,r0 + fmov.s fr14,@r0 + add #4,r0 + fmov.s fr15,@r0 + add #4,r0 +! init video + mov.l setup_video_k,r0 + mov.l @r0,r0 + mov #0,r4 + mov #0x1f,r5 + jsr @r0 + nop +! display 1st set of labels + mov.l labels1_k,r4 + mov #16,r5 + mov #0,r6 + mov #72,r7 + mov.l disp_addr,r0 + jsr @r0 + nop +! display 2nd set of labels + mov.l labels2_k,r4 + mov #16,r5 + mov #160,r6 + extu.b r6,r6 + mov #72,r7 + mov.l disp_addr,r0 + jsr @r0 + nop +! display 3rd set of labels + mov.l labels3_k,r4 + mov #17,r5 + mov #160,r6 + extu.b r6,r6 + shll r6 + mov #48,r7 + mov.l disp_addr,r0 + jsr @r0 + nop +! display 4th set of labels + mov.l labels4_k,r4 + mov #17,r5 + mov #160,r6 + extu.b r6,r6 + mov r6,r7 + shll r6 + add r7,r6 + mov #48,r7 + mov.l disp_addr,r0 + jsr @r0 + nop +! display 1st set of values + mov r15,r0 + add #16,r0 + mov r0,r4 + mov #16,r5 + mov #52,r6 + mov #72,r7 + mov.l val_addr,r0 + jsr @r0 + nop +! display 2nd set of values + mov r15,r0 + add #16,r0 + add #64,r0 + mov r0,r4 + mov #16,r5 + mov #52,r6 + mov #160,r7 + extu.b r7,r7 + add r7,r6 + mov #72,r7 + mov.l val_addr,r0 + jsr @r0 + nop +! display 3rd set of values + mov r15,r0 + add #16,r0 + mov #128,r1 + extu.b r1,r1 + add r1,r0 + mov r0,r4 + mov #17,r5 + mov #52,r6 + mov #160,r7 + extu.b r7,r7 + shll r7 + add r7,r6 + mov #48,r7 + mov.l val_addr,r0 + jsr @r0 + nop +! display 4th set of values + mov r15,r0 + add #16,r0 + mov #196,r1 + extu.b r1,r1 + add r1,r0 + mov r0,r4 + mov #17,r5 + mov #52,r6 + mov #160,r7 + extu.b r7,r7 + mov r7,r8 + shll r8 + add r8,r7 + add r7,r6 + mov #48,r7 + mov.l val_addr,r0 + jsr @r0 + nop +! return + lds.l @r15+,pr + rts + nop +.align 4 +fpscr_val_fr: + .long 0x00040001 +fpscr_val_xf: + .long 0x00240001 +disp_addr: + .long disp_labels +val_addr: + .long disp_values +entry_addr: + .long 0x8c004000 +draw_k: + .long 0x8c004014 +uint_to_string_k: + .long 0x8c004018 +expevt: + .long 0xff000024 +labels1_k: + .long labels1 +labels2_k: + .long labels2 +labels3_k: + .long labels3 +labels4_k: + .long labels4 +setup_video_k: + .long 0x8c00400c +.align 2 +expevt_string: + .asciz "EXPEVT" +.align 2 +misc_string: + .asciz "DEADBEEF" + +.balign 0x400 + +! VBR + 0x400 +general_2: + bra general_1 + nop +.align 2 +labels1: + .asciz "PC " + .asciz "PR " + .asciz "SR " + .asciz "GBR " + .asciz "VBR " + .asciz "DBR " + .asciz "MACH" + .asciz "MACL" + .asciz "R0B0" + .asciz "R1B0" + .asciz "R2B0" + .asciz "R3B0" + .asciz "R4B0" + .asciz "R5B0" + .asciz "R6B0" + .asciz "R7B0" +.align 2 +labels2: + .asciz "R0B1" + .asciz "R1B1" + .asciz "R2B1" + .asciz "R3B1" + .asciz "R4B1" + .asciz "R5B1" + .asciz "R6B1" + .asciz "R7B1" + .asciz "R8 " + .asciz "R9 " + .asciz "R10 " + .asciz "R11 " + .asciz "R12 " + .asciz "R13 " + .asciz "R14 " + .asciz "R15 " +.align 2 +labels3: + .asciz "FPSC" ! FPSCR + .asciz "FR0 " + .asciz "FR1 " + .asciz "FR2 " + .asciz "FR3 " + .asciz "FR4 " + .asciz "FR5 " + .asciz "FR6 " + .asciz "FR7 " + .asciz "FR8 " + .asciz "FR9 " + .asciz "FR10" + .asciz "FR11" + .asciz "FR12" + .asciz "FR13" + .asciz "FR14" + .asciz "FR15" +.align 2 +labels4: + .asciz "FPUL" + .asciz "XF0 " + .asciz "XF1 " + .asciz "XF2 " + .asciz "XF3 " + .asciz "XF4 " + .asciz "XF5 " + .asciz "XF6 " + .asciz "XF7 " + .asciz "XF8 " + .asciz "XF9 " + .asciz "XF10" + .asciz "XF11" + .asciz "XF12" + .asciz "XF13" + .asciz "XF14" + .asciz "XF15" + +.balign 0x200 + +! VBR + 0x600 +interrupt: + rte + nop diff --git a/MODEM/SRCS/dcload-serial/target-src/dcload/go.s b/MODEM/SRCS/dcload-serial/target-src/dcload/go.s new file mode 100644 index 00000000..8cd593aa --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-src/dcload/go.s @@ -0,0 +1,57 @@ + .section .text + .global _go + +_go: + mov.l stack_addr_k,r0 + mov.l @r0,r15 + mov.l entry_addr_k,r0 + mov.l @r0,r0 + lds r0,pr + mov.l sr_data_k,r0 + mov.l @r0,r0 + ldc r0,sr + mov.l vbr_data_k,r0 + mov.l @r0,r0 + ldc r0,vbr + mov.l fpscr_data_k,r0 + mov.l @r0,r0 + lds r0,fpscr + mov #0,r0 + mov r0,r1 + mov r0,r2 + mov r0,r3 + mov r0,r5 + mov r0,r6 + mov r0,r7 + mov r0,r8 + mov r0,r9 + mov r0,r10 + mov r0,r11 + mov r0,r12 + mov r0,r13 + mov r0,r14 + jmp @r4 + mov r0,r4 + + .align 4 +stack_addr_k: + .long stack_addr +stack_addr: + .long 0x8c00f400 +entry_addr_k: + .long entry_addr +entry_addr: + .long 0x8c004000 +sr_data_k: + .long sr_data +sr_data: + .long 0x600000f0 +vbr_data_k: + .long vbr_data +vbr_data: + .long 0x8c00f400 +fpscr_data_k: + .long fpscr_data +fpscr_data: + .long 0x40001 + \ No newline at end of file diff --git a/MODEM/SRCS/dcload-serial/target-src/dcload/memcmp.c b/MODEM/SRCS/dcload-serial/target-src/dcload/memcmp.c new file mode 100644 index 00000000..40b803d3 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-src/dcload/memcmp.c @@ -0,0 +1,105 @@ +/* +FUNCTION + <>---compare two memory areas + +INDEX + memcmp + +ANSI_SYNOPSIS + #include + int memcmp(const void *<[s1]>, const void *<[s2]>, size_t <[n]>); + +TRAD_SYNOPSIS + #include + int memcmp(<[s1]>, <[s2]>, <[n]>) + void *<[s1]>; + void *<[s2]>; + size_t <[n]>; + +DESCRIPTION + This function compares not more than <[n]> characters of the + object pointed to by <[s1]> with the object pointed to by <[s2]>. + + +RETURNS + The function returns an integer greater than, equal to or + less than zero according to whether the object pointed to by + <[s1]> is greater than, equal to or less than the object + pointed to by <[s2]>. + +PORTABILITY +<> is ANSI C. + +<> requires no supporting OS subroutines. + +QUICKREF + memcmp ansi pure +*/ + +#include + + +/* Nonzero if either X or Y is not aligned on a "long" boundary. */ +#define UNALIGNED(X, Y) \ + (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1))) + +/* How many bytes are copied each iteration of the word copy loop. */ +#define LBLOCKSIZE (sizeof (long)) + +/* Threshhold for punting to the byte copier. */ +#define TOO_SMALL(LEN) ((LEN) < LBLOCKSIZE) + +int +_DEFUN(memcmp, (m1, m2, n), + _CONST _PTR m1 _AND _CONST _PTR m2 _AND size_t n) +{ +#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) + unsigned char *s1 = (unsigned char *) m1; + unsigned char *s2 = (unsigned char *) m2; + + while (n--) { + if (*s1 != *s2) { + return *s1 - *s2; + } + s1++; + s2++; + } + return 0; +#else + unsigned char *s1 = (unsigned char *) m1; + unsigned char *s2 = (unsigned char *) m2; + unsigned long *a1; + unsigned long *a2; + + /* If the size is too small, or either pointer is unaligned, + then we punt to the byte compare loop. Hopefully this will + not turn up in inner loops. */ + if (!TOO_SMALL(n) && !UNALIGNED(s1, s2)) { + /* Otherwise, load and compare the blocks of memory one + word at a time. */ + a1 = (unsigned long *) s1; + a2 = (unsigned long *) s2; + while (n >= LBLOCKSIZE) { + if (*a1 != *a2) + break; + a1++; + a2++; + n -= LBLOCKSIZE; + } + + /* check m mod LBLOCKSIZE remaining characters */ + + s1 = (char *) a1; + s2 = (char *) a2; + } + + while (n--) { + if (*s1 != *s2) + return *s1 - *s2; + s1++; + s2++; + } + + return 0; +#endif /* not PREFER_SIZE_OVER_SPEED */ +} diff --git a/MODEM/SRCS/dcload-serial/target-src/dcload/memcpy.S b/MODEM/SRCS/dcload-serial/target-src/dcload/memcpy.S new file mode 100644 index 00000000..4df72e37 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-src/dcload/memcpy.S @@ -0,0 +1,221 @@ +! +! Fast SH memcpy +! +! by Toshiyasu Morita (tm@netcom.com) +! hacked by J"orn Rernnecke (amylaar@cygnus.co.uk) ("o for o-umlaut) +! +! Entry: r4: destination pointer +! r5: source pointer +! r6: byte count +! +! Exit: r0: destination pointer +! r1-r7: trashed +! +! Notes: Usually one wants to do small reads and write a longword, but +! unfortunately it is difficult in some cases to concatanate bytes +! into a longword on the SH, so this does a longword read and small +! writes. +! +! This implementation makes two assumptions about how it is called: +! +! 1.: If the byte count is nonzero, the address of the last byte to be +! copied is unsigned greater than the address of the first byte to +! be copied. This could be easily swapped for a signed comparison, +! but the algorithm used needs some comparison. +! +! 2.: When there are two or three bytes in the last word of an 11-or-bore +! bytes memory chunk to b copied, the rest of the word can be read +! without size effects. +! This could be easily changed by increasing the minumum size of +! a fast memcpy and the amount subtracted from r7 before L_2l_loop be 2, +! however, this would cost a few extra cyles on average. +! + +#include "asm.h" + +ENTRY(memcpy) +#ifdef __LITTLE_ENDIAN__ + ! Little endian version copies with increasing addresses. + mov r4,r3 ! Save return value + mov #11,r0 ! Check if small number of bytes + cmp/hs r0,r6 + ! r6 becomes src end address + SL(bf, L_small, add r5,r6) + mov #1,r1 + tst r1,r5 ! check if source even + SL(bt, L_even, mov r6,r7) + mov.b @r5+,r0 ! no, make it even. + mov.b r0,@r4 + add #1,r4 +L_even: tst r1,r4 ! check if destination is even + add #-3,r7 + SL(bf, L_odddst, mov #2,r1) + tst r1,r4 ! check if destination is 4-byte aligned + mov r4,r0 + SL(bt, L_al4dst, sub r5,r0) + mov.w @r5+,r2 + mov.w r2,@r4 + ! add #2,r4 r4 is dead here. +L_al4dst: + tst r1,r5 + bt L_al4both + mov.w @r5+,r1 + swap.w r1,r1 + add #-6,r0 + add #-6,r7 ! r7 := src end address minus 9. + .align 2 +L_2l_loop: + mov.l @r5+,r2 ! Read & write two longwords per iteration + xtrct r2,r1 + mov.l r1,@(r0,r5) + cmp/hs r7,r5 + mov.l @r5+,r1 + xtrct r1,r2 + mov.l r2,@(r0,r5) + bf L_2l_loop + add #-2,r5 + bra L_cleanup + add #5,r0 +L_al4both: + add #-4,r0 + .align 2 +L_al4both_loop: + mov.l @r5+,r4 ! Read longword, write longword per iteration + cmp/hs r7,r5 + SL(bf, L_al4both_loop, mov.l r4,@(r0,r5)) + + bra L_cleanup + add #3,r0 + +L_odddst: + tst r1,r5 + SL(bt, L_al4src, add #-1,r4) + mov.w @r5+,r0 + mov.b r0,@(1,r4) + shlr8 r0 + mov.b r0,@(2,r4) + add #2,r4 +L_al4src: + .align 2 +L_odd_loop: + mov.l @r5+,r0 ! Read longword, write byte, word, byte per iteration + cmp/hs r7,r5 + mov.b r0,@(1,r4) + shlr8 r0 + mov.w r0,@(2,r4) + shlr16 r0 + mov.b r0,@(4,r4) + SL(bf, L_odd_loop, add #4,r4) + .align 2 ! avoid nop in more frequently executed code. +L_cleanup2: + mov r4,r0 + sub r5,r0 +L_cleanup: + cmp/eq r6,r5 + bt L_ready + .align 2 +L_cleanup_loop: + mov.b @r5+,r1 + cmp/eq r6,r5 + mov.b r1,@(r0,r5) + bf L_cleanup_loop +L_ready: + rts + mov r3,r0 +L_small: + bra L_cleanup2 + add #-1,r4 +#else + ! Big endian version copies with decreasing addresses. + mov r4,r0 + add r6,r0 + sub r4,r5 + mov #11,r1 + cmp/hs r1,r6 + SL(bf, L_small, add #-1,r5) + mov r5,r3 + add r0,r3 + shlr r3 + SL(bt, L_even, + mov r4,r7) + mov.b @(r0,r5),r2 + add #-1,r3 + mov.b r2,@-r0 +L_even: + tst #1,r0 + add #-1,r5 + SL(bf, L_odddst, add #8,r7) + tst #2,r0 + bt L_al4dst + add #-1,r3 + mov.w @(r0,r5),r1 + mov.w r1,@-r0 +L_al4dst: + shlr r3 + bt L_al4both + mov.w @(r0,r5),r1 + swap.w r1,r1 + add #4,r7 + add #-4,r5 + .align 2 +L_2l_loop: + mov.l @(r0,r5),r2 + xtrct r2,r1 + mov.l r1,@-r0 + cmp/hs r7,r0 + mov.l @(r0,r5),r1 + xtrct r1,r2 + mov.l r2,@-r0 + bt L_2l_loop + bra L_cleanup + add #5,r5 + + nop ! avoid nop in executed code. +L_al4both: + add #-2,r5 + .align 2 +L_al4both_loop: + mov.l @(r0,r5),r1 + cmp/hs r7,r0 + SL(bt, L_al4both_loop, + mov.l r1,@-r0) + bra L_cleanup + add #3,r5 + + nop ! avoid nop in executed code. +L_odddst: + shlr r3 + bt L_al4src + mov.w @(r0,r5),r1 + mov.b r1,@-r0 + shlr8 r1 + mov.b r1,@-r0 +L_al4src: + add #-2,r5 + .align 2 +L_odd_loop: + mov.l @(r0,r5),r2 + cmp/hs r7,r0 + mov.b r2,@-r0 + shlr8 r2 + mov.w r2,@-r0 + shlr16 r2 + mov.b r2,@-r0 + bt L_odd_loop + + add #3,r5 +L_cleanup: +L_small: + cmp/eq r4,r0 + bt L_ready + add #1,r4 + .align 2 +L_cleanup_loop: + mov.b @(r0,r5),r2 + cmp/eq r4,r0 + mov.b r2,@-r0 + bf L_cleanup_loop +L_ready: + rts + nop +#endif diff --git a/MODEM/SRCS/dcload-serial/target-src/dcload/memmove.c b/MODEM/SRCS/dcload-serial/target-src/dcload/memmove.c new file mode 100644 index 00000000..bb4fbf2b --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-src/dcload/memmove.c @@ -0,0 +1,128 @@ +/* +FUNCTION + <>---move possibly overlapping memory + +INDEX + memmove + +ANSI_SYNOPSIS + #include + void *memmove(void *<[dst]>, const void *<[src]>, size_t <[length]>); + +TRAD_SYNOPSIS + #include + void *memmove(<[dst]>, <[src]>, <[length]>) + void *<[dst]>; + void *<[src]>; + size_t <[length]>; + +DESCRIPTION + This function moves <[length]> characters from the block of + memory starting at <<*<[src]>>> to the memory starting at + <<*<[dst]>>>. <> reproduces the characters correctly + at <<*<[dst]>>> even if the two areas overlap. + + +RETURNS + The function returns <[dst]> as passed. + +PORTABILITY +<> is ANSI C. + +<> requires no supporting OS subroutines. + +QUICKREF + memmove ansi pure +*/ + +#include +#include <_ansi.h> +#include +#include + +/* Nonzero if either X or Y is not aligned on a "long" boundary. */ +#define UNALIGNED(X, Y) \ + (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1))) + +/* How many bytes are copied each iteration of the 4X unrolled loop. */ +#define BIGBLOCKSIZE (sizeof (long) << 2) + +/* How many bytes are copied each iteration of the word copy loop. */ +#define LITTLEBLOCKSIZE (sizeof (long)) + +/* Threshhold for punting to the byte copier. */ +#define TOO_SMALL(LEN) ((LEN) < BIGBLOCKSIZE) + +/*SUPPRESS 20*/ +_PTR +_DEFUN(memmove, (dst_void, src_void, length), + _PTR dst_void _AND _CONST _PTR src_void _AND size_t length) +{ +#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) + char *dst = dst_void; + _CONST char *src = src_void; + + if (src < dst && dst < src + length) { + /* Have to copy backwards */ + src += length; + dst += length; + while (length--) { + *--dst = *--src; + } + } else { + while (length--) { + *dst++ = *src++; + } + } + + return dst_void; +#else + char *dst = dst_void; + _CONST char *src = src_void; + long *aligned_dst; + _CONST long *aligned_src; + int len = length; + + if (src < dst && dst < src + len) { + /* Destructive overlap...have to copy backwards */ + src += len; + dst += len; + while (len--) { + *--dst = *--src; + } + } else { + /* Use optimizing algorithm for a non-destructive copy to closely + match memcpy. If the size is small or either SRC or DST is unaligned, + then punt into the byte copy loop. This should be rare. */ + if (!TOO_SMALL(len) && !UNALIGNED(src, dst)) { + aligned_dst = (long *) dst; + aligned_src = (long *) src; + + /* Copy 4X long words at a time if possible. */ + while (len >= BIGBLOCKSIZE) { + *aligned_dst++ = *aligned_src++; + *aligned_dst++ = *aligned_src++; + *aligned_dst++ = *aligned_src++; + *aligned_dst++ = *aligned_src++; + len -= BIGBLOCKSIZE; + } + + /* Copy one long word at a time if possible. */ + while (len >= LITTLEBLOCKSIZE) { + *aligned_dst++ = *aligned_src++; + len -= LITTLEBLOCKSIZE; + } + + /* Pick up any residual with a byte copier. */ + dst = (char *) aligned_dst; + src = (char *) aligned_src; + } + + while (len--) { + *dst++ = *src++; + } + } + + return dst_void; +#endif /* not PREFER_SIZE_OVER_SPEED */ +} diff --git a/MODEM/SRCS/dcload-serial/target-src/dcload/memset.S b/MODEM/SRCS/dcload-serial/target-src/dcload/memset.S new file mode 100644 index 00000000..7352b414 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-src/dcload/memset.S @@ -0,0 +1,64 @@ +! +! Fast SH memset +! +! by Toshiyasu Morita (tm@netcom.com) +! +! Entry: r4: destination pointer +! r5: fill value +! r6: byte count +! +! Exit: r0-r3: trashed +! + +! This assumes that the first four bytes of the address space (0..3) are +! reserved - usually by the linker script. Otherwise, we would had to check +! for the case of objects of the size 12..15 at address 0..3 . + +#include "asm.h" + +ENTRY(memset) + mov #12,r0 ! Check for small number of bytes + cmp/gt r6,r0 + mov r4,r0 + SL(bt, L_store_byte_loop_check0, add r4,r6) + + tst #3,r0 ! Align destination + SL(bt, L_dup_bytes, extu.b r5,r5) + .balignw 4,0x0009 +L_align_loop: + mov.b r5,@r0 + add #1,r0 + tst #3,r0 + bf L_align_loop + +L_dup_bytes: + swap.b r5,r2 ! Duplicate bytes across longword + or r2,r5 + swap.w r5,r2 + or r2,r5 + + add #-16,r6 + + .balignw 4,0x0009 +L_store_long_loop: + mov.l r5,@r0 ! Store double longs to memory + cmp/hs r6,r0 + mov.l r5,@(4,r0) + SL(bf, L_store_long_loop, add #8,r0) + + add #16,r6 + +L_store_byte_loop_check0: + cmp/eq r6,r0 + bt L_exit + .balignw 4,0x0009 +L_store_byte_loop: + mov.b r5,@r0 ! Store bytes to memory + add #1,r0 + cmp/eq r6,r0 + bf L_store_byte_loop + +L_exit: + rts + mov r4,r0 + diff --git a/MODEM/SRCS/dcload-serial/target-src/dcload/scif.c b/MODEM/SRCS/dcload-serial/target-src/dcload/scif.c new file mode 100644 index 00000000..7e7f3b51 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-src/dcload/scif.c @@ -0,0 +1,99 @@ +/* + * This file is part of the dcload Dreamcast serial loader + * + * Copyright (C) 2001 Andrew Kieschnick + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include "scif.h" + +#define BORDER_FLASH +#define VIDBORDER (volatile unsigned int *)0xa05f8040 + +void scif_flush() +{ + int v; + + *SCFSR2 &= 0xbf; + while (!((v = *SCFSR2) & 0x40)); + *SCFSR2 = v & 0xbf; +} + +void scif_init(int bps) +{ + int i; + + *SCSCR2 = 0x0; /* clear TE and RE bits in SCSCR2 */ + *SCFCR2 = 0x6; /* set TFRST and RFRST bits in SCFCR2 */ + *SCSMR2 = 0x0; /* set data transfer format 8n1 */ + *SCBRR2 = (50 * 1000000) / (32 * bps) - 1; /* set bit rate */ + + for (i = 0; i < 100000; i++); /* delay at least 1 bit interval */ + + *SCFCR2 = 12; + *SCFCR2 = 0x8; /* set MCE in SCFCR2 */ + *SCSPTR2 = 0; + *SCFSR2 = 0x60; + *SCLSR2 = 0; + *SCSCR2 = 0x30; /* set TE and RE bits in SCSCR2 */ + + for (i = 0; i < 100000; i++); +} + +unsigned char scif_getchar(void) +{ + unsigned char foo; + +#ifdef BORDER_FLASH + *VIDBORDER = ~(*VIDBORDER & 0x00ffffff); +#endif + + while (!(*SCFSR2 & 0x2)); /* check RDF */ + foo = *SCFRDR2; /* read data */ + *SCFSR2 &= 0xfffd; /* clear RDF */ + return foo; + +} + +unsigned int scif_isdata(void) +{ + return (*SCFSR2 & 0x2); +} + +void scif_putchar(unsigned char foo) +{ + +#ifdef BORDER_FLASH + *VIDBORDER = ~(*VIDBORDER & 0x00ffffff); +#endif + + while (!(*SCFSR2 & 0x20)); /* check TDFE */ + *SCFTDR2 = foo; /* send data */ + *SCFSR2 &= 0xff9f; /* clear TDFE and TEND */ +} + +void scif_puts(unsigned char *foo) +{ + int i = 0; + + while (foo[i] != 0) { + scif_putchar(foo[i]); + if (foo[i] == '\n') + scif_putchar('\r'); + i++; + } +} diff --git a/MODEM/SRCS/dcload-serial/target-src/dcload/scif.h b/MODEM/SRCS/dcload-serial/target-src/dcload/scif.h new file mode 100644 index 00000000..6a3be944 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-src/dcload/scif.h @@ -0,0 +1,62 @@ +/* + * This file is part of the dcload Dreamcast serial loader + * + * Copyright (C) 2001 Andrew Kieschnick + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __SCIF_H__ +#define __SCIF_H__ + +/* serial mode register */ +#define SCSMR2 (volatile unsigned short *) 0xffe80000 + +/* bit rate register */ +#define SCBRR2 (volatile unsigned char *) 0xffe80004 + +/* serial control register */ +#define SCSCR2 (volatile unsigned short *) 0xffe80008 + +/* transmit fifo data register */ +#define SCFTDR2 (volatile unsigned char *) 0xffe8000c + +/* serial status register */ +#define SCFSR2 (volatile unsigned short *) 0xffe80010 + +/* receive fifo data register */ +#define SCFRDR2 (volatile unsigned char *) 0xffe80014 + +/* fifo control register */ +#define SCFCR2 (volatile unsigned short *) 0xffe80018 + +/* fifo data count register */ +#define SCFDR2 (volatile unsigned short *) 0xffe8001c + +/* serial port register */ +#define SCSPTR2 (volatile unsigned short *) 0xffe80020 + +/* line status register */ +#define SCLSR2 (volatile unsigned short *) 0xffe80024 + +void scif_flush(void); +void scif_init(int bps); +unsigned char scif_getchar(void); +unsigned int scif_isdata(void); +void scif_putchar(unsigned char foo); +void scif_puts(unsigned char *foo); + +#endif diff --git a/MODEM/SRCS/dcload-serial/target-src/dcload/syscalls.c b/MODEM/SRCS/dcload-serial/target-src/dcload/syscalls.c new file mode 100644 index 00000000..feea1985 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-src/dcload/syscalls.c @@ -0,0 +1,291 @@ +/* + * This file is part of the dcload Dreamcast serial loader + * + * Copyright (C) 2001 Andrew Kieschnick + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include "scif.h" + +extern void load_data_block_general(unsigned char *addr, + unsigned int size, unsigned int verbose); +extern unsigned int send_data_block_compressed(unsigned char * addr, + unsigned int size); +extern unsigned int get_uint(void); + +extern int put_uint(unsigned int val); + +int strlen(const char *s) +{ + int c = 0; + + while (s[c] != 0) + c++; + return c; +} + +void dcexit(void) +{ + scif_putchar(0); + scif_flush(); +} + +int read(int fd, void *buf, size_t count) +{ + scif_putchar(3); + put_uint(fd); + put_uint(count); + load_data_block_general(buf, count, 0); + return (get_uint()); +} + +int write(int fd, const void *buf, size_t count) +{ + scif_putchar(2); + put_uint(fd); + put_uint(count); + send_data_block_compressed(buf, count); + return (get_uint()); +} + +int open(const char *pathname, int flags, ...) +{ + va_list ap; + int namelen = strlen(pathname) + 1; + + va_start(ap, flags); + scif_putchar(4); + put_uint(namelen); + send_data_block_compressed(pathname, namelen); + put_uint(flags); + put_uint(va_arg(ap, int)); + va_end(ap); + return (get_uint()); +} + +int close(int fd) +{ + scif_putchar(5); + + put_uint(fd); + return (get_uint()); +} + +int creat(const char *pathname, mode_t mode) +{ + int namelen = strlen(pathname) + 1; + + scif_putchar(6); + put_uint(namelen); + send_data_block_compressed(pathname, namelen); + put_uint(mode); + return (get_uint()); +} + +int link(const char *oldpath, const char *newpath) +{ + int namelen1 = strlen(oldpath) + 1; + int namelen2 = strlen(newpath) + 1; + + scif_putchar(7); + put_uint(namelen1); + send_data_block_compressed(oldpath, namelen1); + put_uint(namelen2); + send_data_block_compressed(newpath, namelen2); + return (get_uint()); +} + +int unlink(const char *pathname) +{ + int namelen = strlen(pathname) + 1; + + scif_putchar(8); + put_uint(namelen); + send_data_block_compressed(pathname, namelen); + return (get_uint()); +} + +int chdir(const char *path) +{ + int namelen = strlen(path) + 1; + + scif_putchar(9); + put_uint(namelen); + send_data_block_compressed(path, namelen); + return (get_uint()); +} + +int chmod(const char *path, mode_t mode) +{ + int namelen = strlen(path) + 1; + + scif_putchar(10); + put_uint(namelen); + send_data_block_compressed(path, namelen); + put_uint(mode); + return (get_uint()); +} + +off_t lseek(int fildes, off_t offset, int whence) +{ + scif_putchar(11); + put_uint(fildes); + put_uint(offset); + put_uint(whence); + return (get_uint()); +} + +int fstat(int filedes, struct stat *buf) +{ + scif_putchar(1); + put_uint(filedes); + + buf->st_dev = get_uint(); + buf->st_ino = get_uint(); + buf->st_mode = get_uint(); + buf->st_nlink = get_uint(); + buf->st_uid = get_uint(); + buf->st_gid = get_uint(); + buf->st_rdev = get_uint(); + buf->st_size = get_uint(); + buf->st_blksize = get_uint(); + buf->st_blocks = get_uint(); + buf->st_atime = get_uint(); + buf->st_mtime = get_uint(); + buf->st_ctime = get_uint(); + + return (get_uint()); +} + +time_t time(time_t * t) +{ + scif_putchar(12); + + if (t) { + *t = get_uint(); + return *t; + } + return (get_uint()); +} + +int stat(const char *file_name, struct stat *buf) +{ + int namelen = strlen(file_name) + 1; + + scif_putchar(13); + put_uint(namelen); + send_data_block_compressed(file_name, namelen); + + buf->st_dev = get_uint(); + buf->st_ino = get_uint(); + buf->st_mode = get_uint(); + buf->st_nlink = get_uint(); + buf->st_uid = get_uint(); + buf->st_gid = get_uint(); + buf->st_rdev = get_uint(); + buf->st_size = get_uint(); + buf->st_blksize = get_uint(); + buf->st_blocks = get_uint(); + buf->st_atime = get_uint(); + buf->st_mtime = get_uint(); + buf->st_ctime = get_uint(); + + return (get_uint()); +} + +int utime(const char *filename, struct utimbuf *buf) +{ + int namelen = strlen(filename) + 1; + + scif_putchar(14); + put_uint(namelen); + send_data_block_compressed(filename, namelen); + if (buf) { + put_uint(1); + put_uint(buf->actime); + put_uint(buf->modtime); + return (get_uint()); + } + put_uint(0); + return (get_uint()); +} + +DIR * opendir(const char *name) +{ + int namelen = strlen(name) + 1; + + scif_putchar(16); + put_uint(namelen); + send_data_block_compressed(name, namelen); + return(get_uint()); +} + +int closedir(DIR *dir) +{ + scif_putchar(17); + put_uint(dir); + return(get_uint()); +} + +struct dirent *readdir(DIR *dir) +{ + static struct dirent ourdirent; + int namelen; + + scif_putchar(18); + + put_uint(dir); + + if (get_uint()) { + ourdirent.d_ino = get_uint(); + ourdirent.d_off = get_uint(); + ourdirent.d_reclen = get_uint(); + ourdirent.d_type = get_uint(); + namelen = get_uint(); + load_data_block_general(ourdirent.d_name, namelen, 0); + + return &ourdirent; + } else + return 0; +} + +size_t gdbpacket(const char *in_buf, unsigned int size_pack, char* out_buf) +{ + size_t in_size = size_pack >> 16, out_size = size_pack & 0xffff, ret_size; + + scif_putchar(20); + + put_uint(in_size); + put_uint(out_size); + + if (in_size) + send_data_block_compressed(in_buf, in_size); + + ret_size = get_uint(); + + if (ret_size && ret_size <= out_size) + load_data_block_general(out_buf, ret_size, 0); + + return ret_size; +} diff --git a/MODEM/SRCS/dcload-serial/target-src/dcload/video.h b/MODEM/SRCS/dcload-serial/target-src/dcload/video.h new file mode 100644 index 00000000..fcddd0c0 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-src/dcload/video.h @@ -0,0 +1,10 @@ +#ifndef __VIDEO_H__ +#define __VIDEO_H__ + +void draw_string(int x, int y, char *string, int colour); +void clrscr(int colour); +void init_video(int cabletype, int pixelmode); +int check_cable(void); +unsigned char *get_font_address(void); + +#endif diff --git a/MODEM/SRCS/dcload-serial/target-src/dcload/video.s b/MODEM/SRCS/dcload-serial/target-src/dcload/video.s new file mode 100644 index 00000000..87158446 --- /dev/null +++ b/MODEM/SRCS/dcload-serial/target-src/dcload/video.s @@ -0,0 +1,348 @@ + + ! Video routines from Vide example + ! + + .globl _draw_string, _clrscr, _init_video, _check_cable + .globl _get_font_address + + .text + + + ! Draw a text string on screen + ! + ! Assumes a 640*480 screen with RGB555 or RGB565 pixels + + ! r4 = x + ! r5 = y + ! r6 = string + ! r7 = colour +_draw_string: + mov.l r14,@-r15 + sts pr,r14 + mov.l r13,@-r15 + mov.l r12,@-r15 + mov.l r11,@-r15 + mov.l r10,@-r15 + mov r4,r10 + mov r5,r11 + mov r6,r12 + mov r7,r13 +ds_loop: + mov.b @r12+,r6 + mov r10,r4 + mov r11,r5 + tst r6,r6 ! string is NUL terminated + bt ds_done + extu.b r6,r6 ! undo sign-extension of char + bsr draw_char12 + mov r13,r7 + bra ds_loop + add #12,r10 +ds_done: + mov.l @r15+,r10 + mov.l @r15+,r11 + mov.l @r15+,r12 + mov.l @r15+,r13 + lds r14,pr + rts + mov.l @r15+,r14 + + + ! Draw a "narrow" character on screen + ! + ! Assumes a 640*480 screen with RGB555 or RGB565 pixels + + ! r4 = x + ! r5 = y + ! r6 = char + ! r7 = colour +draw_char12: + ! First get the address of the ROM font + sts pr,r3 + bsr _get_font_address + nop + lds r3,pr + mov r0,r2 + + ! Then, compute the destination address + shll r4 + mov r5,r0 + shll2 r0 + add r5,r0 + shll8 r0 + add r4,r0 + mov.l vrambase,r1 + add r1,r0 + + ! Find right char in font + mov #32,r1 + cmp/gt r1,r6 + bt okchar1 + ! <= 32 = space or unprintable +blank: + mov #72,r6 ! Char # 72 in font is blank + bra decided + shll2 r6 +okchar1: + mov #127,r1 + cmp/ge r1,r6 + bf/s decided ! 33-126 = ASCII, Char # 1-94 in font + add #-32,r6 + cmp/gt r1,r6 + bf blank ! 127-159 = unprintable + add #-96,r6 + cmp/gt r1,r6 + bt blank ! 256- = ? + ! 160-255 = Latin 1, char # 96-191 in font + add #64,r6 + + ! Add offset of selected char to font addr +decided: + mov r6,r1 + shll2 r1 + shll r1 + add r6,r1 + shll2 r1 + add r2,r1 + + ! Copy ROM data into cache so we can access it as bytes + ! Char data is 36 bytes, so we need to fetch two cache lines + pref @r1 + mov r1,r2 + add #32,r2 + pref @r2 + + mov #24,r2 ! char is 24 lines high +drawy: + ! Each pixel line is stored as 1½ bytes, so we'll load + ! 3 bytes into r4 and draw two lines in one go + mov.b @r1+,r4 + shll8 r4 + mov.b @r1+,r5 + extu.b r5,r5 + or r5,r4 + shll8 r4 + mov.b @r1+,r5 + extu.b r5,r5 + or r5,r4 + shll8 r4 + ! Even line + mov #12,r3 +drawx1: + rotl r4 + bf/s nopixel1 + dt r3 + mov.w r7,@r0 ! Set pixel +nopixel1: + bf/s drawx1 + add #2,r0 + mov.w drawmod,r3 + dt r2 + add r3,r0 + ! Odd line + mov #12,r3 +drawx2: + rotl r4 + bf/s nopixel2 + dt r3 + mov.w r7,@r0 ! Set pixel +nopixel2: + bf/s drawx2 + add #2,r0 + mov.w drawmod,r3 + dt r2 + bf/s drawy + add r3,r0 + + rts + nop + +drawmod: + .word 2*(640-12) + + + ! Clear screen + ! + ! Assumes a 640*480 screen with RGB555 or RGB565 pixels + + ! r4 = pixel colour +_clrscr: + mov.l vrambase,r0 + mov.l clrcount,r1 +clrloop: + mov.w r4,@r0 ! clear one pixel + dt r1 + bf/s clrloop + add #2,r0 + rts + nop + + .align 4 +vrambase: + .long 0xa5000000 +clrcount: + .long 640*480 + + + + ! Set up video registers to the desired + ! video mode (only 640*480 supported right now) + ! + ! Note: This function does not currently initialize + ! all registers, but assume that the boot ROM + ! has set up reasonable defaults for syncs etc. + ! + ! TODO: PAL + + ! r4 = cabletype (0=VGA, 2=RGB, 3=Composite) + ! r5 = pixel mode (0=RGB555, 1=RGB565, 3=RGB888) +_init_video: + ! Look up bytes per pixel as shift value + mov #3,r1 + and r5,r1 + mova bppshifttab,r0 + mov.b @(r0,r1),r5 + ! Get video HW address + mov.l videobase,r0 + mov #0,r2 + mov.l r2,@(8,r0) + add #0x40,r0 + ! Set border colour + mov #0,r2 + mov.l r2,@r0 + ! Set pixel clock and colour mode + shll2 r1 + mov #240/2,r3 ! Non-VGA screen has 240 display lines + shll r3 + mov #2,r2 + tst r2,r4 + bf/s khz15 + add #1,r1 + shll r3 ! Double # of display lines for VGA + ! Set double pixel clock + mov #1,r2 + rotr r2 + shlr8 r2 + or r2,r1 +khz15: + mov.l r1,@(4,r0) + ! Set video base address + mov #0,r1 + mov.l r1,@(0x10,r0) + ! Video base address for short fields should be offset by one line + mov #640/16,r1 + shll2 r1 + shll2 r1 + shld r5,r1 + mov.l r1,@(0x14,r0) + ! Set screen size and modulo, and interlace flag + mov.l r4,@-r15 + mov #1,r2 + shll8 r2 + mov #640/16,r1 + shll2 r1 + shld r5,r1 + mov #2,r5 + tst r5,r4 + bt/s nonlace ! VGA => no interlace + mov #1,r4 + add r1,r4 ! add one line to offset => display every other line + add #0x50,r2 ! enable LACE +nonlace: + shll8 r4 + shll2 r4 + add r3,r4 + add #-1,r4 + shll8 r4 + shll2 r4 + add r1,r4 + add #-1,r4 + mov.l r4,@(0x1c,r0) + mov.l @r15+,r4 + add #0x7c,r0 + mov.l r2,@(0x14,r0) + ! Set vertical pos and border + mov #0x12,r1 + mov r1,r2 + shll16 r1 + or r2,r1 + mov.l r1,@(0x34,r0) + add r3,r1 + mov.l r1,@(0x20,r0) + ! Horizontal pos + mov.w hpos,r1 + mov.l r1,@(0x30,r0) + + ! Select RGB/CVBS + mov.l cvbsbase,r1 + rotr r4 + bf/s rgbmode + mov #0,r0 + mov #3,r0 +rgbmode: + shll8 r0 + mov.l r0,@r1 + + rts + nop + + .align 4 +videobase: + .long 0xa05f8000 +cvbsbase: + .long 0xa0702c00 +bppshifttab: + .byte 1,1,0,2 +hpos: + .word 0xa4 + + + + ! Check type of A/V cable connected + ! + ! 0 = VGA + ! 1 = --- + ! 2 = RGB + ! 3 = Composite + +_check_cable: + ! set PORT8 and PORT9 to input + mov.l porta,r0 + mov.l pctra_clr,r2 + mov.l @r0,r1 + mov.l pctra_set,r3 + and r2,r1 + or r3,r1 + mov.l r1,@r0 + ! read PORT8 and PORT9 + mov.w @(4,r0),r0 + shlr8 r0 + rts + and #3,r0 + + .align 4 +porta: + .long 0xff80002c +pctra_clr: + .long 0xfff0ffff +pctra_set: + .long 0x000a0000 + + + ! Return base address of ROM font + ! + +_get_font_address: + mov.l syscall_b4,r0 + mov.l @r0,r0 + jmp @r0 + mov #0,r1 + + .align 4 +syscall_b4: + .long 0x8c0000b4 + + + .end + + diff --git a/POWERVR/DOCS/PowerVR/MRT_Movie.avi b/POWERVR/DOCS/PowerVR/MRT_Movie.avi new file mode 100644 index 00000000..95b77888 Binary files /dev/null and b/POWERVR/DOCS/PowerVR/MRT_Movie.avi differ diff --git a/POWERVR/DOCS/PowerVR/Parallax_Movie.avi b/POWERVR/DOCS/PowerVR/Parallax_Movie.avi new file mode 100644 index 00000000..99d27a7b Binary files /dev/null and b/POWERVR/DOCS/PowerVR/Parallax_Movie.avi differ diff --git a/POWERVR/DOCS/PowerVR/Water_Movie.avi b/POWERVR/DOCS/PowerVR/Water_Movie.avi new file mode 100644 index 00000000..3f03333a Binary files /dev/null and b/POWERVR/DOCS/PowerVR/Water_Movie.avi differ diff --git a/POWERVR/EXES/CinePack/CinePack.exe b/POWERVR/EXES/CinePack/CinePack.exe new file mode 100644 index 00000000..7141f60d Binary files /dev/null and b/POWERVR/EXES/CinePack/CinePack.exe differ diff --git a/POWERVR/EXES/CinePack/readme.txt b/POWERVR/EXES/CinePack/readme.txt new file mode 100644 index 00000000..fe89d4d5 --- /dev/null +++ b/POWERVR/EXES/CinePack/readme.txt @@ -0,0 +1,163 @@ +Cinepack.exe ƒÀ26”Å for Windows95 +Saturn CinePack -> Video for Windows Cinepack +ƒ¿ + +[‹@”\] +ƒZƒKƒTƒ^[ƒ“‚ÌCPK,CAK‚̃VƒlƒpƒbƒNƒ€[ƒr[‚ðWindows‚ÌAVI‚É•ÏŠ·‚·‚éB +CRI ADX‚ð’¼ÚĶB‚Ü‚½‚ÍAWindows‚ÌWaveƒtƒ@ƒCƒ‹‚É•ÏŠ·‚·‚éB + +[Žg‚¢•û] +iWindows‚ÌAVI‚É•ÏŠ·j +ƒ€[ƒr[‚ðƒRƒ“ƒo[ƒg‚·‚é‚Æ‚«‚ÍuƒRƒ“ƒo[ƒgvƒ{ƒ^ƒ“i‚Ü‚½‚̓tƒ@ƒCƒ‹ƒƒjƒ…[ +‚©‚ç‘I‘ðj‚ðŽg‚Á‚Ä‚­‚¾‚³‚¢B +‰¹Šy—p‚̃pƒlƒ‹‚ªo‚Ä‚¢‚é‚Æ‚«‚É‚Íu•Â‚¶‚évƒ{ƒ^ƒ“‚Ńpƒlƒ‹‚ð•Â‚¶‚Ä‚©‚çA +uƒRƒ“ƒo[ƒgvƒ{ƒ^ƒ“‚ðŽg‚Á‚Ä‚­‚¾‚³‚¢BiŒãq‚Ì‚à‚Ì‚Æ‹@”\‚ª‚Ԃ‚©‚邽‚ßj +‚»‚ÌŒãA‚µ‚΂炭‚µ‚Ä•Û‘¶æ‚ð•·‚¢‚Ä‚«‚Ü‚·‚Ì‚ÅA•Û‘¶æ‚ƃtƒ@ƒCƒ‹–¼‚ðŽw’肵‚Ä +‚­‚¾‚³‚¢B‚±‚Ì‚Æ‚«•Û‘¶æ‚É‹ó‚«—e—Ê‚ª‚ ‚é‚©‚Ç‚¤‚©‚Í‚©‚ñ‚ª‚¦‚Ä‚¨‚è‚Ü‚¹‚ñ‚Ì‚ÅA +\•ª‚È‹ó‚«—e—Ê‚ª‚ ‚éꊂɕۑ¶‚µ‚Ä‚­‚¾‚³‚¢B +Šg’£Žq‚ªCAK‚Ì‚à‚Ì‚ÍAˆê“xƒeƒ“ƒ|ƒ‰ƒŠƒtƒ@ƒCƒ‹‚ð쬂µ‚Ü‚·‚Ì‚ÅA‚»‚Ì—e—Ê‚à +ŒvŽZ‚É‚¢‚ê‚Ä‚­‚¾‚³‚¢Bƒeƒ“ƒ|ƒ‰ƒŠ‚Ì•Û‘¶æ‚̓IƒvƒVƒ‡ƒ“‚Å•Ï‚¦‚邱‚Æ‚ª‚Å‚«‚Ü‚·B +‰f‘œ‚Ɖ¹º‚ðƒCƒ“ƒ^[ƒŠ[ƒu‚µ‚Ä‚¢‚éŠÖŒWãACPK‚Å‚àŒ³‚̃tƒ@ƒCƒ‹‚æ‚èŽáŠ± +‘å‚«‚­‚È‚è‚Ü‚·B + +iCRI ADX‚ð’¼ÚĶ Windows‚ÌWaveƒtƒ@ƒCƒ‹‚É•ÏŠ·j +‰¹º‚ðĶ‚·‚é‚Æ‚«‚ÍuŠJ‚­vƒ{ƒ^ƒ“i‚Ü‚½‚̓tƒ@ƒCƒ‹ƒƒjƒ…[‚©‚ç‘I‘ðj‚ðŽg‚Á‚Ä +‚­‚¾‚³‚¢Bƒ_ƒCƒAƒƒO‚ª‚Å‚Ü‚·‚Ì‚ÅAĶ‚µ‚½‚¢ƒtƒ@ƒCƒ‹‚ðŽw’肵‚Ä‚­‚¾‚³‚¢B +Œ»Ý‰¹º‚ªÄ¶‚Å‚«‚é‚Ì‚ÍAADXAACXACAKASTZ‚ÌŽd—l‚Ì‚à‚Ì‚¾‚¯‚Å‚·B +‰¹Šy—p‚̃pƒlƒ‹‚ª•\Ž¦‚³‚ê‚Ü‚·‚Ì‚ÅA‚ ‚Æ‚ÍĶƒ{ƒ^ƒ“‚ÅĶ‚·‚ê‚ÎA‰¹‚ª–‚è‚Ü‚·B +ACXASTZ‚ÉŠÖ‚µ‚Ä‚Í‚P‚‚̃tƒ@ƒCƒ‹‚É•¡”‚̉¹‚ªŠÜ‚Ü‚ê‚Ä‚¢‚Ü‚·‚Ì‚ÅA‰E‚É‚Å‚Ä‚­‚é +ƒCƒ“ƒfƒbƒNƒX‚Ì”Žš‚ðŽw’肵‚Ä‚©‚çĶ‚µ‚Ä‚­‚¾‚³‚¢B +ƒL[ƒ{[ƒh‚Å‚Í㉺¶‰E‚ªƒCƒ“ƒfƒbƒNƒX‚Ì‘Œ¸AEnter‚ªÄ¶A’âŽ~‚̃gƒOƒ‹‚É‚È‚Á‚Ä +‚¢‚Ü‚·B‚±‚Ì‚Æ‚«AuƒRƒ“ƒo[ƒgvƒ{ƒ^ƒ“‚ÅAŒ»ÝŠJ‚¢‚Ă鉹ºƒtƒ@ƒCƒ‹‚ðWAVE‚É +•ÏŠ·‚Å‚«‚Ü‚·B +•Û‘¶æ‚ð•·‚¢‚Ä‚«‚Ü‚·‚Ì‚ÅAƒ€[ƒr[‚̃Rƒ“ƒo[ƒg“¯—lA•Û‘¶æ‚ƃtƒ@ƒCƒ‹–¼‚ðŽw’肵‚Ä +•Û‘¶‚µ‚Ä‚­‚¾‚³‚¢BiACX‚Ìꇂɂ̓Cƒ“ƒfƒbƒNƒX‚ªƒfƒtƒHƒ‹ƒgƒtƒ@ƒCƒ‹–¼‚ɒljÁ‚³‚ê +‚Ü‚·Bj +STZ‚ÍAŽ©“®‰ðÍ‚µ‚Ü‚·‚Ì‚ÅAŠJ‚­‚Ü‚ÅŽžŠÔ‚ª‚©‚©‚è‚Ü‚·B + +iƒIƒvƒVƒ‡ƒ“‚ɂ‚¢‚Äj +uƒIƒvƒVƒ‡ƒ“vƒ{ƒ^ƒ“‚ÍAŽå‚ÉADX‚ɂ‚¢‚ẴIƒvƒVƒ‡ƒ“‚Å‚·B +‘æˆê‘æ“ñƒtƒBƒ‹ƒ^‚Ì’²®‚Ɖ¹º‘•‚Ì”{—¦Aƒeƒ“ƒ|ƒ‰ƒŠ‚Ì•Û‘¶æA +CAK•ÏŠ·Žž‚ɉ¹º‚Ì‚Ý‚ð•ÏŠ·‚·‚é‚©‚Ç‚¤‚©‚ªŽw’è‚Å‚«‚Ü‚·B +Œ»ÝAƒtƒBƒ‹ƒ^‚Ì’l‚ÍŽ„‚ÌŸŽè‚È”»’f‚Å‚·‚Ì‚ÅA‚¢‚ë‚¢‚뎎‚µ‚Ä‚Ý‚Ä‚­‚¾‚³‚¢B +iŽv‚¢’Ê‚è‚̉¹‚É‚È‚é‚Æ‚¢‚¤‚Ù‚Ç‚Ì•ÏX‚Í‚Å‚«‚Ü‚¹‚ñ‚ª(^^;j +‘æˆê‚Í‚‰¹ˆæ‚Ì—}‚¦A‘æ“ñ‘æŽO‚͈ꉞƒtƒBƒ‹ƒ^‚Qƒ^ƒbƒv‚ÌŒW”•ÏX‚Å‚·B +ƒfƒtƒHƒ‹ƒg‚ÍA‘æˆê‘æ“ñ‘æŽOƒtƒBƒ‹ƒ^‚ª1A‰¹—Ê’†‚Å‚·B +‚‰¹‚ª‹­‚¢‚ÆŽv‚í‚ꂽ‚ç‘æˆê‚ð‘‚₵‚Ä‚­‚¾‚³‚¢B + + ADXĶ’†‚ɃI[ƒo[ƒtƒ[‚̃`ƒFƒbƒN‚ð‚Å‚«‚é‚悤‚É•ÏX‚µ‚Ü‚µ‚½B + ƒfƒtƒHƒ‹ƒg‚ÅA‚Ü‚¸ƒI[ƒo[ƒtƒ[‚µ‚È‚¢‚ÆŽv‚¢‚Ü‚·‚ªA‰Â”\«‚Æ‚µ‚Ä + ƒI[ƒo[ƒtƒ[‚·‚é‚à‚Ì‚à‚ ‚é‚©‚à‚µ‚ê‚Ü‚¹‚ñ‚Ì‚ÅAˆê‰žB + + CD-ROM—p‚̃tƒŒ[ƒ€•âŠ®‚ɂ‚¢‚Ä‚ÍACD-ROM‚̃V[ƒN‚É‚ ‚킹‚ătƒŒ[ƒ€‚ð + •âŠ®‚·‚é‚à‚Ì‚ÅAƒtƒ@ƒCƒ‹‚ª‚»‚Ì•ª‚Å‚©‚­‚È‚è‚Ü‚·‚Ì‚ÅA’ˆÓ‚µ‚Ä‚­‚¾‚³‚¢B + + ƒÀ‚P‚W‚©‚çƒCƒjƒVƒƒƒ‰ƒCƒYƒtƒ@ƒCƒ‹‚ð—˜—p‚µ‚Ä‚Ü‚·‚Ì‚ÅA‘O‰ñ‚̃IƒvƒVƒ‡ƒ“‚ª‚»‚Ì‚Ü‚Ü + Žc‚è‚Ü‚·B•K—v‚ª‚ ‚ê‚ÎA•ÏX‚ð‚µ‚Ä‚­‚¾‚³‚¢B + + ƒwƒbƒ_[‚ÌŽ©“®‰ðÍ‚ÍAŠg’£ŽqADX‚̃tƒ@ƒCƒ‹‚É•¡”‚ÌADX‚ªŠÜ‚Ü‚ê‚Ä‚é‚©‚Ç‚¤‚©‚ð + Ž©“®“I‚É’²‚ׂé‚à‚Ì‚Å‚·Bƒwƒbƒ_[‚Ì”Žš‚ªAƒQ[ƒ€‚É‚æ‚Á‚ĈӖ¡‚ªˆá‚¤‚Ì‚ÅA + ƒTƒNƒ‰‘åí‚Q‚É‚µ‚©‘Ήž‚µ‚Ä‚Ü‚¹‚ñB‚Æ‚¢‚¤‚æ‚è¡‚Ì‚Æ‚±‚ëƒTƒNƒ‰‘åí‚QA + ƒOƒ‰ƒ“ƒfƒBƒA‚Å‚µ‚©A‚±‚ÌŒ`Ž®‚Í‚ ‚è‚Ü‚¹‚ñ‚Ì‚ÅBBB + + ‰¹º‚Ì‚Ý‚Ì•ÏŠ·‚ɂ‚¢‚Ä‚ÍA–¼‘O‚ÍŽw’è‚Å‚«‚¸Aƒeƒ“ƒ|ƒ‰ƒŠ•Û‘¶æ‚ÉŒ³‚Ì + ƒtƒ@ƒCƒ‹ƒl[ƒ€‚ÌŠg’£Žq‚ð•Ï‚¦‚½WAV‚ª‚‚­‚ç‚ê‚Ü‚·B + + ŠO•”‚©‚特º‚ðŽæ‚螂ނ悤‚É‚µ‚Ü‚µ‚½B‚Ü‚¾Žb’è“I‚È‚à‚Ì‚Å‚·‚Ì‚ÅA•s‹ï‡‚ª‚ ‚é + ‚©‚à‚µ‚ê‚Ü‚¹‚ñBˆê‰ž‘ã•\“I‚ÈWAVEƒtƒH[ƒ}ƒbƒg(PCM,MS-ADPCM,IMA-ADPCM, + CCITT A-Law¥u-Law,GSM611‚Æ‚©)‚ÅŽÀŒ±‚µ‚Ü‚µ‚½‚ªA‚·‚ׂĒ²‚ׂ½‚킯‚Å‚Í‚È‚¢‚Ì‚ÅA + ‚Ç‚¤‚È‚é‚©•s–¾‚È‚à‚Ì‚à‚ ‚è‚Ü‚·BBB(^^; + + ƒCƒ“ƒ^[ƒŠ[ƒu‚·‚é‚Æ‚«‚ɉ¹º‚ð‚ǂꂾ‚¯‚¸‚ç‚·‚©‚ðŽw’è‚Å‚«‚Ü‚·B + ‚ ‚Ü‚èˆÓ–¡‚Í‚È‚¢‚©‚à‚µ‚ê‚Ü‚¹‚ñ‚ªA‚¢‚ë‚¢‚뎎‚µ‚ÄŒ©‚Ä‚­‚¾‚³‚¢B + +[”õl] +‰¹º‚̃tƒH[ƒ}ƒbƒg‚Ì•ÏX‚ɂ‚¢‚Ä‚Å‚·‚ªA‚±‚¿‚ç‚ň³kƒ‹[ƒ`ƒ“‚ð +—pˆÓ‚·‚é‚æ‚è‚ÍŠO•”ƒAƒvƒŠ‚É”C‚¹‚ÄAŠeŽ©‚ŘAŒ‹‚µ‚Ä‚¢‚½‚¾‚­‚Æ‚¢‚¤ +•û–@‚ðŽæ‚肽‚¢‚ÆŽv‚¢‚Ü‚·B +AVI‚Å‚àCODEC‚³‚¦“ü‚Á‚Ä‚¢‚ê‚ÎRIFF‚ÌMP3‚Æ‚©Žg‚¦‚Ü‚·‚Ì‚ÅA +‚»‚¿‚ç‚ð—˜—p‚µ‚½•û‚ª‚æ‚èƒtƒ@ƒCƒ‹‚ª¬‚³‚­A‰¹‚à‚«‚ê‚¢‚É +–‚点‚Ü‚·‚Ì‚ÅAAA(^^; + +ƒCƒ“ƒ^[ƒŠ[ƒu‚ɂ‚¢‚Ä‚ÍAƒtƒ@ƒCƒ‹‚ª­‚µ‘å‚«‚­‚È‚è‚Ü‚·‚ªAƒ}ƒVƒ“‚Ì«”\‚ðƒtƒ‹‚É +”­Šö‚·‚邽‚ß‚ÉA‘½­‚̃tƒ@ƒCƒ‹ƒTƒCƒY‚Í‹]µ‚É‚µ‚Ä‚¨‚è‚Ü‚·B +iAVI‚Ì–¼‘O‚Ì—R—ˆ‚ªAudioVideoInterleave‚Æ‚¢‚¤‚­‚ç‚¢‚Å‚·‚Ì‚Å(^^;j +ƒCƒ“ƒ^[ƒŠ[ƒu‚ÍA‚±‚̃\ƒtƒg‚Ì“–‰‚©‚ç‚ÌŠî–{‚É‚È‚Á‚Ä‚Ü‚·‚Ì‚ÅA‚±‚ê‚Í•Ï‚¦‚È‚¢‚Æ +Žv‚¢‚Ü‚·B + +ĶŽž‚̃‹[ƒv‚ÍAƒ‹[ƒv‚Å‚«‚é‚à‚Ì‚Í‚·‚ׂă‹[ƒv‚µ‚Ü‚·B +•ú‚Á‚Ä‚¨‚­‚Ɖi‹v‚É‚Æ‚Ü‚è‚Ü‚¹‚ñ‚Ì‚ÅA’ˆÓ‚µ‚Ä‚­‚¾‚³‚¢B +ƒQ[ƒ€’†‚ł̓‹[ƒv‚µ‚Ä‚È‚¢‚É‚à‚©‚©‚í‚炸Aƒ‹[ƒv‚µ‚Ä‚µ‚Ü‚¤‚à‚Ì‚ª‚ ‚è‚Ü‚·‚ªA +‚±‚ê‚̓wƒbƒ_[‚É’‰ŽÀ‚Ƀ‹[ƒv‚µ‚Ä‚¢‚邽‚ß‚Å‚·(^^; +WAVEƒRƒ“ƒo[ƒgŽž‚Í‚¨‚æ‚»‚P‰ñ•ª‚ð•Û‘¶‚µ‚Ü‚·B + +ƒtƒ@ƒCƒ‹‚̃V[ƒN‚ÍAƒXƒNƒ[ƒ‹ƒo[‚̃hƒ‰ƒbƒO‚É‚æ‚éˆÚ“®‚µ‚©‘Ήž‚µ‚Ä‚Ü‚¹‚ñB + +m‚¨‚Ü‚¯n +Šg’£Žq‚ªˆá‚¤‚ªŽÀÛ‚Í.ACX‚Ì‚à‚ÌB +i‘Ήžƒtƒ@ƒCƒ‹‚É“ü‚Á‚Ä‚Ü‚·‚Ì‚ÅuŠJ‚­v‚Å‘I‘ð‰Â”\‚Å‚·j + +ƒMƒŒƒ“‚Ì–ì–] 00000003.bin(ƒQ[ƒ€’†‚̃ZƒŠƒt) + +ƒTƒNƒ‰‘åí‚Q \SAKURA1\ADVADX1.VCE(ƒQ[ƒ€’†‚̃ZƒŠƒt) + \SAKURA1\ADVADX2.VCE(ƒQ[ƒ€’†‚̃ZƒŠƒt) + \SAKURA1\ADVADX3.VCE(ƒQ[ƒ€’†‚̃ZƒŠƒt) + +[—š—ð] +1997/ 6/27 ƒÀ2”Å 1998/ 1/12 ƒÀ3”Å +1998/ 4/29 ƒÀ4”Å 1998/ 4/29 ƒÀ5”Å +1998/ 5/ 2 ƒÀ6”Å 1998/ 5/ 2 ƒÀ7”Å +1998/ 5/ 4 ƒÀ8”Å 1998/ 5/ 7 ƒÀ9”Å +1998/ 5/10 ƒÀ10”Å 1998/ 5/11 ƒÀ11”Å +1998/ 5/13 ƒÀ12”Å 1998/ 5/13 ƒÀ13”Å +1998/ 5/14 ƒÀ14”Å 1998/ 5/19 ƒÀ15”Å +1998/ 5/22 ƒÀ16”Å 1998/ 5/25 ƒÀ17”Å +1998/ 6/ 3 ƒÀ18”Å + +1998/ 6/ 6 ƒÀ19”Å + ĶAƒRƒ“ƒo[ƒg‚ÅŠg’£Žq.STZ‚ɑΉžB + iƒOƒ‰ƒ“ƒfƒBƒAAƒOƒ‰ƒ“ƒfƒBƒAƒfƒWƒ^ƒ‹ƒ~ƒ…[ƒWƒAƒ€ \Field\GM*.STZj + “¯‚¶‚­ƒTƒNƒ‰‘åí‚Q‚Ì•¡‡ADX‚ɑΉžBiƒIƒvƒVƒ‡ƒ“‚Ìuƒwƒbƒ_[‚ÌŽ©“®‰ðÍvj + ĶŽžƒtƒ@ƒCƒ‹‚̃V[ƒNAƒ|ƒWƒVƒ‡ƒ“•\Ž¦‘ΉžB + ׂ©‚¢ƒoƒO‚ðC³B + +1998/ 6/ 16 ƒÀ20”Å + •\Ž¦ŒnƒoƒO‚‚ԂµBƒAƒvƒŠ‚̃AƒCƒRƒ“‚ðì‚Á‚Ä‚Ý‚éB + Ķ’†‚̃V[ƒN‚ÅAƒXƒeƒŒƒI‚Ìê‡A¶‰E‚ª‚¸‚ê‚邱‚Æ‚ª‚ ‚Á‚½‚Ì‚ðC³B + ˆê‰žAƒtƒ@ƒCƒ‹‚̃hƒ‰ƒbƒOƒAƒ“ƒhƒhƒƒbƒv‚ɑΉžB + ƒEƒBƒ“ƒhƒE‚ɑ΂µ‚Ẵhƒ‰ƒbƒO‚Í–¢‘ΉžB + ‰¹—ʂ̃Aƒbƒv‚Ì‚Q”{‚ð‚â‚ßA‚P‚U”{‚É•ÏXB + CPK•CAK‚̃IƒvƒVƒ‡ƒ“‚ʼn¹º‚ðŽc‚·‚Ì‚Å‚Í‚È‚­A‰¹º‚Ì‚Ý‚Ì•ÏŠ·‚É•ÏXB + CPK•CAK•ÏŠ·Žž‚ÉŠO•”‚©‚çWAVEƒtƒ@ƒCƒ‹‚ðŽæ‚èž‚ß‚é‚悤‚É‚µ‚½B + +1998/ 6/ 17 ƒÀ21”Å + •\Ž¦Œn‰ü—ÇB + ƒÀ‚U‚­‚ç‚¢‚Å‚â‚ß‚Ä‚½ƒtƒŒ[ƒ€‚ª•s‹Ï“™‚ÈCPK‚ɑ΂µ‚Ă̑Έ‚ð–ß‚·B + iƒNƒIƒ”ƒ@ƒfƒBƒXAƒGƒ”ƒ@“™j + ŠO•”‰¹º‚ÌŽæ‚èž‚Ý‚ª‚¤‚Ü‚­s‚©‚È‚¢ê‡‚ª‚ ‚Á‚½‚Ì‚ðC³B + +1998/ 6/ 19 ƒÀ22”Å + ƒoƒOC³B + ŽžŠÔ•\Ž¦‰ü—ÇB + +1998/ 6/ 24 ƒÀ23”Å + idxƒ`ƒƒƒ“ƒN‚ÌŒvŽZ‚̃oƒO‚ðC³B + ƒCƒ“ƒ^[ƒŠ[ƒu‚ð‚¸‚ç‚¹‚é‚悤‚ÉC³B + +1998/ 12/ 6 ƒÀ24”Å + ƒtƒBƒ‹ƒ^‚ð•ÏXB + +1998/ 12/ 8 ƒÀ25”Å + ƒtƒBƒ‹ƒ^‚ð‚³‚ç‚É•ÏXB + +1998/ 3/ 1 ƒÀ26”Å + •s‹Ï“™‚ȃtƒŒ[ƒ€‚ª‚ ‚éê‡AƒtƒŒ[ƒ€‚ðÅ“K‰»‚·‚é‚悤‚ÉC³B + i‚»‚Ì•ªAVI‚̃TƒCƒY‚Í‘‰Áj + Šg’£Žq‚ªˆá‚¤CAK‚à‚«‚¿‚ñ‚Æ‘I•Ê‚·‚é‚悤‚É‚µ‚½Bi‚·‚ׂẴtƒ@ƒCƒ‹‚©‚ç‘I‘ðj + ‚»‚Ì‘¼×‚©‚¢Œ©’¼‚µB + +‚±‚̃vƒƒOƒ‰ƒ€‚ÍAŽ„‚ªŒÂl“I‚Éì‚Á‚Ä‚é‚à‚Ì‚Å‚·B +SEGA‚âCRI‚Æ‚ÍŠÖŒW‚ª–³‚¢‚Ì‚ÅA‚²’ˆÓ‚­‚¾‚³‚¢B +ƒf[ƒ^‚ÍŒÂl“IŠÓÜ‚É‚Ì‚ÝŽg‚Á‚Ä‚­‚¾‚³‚¢B +“]Ú‚Í‹ÖŽ~AAA‚Æ‚¢‚¤‚±‚Æ‚É‚µ‚Æ‚¢‚Ä‚­‚¾‚³‚¢ + lcm@interlink.or.jp + ‚kD‚bD‚l diff --git a/POWERVR/EXES/PVR2BMP/pvr2bmp.exe b/POWERVR/EXES/PVR2BMP/pvr2bmp.exe new file mode 100644 index 00000000..ea75f71f Binary files /dev/null and b/POWERVR/EXES/PVR2BMP/pvr2bmp.exe differ diff --git a/POWERVR/EXES/SFD2MPG/sfd2mpg.exe b/POWERVR/EXES/SFD2MPG/sfd2mpg.exe new file mode 100644 index 00000000..37e0e499 Binary files /dev/null and b/POWERVR/EXES/SFD2MPG/sfd2mpg.exe differ diff --git a/POWERVR/EXES/SFD2MPG/sfd2mpg.txt b/POWERVR/EXES/SFD2MPG/sfd2mpg.txt new file mode 100644 index 00000000..05b2162c --- /dev/null +++ b/POWERVR/EXES/SFD2MPG/sfd2mpg.txt @@ -0,0 +1,74 @@ +sfd2mpg : DreamCast SFD->MPG converter + + http://www.geocities.co.jp/Playtown/2004/ + bero@geocities.co.jp + + +This software convert DreamCast Movie file (.sfd) to MPEG-1 (.mpg). + +you need external mp2(MPEG-1 Audio Layer I/II) encoder. +default is tooLAME. +you also can use mp3(MPEG-1 Audio Layer II),but can't play with Windows Media Player(very noisy). I heard Xing Mpeg Player work fine with mp3. +in my view, famous LAME or gogo encoder looks can't generate layer I/II. is it right? + + sfd2mpg [-c "encoder"] + +option + -c "encoder" + +ex: use tooLAME with 160kbps + + sfd2mpg -c "toolame32 -b 160" movie.sfd + +ex: use SCMPX with Layer-II + + sfd2mpg -c "C:\progra~1\scmpx\scmpx /e /l2" movie.sfd + + +What is sfd? + +SFD format is almost same MPEG-1 System format. + +o audio streams is ADX adpcm format. +o video stream is I,P picture only. not used B picture. +o usualy mpeg has one system header for audio and video, + but sfd has two system header: one for audio, another for video. +o sometime additional data at top of file. + + +IMPORTANT: + don't distruibute converted data follows copyright law in your country. + at least Japanese law, "personal use" only. "personal use" means yourself, your family, and so on. + + + +DC‚̃€[ƒr[ƒtƒ@ƒCƒ‹(.SFD)‚ðMPEG‚É•ÏŠ·‚µ‚Ü‚·B + +ŠO•”‚Émp2(MPEG-1 Audio Layer I/II)ƒGƒ“ƒR[ƒ_‚ª•K—v‚Å‚·B +ƒfƒtƒHƒ‹ƒg‚Å‚ÍtooLAME‚Å‚·B +mp3(MPEG-1 Audio Layer III)‚àŽg‚¦‚Ü‚·‚ªAWindows Media Player‚łͳí‚ÉĶ‚Å‚«‚È‚¢‚悤‚Å‚·B(Xing Mpeg Player‚¾‚ÆĶ‚Å‚«‚é‚炵‚¢) +mp3ŠÖŒW‚ÍÚ‚µ‚­‚È‚¢‚Ì‚Å‚¢‚­‚‚©ƒ\ƒtƒg‚ð’T‚µ‚Ä‚Ý‚½‚Ì‚Å‚·‚ªA—L–¼‚ÈLAME‚âŒßŒã‚Ì‚±[‚¾‚Ílayer I/II‚𶬂·‚éƒIƒvƒVƒ‡ƒ“‚ªŒ©“–‚½‚ç‚È‚¢‚ñ‚Å‚·‚ªA‚»‚¤‚È‚ñ‚·‚©H + + sfd2mpg [-c "encoder"] + +ƒIƒvƒVƒ‡ƒ“ + -c "encoder" ŠO•”ƒGƒ“ƒR[ƒ_‚ðŽw’肵‚Ü‚·B + +—á:tooLAME‚Å160kbps‚É‚·‚é + + sfd2mpg -c "toolame32 -b 160" movie.sfd + +—á:SCMPX‚ðŽg‚¤ê‡ + + sfd2mpg -c "C:\progra~1\scmpx\scmpx /e /l2" movie.sfd + +d—v: + •ÏŠ·‚µ‚½ƒf[ƒ^‚ð•s“Á’葽”‚É”z•z‚µ‚È‚¢‚Å‚­‚¾‚³‚¢B + ­‚È‚­‚Æ‚à“ú–{‚Ì–@—¥‚Å‚ÍA"Ž„“I—˜—p"‚ÉŒÀ‚ç‚ê‚Ü‚·B + "Ž„“I—˜—p"‚Æ‚ÍAŽ©•ªA‰Æ‘°“™‚ðŽw‚µ‚Ü‚·B + + +links: + tooLAME http://members.dingoblue.net.au/~mikecheng/ + http://www.flexion.org/audio/toolame/ (Win32 binary) + SCMPX http://www.din.or.jp/~ch3/ diff --git a/POWERVR/EXES/SMC/0GDTEX.PVR b/POWERVR/EXES/SMC/0GDTEX.PVR new file mode 100644 index 00000000..9955cffe Binary files /dev/null and b/POWERVR/EXES/SMC/0GDTEX.PVR differ diff --git a/POWERVR/EXES/SMC/1ST_READ.BIN b/POWERVR/EXES/SMC/1ST_READ.BIN new file mode 100644 index 00000000..51f3f3eb Binary files /dev/null and b/POWERVR/EXES/SMC/1ST_READ.BIN differ diff --git a/POWERVR/EXES/SMC/GINXFER.BIN b/POWERVR/EXES/SMC/GINXFER.BIN new file mode 100644 index 00000000..18b858d2 Binary files /dev/null and b/POWERVR/EXES/SMC/GINXFER.BIN differ diff --git a/POWERVR/EXES/SMC/IP.BIN b/POWERVR/EXES/SMC/IP.BIN new file mode 100644 index 00000000..c8744992 Binary files /dev/null and b/POWERVR/EXES/SMC/IP.BIN differ diff --git a/POWERVR/EXES/SMC/MOVIE.BIN b/POWERVR/EXES/SMC/MOVIE.BIN new file mode 100644 index 00000000..bfe49576 Binary files /dev/null and b/POWERVR/EXES/SMC/MOVIE.BIN differ diff --git a/POWERVR/EXES/SMC/mcsetup.exe b/POWERVR/EXES/SMC/mcsetup.exe new file mode 100644 index 00000000..aa42e4fd Binary files /dev/null and b/POWERVR/EXES/SMC/mcsetup.exe differ diff --git a/POWERVR/EXES/SMC/movie/MANATEE.DRV b/POWERVR/EXES/SMC/movie/MANATEE.DRV new file mode 100644 index 00000000..d2237a39 Binary files /dev/null and b/POWERVR/EXES/SMC/movie/MANATEE.DRV differ diff --git a/POWERVR/EXES/SMC/movie/SOFTDEC.PVR b/POWERVR/EXES/SMC/movie/SOFTDEC.PVR new file mode 100644 index 00000000..019e62f4 Binary files /dev/null and b/POWERVR/EXES/SMC/movie/SOFTDEC.PVR differ diff --git a/POWERVR/EXES/SMC/movie/WARNER.PVR b/POWERVR/EXES/SMC/movie/WARNER.PVR new file mode 100644 index 00000000..019e62f4 Binary files /dev/null and b/POWERVR/EXES/SMC/movie/WARNER.PVR differ diff --git a/POWERVR/ROMS/DC_Movie_Player-n5.nrg b/POWERVR/ROMS/DC_Movie_Player-n5.nrg new file mode 100644 index 00000000..f343bf4a Binary files /dev/null and b/POWERVR/ROMS/DC_Movie_Player-n5.nrg differ diff --git a/POWERVR/ROMS/DC_Movie_Player-n6.nrg b/POWERVR/ROMS/DC_Movie_Player-n6.nrg new file mode 100644 index 00000000..9ce48ceb Binary files /dev/null and b/POWERVR/ROMS/DC_Movie_Player-n6.nrg differ diff --git a/POWERVR/ROMS/dcplaya2b2-dj.cdi b/POWERVR/ROMS/dcplaya2b2-dj.cdi new file mode 100644 index 00000000..a1428cfc Binary files /dev/null and b/POWERVR/ROMS/dcplaya2b2-dj.cdi differ diff --git a/POWERVR/ROMS/dcplaya2b2-n5.nrg b/POWERVR/ROMS/dcplaya2b2-n5.nrg new file mode 100644 index 00000000..53a63337 Binary files /dev/null and b/POWERVR/ROMS/dcplaya2b2-n5.nrg differ diff --git a/POWERVR/ROMS/dcplaya2b2-n6.nrg b/POWERVR/ROMS/dcplaya2b2-n6.nrg new file mode 100644 index 00000000..8efc2091 Binary files /dev/null and b/POWERVR/ROMS/dcplaya2b2-n6.nrg differ diff --git a/SDK/LIBS/dcinclude/GL/gl.h b/SDK/LIBS/dcinclude/GL/gl.h new file mode 100644 index 00000000..a08296ac --- /dev/null +++ b/SDK/LIBS/dcinclude/GL/gl.h @@ -0,0 +1,423 @@ +#ifndef __GL_GL_H +#define __GL_GL_H + +#include +__BEGIN_DECLS + +/* This file was created using Mesa 3-D 3.4's gl.h as a reference. It is not a + complete gl.h header, but includes enough to use GL effectively. */ + +/* This is currently DC specific, so I don't feel toooo bad about this =) */ +#include + +/* GL data types */ +#include +typedef unsigned int GLenum; +typedef int GLboolean; +typedef unsigned int GLbitfield; +typedef void GLvoid; +typedef int8 GLbyte; /* 1-byte signed */ +typedef int16 GLshort; /* 2-byte signed */ +typedef int32 GLint; /* 4-byte signed */ +typedef uint8 GLubyte; /* 1-byte unsigned */ +typedef uint16 GLushort; /* 2-byte unsigned */ +typedef uint32 GLuint; /* 4-byte unsigned */ +typedef int32 GLsizei; /* 4-byte signed */ +typedef float GLfloat; /* single precision float */ +typedef float GLclampf; /* single precision float in [0,1] */ + +/* For these next two, KOS is generally compiled in m4-single-only, so we + just use floats for everything anyway. */ +typedef float GLdouble; /* double precision float */ +typedef float GLclampd; /* double precision float in [0,1] */ + +/* Constants */ +#define GL_FALSE 0 +#define GL_TRUE 1 + +/* Data types */ +#define GL_BYTE 0x1400 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_SHORT 0x1402 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_INT 0x1404 +#define GL_UNSIGNED_INT 0x1405 +#define GL_FLOAT 0x1406 +#define GL_DOUBLE 0x140A +#define GL_2_BYTES 0x1407 +#define GL_3_BYTES 0x1408 +#define GL_4_BYTES 0x1409 + +/* StringName */ +#define GL_VENDOR 0x1F00 +#define GL_RENDERER 0x1F01 +#define GL_VERSION 0x1F02 +#define GL_EXTENSIONS 0x1F03 + +/* Gets */ +#define GL_ATTRIB_STACK_DEPTH 0x0BB0 +#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1 +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_CURRENT_INDEX 0x0B01 +#define GL_CURRENT_COLOR 0x0B00 +#define GL_CURRENT_NORMAL 0x0B02 +#define GL_CURRENT_RASTER_COLOR 0x0B04 +#define GL_CURRENT_RASTER_DISTANCE 0x0B09 +#define GL_CURRENT_RASTER_INDEX 0x0B05 +#define GL_CURRENT_RASTER_POSITION 0x0B07 +#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06 +#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08 +#define GL_CURRENT_TEXTURE_COORDS 0x0B03 +#define GL_INDEX_CLEAR_VALUE 0x0C20 +#define GL_INDEX_MODE 0x0C30 +#define GL_INDEX_WRITEMASK 0x0C21 +#define GL_MODELVIEW_MATRIX 0x0BA6 +#define GL_MODELVIEW_STACK_DEPTH 0x0BA3 +#define GL_NAME_STACK_DEPTH 0x0D70 +#define GL_PROJECTION_MATRIX 0x0BA7 +#define GL_PROJECTION_STACK_DEPTH 0x0BA4 +#define GL_RENDER_MODE 0x0C40 +#define GL_RGBA_MODE 0x0C31 +#define GL_TEXTURE_MATRIX 0x0BA8 +#define GL_TEXTURE_STACK_DEPTH 0x0BA5 +#define GL_VIEWPORT 0x0BA2 + +/* Primitives types: all 0's are unsupported for now */ +#define GL_POINTS 1 +#define GL_LINES 0 /*2*/ +#define GL_LINE_LOOP 0 /*3*/ +#define GL_LINE_STRIP 0 /*4*/ +#define GL_TRIANGLES 5 +#define GL_TRIANGLE_STRIP 6 +#define GL_TRIANGLE_FAN 0 /*7*/ +#define GL_QUADS 8 +#define GL_QUAD_STRIP 9 +#define GL_POLYGON 10 + +/* FrontFaceDirection */ +#define GL_CW 0x0900 +#define GL_CCW 0x0901 + +#define GL_CULL_FACE 0x0B44 +#define GL_FRONT 0x0404 +#define GL_BACK 0x0405 + +/* Scissor box */ +#define GL_SCISSOR_TEST 0x0008 /* capability bit */ +#define GL_KOS_USERCLIP_OUTSIDE 0x4000 /* capability bit */ +#define GL_SCISSOR_BOX 0x0C10 + +/* Matrix modes */ +#define GL_MATRIX_MODE 0x0BA0 +#define GL_MATRIX_MODE_FIRST 1 +#define GL_MODELVIEW 1 +#define GL_PROJECTION 2 +#define GL_TEXTURE 3 +#define GL_MATRIX_COUNT 4 + +/* Special KOS "matrix mode" (for glKosMatrixApply only) */ +#define GL_KOS_SCREENVIEW 0x100 + +/* "Depth buffer" -- we don't actually support a depth buffer because + the PVR does all of that internally. But these constants are to + ease porting. */ +#define GL_NEVER 0x0200 +#define GL_LESS 0x0201 +#define GL_EQUAL 0x0202 +#define GL_LEQUAL 0x0203 +#define GL_GREATER 0x0204 +#define GL_NOTEQUAL 0x0205 +#define GL_GEQUAL 0x0206 +#define GL_ALWAYS 0x0207 + +#define GL_DEPTH_TEST 0 +#define GL_DEPTH_BITS 0 +#define GL_DEPTH_CLEAR_VALUE 0 +#define GL_DEPTH_FUNC 0 +#define GL_DEPTH_RANGE 0 +#define GL_DEPTH_WRITEMASK 0 +#define GL_DEPTH_COMPONENT 0 + +/* Lighting constants */ +#define GL_LIGHTING 0x0b50 +#define GL_LIGHT0 0x0010 /* capability bit */ +#define GL_LIGHT1 0x0000 +#define GL_LIGHT2 0x0000 +#define GL_LIGHT3 0x0000 +#define GL_LIGHT4 0x0000 +#define GL_LIGHT5 0x0000 +#define GL_LIGHT6 0x0000 +#define GL_LIGHT7 0x0000 +#define GL_AMBIENT 0x1200 +#define GL_DIFFUSE 0x1201 +#define GL_SPECULAR 0 +#define GL_SHININESS 0 +#define GL_EMISSION 0 +#define GL_POSITION 0x1203 +#define GL_SHADE_MODEL 0x0b54 +#define GL_FLAT 0x1d00 +#define GL_SMOOTH 0x1d01 + +/* Fog */ +#define GL_FOG 0x0004 /* capability bit */ +#define GL_FOG_MODE 0x0B65 +#define GL_FOG_DENSITY 0x0B62 +#define GL_FOG_COLOR 0x0B66 +#define GL_FOG_INDEX 0x0B61 +#define GL_FOG_START 0x0B63 +#define GL_FOG_END 0x0B64 +#define GL_LINEAR 0x2601 +#define GL_EXP 0x0800 +#define GL_EXP2 0x0801 + +/* Hints */ +#define GL_FOG_HINT 0x0C54 +#define GL_PERSPECTIVE_CORRECTION_HINT 0x0c50 +#define GL_POINT_SMOOTH_HINT 0x0C51 +#define GL_LINE_SMOOTH_HINT 0x0C52 +#define GL_POLYGON_SMOOTH_HINT 0x0C53 +#define GL_DONT_CARE 0x1100 +#define GL_FASTEST 0x1101 +#define GL_NICEST 0x1102 + +/* Misc bitfield things; we don't really use these either */ +#define GL_COLOR_BUFFER_BIT 0 +#define GL_DEPTH_BUFFER_BIT 0 + +/* Blending: not sure how we'll use these yet; the PVR supports a few + of these so we'll want to eventually */ +#define GL_BLEND 0x0002 /* capability bit */ +#define GL_BLEND_SRC 2 +#define GL_BLEND_DST 3 + +#define GL_ZERO 0 +#define GL_ONE 1 +#define GL_SRC_COLOR 0x0300 +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#define GL_SRC_ALPHA 0x0302 +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_DST_ALPHA 0x0304 +#define GL_ONE_MINUS_DST_ALPHA 0x0305 +#define GL_DST_COLOR 0x0306 +#define GL_ONE_MINUS_DST_COLOR 0x0307 +/*#define GL_SRC_ALPHA_SATURATE 0x0308 unsupported */ + +/* Misc texture constants */ +#define GL_TEXTURE_2D 0x0001 /* capability bit */ +#define GL_KOS_AUTO_UV 0x8000 /* capability bit */ +#define GL_TEXTURE_WRAP_S 0x2802 +#define GL_TEXTURE_WRAP_T 0x2803 +#define GL_TEXTURE_MIN_FILTER 1 +#define GL_TEXTURE_MAG_FILTER 1 +#define GL_TEXTURE_FILTER GL_TEXTURE_MIN_FILTER +#define GL_FILTER_NONE 0 +#define GL_FILTER_BILINEAR 1 +#define GL_REPEAT 0x2901 +#define GL_CLAMP 0x2900 + +/* Texture Environment */ +#define GL_TEXTURE_ENV_MODE 0x2200 +#define GL_REPLACE 0 +#define GL_MODULATE 1 +#define GL_DECAL 2 +#define GL_MODULATEALPHA 3 + +/* Texture format definitions (yes, these vary from real GL) */ +#define GL_ARGB1555 (PVR_TXRFMT_ARGB1555 | PVR_TXRFMT_NONTWIDDLED) +#define GL_RGB565 (PVR_TXRFMT_RGB565 | PVR_TXRFMT_NONTWIDDLED) +#define GL_ARGB4444 (PVR_TXRFMT_ARGB4444 | PVR_TXRFMT_NONTWIDDLED) +#define GL_YUV422 (PVR_TXRFMT_YUV422 | PVR_TXRFMT_NONTWIDDLED) +#define GL_BUMP (PVR_TXRFMT_BUMP | PVR_TXRFMT_NONTWIDDLED) +#define GL_ARGB1555_TWID PVR_TXRFMT_ARGB1555 +#define GL_RGB565_TWID PVR_TXRFMT_RGB565 +#define GL_ARGB4444_TWID PVR_TXRFMT_ARGB4444 +#define GL_YUV422_TWID PVR_TXRFMT_YUV422 +#define GL_BUMP_TWID PVR_TXRFMT_BUMP +#define GL_VQ_ENABLE PVR_TXRFMT_VQ_ENABLE + +/* KOS-specific defines */ +#define GL_LIST_NONE 0x00 +#define GL_LIST_FIRST 0x01 +#define GL_LIST_OPAQUE_POLY 0x01 /* PVR2 modes */ +#define GL_LIST_OPAQUE_MOD 0x02 +#define GL_LIST_TRANS_POLY 0x04 +#define GL_LIST_TRANS_MOD 0x08 +#define GL_LIST_PUNCHTHRU 0x10 +#define GL_LIST_END 0x20 /* no more lists */ +#define GL_LIST_COUNT 5 + +/* KOS-DCPVR-Modifier-specific '?primatives?'*/ +#define GL_KOS_MODIFIER_OTHER_POLY PVR_MODIFIER_OTHER_POLY +#define GL_KOS_MODIFIER_FIRST_POLY PVR_MODIFIER_FIRST_POLY +#define GL_KOS_MODIFIER_LAST_POLY PVR_MODIFIER_LAST_POLY + +/* Applied to primatives that will be affected by modifier volumes + or cheap shadows */ +#define GL_KOS_MODIFIER 0x2000 /* capability bit */ +#define GL_KOS_CHEAP_SHADOW 0x1000 /* capability bit */ + +/* KOS near Z-CLIPPING */ +#define GL_KOS_NEARZ_CLIPPING 0x0020 /* capability bit */ + +/* KOS-specific APIs */ +int glKosInit(); /* Call before using GL */ +void glKosShutdown(); /* Call after finishing with it */ +void glKosGetScreenSize(GLfloat *x, GLfloat *y); /* Get screen size */ +void glKosBeginFrame(); /* Begin frame sequence */ +void glKosFinishFrame(); /* Finish frame sequence */ +void glKosFinishList(); /* Finish with the current list */ +void glKosMatrixIdent(); /* Set the DC's matrix regs to an identity */ +void glKosMatrixApply(GLenum mode); /* Apply one of the GL matrices to the DC's matrix regs */ +void glKosMatrixDirty(); /* Set matrix regs as dirtied */ +void glKosPolyHdrDirty(); /* Set poly header context as dirtied */ +void glKosPolyHdrSend(); /* Send the current KGL poly header */ + +/* Miscellaneous APIs */ +void glClearColor(GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha); + +void glClear(GLbitfield mask); + +void glEnable(GLenum cap); + +void glDisable(GLenum cap); + +void glFrontFace(GLenum mode); + +void glCullFace(GLenum mode); + +void glFlush(); + +void glHint(GLenum target, GLenum mode); + +void glPointSize(GLfloat size); + +const GLubyte *glGetString(GLenum name); + +void glGetFloatv(GLenum pname, GLfloat *param); + +/* Blending functions */ +void glBlendFunc(GLenum sfactor, GLenum dfactor); + +/* Depth buffer (non-functional, just stubs) */ +void glClearDepth(GLclampd depth); + +void glDepthMask(GLboolean flag); + +void glDepthFunc(GLenum func); + +/* Transformation */ +void glMatrixMode(GLenum mode); + +void glFrustum(GLfloat left, GLfloat right, + GLfloat bottom, GLfloat top, + GLfloat znear, GLfloat zfar); + +void glOrtho(GLfloat left, GLfloat right, + GLfloat bottom, GLfloat top, + GLfloat znear, GLfloat zfar); + +void glDepthRange(GLclampf n, GLclampf f); + +void glViewport(GLint x, GLint y, + GLsizei width, GLsizei height); + +void glPushMatrix(void); + +void glPopMatrix(void); + +void glLoadIdentity(void); + +void glLoadMatrixf(const GLfloat *m); + +void glLoadTransposeMatrixf(const GLfloat *m); + +void glMultMatrixf(const GLfloat *m); + +void glMultTransposeMatrixf(const GLfloat *m); + +void glRotatef(GLfloat angle, + GLfloat x, GLfloat y, GLfloat z); + +void glScalef(GLfloat x, GLfloat y, GLfloat z); + +void glTranslatef(GLfloat x, GLfloat y, GLfloat z); + +/* Display lists */ +/* (need to complete) */ + +/* Drawing functions */ +void glBegin(GLenum mode); + +void glEnd(void); + +void glVertex3f(GLfloat x, GLfloat y, GLfloat z); + +void glVertex3fv(GLfloat *v); + +void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz); + +void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); + +void glColor3f(GLfloat red, GLfloat green, GLfloat blue); + +void glColor3fv(GLfloat *v); + +void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); + +void glColor4fv(GLfloat *v); + +void glTexCoord2f(GLfloat s, GLfloat t); + +void glTexCoord2fv(GLfloat *v); + +void glScissor(GLint x, GLint y, GLsizei width, GLsizei height); + +/* Texture API */ +void glGenTextures(GLsizei n, GLuint *textures); + +void glDeleteTextures(GLsizei n, const GLuint *textures); + +void glBindTexture(GLenum target, GLuint texture); + +void glTexImage2D(GLenum target, GLint level, + GLint internalFormat, + GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, + const GLvoid *pixels); + +void glKosTex2D(GLint internal_fmt, GLsizei width, GLsizei height, + pvr_ptr_t txr_address); + +void glTexEnvi(GLenum target, GLenum pname, GLint param); + +void glTexParameteri(GLenum target, GLenum pname, GLint param); + +/* Lighting */ +void glShadeModel(GLenum mode); + +/* Fog */ +void glFogf( GLenum pname, GLfloat param ); + +void glFogi( GLenum pname, GLint param ); + +void glFogfv( GLenum pname, const GLfloat *params ); + +void glFogiv( GLenum pname, const GLint *params ); + +/* Modifier Volumes - currently non-functional */ +void glKosModBegin(GLenum mode); + +void glKosModEnd(void); + +void glKosModVolume9f(GLfloat ax, GLfloat ay, GLfloat az, + GLfloat bx, GLfloat by, GLfloat bz, + GLfloat cx, GLfloat cy, GLfloat cz); + +__END_DECLS + +#endif /* __GL_GL_H */ + diff --git a/SDK/LIBS/dcinclude/GL/glu.h b/SDK/LIBS/dcinclude/GL/glu.h new file mode 100644 index 00000000..4946523d --- /dev/null +++ b/SDK/LIBS/dcinclude/GL/glu.h @@ -0,0 +1,22 @@ +#ifndef __GL_GLU_H +#define __GL_GLU_H + +#include +__BEGIN_DECLS + +#include + +#define GLU_FALSE 0 +#define GLU_TRUE 1 + +void gluPerspective(GLfloat fovy, GLfloat aspect, GLfloat zNear, + GLfloat zFar); + +void gluLookAt(GLfloat eyex, GLfloat eyey, GLfloat eyez, GLfloat centerx, + GLfloat centery, GLfloat centerz, GLfloat upx, GLfloat upy, + GLfloat upz); + +__END_DECLS + +#endif /* __GL_GLU_H */ + diff --git a/SDK/LIBS/dcinclude/GLX/gl.h b/SDK/LIBS/dcinclude/GLX/gl.h new file mode 100644 index 00000000..bf4b18c0 --- /dev/null +++ b/SDK/LIBS/dcinclude/GLX/gl.h @@ -0,0 +1,657 @@ +#ifndef __GL_GL_H +#define __GL_GL_H + +#define NOT_IMPLEMENTED 0 + + +#define GLAPI +#define GLAPIENTRY + +#include +__BEGIN_DECLS + +/* This file was created using Mesa 3-D 3.4's gl.h as a reference. It is not a + complete gl.h header, but includes enough to use GL effectively. */ + +/* This is currently DC specific, so I don't feel toooo bad about this =) */ +#include + +/* GL data types */ +#include +typedef unsigned int GLenum; +typedef int GLboolean; +typedef unsigned int GLbitfield; +typedef void GLvoid; +typedef int8 GLbyte; /* 1-byte signed */ +typedef int16 GLshort; /* 2-byte signed */ +typedef int32 GLint; /* 4-byte signed */ +typedef uint8 GLubyte; /* 1-byte unsigned */ +typedef uint16 GLushort; /* 2-byte unsigned */ +typedef uint32 GLuint; /* 4-byte unsigned */ +typedef int32 GLsizei; /* 4-byte signed */ +typedef float GLfloat; /* single precision float */ +typedef float GLclampf; /* single precision float in [0,1] */ + +/* For these next two, KOS is generally compiled in m4-single-only, so we + just use floats for everything anyway. */ +typedef float GLdouble; /* double precision float */ +typedef float GLclampd; /* double precision float in [0,1] */ + +/* Constants */ +#define GL_FALSE 0 +#define GL_TRUE 1 + +/* Data types */ +#define GL_BYTE 0x1400 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_SHORT 0x1402 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_INT 0x1404 +#define GL_UNSIGNED_INT 0x1405 +#define GL_FLOAT 0x1406 +#define GL_DOUBLE 0x140A +#define GL_2_BYTES 0x1407 +#define GL_3_BYTES 0x1408 +#define GL_4_BYTES 0x1409 + +/* StringName */ +#define GL_VENDOR 0x1F00 +#define GL_RENDERER 0x1F01 +#define GL_VERSION 0x1F02 +#define GL_EXTENSIONS 0x1F03 + +/* Gets */ +#define GL_ATTRIB_STACK_DEPTH 0x0BB0 +#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1 +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_CURRENT_INDEX 0x0B01 +#define GL_CURRENT_COLOR 0x0B00 +#define GL_CURRENT_NORMAL 0x0B02 +#define GL_CURRENT_RASTER_COLOR 0x0B04 +#define GL_CURRENT_RASTER_DISTANCE 0x0B09 +#define GL_CURRENT_RASTER_INDEX 0x0B05 +#define GL_CURRENT_RASTER_POSITION 0x0B07 +#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06 +#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08 +#define GL_CURRENT_TEXTURE_COORDS 0x0B03 +#define GL_INDEX_CLEAR_VALUE 0x0C20 +#define GL_INDEX_MODE 0x0C30 +#define GL_INDEX_WRITEMASK 0x0C21 +#define GL_MODELVIEW_MATRIX 0x0BA6 +#define GL_MODELVIEW_STACK_DEPTH 0x0BA3 +#define GL_NAME_STACK_DEPTH 0x0D70 +#define GL_PROJECTION_MATRIX 0x0BA7 +#define GL_PROJECTION_STACK_DEPTH 0x0BA4 +#define GL_RENDER_MODE 0x0C40 +#define GL_RGBA_MODE 0x0C31 +#define GL_TEXTURE_MATRIX 0x0BA8 +#define GL_TEXTURE_STACK_DEPTH 0x0BA5 +#define GL_VIEWPORT 0x0BA2 + +/* Primitives types: all 0's are unsupported for now */ +#define GL_POINTS 1 +#define GL_LINES 0 /*2*/ +#define GL_LINE_LOOP 0 /*3*/ +#define GL_LINE_STRIP 0 /*4*/ +#define GL_TRIANGLES 5 +#define GL_TRIANGLE_STRIP 6 +#define GL_TRIANGLE_FAN 7 /*7*/ +#define GL_QUADS 8 +#define GL_QUAD_STRIP 9 +#define GL_POLYGON 10 +//+HT Extensions inspired from MiniGL (Amiga) +#define GL_NT_FLATFAN GL_POLYGON +1 +#define GL_NT_FLATSTRIP GL_POLYGON +2 +#define GL_NT_QUADS GL_POLYGON +3 + + +/* FrontFaceDirection */ +#define GL_CW 0x0900 +#define GL_CCW 0x0901 + +#define GL_CULL_FACE 0x0B44 +#define GL_FRONT 0x0404 +#define GL_BACK 0x0405 + +/* Scissor box */ +#define GL_SCISSOR_TEST 0x0008 /* capability bit */ +#define GL_KOS_USERCLIP_OUTSIDE 0x4000 /* capability bit */ +#define GL_SCISSOR_BOX 0x0C10 + + +/* Vertex Arrays */ +#define GL_VERTEX_ARRAY 0x8074 +#define GL_NORMAL_ARRAY 0x8075 +#define GL_COLOR_ARRAY 0x8076 +#define GL_INDEX_ARRAY 0x8077 +#define GL_TEXTURE_COORD_ARRAY 0x8078 + +#define GL_EDGE_FLAG_ARRAY 0x8079 +#define GL_VERTEX_ARRAY_SIZE 0x807A +#define GL_VERTEX_ARRAY_TYPE 0x807B +#define GL_VERTEX_ARRAY_STRIDE 0x807C +#define GL_NORMAL_ARRAY_TYPE 0x807E +#define GL_NORMAL_ARRAY_STRIDE 0x807F +#define GL_COLOR_ARRAY_SIZE 0x8081 +#define GL_COLOR_ARRAY_TYPE 0x8082 +#define GL_COLOR_ARRAY_STRIDE 0x8083 +#define GL_INDEX_ARRAY_TYPE 0x8085 +#define GL_INDEX_ARRAY_STRIDE 0x8086 +#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A +#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C +#define GL_VERTEX_ARRAY_POINTER 0x808E +#define GL_NORMAL_ARRAY_POINTER 0x808F +#define GL_COLOR_ARRAY_POINTER 0x8090 +#define GL_INDEX_ARRAY_POINTER 0x8091 +#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 +#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093 +#define GL_V2F 0x2A20 +#define GL_V3F 0x2A21 +#define GL_C4UB_V2F 0x2A22 +#define GL_C4UB_V3F 0x2A23 +#define GL_C3F_V3F 0x2A24 +#define GL_N3F_V3F 0x2A25 +#define GL_C4F_N3F_V3F 0x2A26 +#define GL_T2F_V3F 0x2A27 +#define GL_T4F_V4F 0x2A28 +#define GL_T2F_C4UB_V3F 0x2A29 +#define GL_T2F_C3F_V3F 0x2A2A +#define GL_T2F_N3F_V3F 0x2A2B +#define GL_T2F_C4F_N3F_V3F 0x2A2C +#define GL_T4F_C4F_N3F_V4F 0x2A2D + + +/* Matrix modes */ +#define GL_MATRIX_MODE 0x0BA0 +#define GL_MATRIX_MODE_FIRST 1 +#define GL_MODELVIEW 1 +#define GL_PROJECTION 2 +#define GL_TEXTURE 3 +#define GL_MATRIX_COUNT 4 + +/* Special KOS "matrix mode" (for glKosMatrixApply only) */ +#define GL_KOS_SCREENVIEW 0x100 + +/* "Depth buffer" -- we don't actually support a depth buffer because + the PVR does all of that internally. But these constants are to + ease porting. */ +#define GL_NEVER 0x0200 +#define GL_LESS 0x0201 +#define GL_EQUAL 0x0202 +#define GL_LEQUAL 0x0203 +#define GL_GREATER 0x0204 +#define GL_NOTEQUAL 0x0205 +#define GL_GEQUAL 0x0206 +#define GL_ALWAYS 0x0207 + +#define GL_DEPTH_TEST 0 +#define GL_DEPTH_BITS 0 +#define GL_DEPTH_CLEAR_VALUE 0 +#define GL_DEPTH_FUNC 0 +#define GL_DEPTH_RANGE 0 +#define GL_DEPTH_WRITEMASK 0 +#define GL_DEPTH_COMPONENT 0 + +/* Lighting constants */ +#define GL_LIGHTING 0x0b50 +#define GL_LIGHT0 0x0010 /* capability bit */ +#define GL_LIGHT1 0x0000 +#define GL_LIGHT2 0x0000 +#define GL_LIGHT3 0x0000 +#define GL_LIGHT4 0x0000 +#define GL_LIGHT5 0x0000 +#define GL_LIGHT6 0x0000 +#define GL_LIGHT7 0x0000 +#define GL_AMBIENT 0x1200 +#define GL_DIFFUSE 0x1201 +#define GL_SPECULAR 0 +#define GL_SHININESS 0 +#define GL_EMISSION 0 +#define GL_POSITION 0x1203 +#define GL_SHADE_MODEL 0x0b54 +#define GL_FLAT 0x1d00 +#define GL_SMOOTH 0x1d01 + +/* Fog */ +#define GL_FOG 0x0004 /* capability bit */ +#define GL_FOG_MODE 0x0B65 +#define GL_FOG_DENSITY 0x0B62 +#define GL_FOG_COLOR 0x0B66 +#define GL_FOG_INDEX 0x0B61 +#define GL_FOG_START 0x0B63 +#define GL_FOG_END 0x0B64 +#define GL_LINEAR 0x2601 +#define GL_EXP 0x0800 +#define GL_EXP2 0x0801 + +/* Hints */ +#define GL_FOG_HINT 0x0C54 +#define GL_PERSPECTIVE_CORRECTION_HINT 0x0c50 +#define GL_POINT_SMOOTH_HINT 0x0C51 +#define GL_LINE_SMOOTH_HINT 0x0C52 +#define GL_POLYGON_SMOOTH_HINT 0x0C53 +#define GL_DONT_CARE 0x1100 +#define GL_FASTEST 0x1101 +#define GL_NICEST 0x1102 + +/* Misc bitfield things; we don't really use these either */ +#define GL_COLOR_BUFFER_BIT 0 +#define GL_DEPTH_BUFFER_BIT 0 + +/* Blending: not sure how we'll use these yet; the PVR supports a few + of these so we'll want to eventually */ +#define GL_BLEND 0x0BE2 /* capability bit */ +#define GL_BLEND_SRC 2 +#define GL_BLEND_DST 3 + +#define GL_ZERO 0 +#define GL_ONE 1 +#define GL_SRC_COLOR 0x0300 +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#define GL_SRC_ALPHA 0x0302 +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_DST_ALPHA 0x0304 +#define GL_ONE_MINUS_DST_ALPHA 0x0305 +#define GL_DST_COLOR 0x0306 +#define GL_ONE_MINUS_DST_COLOR 0x0307 +/*#define GL_SRC_ALPHA_SATURATE 0x0308 unsupported */ + +/* Misc texture constants */ +#define GL_TEXTURE_2D 0x0001 /* capability bit */ +#define GL_KOS_AUTO_UV 0x8000 /* capability bit */ +#define GL_KOS_MIPMAP 0x8001 +#define GL_TEXTURE_WRAP_S 0x2802 +#define GL_TEXTURE_WRAP_T 0x2803 +#define GL_TEXTURE_MAG_FILTER 0x2800 +#define GL_TEXTURE_MIN_FILTER 0x2801 +#define GL_TEXTURE_FILTER GL_TEXTURE_MIN_FILTER +#define GL_FILTER_NONE 0 +#define GL_FILTER_BILINEAR 1 +#define GL_REPEAT 0x2901 +#define GL_CLAMP 0x2900 + + + +/* Texture Environment */ +#define GL_TEXTURE_ENV_MODE 0x2200 +#define GL_REPLACE 0 +#define GL_MODULATE 1 +#define GL_DECAL 2 +#define GL_MODULATEALPHA 3 +#define GL_NEAREST 0x2600 + +/* Texture mapping */ +#define GL_TEXTURE_ENV 0x2300 + +#define GL_TEXTURE_ENV_COLOR 0x2201 + +#define GL_NEAREST_MIPMAP_NEAREST 0x2700 +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#define GL_LINEAR_MIPMAP_NEAREST 0x2701 +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 + +/* Texture mipmaping */ +#define GL_MIPBIAS_NONE 0 +#define GL_MIPBIAS_NORMAL PVR_MIPBIAS_NORMAL +#define GL_MIPBIAS_0_25 PVR_MIPBIAS_0_25 +#define GL_MIPBIAS_0_50 PVR_MIPBIAS_0_50 +#define GL_MIPBIAS_0_75 PVR_MIPBIAS_0_75 +#define GL_MIPBIAS_1_00 PVR_MIPBIAS_1_00 +#define GL_MIPBIAS_1_25 PVR_MIPBIAS_1_25 +#define GL_MIPBIAS_1_50 PVR_MIPBIAS_1_50 +#define GL_MIPBIAS_1_75 PVR_MIPBIAS_1_75 +#define GL_MIPBIAS_2_00 PVR_MIPBIAS_2_00 +#define GL_MIPBIAS_2_25 PVR_MIPBIAS_2_25 +#define GL_MIPBIAS_2_50 PVR_MIPBIAS_2_50 +#define GL_MIPBIAS_2_75 PVR_MIPBIAS_2_75 +#define GL_MIPBIAS_3_00 PVR_MIPBIAS_3_00 +#define GL_MIPBIAS_3_25 PVR_MIPBIAS_3_25 +#define GL_MIPBIAS_3_50 PVR_MIPBIAS_3_50 +#define GL_MIPBIAS_3_75 PVR_MIPBIAS_3_75 + + +/* Display Lists */ +#define GL_COMPILE 0x1300 +#define GL_COMPILE_AND_EXECUTE 0x1301 +#define GL_LIST_BASE 0x0B32 +#define GL_LIST_INDEX 0x0B33 +#define GL_LIST_MODE 0x0B30 + + + +/* Buffers, Pixel Drawing/Reading */ +#if NOT_IMPLEMENTED +#define GL_NONE 0x0 +#define GL_LEFT 0x0406 +#define GL_RIGHT 0x0407 +#endif +/*GL_FRONT 0x0404 */ +/*GL_BACK 0x0405 */ +/*GL_FRONT_AND_BACK 0x0408 */ +#if NOT_IMPLEMENTED +#define GL_FRONT_LEFT 0x0400 +#define GL_FRONT_RIGHT 0x0401 +#endif +#define GL_BACK_LEFT 0x0402 +#if NOT_IMPLEMENTED +#define GL_BACK_RIGHT 0x0403 +#define GL_AUX0 0x0409 +#define GL_AUX1 0x040A +#define GL_AUX2 0x040B +#define GL_AUX3 0x040C +#define GL_RED 0x1903 +#define GL_GREEN 0x1904 +#define GL_BLUE 0x1905 +#endif +#define GL_ALPHA 0x1906 +#define GL_LUMINANCE 0x1909 +#if NOT_IMPLEMENTED +#define GL_LUMINANCE_ALPHA 0x190A +#define GL_ALPHA_BITS 0x0D55 +#define GL_RED_BITS 0x0D52 +#define GL_GREEN_BITS 0x0D53 +#define GL_BLUE_BITS 0x0D54 +#define GL_INDEX_BITS 0x0D51 +#define GL_SUBPIXEL_BITS 0x0D50 +#define GL_AUX_BUFFERS 0x0C00 +#define GL_READ_BUFFER 0x0C02 +#define GL_DRAW_BUFFER 0x0C01 +#define GL_DOUBLEBUFFER 0x0C32 +#define GL_STEREO 0x0C33 +#define GL_BITMAP 0x1A00 +#define GL_COLOR 0x1800 +#define GL_DEPTH 0x1801 +#define GL_STENCIL 0x1802 +#define GL_DITHER 0x0BD0 +#endif +#define GL_RGB 0x1907 +#define GL_RGBA 0x1908 +#define GL_COLOR_INDEX 0x1900 + + +/* OpenGL 1.1 */ +#if NOT_IMPLEMENTED +#define GL_PROXY_TEXTURE_1D 0x8063 +#define GL_PROXY_TEXTURE_2D 0x8064 +#define GL_TEXTURE_PRIORITY 0x8066 +#define GL_TEXTURE_RESIDENT 0x8067 +#define GL_TEXTURE_BINDING_1D 0x8068 +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 +#define GL_ALPHA4 0x803B +#define GL_ALPHA8 0x803C +#define GL_ALPHA12 0x803D +#define GL_ALPHA16 0x803E +#define GL_LUMINANCE4 0x803F +#endif +#define GL_LUMINANCE8 0x8040 +#if NOT_IMPLEMENTED +#define GL_LUMINANCE12 0x8041 +#define GL_LUMINANCE16 0x8042 +#define GL_LUMINANCE4_ALPHA4 0x8043 +#define GL_LUMINANCE6_ALPHA2 0x8044 +#define GL_LUMINANCE8_ALPHA8 0x8045 +#define GL_LUMINANCE12_ALPHA4 0x8046 +#define GL_LUMINANCE12_ALPHA12 0x8047 +#define GL_LUMINANCE16_ALPHA16 0x8048 +#endif +#define GL_INTENSITY 0x8049 +#if NOT_IMPLEMENTED +#define GL_INTENSITY4 0x804A +#endif +#define GL_INTENSITY8 0x804B +#if NOT_IMPLEMENTED +#define GL_INTENSITY12 0x804C +#define GL_INTENSITY16 0x804D +#endif +/* need for quake2 */ +#define GL_R3_G3_B2 0x2A10 +#define GL_RGB4 0x804F +#define GL_RGB5 0x8050 +#define GL_RGB8 0x8051 +#define GL_RGB10 0x8052 +#define GL_RGB12 0x8053 +#define GL_RGB16 0x8054 +#define GL_RGBA2 0x8055 +#define GL_RGBA4 0x8056 +#define GL_RGB5_A1 0x8057 +#define GL_RGBA8 0x8058 +#define GL_RGB10_A2 0x8059 +#define GL_RGBA12 0x805A +#define GL_RGBA16 0x805B +#if NOT_IMPLEMENTED +#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001 +#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002 +#define GL_ALL_CLIENT_ATTRIB_BITS 0xFFFFFFFF +#define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF +#endif + + +/* Texture format definitions (yes, these vary from real GL) */ +#define GL_ARGB1555 (PVR_TXRFMT_ARGB1555 | PVR_TXRFMT_NONTWIDDLED) +#define GL_RGB565 (PVR_TXRFMT_RGB565 | PVR_TXRFMT_NONTWIDDLED) +#define GL_ARGB4444 (PVR_TXRFMT_ARGB4444 | PVR_TXRFMT_NONTWIDDLED) +#define GL_YUV422 (PVR_TXRFMT_YUV422 | PVR_TXRFMT_NONTWIDDLED) +#define GL_BUMP (PVR_TXRFMT_BUMP | PVR_TXRFMT_NONTWIDDLED) +#define GL_ARGB1555_TWID PVR_TXRFMT_ARGB1555 +#define GL_RGB565_TWID PVR_TXRFMT_RGB565 +#define GL_ARGB4444_TWID PVR_TXRFMT_ARGB4444 +#define GL_YUV422_TWID PVR_TXRFMT_YUV422 +#define GL_BUMP_TWID PVR_TXRFMT_BUMP + + + +/* KOS-specific defines */ +#define GL_LIST_NONE 0x00 +#define GL_LIST_FIRST 0x01 +#define GL_LIST_OPAQUE_POLY 0x01 /* PVR2 modes */ +#define GL_LIST_OPAQUE_MOD 0x02 +#define GL_LIST_TRANS_POLY 0x04 +#define GL_LIST_TRANS_MOD 0x08 +#define GL_LIST_PUNCHTHRU 0x10 +#define GL_LIST_END 0x20 /* no more lists */ +#define GL_LIST_COUNT 5 + +/* KOS-DCPVR-Modifier-specific '?primatives?'*/ +#define GL_KOS_MODIFIER_OTHER_POLY PVR_MODIFIER_OTHER_POLY +#define GL_KOS_MODIFIER_FIRST_POLY PVR_MODIFIER_FIRST_POLY +#define GL_KOS_MODIFIER_LAST_POLY PVR_MODIFIER_LAST_POLY + +/* Applied to primatives that will be affected by modifier volumes + or cheap shadows */ +#define GL_KOS_MODIFIER 0x2000 /* capability bit */ +#define GL_KOS_CHEAP_SHADOW 0x1000 /* capability bit */ + +/* KOS near Z-CLIPPING */ +#define GL_KOS_NEARZ_CLIPPING 0x0020 /* capability bit */ + +/* KOS-specific APIs */ +int glKosInit(); /* Call before using GL */ +void glKosShutdown(); /* Call after finishing with it */ +void glKosGetScreenSize(GLfloat *x, GLfloat *y); /* Get screen size */ +void glKosBeginFrame(); /* Begin frame sequence */ +void glKosFinishFrame(); /* Finish frame sequence */ +void glKosFinishList(); /* Finish with the current list */ +void glKosMatrixIdent(); /* Set the DC's matrix regs to an identity */ +void glKosMatrixApply(GLenum mode); /* Apply one of the GL matrices to the DC's matrix regs */ +void glKosMatrixDirty(); /* Set matrix regs as dirtied */ +void glKosPolyHdrDirty(); /* Set poly header context as dirtied */ +void glKosPolyHdrSend(); /* Send the current KGL poly header */ + +/* Miscellaneous APIs */ +void glClearColor(GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha); + +void glClear(GLbitfield mask); + +void glEnable(GLenum cap); + +void glDisable(GLenum cap); + +void glFrontFace(GLenum mode); + +void glCullFace(GLenum mode); + +void glFlush(); + +void glHint(GLenum target, GLenum mode); + +void glPointSize(GLfloat size); + +const GLubyte *glGetString(GLenum name); + +void glGetFloatv(GLenum pname, GLfloat *param); + +/* Blending functions */ +void glBlendFunc(GLenum sfactor, GLenum dfactor); + +/* Depth buffer (non-functional, just stubs) */ +void glClearDepth(GLclampd depth); + +void glDepthMask(GLboolean flag); + +void glDepthFunc(GLenum func); + +/* Transformation */ +void glMatrixMode(GLenum mode); + +void glFrustum(GLfloat left, GLfloat right, + GLfloat bottom, GLfloat top, + GLfloat znear, GLfloat zfar); + +void glOrtho(GLfloat left, GLfloat right, + GLfloat bottom, GLfloat top, + GLfloat znear, GLfloat zfar); + +void glDepthRange(GLclampf n, GLclampf f); + +void glViewport(GLint x, GLint y, + GLsizei width, GLsizei height); + +void glPushMatrix(void); + +void glPopMatrix(void); + +void glLoadIdentity(void); + +void glLoadMatrixf(const GLfloat *m); + +void glLoadTransposeMatrixf(const GLfloat *m); + +void glMultMatrixf(const GLfloat *m); + +void glMultTransposeMatrixf(const GLfloat *m); + +void glRotatef(GLfloat angle, + GLfloat x, GLfloat y, GLfloat z); + +void glScalef(GLfloat x, GLfloat y, GLfloat z); + +void glTranslatef(GLfloat x, GLfloat y, GLfloat z); + +/* Display lists */ + +GLAPI GLuint GLAPIENTRY glGenLists(GLsizei range); +GLAPI GLint GLAPIENTRY glIsList(GLuint list); +GLAPI void GLAPIENTRY glNewList(GLuint list, GLenum mode); +GLAPI void GLAPIENTRY glEndList(void); +GLAPI void GLAPIENTRY glCallList(GLuint list); + +/* opengl 1.2 arrays */ +GLAPI void GLAPIENTRY glEnableClientState(GLenum cap); +GLAPI void GLAPIENTRY glDisableClientState(GLenum cap); +GLAPI void GLAPIENTRY glArrayElement(GLint i); +GLAPI void GLAPIENTRY glVertexPointer(GLint size, GLenum type, GLsizei stride, + const GLvoid *pointer); +GLAPI void GLAPIENTRY glColorPointer(GLint size, GLenum type, GLsizei stride, + const GLvoid *pointer); +GLAPI void GLAPIENTRY glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void GLAPIENTRY glTexCoordPointer(GLint size, GLenum type, GLsizei stride, + const GLvoid *pointer); + +void glDrawElements( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ); +void glDrawArrays( GLenum mode, GLint first, GLsizei count ); + +/* Drawing functions */ +void glBegin(GLenum mode); + +void glEnd(void); + +void glVertex3f(GLfloat x, GLfloat y, GLfloat z); + +void glVertex3fv(GLfloat *v); + +void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz); + +void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); + +void glColor3f(GLfloat red, GLfloat green, GLfloat blue); + +void glColor3ub(GLubyte red, GLubyte green, GLubyte blue); + +void glColor3fv(GLfloat *v); + +void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); + +void glColor4fv(GLfloat *v); + +void glTexCoord2f(GLfloat s, GLfloat t); + +void glTexCoord2fv(GLfloat *v); + +void glScissor(GLint x, GLint y, GLsizei width, GLsizei height); + +/* Texture API */ +void glGenTextures(GLsizei n, GLuint *textures); + +void glDeleteTextures(GLsizei n, const GLuint *textures); + +void glBindTexture(GLenum target, GLuint texture); + +void glTexImage2D(GLenum target, GLint level, + GLint internalFormat, + GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, + const GLvoid *pixels); + +void glKosTex2D(GLint internal_fmt, GLsizei width, GLsizei height, + pvr_ptr_t txr_address); + +void glKosTexMipMapi(GLenum target, GLenum pname, GLint param); + +void glTexEnvi(GLenum target, GLenum pname, GLint param); + +void glTexParameteri(GLenum target, GLenum pname, GLint param); + +GLuint glKmgLoad(char * kmg_file); + +/* Lighting */ +void glShadeModel(GLenum mode); + +/* Fog */ +void glFogf( GLenum pname, GLfloat param ); + +void glFogi( GLenum pname, GLint param ); + +void glFogfv( GLenum pname, const GLfloat *params ); + +void glFogiv( GLenum pname, const GLint *params ); + +/* Modifier Volumes - currently non-functional */ +void glKosModBegin(GLenum mode); + +void glKosModEnd(void); + +void glKosModVolume9f(GLfloat ax, GLfloat ay, GLfloat az, + GLfloat bx, GLfloat by, GLfloat bz, + GLfloat cx, GLfloat cy, GLfloat cz); + +__END_DECLS + +#endif /* __GL_GL_H */ + diff --git a/SDK/LIBS/dcinclude/GLX/glu.h b/SDK/LIBS/dcinclude/GLX/glu.h new file mode 100644 index 00000000..c8d4e801 --- /dev/null +++ b/SDK/LIBS/dcinclude/GLX/glu.h @@ -0,0 +1,45 @@ +#ifndef __GL_GLU_H +#define __GL_GLU_H + +#include +__BEGIN_DECLS + +#include + +#define GLU_FALSE 0 +#define GLU_TRUE 1 + +void gluPerspective(GLfloat fovy, GLfloat aspect, GLfloat zNear, + GLfloat zFar); + +void gluLookAt(GLfloat eyex, GLfloat eyey, GLfloat eyez, GLfloat centerx, + GLfloat centery, GLfloat centerz, GLfloat upx, GLfloat upy, + GLfloat upz); + + +/*+HT*/ + + +void +gluOrtho2D(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top); + +void +gluPickMatrix(GLfloat x, GLfloat y, + GLfloat width, GLfloat height, GLint viewport[4]); + + + +GLint +gluProject(GLfloat objx, GLfloat objy, GLfloat objz, + const GLfloat modelMatrix[16], + const GLfloat projMatrix[16], + const GLint viewport[4], + GLfloat *winx, GLfloat *winy, GLfloat *winz); + + +/*-HT*/ + +__END_DECLS + +#endif /* __GL_GLU_H */ + diff --git a/SDK/LIBS/dcinclude/SDL/SDL.h b/SDK/LIBS/dcinclude/SDL/SDL.h new file mode 100644 index 00000000..2139b03e --- /dev/null +++ b/SDK/LIBS/dcinclude/SDL/SDL.h @@ -0,0 +1,97 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id: SDL.h,v 1.1 2003/02/27 03:46:29 bardtx Exp $"; +#endif + +/* Main include header for the SDL library */ + +#ifndef _SDL_H +#define _SDL_H + +#include "SDL_main.h" +#include "SDL_types.h" +#include "SDL_getenv.h" +#include "SDL_error.h" +#include "SDL_rwops.h" +#include "SDL_timer.h" +#include "SDL_audio.h" +#include "SDL_cdrom.h" +#include "SDL_joystick.h" +#include "SDL_events.h" +#include "SDL_video.h" +#include "SDL_byteorder.h" +#include "SDL_version.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* As of version 0.5, SDL is loaded dynamically into the application */ + +/* These are the flags which may be passed to SDL_Init() -- you should + specify the subsystems which you will be using in your application. +*/ +#define SDL_INIT_TIMER 0x00000001 +#define SDL_INIT_AUDIO 0x00000010 +#define SDL_INIT_VIDEO 0x00000020 +#define SDL_INIT_CDROM 0x00000100 +#define SDL_INIT_JOYSTICK 0x00000200 +#define SDL_INIT_NOPARACHUTE 0x00100000 /* Don't catch fatal signals */ +#define SDL_INIT_EVENTTHREAD 0x01000000 /* Not supported on all OS's */ +#define SDL_INIT_EVERYTHING 0x0000FFFF + +/* This function loads the SDL dynamically linked library and initializes + * the subsystems specified by 'flags' (and those satisfying dependencies) + * Unless the SDL_INIT_NOPARACHUTE flag is set, it will install cleanup + * signal handlers for some commonly ignored fatal signals (like SIGSEGV) + */ +extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags); + +/* This function initializes specific SDL subsystems */ +extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags); + +/* This function cleans up specific SDL subsystems */ +extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags); + +/* This function returns mask of the specified subsystems which have + been initialized. + If 'flags' is 0, it returns a mask of all initialized subsystems. +*/ +extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags); + +/* This function cleans up all initialized subsystems and unloads the + * dynamically linked library. You should call it upon all exit conditions. + */ +extern DECLSPEC void SDLCALL SDL_Quit(void); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_H */ diff --git a/SDK/LIBS/dcinclude/SDL/SDL_active.h b/SDK/LIBS/dcinclude/SDL/SDL_active.h new file mode 100644 index 00000000..be133335 --- /dev/null +++ b/SDK/LIBS/dcinclude/SDL/SDL_active.h @@ -0,0 +1,60 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id: SDL_active.h,v 1.1 2003/02/27 03:46:29 bardtx Exp $"; +#endif + +/* Include file for SDL application focus event handling */ + +#ifndef _SDL_active_h +#define _SDL_active_h + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* The available application states */ +#define SDL_APPMOUSEFOCUS 0x01 /* The app has mouse coverage */ +#define SDL_APPINPUTFOCUS 0x02 /* The app has input focus */ +#define SDL_APPACTIVE 0x04 /* The application is active */ + +/* Function prototypes */ +/* + * This function returns the current state of the application, which is a + * bitwise combination of SDL_APPMOUSEFOCUS, SDL_APPINPUTFOCUS, and + * SDL_APPACTIVE. If SDL_APPACTIVE is set, then the user is able to + * see your application, otherwise it has been iconified or disabled. + */ +extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_active_h */ diff --git a/SDK/LIBS/dcinclude/SDL/SDL_audio.h b/SDK/LIBS/dcinclude/SDL/SDL_audio.h new file mode 100644 index 00000000..e390ffcd --- /dev/null +++ b/SDK/LIBS/dcinclude/SDL/SDL_audio.h @@ -0,0 +1,259 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id: SDL_audio.h,v 1.1 2003/02/27 03:46:29 bardtx Exp $"; +#endif + +/* Access to the raw audio mixing buffer for the SDL library */ + +#ifndef _SDL_audio_h +#define _SDL_audio_h + +#include + +#include "SDL_main.h" +#include "SDL_types.h" +#include "SDL_error.h" +#include "SDL_rwops.h" +#include "SDL_byteorder.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* The calculated values in this structure are calculated by SDL_OpenAudio() */ +typedef struct { + int freq; /* DSP frequency -- samples per second */ + Uint16 format; /* Audio data format */ + Uint8 channels; /* Number of channels: 1 mono, 2 stereo */ + Uint8 silence; /* Audio buffer silence value (calculated) */ + Uint16 samples; /* Audio buffer size in samples (power of 2) */ + Uint16 padding; /* Necessary for some compile environments */ + Uint32 size; /* Audio buffer size in bytes (calculated) */ + /* This function is called when the audio device needs more data. + 'stream' is a pointer to the audio data buffer + 'len' is the length of that buffer in bytes. + Once the callback returns, the buffer will no longer be valid. + Stereo samples are stored in a LRLRLR ordering. + */ + void (*callback)(void *userdata, Uint8 *stream, int len); + void *userdata; +} SDL_AudioSpec; + +/* Audio format flags (defaults to LSB byte order) */ +#define AUDIO_U8 0x0008 /* Unsigned 8-bit samples */ +#define AUDIO_S8 0x8008 /* Signed 8-bit samples */ +#define AUDIO_U16LSB 0x0010 /* Unsigned 16-bit samples */ +#define AUDIO_S16LSB 0x8010 /* Signed 16-bit samples */ +#define AUDIO_U16MSB 0x1010 /* As above, but big-endian byte order */ +#define AUDIO_S16MSB 0x9010 /* As above, but big-endian byte order */ +#define AUDIO_U16 AUDIO_U16LSB +#define AUDIO_S16 AUDIO_S16LSB + +/* Native audio byte ordering */ +#if SDL_BYTEORDER == SDL_LIL_ENDIAN +#define AUDIO_U16SYS AUDIO_U16LSB +#define AUDIO_S16SYS AUDIO_S16LSB +#else +#define AUDIO_U16SYS AUDIO_U16MSB +#define AUDIO_S16SYS AUDIO_S16MSB +#endif + + +/* A structure to hold a set of audio conversion filters and buffers */ +typedef struct SDL_AudioCVT { + int needed; /* Set to 1 if conversion possible */ + Uint16 src_format; /* Source audio format */ + Uint16 dst_format; /* Target audio format */ + double rate_incr; /* Rate conversion increment */ + Uint8 *buf; /* Buffer to hold entire audio data */ + int len; /* Length of original audio buffer */ + int len_cvt; /* Length of converted audio buffer */ + int len_mult; /* buffer must be len*len_mult big */ + double len_ratio; /* Given len, final size is len*len_ratio */ + void (*filters[10])(struct SDL_AudioCVT *cvt, Uint16 format); + int filter_index; /* Current audio conversion function */ +} SDL_AudioCVT; + + +/* Function prototypes */ + +/* These functions are used internally, and should not be used unless you + * have a specific need to specify the audio driver you want to use. + * You should normally use SDL_Init() or SDL_InitSubSystem(). + */ +extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name); +extern DECLSPEC void SDLCALL SDL_AudioQuit(void); + +/* This function fills the given character buffer with the name of the + * current audio driver, and returns a pointer to it if the audio driver has + * been initialized. It returns NULL if no driver has been initialized. + */ +extern DECLSPEC char * SDLCALL SDL_AudioDriverName(char *namebuf, int maxlen); + +/* + * This function opens the audio device with the desired parameters, and + * returns 0 if successful, placing the actual hardware parameters in the + * structure pointed to by 'obtained'. If 'obtained' is NULL, the audio + * data passed to the callback function will be guaranteed to be in the + * requested format, and will be automatically converted to the hardware + * audio format if necessary. This function returns -1 if it failed + * to open the audio device, or couldn't set up the audio thread. + * + * When filling in the desired audio spec structure, + * 'desired->freq' should be the desired audio frequency in samples-per-second. + * 'desired->format' should be the desired audio format. + * 'desired->samples' is the desired size of the audio buffer, in samples. + * This number should be a power of two, and may be adjusted by the audio + * driver to a value more suitable for the hardware. Good values seem to + * range between 512 and 8096 inclusive, depending on the application and + * CPU speed. Smaller values yield faster response time, but can lead + * to underflow if the application is doing heavy processing and cannot + * fill the audio buffer in time. A stereo sample consists of both right + * and left channels in LR ordering. + * Note that the number of samples is directly related to time by the + * following formula: ms = (samples*1000)/freq + * 'desired->size' is the size in bytes of the audio buffer, and is + * calculated by SDL_OpenAudio(). + * 'desired->silence' is the value used to set the buffer to silence, + * and is calculated by SDL_OpenAudio(). + * 'desired->callback' should be set to a function that will be called + * when the audio device is ready for more data. It is passed a pointer + * to the audio buffer, and the length in bytes of the audio buffer. + * This function usually runs in a separate thread, and so you should + * protect data structures that it accesses by calling SDL_LockAudio() + * and SDL_UnlockAudio() in your code. + * 'desired->userdata' is passed as the first parameter to your callback + * function. + * + * The audio device starts out playing silence when it's opened, and should + * be enabled for playing by calling SDL_PauseAudio(0) when you are ready + * for your audio callback function to be called. Since the audio driver + * may modify the requested size of the audio buffer, you should allocate + * any local mixing buffers after you open the audio device. + */ +extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained); + +/* + * Get the current audio state: + */ +typedef enum { + SDL_AUDIO_STOPPED = 0, + SDL_AUDIO_PLAYING, + SDL_AUDIO_PAUSED +} SDL_audiostatus; +extern DECLSPEC SDL_audiostatus SDLCALL SDL_GetAudioStatus(void); + +/* + * This function pauses and unpauses the audio callback processing. + * It should be called with a parameter of 0 after opening the audio + * device to start playing sound. This is so you can safely initialize + * data for your callback function after opening the audio device. + * Silence will be written to the audio device during the pause. + */ +extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on); + +/* + * This function loads a WAVE from the data source, automatically freeing + * that source if 'freesrc' is non-zero. For example, to load a WAVE file, + * you could do: + * SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...); + * + * If this function succeeds, it returns the given SDL_AudioSpec, + * filled with the audio data format of the wave data, and sets + * 'audio_buf' to a malloc()'d buffer containing the audio data, + * and sets 'audio_len' to the length of that audio buffer, in bytes. + * You need to free the audio buffer with SDL_FreeWAV() when you are + * done with it. + * + * This function returns NULL and sets the SDL error message if the + * wave file cannot be opened, uses an unknown data format, or is + * corrupt. Currently raw and MS-ADPCM WAVE files are supported. + */ +extern DECLSPEC SDL_AudioSpec * SDLCALL SDL_LoadWAV_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len); + +/* Compatibility convenience function -- loads a WAV from a file */ +#define SDL_LoadWAV(file, spec, audio_buf, audio_len) \ + SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len) + +/* + * This function frees data previously allocated with SDL_LoadWAV_RW() + */ +extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 *audio_buf); + +/* + * This function takes a source format and rate and a destination format + * and rate, and initializes the 'cvt' structure with information needed + * by SDL_ConvertAudio() to convert a buffer of audio data from one format + * to the other. + * This function returns 0, or -1 if there was an error. + */ +extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT *cvt, + Uint16 src_format, Uint8 src_channels, int src_rate, + Uint16 dst_format, Uint8 dst_channels, int dst_rate); + +/* Once you have initialized the 'cvt' structure using SDL_BuildAudioCVT(), + * created an audio buffer cvt->buf, and filled it with cvt->len bytes of + * audio data in the source format, this function will convert it in-place + * to the desired format. + * The data conversion may expand the size of the audio data, so the buffer + * cvt->buf should be allocated after the cvt structure is initialized by + * SDL_BuildAudioCVT(), and should be cvt->len*cvt->len_mult bytes long. + */ +extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT *cvt); + +/* + * This takes two audio buffers of the playing audio format and mixes + * them, performing addition, volume adjustment, and overflow clipping. + * The volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME + * for full audio volume. Note this does not change hardware volume. + * This is provided for convenience -- you can mix your own audio data. + */ +#define SDL_MIX_MAXVOLUME 128 +extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 *dst, const Uint8 *src, Uint32 len, int volume); + +/* + * The lock manipulated by these functions protects the callback function. + * During a LockAudio/UnlockAudio pair, you can be guaranteed that the + * callback function is not running. Do not call these from the callback + * function or you will cause deadlock. + */ +extern DECLSPEC void SDLCALL SDL_LockAudio(void); +extern DECLSPEC void SDLCALL SDL_UnlockAudio(void); + +/* + * This function shuts down audio processing and closes the audio device. + */ +extern DECLSPEC void SDLCALL SDL_CloseAudio(void); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_audio_h */ diff --git a/SDK/LIBS/dcinclude/SDL/SDL_byteorder.h b/SDK/LIBS/dcinclude/SDL/SDL_byteorder.h new file mode 100644 index 00000000..28b95d6d --- /dev/null +++ b/SDK/LIBS/dcinclude/SDL/SDL_byteorder.h @@ -0,0 +1,53 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id: SDL_byteorder.h,v 1.1 2003/02/27 03:46:29 bardtx Exp $"; +#endif + +/* Macros for determining the byte-order of this platform */ + +#ifndef _SDL_byteorder_h +#define _SDL_byteorder_h + +/* The two types of endianness */ +#define SDL_LIL_ENDIAN 1234 +#define SDL_BIG_ENDIAN 4321 + +/* Pardon the mess, I'm trying to determine the endianness of this host. + I'm doing it by preprocessor defines rather than some sort of configure + script so that application code can use this too. The "right" way would + be to dynamically generate this file on install, but that's a lot of work. + */ +#if defined(__i386__) || defined(__ia64__) || defined(WIN32) || \ + (defined(__alpha__) || defined(__alpha)) || \ + defined(__arm__) || \ + (defined(__mips__) && defined(__MIPSEL__)) || \ + defined(__SYMBIAN32__) || \ + defined(__LITTLE_ENDIAN__) +#define SDL_BYTEORDER SDL_LIL_ENDIAN +#else +#define SDL_BYTEORDER SDL_BIG_ENDIAN +#endif + +#endif /* _SDL_byteorder_h */ diff --git a/SDK/LIBS/dcinclude/SDL/SDL_cdrom.h b/SDK/LIBS/dcinclude/SDL/SDL_cdrom.h new file mode 100644 index 00000000..2a9f7773 --- /dev/null +++ b/SDK/LIBS/dcinclude/SDL/SDL_cdrom.h @@ -0,0 +1,175 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id: SDL_cdrom.h,v 1.1 2003/02/27 03:46:29 bardtx Exp $"; +#endif + +/* This is the CD-audio control API for Simple DirectMedia Layer */ + +#ifndef _SDL_cdrom_h +#define _SDL_cdrom_h + +#include "SDL_types.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* In order to use these functions, SDL_Init() must have been called + with the SDL_INIT_CDROM flag. This causes SDL to scan the system + for CD-ROM drives, and load appropriate drivers. +*/ + +/* The maximum number of CD-ROM tracks on a disk */ +#define SDL_MAX_TRACKS 99 + +/* The types of CD-ROM track possible */ +#define SDL_AUDIO_TRACK 0x00 +#define SDL_DATA_TRACK 0x04 + +/* The possible states which a CD-ROM drive can be in. */ +typedef enum { + CD_TRAYEMPTY, + CD_STOPPED, + CD_PLAYING, + CD_PAUSED, + CD_ERROR = -1 +} CDstatus; + +/* Given a status, returns true if there's a disk in the drive */ +#define CD_INDRIVE(status) ((int)status > 0) + +typedef struct { + Uint8 id; /* Track number */ + Uint8 type; /* Data or audio track */ + Uint16 unused; + Uint32 length; /* Length, in frames, of this track */ + Uint32 offset; /* Offset, in frames, from start of disk */ +} SDL_CDtrack; + +/* This structure is only current as of the last call to SDL_CDStatus() */ +typedef struct SDL_CD { + int id; /* Private drive identifier */ + CDstatus status; /* Current drive status */ + + /* The rest of this structure is only valid if there's a CD in drive */ + int numtracks; /* Number of tracks on disk */ + int cur_track; /* Current track position */ + int cur_frame; /* Current frame offset within current track */ + SDL_CDtrack track[SDL_MAX_TRACKS+1]; +} SDL_CD; + +/* Conversion functions from frames to Minute/Second/Frames and vice versa */ +#define CD_FPS 75 +#define FRAMES_TO_MSF(f, M,S,F) { \ + int value = f; \ + *(F) = value%CD_FPS; \ + value /= CD_FPS; \ + *(S) = value%60; \ + value /= 60; \ + *(M) = value; \ +} +#define MSF_TO_FRAMES(M, S, F) ((M)*60*CD_FPS+(S)*CD_FPS+(F)) + +/* CD-audio API functions: */ + +/* Returns the number of CD-ROM drives on the system, or -1 if + SDL_Init() has not been called with the SDL_INIT_CDROM flag. + */ +extern DECLSPEC int SDLCALL SDL_CDNumDrives(void); + +/* Returns a human-readable, system-dependent identifier for the CD-ROM. + Example: + "/dev/cdrom" + "E:" + "/dev/disk/ide/1/master" +*/ +extern DECLSPEC const char * SDLCALL SDL_CDName(int drive); + +/* Opens a CD-ROM drive for access. It returns a drive handle on success, + or NULL if the drive was invalid or busy. This newly opened CD-ROM + becomes the default CD used when other CD functions are passed a NULL + CD-ROM handle. + Drives are numbered starting with 0. Drive 0 is the system default CD-ROM. +*/ +extern DECLSPEC SDL_CD * SDLCALL SDL_CDOpen(int drive); + +/* This function returns the current status of the given drive. + If the drive has a CD in it, the table of contents of the CD and current + play position of the CD will be stored in the SDL_CD structure. +*/ +extern DECLSPEC CDstatus SDLCALL SDL_CDStatus(SDL_CD *cdrom); + +/* Play the given CD starting at 'start_track' and 'start_frame' for 'ntracks' + tracks and 'nframes' frames. If both 'ntrack' and 'nframe' are 0, play + until the end of the CD. This function will skip data tracks. + This function should only be called after calling SDL_CDStatus() to + get track information about the CD. + For example: + // Play entire CD: + if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) + SDL_CDPlayTracks(cdrom, 0, 0, 0, 0); + // Play last track: + if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) { + SDL_CDPlayTracks(cdrom, cdrom->numtracks-1, 0, 0, 0); + } + // Play first and second track and 10 seconds of third track: + if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) + SDL_CDPlayTracks(cdrom, 0, 0, 2, 10); + + This function returns 0, or -1 if there was an error. +*/ +extern DECLSPEC int SDLCALL SDL_CDPlayTracks(SDL_CD *cdrom, + int start_track, int start_frame, int ntracks, int nframes); + +/* Play the given CD starting at 'start' frame for 'length' frames. + It returns 0, or -1 if there was an error. +*/ +extern DECLSPEC int SDLCALL SDL_CDPlay(SDL_CD *cdrom, int start, int length); + +/* Pause play -- returns 0, or -1 on error */ +extern DECLSPEC int SDLCALL SDL_CDPause(SDL_CD *cdrom); + +/* Resume play -- returns 0, or -1 on error */ +extern DECLSPEC int SDLCALL SDL_CDResume(SDL_CD *cdrom); + +/* Stop play -- returns 0, or -1 on error */ +extern DECLSPEC int SDLCALL SDL_CDStop(SDL_CD *cdrom); + +/* Eject CD-ROM -- returns 0, or -1 on error */ +extern DECLSPEC int SDLCALL SDL_CDEject(SDL_CD *cdrom); + +/* Closes the handle for the CD-ROM drive */ +extern DECLSPEC void SDLCALL SDL_CDClose(SDL_CD *cdrom); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_video_h */ diff --git a/SDK/LIBS/dcinclude/SDL/SDL_copying.h b/SDK/LIBS/dcinclude/SDL/SDL_copying.h new file mode 100644 index 00000000..ea8ae09f --- /dev/null +++ b/SDK/LIBS/dcinclude/SDL/SDL_copying.h @@ -0,0 +1,27 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id: SDL_copying.h,v 1.1 2003/02/27 03:46:29 bardtx Exp $"; +#endif + diff --git a/SDK/LIBS/dcinclude/SDL/SDL_endian.h b/SDK/LIBS/dcinclude/SDL/SDL_endian.h new file mode 100644 index 00000000..51af82ec --- /dev/null +++ b/SDK/LIBS/dcinclude/SDL/SDL_endian.h @@ -0,0 +1,149 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id: SDL_endian.h,v 1.1 2003/02/27 03:46:29 bardtx Exp $"; +#endif + +/* Functions for reading and writing endian-specific values */ + +#ifndef _SDL_endian_h +#define _SDL_endian_h + +/* These functions read and write data of the specified endianness, + dynamically translating to the host machine endianness. + + e.g.: If you want to read a 16 bit value on big-endian machine from + an open file containing little endian values, you would use: + value = SDL_ReadLE16(rp); + Note that the read/write functions use SDL_RWops pointers + instead of FILE pointers. This allows you to read and write + endian values from large chunks of memory as well as files + and other data sources. +*/ + +#include + +#include "SDL_types.h" +#include "SDL_rwops.h" +#include "SDL_byteorder.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* The macros used to swap values */ +/* Try to use superfast macros on systems that support them */ +#ifdef linux +#include +#ifdef __arch__swab16 +#define SDL_Swap16 __arch__swab16 +#endif +#ifdef __arch__swab32 +#define SDL_Swap32 __arch__swab32 +#endif +#endif /* linux */ +/* Use inline functions for compilers that support them, and static + functions for those that do not. Because these functions become + static for compilers that do not support inline functions, this + header should only be included in files that actually use them. +*/ +#ifndef SDL_Swap16 +static __inline__ Uint16 SDL_Swap16(Uint16 D) { + return((D<<8)|(D>>8)); +} +#endif +#ifndef SDL_Swap32 +static __inline__ Uint32 SDL_Swap32(Uint32 D) { + return((D<<24)|((D<<8)&0x00FF0000)|((D>>8)&0x0000FF00)|(D>>24)); +} +#endif +#ifdef SDL_HAS_64BIT_TYPE +#ifndef SDL_Swap64 +static __inline__ Uint64 SDL_Swap64(Uint64 val) { + Uint32 hi, lo; + + /* Separate into high and low 32-bit values and swap them */ + lo = (Uint32)(val&0xFFFFFFFF); + val >>= 32; + hi = (Uint32)(val&0xFFFFFFFF); + val = SDL_Swap32(lo); + val <<= 32; + val |= SDL_Swap32(hi); + return(val); +} +#endif +#else +#ifndef SDL_Swap64 +/* This is mainly to keep compilers from complaining in SDL code. + If there is no real 64-bit datatype, then compilers will complain about + the fake 64-bit datatype that SDL provides when it compiles user code. +*/ +#define SDL_Swap64(X) (X) +#endif +#endif /* SDL_HAS_64BIT_TYPE */ + + +/* Byteswap item from the specified endianness to the native endianness */ +#if SDL_BYTEORDER == SDL_LIL_ENDIAN +#define SDL_SwapLE16(X) (X) +#define SDL_SwapLE32(X) (X) +#define SDL_SwapLE64(X) (X) +#define SDL_SwapBE16(X) SDL_Swap16(X) +#define SDL_SwapBE32(X) SDL_Swap32(X) +#define SDL_SwapBE64(X) SDL_Swap64(X) +#else +#define SDL_SwapLE16(X) SDL_Swap16(X) +#define SDL_SwapLE32(X) SDL_Swap32(X) +#define SDL_SwapLE64(X) SDL_Swap64(X) +#define SDL_SwapBE16(X) (X) +#define SDL_SwapBE32(X) (X) +#define SDL_SwapBE64(X) (X) +#endif + +/* Read an item of the specified endianness and return in native format */ +extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops *src); +extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops *src); +extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops *src); +extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops *src); +extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops *src); +extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops *src); + +/* Write an item of native format to the specified endianness */ +extern DECLSPEC int SDLCALL SDL_WriteLE16(SDL_RWops *dst, Uint16 value); +extern DECLSPEC int SDLCALL SDL_WriteBE16(SDL_RWops *dst, Uint16 value); +extern DECLSPEC int SDLCALL SDL_WriteLE32(SDL_RWops *dst, Uint32 value); +extern DECLSPEC int SDLCALL SDL_WriteBE32(SDL_RWops *dst, Uint32 value); +extern DECLSPEC int SDLCALL SDL_WriteLE64(SDL_RWops *dst, Uint64 value); +extern DECLSPEC int SDLCALL SDL_WriteBE64(SDL_RWops *dst, Uint64 value); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_endian_h */ diff --git a/SDK/LIBS/dcinclude/SDL/SDL_error.h b/SDK/LIBS/dcinclude/SDL/SDL_error.h new file mode 100644 index 00000000..bf9d91e2 --- /dev/null +++ b/SDK/LIBS/dcinclude/SDL/SDL_error.h @@ -0,0 +1,62 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id: SDL_error.h,v 1.1 2003/02/27 03:46:29 bardtx Exp $"; +#endif + +/* Simple error message routines for SDL */ + +#ifndef _SDL_error_h +#define _SDL_error_h + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Public functions */ +extern DECLSPEC void SDLCALL SDL_SetError(const char *fmt, ...); +extern DECLSPEC char * SDLCALL SDL_GetError(void); +extern DECLSPEC void SDLCALL SDL_ClearError(void); + +/* Private error message function - used internally */ +#define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM) +typedef enum { + SDL_ENOMEM, + SDL_EFREAD, + SDL_EFWRITE, + SDL_EFSEEK, + SDL_LASTERROR +} SDL_errorcode; +extern void SDL_Error(SDL_errorcode code); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_error_h */ diff --git a/SDK/LIBS/dcinclude/SDL/SDL_events.h b/SDK/LIBS/dcinclude/SDL/SDL_events.h new file mode 100644 index 00000000..0ee3e189 --- /dev/null +++ b/SDK/LIBS/dcinclude/SDL/SDL_events.h @@ -0,0 +1,334 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id: SDL_events.h,v 1.1 2003/02/27 03:46:29 bardtx Exp $"; +#endif + +/* Include file for SDL event handling */ + +#ifndef _SDL_events_h +#define _SDL_events_h + +#include "SDL_types.h" +#include "SDL_active.h" +#include "SDL_keyboard.h" +#include "SDL_mouse.h" +#include "SDL_joystick.h" +#include "SDL_quit.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Event enumerations */ +enum { SDL_NOEVENT = 0, /* Unused (do not remove) */ + SDL_ACTIVEEVENT, /* Application loses/gains visibility */ + SDL_KEYDOWN, /* Keys pressed */ + SDL_KEYUP, /* Keys released */ + SDL_MOUSEMOTION, /* Mouse moved */ + SDL_MOUSEBUTTONDOWN, /* Mouse button pressed */ + SDL_MOUSEBUTTONUP, /* Mouse button released */ + SDL_JOYAXISMOTION, /* Joystick axis motion */ + SDL_JOYBALLMOTION, /* Joystick trackball motion */ + SDL_JOYHATMOTION, /* Joystick hat position change */ + SDL_JOYBUTTONDOWN, /* Joystick button pressed */ + SDL_JOYBUTTONUP, /* Joystick button released */ + SDL_QUIT, /* User-requested quit */ + SDL_SYSWMEVENT, /* System specific event */ + SDL_EVENT_RESERVEDA, /* Reserved for future use.. */ + SDL_EVENT_RESERVEDB, /* Reserved for future use.. */ + SDL_VIDEORESIZE, /* User resized video mode */ + SDL_VIDEOEXPOSE, /* Screen needs to be redrawn */ + SDL_EVENT_RESERVED2, /* Reserved for future use.. */ + SDL_EVENT_RESERVED3, /* Reserved for future use.. */ + SDL_EVENT_RESERVED4, /* Reserved for future use.. */ + SDL_EVENT_RESERVED5, /* Reserved for future use.. */ + SDL_EVENT_RESERVED6, /* Reserved for future use.. */ + SDL_EVENT_RESERVED7, /* Reserved for future use.. */ + /* Events SDL_USEREVENT through SDL_MAXEVENTS-1 are for your use */ + SDL_USEREVENT = 24, + /* This last event is only for bounding internal arrays + It is the number of bits in the event mask datatype -- Uint32 + */ + SDL_NUMEVENTS = 32 +}; + +/* Predefined event masks */ +#define SDL_EVENTMASK(X) (1<<(X)) +enum { + SDL_ACTIVEEVENTMASK = SDL_EVENTMASK(SDL_ACTIVEEVENT), + SDL_KEYDOWNMASK = SDL_EVENTMASK(SDL_KEYDOWN), + SDL_KEYUPMASK = SDL_EVENTMASK(SDL_KEYUP), + SDL_MOUSEMOTIONMASK = SDL_EVENTMASK(SDL_MOUSEMOTION), + SDL_MOUSEBUTTONDOWNMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN), + SDL_MOUSEBUTTONUPMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONUP), + SDL_MOUSEEVENTMASK = SDL_EVENTMASK(SDL_MOUSEMOTION)| + SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN)| + SDL_EVENTMASK(SDL_MOUSEBUTTONUP), + SDL_JOYAXISMOTIONMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION), + SDL_JOYBALLMOTIONMASK = SDL_EVENTMASK(SDL_JOYBALLMOTION), + SDL_JOYHATMOTIONMASK = SDL_EVENTMASK(SDL_JOYHATMOTION), + SDL_JOYBUTTONDOWNMASK = SDL_EVENTMASK(SDL_JOYBUTTONDOWN), + SDL_JOYBUTTONUPMASK = SDL_EVENTMASK(SDL_JOYBUTTONUP), + SDL_JOYEVENTMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION)| + SDL_EVENTMASK(SDL_JOYBALLMOTION)| + SDL_EVENTMASK(SDL_JOYHATMOTION)| + SDL_EVENTMASK(SDL_JOYBUTTONDOWN)| + SDL_EVENTMASK(SDL_JOYBUTTONUP), + SDL_VIDEORESIZEMASK = SDL_EVENTMASK(SDL_VIDEORESIZE), + SDL_VIDEOEXPOSEMASK = SDL_EVENTMASK(SDL_VIDEOEXPOSE), + SDL_QUITMASK = SDL_EVENTMASK(SDL_QUIT), + SDL_SYSWMEVENTMASK = SDL_EVENTMASK(SDL_SYSWMEVENT) +}; +#define SDL_ALLEVENTS 0xFFFFFFFF + +/* Application visibility event structure */ +typedef struct { + Uint8 type; /* SDL_ACTIVEEVENT */ + Uint8 gain; /* Whether given states were gained or lost (1/0) */ + Uint8 state; /* A mask of the focus states */ +} SDL_ActiveEvent; + +/* Keyboard event structure */ +typedef struct { + Uint8 type; /* SDL_KEYDOWN or SDL_KEYUP */ + Uint8 which; /* The keyboard device index */ + Uint8 state; /* SDL_PRESSED or SDL_RELEASED */ + SDL_keysym keysym; +} SDL_KeyboardEvent; + +/* Mouse motion event structure */ +typedef struct { + Uint8 type; /* SDL_MOUSEMOTION */ + Uint8 which; /* The mouse device index */ + Uint8 state; /* The current button state */ + Uint16 x, y; /* The X/Y coordinates of the mouse */ + Sint16 xrel; /* The relative motion in the X direction */ + Sint16 yrel; /* The relative motion in the Y direction */ +} SDL_MouseMotionEvent; + +/* Mouse button event structure */ +typedef struct { + Uint8 type; /* SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP */ + Uint8 which; /* The mouse device index */ + Uint8 button; /* The mouse button index */ + Uint8 state; /* SDL_PRESSED or SDL_RELEASED */ + Uint16 x, y; /* The X/Y coordinates of the mouse at press time */ +} SDL_MouseButtonEvent; + +/* Joystick axis motion event structure */ +typedef struct { + Uint8 type; /* SDL_JOYAXISMOTION */ + Uint8 which; /* The joystick device index */ + Uint8 axis; /* The joystick axis index */ + Sint16 value; /* The axis value (range: -32768 to 32767) */ +} SDL_JoyAxisEvent; + +/* Joystick trackball motion event structure */ +typedef struct { + Uint8 type; /* SDL_JOYBALLMOTION */ + Uint8 which; /* The joystick device index */ + Uint8 ball; /* The joystick trackball index */ + Sint16 xrel; /* The relative motion in the X direction */ + Sint16 yrel; /* The relative motion in the Y direction */ +} SDL_JoyBallEvent; + +/* Joystick hat position change event structure */ +typedef struct { + Uint8 type; /* SDL_JOYHATMOTION */ + Uint8 which; /* The joystick device index */ + Uint8 hat; /* The joystick hat index */ + Uint8 value; /* The hat position value: + 8 1 2 + 7 0 3 + 6 5 4 + Note that zero means the POV is centered. + */ +} SDL_JoyHatEvent; + +/* Joystick button event structure */ +typedef struct { + Uint8 type; /* SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP */ + Uint8 which; /* The joystick device index */ + Uint8 button; /* The joystick button index */ + Uint8 state; /* SDL_PRESSED or SDL_RELEASED */ +} SDL_JoyButtonEvent; + +/* The "window resized" event + When you get this event, you are responsible for setting a new video + mode with the new width and height. + */ +typedef struct { + Uint8 type; /* SDL_VIDEORESIZE */ + int w; /* New width */ + int h; /* New height */ +} SDL_ResizeEvent; + +/* The "screen redraw" event */ +typedef struct { + Uint8 type; /* SDL_VIDEOEXPOSE */ +} SDL_ExposeEvent; + +/* The "quit requested" event */ +typedef struct { + Uint8 type; /* SDL_QUIT */ +} SDL_QuitEvent; + +/* A user-defined event type */ +typedef struct { + Uint8 type; /* SDL_USEREVENT through SDL_NUMEVENTS-1 */ + int code; /* User defined event code */ + void *data1; /* User defined data pointer */ + void *data2; /* User defined data pointer */ +} SDL_UserEvent; + +/* If you want to use this event, you should include SDL_syswm.h */ +struct SDL_SysWMmsg; +typedef struct SDL_SysWMmsg SDL_SysWMmsg; +typedef struct { + Uint8 type; + SDL_SysWMmsg *msg; +} SDL_SysWMEvent; + +/* General event structure */ +typedef union { + Uint8 type; + SDL_ActiveEvent active; + SDL_KeyboardEvent key; + SDL_MouseMotionEvent motion; + SDL_MouseButtonEvent button; + SDL_JoyAxisEvent jaxis; + SDL_JoyBallEvent jball; + SDL_JoyHatEvent jhat; + SDL_JoyButtonEvent jbutton; + SDL_ResizeEvent resize; + SDL_ExposeEvent expose; + SDL_QuitEvent quit; + SDL_UserEvent user; + SDL_SysWMEvent syswm; +} SDL_Event; + + +/* Function prototypes */ + +/* Pumps the event loop, gathering events from the input devices. + This function updates the event queue and internal input device state. + This should only be run in the thread that sets the video mode. +*/ +extern DECLSPEC void SDLCALL SDL_PumpEvents(void); + +/* Checks the event queue for messages and optionally returns them. + If 'action' is SDL_ADDEVENT, up to 'numevents' events will be added to + the back of the event queue. + If 'action' is SDL_PEEKEVENT, up to 'numevents' events at the front + of the event queue, matching 'mask', will be returned and will not + be removed from the queue. + If 'action' is SDL_GETEVENT, up to 'numevents' events at the front + of the event queue, matching 'mask', will be returned and will be + removed from the queue. + This function returns the number of events actually stored, or -1 + if there was an error. This function is thread-safe. +*/ +typedef enum { + SDL_ADDEVENT, + SDL_PEEKEVENT, + SDL_GETEVENT +} SDL_eventaction; +/* */ +extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, + SDL_eventaction action, Uint32 mask); + +/* Polls for currently pending events, and returns 1 if there are any pending + events, or 0 if there are none available. If 'event' is not NULL, the next + event is removed from the queue and stored in that area. + */ +extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event *event); + +/* Waits indefinitely for the next available event, returning 1, or 0 if there + was an error while waiting for events. If 'event' is not NULL, the next + event is removed from the queue and stored in that area. + */ +extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event *event); + +/* Add an event to the event queue. + This function returns 0 if the event queue was full, or -1 + if there was some other error. Returns 1 on success. + */ +extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event); + +/* + This function sets up a filter to process all events before they + change internal state and are posted to the internal event queue. + + The filter is protypted as: +*/ +typedef int (*SDL_EventFilter)(const SDL_Event *event); +/* + If the filter returns 1, then the event will be added to the internal queue. + If it returns 0, then the event will be dropped from the queue, but the + internal state will still be updated. This allows selective filtering of + dynamically arriving events. + + WARNING: Be very careful of what you do in the event filter function, as + it may run in a different thread! + + There is one caveat when dealing with the SDL_QUITEVENT event type. The + event filter is only called when the window manager desires to close the + application window. If the event filter returns 1, then the window will + be closed, otherwise the window will remain open if possible. + If the quit event is generated by an interrupt signal, it will bypass the + internal queue and be delivered to the application at the next event poll. +*/ +extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter); + +/* + Return the current event filter - can be used to "chain" filters. + If there is no event filter set, this function returns NULL. +*/ +extern DECLSPEC SDL_EventFilter SDLCALL SDL_GetEventFilter(void); + +/* + This function allows you to set the state of processing certain events. + If 'state' is set to SDL_IGNORE, that event will be automatically dropped + from the event queue and will not event be filtered. + If 'state' is set to SDL_ENABLE, that event will be processed normally. + If 'state' is set to SDL_QUERY, SDL_EventState() will return the + current processing state of the specified event. +*/ +#define SDL_QUERY -1 +#define SDL_IGNORE 0 +#define SDL_DISABLE 0 +#define SDL_ENABLE 1 +extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint8 type, int state); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_events_h */ diff --git a/SDK/LIBS/dcinclude/SDL/SDL_getenv.h b/SDK/LIBS/dcinclude/SDL/SDL_getenv.h new file mode 100644 index 00000000..42037dd4 --- /dev/null +++ b/SDK/LIBS/dcinclude/SDL/SDL_getenv.h @@ -0,0 +1,30 @@ + +/* Not all environments have a working getenv()/putenv() */ + +#if defined(macintosh) || defined(_WIN32_WCE) +#define NEED_SDL_GETENV +#endif + +#ifdef NEED_SDL_GETENV + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Put a variable of the form "name=value" into the environment */ +extern DECLSPEC int SDLCALL SDL_putenv(const char *variable); +#define putenv(X) SDL_putenv(X) + +/* Retrieve a variable named "name" from the environment */ +extern DECLSPEC char * SDLCALL SDL_getenv(const char *name); +#define getenv(X) SDL_getenv(X) + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* NEED_GETENV */ diff --git a/SDK/LIBS/dcinclude/SDL/SDL_joystick.h b/SDK/LIBS/dcinclude/SDL/SDL_joystick.h new file mode 100644 index 00000000..d76051a9 --- /dev/null +++ b/SDK/LIBS/dcinclude/SDL/SDL_joystick.h @@ -0,0 +1,171 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id: SDL_joystick.h,v 1.1 2003/02/27 03:46:29 bardtx Exp $"; +#endif + +/* Include file for SDL joystick event handling */ + +#ifndef _SDL_joystick_h +#define _SDL_joystick_h + +#include "SDL_types.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* In order to use these functions, SDL_Init() must have been called + with the SDL_INIT_JOYSTICK flag. This causes SDL to scan the system + for joysticks, and load appropriate drivers. +*/ + +/* The joystick structure used to identify an SDL joystick */ +struct _SDL_Joystick; +typedef struct _SDL_Joystick SDL_Joystick; + + +/* Function prototypes */ +/* + * Count the number of joysticks attached to the system + */ +extern DECLSPEC int SDLCALL SDL_NumJoysticks(void); + +/* + * Get the implementation dependent name of a joystick. + * This can be called before any joysticks are opened. + * If no name can be found, this function returns NULL. + */ +extern DECLSPEC const char * SDLCALL SDL_JoystickName(int device_index); + +/* + * Open a joystick for use - the index passed as an argument refers to + * the N'th joystick on the system. This index is the value which will + * identify this joystick in future joystick events. + * + * This function returns a joystick identifier, or NULL if an error occurred. + */ +extern DECLSPEC SDL_Joystick * SDLCALL SDLCALL SDL_JoystickOpen(int device_index); + +/* + * Returns 1 if the joystick has been opened, or 0 if it has not. + */ +extern DECLSPEC int SDLCALL SDL_JoystickOpened(int device_index); + +/* + * Get the device index of an opened joystick. + */ +extern DECLSPEC int SDLCALL SDL_JoystickIndex(SDL_Joystick *joystick); + +/* + * Get the number of general axis controls on a joystick + */ +extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick *joystick); + +/* + * Get the number of trackballs on a joystick + * Joystick trackballs have only relative motion events associated + * with them and their state cannot be polled. + */ +extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick *joystick); + +/* + * Get the number of POV hats on a joystick + */ +extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick *joystick); + +/* + * Get the number of buttons on a joystick + */ +extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick *joystick); + +/* + * Update the current state of the open joysticks. + * This is called automatically by the event loop if any joystick + * events are enabled. + */ +extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void); + +/* + * Enable/disable joystick event polling. + * If joystick events are disabled, you must call SDL_JoystickUpdate() + * yourself and check the state of the joystick when you want joystick + * information. + * The state can be one of SDL_QUERY, SDL_ENABLE or SDL_IGNORE. + */ +extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state); + +/* + * Get the current state of an axis control on a joystick + * The state is a value ranging from -32768 to 32767. + * The axis indices start at index 0. + */ +extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis); + +/* + * Get the current state of a POV hat on a joystick + * The return value is one of the following positions: + */ +#define SDL_HAT_CENTERED 0x00 +#define SDL_HAT_UP 0x01 +#define SDL_HAT_RIGHT 0x02 +#define SDL_HAT_DOWN 0x04 +#define SDL_HAT_LEFT 0x08 +#define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP) +#define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN) +#define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP) +#define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN) +/* + * The hat indices start at index 0. + */ +extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick *joystick, int hat); + +/* + * Get the ball axis change since the last poll + * This returns 0, or -1 if you passed it invalid parameters. + * The ball indices start at index 0. + */ +extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy); + +/* + * Get the current state of a button on a joystick + * The button indices start at index 0. + */ +extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick *joystick, int button); + +/* + * Close a joystick previously opened with SDL_JoystickOpen() + */ +extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick *joystick); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_joystick_h */ diff --git a/SDK/LIBS/dcinclude/SDL/SDL_keyboard.h b/SDK/LIBS/dcinclude/SDL/SDL_keyboard.h new file mode 100644 index 00000000..8576097a --- /dev/null +++ b/SDK/LIBS/dcinclude/SDL/SDL_keyboard.h @@ -0,0 +1,124 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id: SDL_keyboard.h,v 1.1 2003/02/27 03:46:29 bardtx Exp $"; +#endif + +/* Include file for SDL keyboard event handling */ + +#ifndef _SDL_keyboard_h +#define _SDL_keyboard_h + +#include "SDL_types.h" +#include "SDL_keysym.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Keysym structure + - The scancode is hardware dependent, and should not be used by general + applications. If no hardware scancode is available, it will be 0. + + - The 'unicode' translated character is only available when character + translation is enabled by the SDL_EnableUNICODE() API. If non-zero, + this is a UNICODE character corresponding to the keypress. If the + high 9 bits of the character are 0, then this maps to the equivalent + ASCII character: + char ch; + if ( (keysym.unicode & 0xFF80) == 0 ) { + ch = keysym.unicode & 0x7F; + } else { + An international character.. + } + */ +typedef struct { + Uint8 scancode; /* hardware specific scancode */ + SDLKey sym; /* SDL virtual keysym */ + SDLMod mod; /* current key modifiers */ + Uint16 unicode; /* translated character */ +} SDL_keysym; + +/* This is the mask which refers to all hotkey bindings */ +#define SDL_ALL_HOTKEYS 0xFFFFFFFF + +/* Function prototypes */ +/* + * Enable/Disable UNICODE translation of keyboard input. + * This translation has some overhead, so translation defaults off. + * If 'enable' is 1, translation is enabled. + * If 'enable' is 0, translation is disabled. + * If 'enable' is -1, the translation state is not changed. + * It returns the previous state of keyboard translation. + */ +extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable); + +/* + * Enable/Disable keyboard repeat. Keyboard repeat defaults to off. + * 'delay' is the initial delay in ms between the time when a key is + * pressed, and keyboard repeat begins. + * 'interval' is the time in ms between keyboard repeat events. + */ +#define SDL_DEFAULT_REPEAT_DELAY 500 +#define SDL_DEFAULT_REPEAT_INTERVAL 30 +/* + * If 'delay' is set to 0, keyboard repeat is disabled. + */ +extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat(int delay, int interval); + +/* + * Get a snapshot of the current state of the keyboard. + * Returns an array of keystates, indexed by the SDLK_* syms. + * Used: + * Uint8 *keystate = SDL_GetKeyState(NULL); + * if ( keystate[SDLK_RETURN] ) ... is pressed. + */ +extern DECLSPEC Uint8 * SDLCALL SDL_GetKeyState(int *numkeys); + +/* + * Get the current key modifier state + */ +extern DECLSPEC SDLMod SDLCALL SDL_GetModState(void); + +/* + * Set the current key modifier state + * This does not change the keyboard state, only the key modifier flags. + */ +extern DECLSPEC void SDLCALL SDL_SetModState(SDLMod modstate); + +/* + * Get the name of an SDL virtual keysym + */ +extern DECLSPEC char * SDLCALL SDL_GetKeyName(SDLKey key); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_keyboard_h */ diff --git a/SDK/LIBS/dcinclude/SDL/SDL_keysym.h b/SDK/LIBS/dcinclude/SDL/SDL_keysym.h new file mode 100644 index 00000000..75a86f21 --- /dev/null +++ b/SDK/LIBS/dcinclude/SDL/SDL_keysym.h @@ -0,0 +1,316 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id: SDL_keysym.h,v 1.1 2003/02/27 03:46:29 bardtx Exp $"; +#endif + +#ifndef _SDL_keysym_h +#define _SDL_keysym_h + +/* What we really want is a mapping of every raw key on the keyboard. + To support international keyboards, we use the range 0xA1 - 0xFF + as international virtual keycodes. We'll follow in the footsteps of X11... + The names of the keys + */ + +typedef enum { + /* The keyboard syms have been cleverly chosen to map to ASCII */ + SDLK_UNKNOWN = 0, + SDLK_FIRST = 0, + SDLK_BACKSPACE = 8, + SDLK_TAB = 9, + SDLK_CLEAR = 12, + SDLK_RETURN = 13, + SDLK_PAUSE = 19, + SDLK_ESCAPE = 27, + SDLK_SPACE = 32, + SDLK_EXCLAIM = 33, + SDLK_QUOTEDBL = 34, + SDLK_HASH = 35, + SDLK_DOLLAR = 36, + SDLK_AMPERSAND = 38, + SDLK_QUOTE = 39, + SDLK_LEFTPAREN = 40, + SDLK_RIGHTPAREN = 41, + SDLK_ASTERISK = 42, + SDLK_PLUS = 43, + SDLK_COMMA = 44, + SDLK_MINUS = 45, + SDLK_PERIOD = 46, + SDLK_SLASH = 47, + SDLK_0 = 48, + SDLK_1 = 49, + SDLK_2 = 50, + SDLK_3 = 51, + SDLK_4 = 52, + SDLK_5 = 53, + SDLK_6 = 54, + SDLK_7 = 55, + SDLK_8 = 56, + SDLK_9 = 57, + SDLK_COLON = 58, + SDLK_SEMICOLON = 59, + SDLK_LESS = 60, + SDLK_EQUALS = 61, + SDLK_GREATER = 62, + SDLK_QUESTION = 63, + SDLK_AT = 64, + /* + Skip uppercase letters + */ + SDLK_LEFTBRACKET = 91, + SDLK_BACKSLASH = 92, + SDLK_RIGHTBRACKET = 93, + SDLK_CARET = 94, + SDLK_UNDERSCORE = 95, + SDLK_BACKQUOTE = 96, + SDLK_a = 97, + SDLK_b = 98, + SDLK_c = 99, + SDLK_d = 100, + SDLK_e = 101, + SDLK_f = 102, + SDLK_g = 103, + SDLK_h = 104, + SDLK_i = 105, + SDLK_j = 106, + SDLK_k = 107, + SDLK_l = 108, + SDLK_m = 109, + SDLK_n = 110, + SDLK_o = 111, + SDLK_p = 112, + SDLK_q = 113, + SDLK_r = 114, + SDLK_s = 115, + SDLK_t = 116, + SDLK_u = 117, + SDLK_v = 118, + SDLK_w = 119, + SDLK_x = 120, + SDLK_y = 121, + SDLK_z = 122, + SDLK_DELETE = 127, + /* End of ASCII mapped keysyms */ + + /* International keyboard syms */ + SDLK_WORLD_0 = 160, /* 0xA0 */ + SDLK_WORLD_1 = 161, + SDLK_WORLD_2 = 162, + SDLK_WORLD_3 = 163, + SDLK_WORLD_4 = 164, + SDLK_WORLD_5 = 165, + SDLK_WORLD_6 = 166, + SDLK_WORLD_7 = 167, + SDLK_WORLD_8 = 168, + SDLK_WORLD_9 = 169, + SDLK_WORLD_10 = 170, + SDLK_WORLD_11 = 171, + SDLK_WORLD_12 = 172, + SDLK_WORLD_13 = 173, + SDLK_WORLD_14 = 174, + SDLK_WORLD_15 = 175, + SDLK_WORLD_16 = 176, + SDLK_WORLD_17 = 177, + SDLK_WORLD_18 = 178, + SDLK_WORLD_19 = 179, + SDLK_WORLD_20 = 180, + SDLK_WORLD_21 = 181, + SDLK_WORLD_22 = 182, + SDLK_WORLD_23 = 183, + SDLK_WORLD_24 = 184, + SDLK_WORLD_25 = 185, + SDLK_WORLD_26 = 186, + SDLK_WORLD_27 = 187, + SDLK_WORLD_28 = 188, + SDLK_WORLD_29 = 189, + SDLK_WORLD_30 = 190, + SDLK_WORLD_31 = 191, + SDLK_WORLD_32 = 192, + SDLK_WORLD_33 = 193, + SDLK_WORLD_34 = 194, + SDLK_WORLD_35 = 195, + SDLK_WORLD_36 = 196, + SDLK_WORLD_37 = 197, + SDLK_WORLD_38 = 198, + SDLK_WORLD_39 = 199, + SDLK_WORLD_40 = 200, + SDLK_WORLD_41 = 201, + SDLK_WORLD_42 = 202, + SDLK_WORLD_43 = 203, + SDLK_WORLD_44 = 204, + SDLK_WORLD_45 = 205, + SDLK_WORLD_46 = 206, + SDLK_WORLD_47 = 207, + SDLK_WORLD_48 = 208, + SDLK_WORLD_49 = 209, + SDLK_WORLD_50 = 210, + SDLK_WORLD_51 = 211, + SDLK_WORLD_52 = 212, + SDLK_WORLD_53 = 213, + SDLK_WORLD_54 = 214, + SDLK_WORLD_55 = 215, + SDLK_WORLD_56 = 216, + SDLK_WORLD_57 = 217, + SDLK_WORLD_58 = 218, + SDLK_WORLD_59 = 219, + SDLK_WORLD_60 = 220, + SDLK_WORLD_61 = 221, + SDLK_WORLD_62 = 222, + SDLK_WORLD_63 = 223, + SDLK_WORLD_64 = 224, + SDLK_WORLD_65 = 225, + SDLK_WORLD_66 = 226, + SDLK_WORLD_67 = 227, + SDLK_WORLD_68 = 228, + SDLK_WORLD_69 = 229, + SDLK_WORLD_70 = 230, + SDLK_WORLD_71 = 231, + SDLK_WORLD_72 = 232, + SDLK_WORLD_73 = 233, + SDLK_WORLD_74 = 234, + SDLK_WORLD_75 = 235, + SDLK_WORLD_76 = 236, + SDLK_WORLD_77 = 237, + SDLK_WORLD_78 = 238, + SDLK_WORLD_79 = 239, + SDLK_WORLD_80 = 240, + SDLK_WORLD_81 = 241, + SDLK_WORLD_82 = 242, + SDLK_WORLD_83 = 243, + SDLK_WORLD_84 = 244, + SDLK_WORLD_85 = 245, + SDLK_WORLD_86 = 246, + SDLK_WORLD_87 = 247, + SDLK_WORLD_88 = 248, + SDLK_WORLD_89 = 249, + SDLK_WORLD_90 = 250, + SDLK_WORLD_91 = 251, + SDLK_WORLD_92 = 252, + SDLK_WORLD_93 = 253, + SDLK_WORLD_94 = 254, + SDLK_WORLD_95 = 255, /* 0xFF */ + + /* Numeric keypad */ + SDLK_KP0 = 256, + SDLK_KP1 = 257, + SDLK_KP2 = 258, + SDLK_KP3 = 259, + SDLK_KP4 = 260, + SDLK_KP5 = 261, + SDLK_KP6 = 262, + SDLK_KP7 = 263, + SDLK_KP8 = 264, + SDLK_KP9 = 265, + SDLK_KP_PERIOD = 266, + SDLK_KP_DIVIDE = 267, + SDLK_KP_MULTIPLY = 268, + SDLK_KP_MINUS = 269, + SDLK_KP_PLUS = 270, + SDLK_KP_ENTER = 271, + SDLK_KP_EQUALS = 272, + + /* Arrows + Home/End pad */ + SDLK_UP = 273, + SDLK_DOWN = 274, + SDLK_RIGHT = 275, + SDLK_LEFT = 276, + SDLK_INSERT = 277, + SDLK_HOME = 278, + SDLK_END = 279, + SDLK_PAGEUP = 280, + SDLK_PAGEDOWN = 281, + + /* Function keys */ + SDLK_F1 = 282, + SDLK_F2 = 283, + SDLK_F3 = 284, + SDLK_F4 = 285, + SDLK_F5 = 286, + SDLK_F6 = 287, + SDLK_F7 = 288, + SDLK_F8 = 289, + SDLK_F9 = 290, + SDLK_F10 = 291, + SDLK_F11 = 292, + SDLK_F12 = 293, + SDLK_F13 = 294, + SDLK_F14 = 295, + SDLK_F15 = 296, + + /* Key state modifier keys */ + SDLK_NUMLOCK = 300, + SDLK_CAPSLOCK = 301, + SDLK_SCROLLOCK = 302, + SDLK_RSHIFT = 303, + SDLK_LSHIFT = 304, + SDLK_RCTRL = 305, + SDLK_LCTRL = 306, + SDLK_RALT = 307, + SDLK_LALT = 308, + SDLK_RMETA = 309, + SDLK_LMETA = 310, + SDLK_LSUPER = 311, /* Left "Windows" key */ + SDLK_RSUPER = 312, /* Right "Windows" key */ + SDLK_MODE = 313, /* "Alt Gr" key */ + SDLK_COMPOSE = 314, /* Multi-key compose key */ + + /* Miscellaneous function keys */ + SDLK_HELP = 315, + SDLK_PRINT = 316, + SDLK_SYSREQ = 317, + SDLK_BREAK = 318, + SDLK_MENU = 319, + SDLK_POWER = 320, /* Power Macintosh power key */ + SDLK_EURO = 321, /* Some european keyboards */ + SDLK_UNDO = 322, /* Atari keyboard has Undo */ + + /* Add any other keys here */ + + SDLK_LAST +} SDLKey; + +/* Enumeration of valid key mods (possibly OR'd together) */ +typedef enum { + KMOD_NONE = 0x0000, + KMOD_LSHIFT= 0x0001, + KMOD_RSHIFT= 0x0002, + KMOD_LCTRL = 0x0040, + KMOD_RCTRL = 0x0080, + KMOD_LALT = 0x0100, + KMOD_RALT = 0x0200, + KMOD_LMETA = 0x0400, + KMOD_RMETA = 0x0800, + KMOD_NUM = 0x1000, + KMOD_CAPS = 0x2000, + KMOD_MODE = 0x4000, + KMOD_RESERVED = 0x8000 +} SDLMod; + +#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL) +#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT) +#define KMOD_ALT (KMOD_LALT|KMOD_RALT) +#define KMOD_META (KMOD_LMETA|KMOD_RMETA) + +#endif /* _SDL_keysym_h */ diff --git a/SDK/LIBS/dcinclude/SDL/SDL_main.h b/SDK/LIBS/dcinclude/SDL/SDL_main.h new file mode 100644 index 00000000..574cafa3 --- /dev/null +++ b/SDK/LIBS/dcinclude/SDL/SDL_main.h @@ -0,0 +1,101 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id: SDL_main.h,v 1.1 2003/02/27 03:46:29 bardtx Exp $"; +#endif + +#ifndef _SDL_main_h +#define _SDL_main_h + +/* Redefine main() on Win32 and MacOS so that it is called by winmain.c */ + +#if defined(WIN32) || defined(_WIN32) || \ + (defined(__MWERKS__) && !defined(__BEOS__)) || \ + defined(macintosh) || defined(__APPLE__) || \ + defined(__SYMBIAN32__) || defined(QWS) + +#ifdef __cplusplus +#define C_LINKAGE "C" +#else +#define C_LINKAGE +#endif /* __cplusplus */ + +/* The application's main() function must be called with C linkage, + and should be declared like this: +#ifdef __cplusplus +extern "C" +#endif + int main(int argc, char *argv[]) + { + } + */ +#define main SDL_main + +/* The prototype for the application's main() function */ +extern C_LINKAGE int SDL_main(int argc, char *argv[]); + + +/* From the SDL library code -- needed for registering the app on Win32 */ +#if defined(WIN32) +#include "SDL_types.h" +#include "begin_code.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* This should be called from your WinMain() function, if any */ +extern DECLSPEC void SDLCALL SDL_SetModuleHandle(void *hInst); +/* This can also be called, but is no longer necessary */ +extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, void *hInst); + +#ifdef __cplusplus +} +#endif +#include "close_code.h" +#endif + +/* From the SDL library code -- needed for registering QuickDraw on MacOS */ +#if defined(macintosh) +#include "begin_code.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declaration so we don't need to include QuickDraw.h */ +struct QDGlobals; + +/* This should be called from your main() function, if any */ +extern DECLSPEC void SDLCALL SDL_InitQuickDraw(struct QDGlobals *the_qd); + +#ifdef __cplusplus +} +#endif +#include "close_code.h" +#endif + +#endif /* Need to redefine main()? */ + +#endif /* _SDL_main_h */ diff --git a/SDK/LIBS/dcinclude/SDL/SDL_mouse.h b/SDK/LIBS/dcinclude/SDL/SDL_mouse.h new file mode 100644 index 00000000..595e1741 --- /dev/null +++ b/SDK/LIBS/dcinclude/SDL/SDL_mouse.h @@ -0,0 +1,140 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id: SDL_mouse.h,v 1.1 2003/02/27 03:46:29 bardtx Exp $"; +#endif + +/* Include file for SDL mouse event handling */ + +#ifndef _SDL_mouse_h +#define _SDL_mouse_h + +#include "SDL_types.h" +#include "SDL_video.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct WMcursor WMcursor; /* Implementation dependent */ +typedef struct { + SDL_Rect area; /* The area of the mouse cursor */ + Sint16 hot_x, hot_y; /* The "tip" of the cursor */ + Uint8 *data; /* B/W cursor data */ + Uint8 *mask; /* B/W cursor mask */ + Uint8 *save[2]; /* Place to save cursor area */ + WMcursor *wm_cursor; /* Window-manager cursor */ +} SDL_Cursor; + +/* Function prototypes */ +/* + * Retrieve the current state of the mouse. + * The current button state is returned as a button bitmask, which can + * be tested using the SDL_BUTTON(X) macros, and x and y are set to the + * current mouse cursor position. You can pass NULL for either x or y. + */ +extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int *x, int *y); + +/* + * Retrieve the current state of the mouse. + * The current button state is returned as a button bitmask, which can + * be tested using the SDL_BUTTON(X) macros, and x and y are set to the + * mouse deltas since the last call to SDL_GetRelativeMouseState(). + */ +extern DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState(int *x, int *y); + +/* + * Set the position of the mouse cursor (generates a mouse motion event) + */ +extern DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y); + +/* + * Create a cursor using the specified data and mask (in MSB format). + * The cursor width must be a multiple of 8 bits. + * + * The cursor is created in black and white according to the following: + * data mask resulting pixel on screen + * 0 1 White + * 1 1 Black + * 0 0 Transparent + * 1 0 Inverted color if possible, black if not. + * + * Cursors created with this function must be freed with SDL_FreeCursor(). + */ +extern DECLSPEC SDL_Cursor * SDLCALL SDL_CreateCursor + (Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y); + +/* + * Set the currently active cursor to the specified one. + * If the cursor is currently visible, the change will be immediately + * represented on the display. + */ +extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor *cursor); + +/* + * Returns the currently active cursor. + */ +extern DECLSPEC SDL_Cursor * SDLCALL SDL_GetCursor(void); + +/* + * Deallocates a cursor created with SDL_CreateCursor(). + */ +extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor *cursor); + +/* + * Toggle whether or not the cursor is shown on the screen. + * The cursor start off displayed, but can be turned off. + * SDL_ShowCursor() returns 1 if the cursor was being displayed + * before the call, or 0 if it was not. You can query the current + * state by passing a 'toggle' value of -1. + */ +extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle); + +/* Used as a mask when testing buttons in buttonstate + Button 1: Left mouse button + Button 2: Middle mouse button + Button 3: Right mouse button + Button 4: Mouse wheel up (may also be a real button) + Button 5: Mouse wheel down (may also be a real button) + */ +#define SDL_BUTTON(X) (SDL_PRESSED<<(X-1)) +#define SDL_BUTTON_LEFT 1 +#define SDL_BUTTON_MIDDLE 2 +#define SDL_BUTTON_RIGHT 3 +#define SDL_BUTTON_WHEELUP 4 +#define SDL_BUTTON_WHEELDOWN 5 +#define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT) +#define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE) +#define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT) + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_mouse_h */ diff --git a/SDK/LIBS/dcinclude/SDL/SDL_mutex.h b/SDK/LIBS/dcinclude/SDL/SDL_mutex.h new file mode 100644 index 00000000..d1d981bb --- /dev/null +++ b/SDK/LIBS/dcinclude/SDL/SDL_mutex.h @@ -0,0 +1,166 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id: SDL_mutex.h,v 1.1 2003/02/27 03:46:29 bardtx Exp $"; +#endif + +#ifndef _SDL_mutex_h +#define _SDL_mutex_h + +/* Functions to provide thread synchronization primitives + + These are independent of the other SDL routines. +*/ + +#include "SDL_main.h" +#include "SDL_types.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Synchronization functions which can time out return this value + if they time out. +*/ +#define SDL_MUTEX_TIMEDOUT 1 + +/* This is the timeout value which corresponds to never time out */ +#define SDL_MUTEX_MAXWAIT (~(Uint32)0) + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* Mutex functions */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* The SDL mutex structure, defined in SDL_mutex.c */ +struct SDL_mutex; +typedef struct SDL_mutex SDL_mutex; + +/* Create a mutex, initialized unlocked */ +extern DECLSPEC SDL_mutex * SDLCALL SDL_CreateMutex(void); + +/* Lock the mutex (Returns 0, or -1 on error) */ +#define SDL_LockMutex(m) SDL_mutexP(m) +extern DECLSPEC int SDLCALL SDL_mutexP(SDL_mutex *mutex); + +/* Unlock the mutex (Returns 0, or -1 on error) + It is an error to unlock a mutex that has not been locked by + the current thread, and doing so results in undefined behavior. + */ +#define SDL_UnlockMutex(m) SDL_mutexV(m) +extern DECLSPEC int SDLCALL SDL_mutexV(SDL_mutex *mutex); + +/* Destroy a mutex */ +extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex *mutex); + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* Semaphore functions */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* The SDL semaphore structure, defined in SDL_sem.c */ +struct SDL_semaphore; +typedef struct SDL_semaphore SDL_sem; + +/* Create a semaphore, initialized with value, returns NULL on failure. */ +extern DECLSPEC SDL_sem * SDLCALL SDL_CreateSemaphore(Uint32 initial_value); + +/* Destroy a semaphore */ +extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem *sem); + +/* This function suspends the calling thread until the semaphore pointed + * to by sem has a positive count. It then atomically decreases the semaphore + * count. + */ +extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem *sem); + +/* Non-blocking variant of SDL_SemWait(), returns 0 if the wait succeeds, + SDL_MUTEX_TIMEDOUT if the wait would block, and -1 on error. +*/ +extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem *sem); + +/* Variant of SDL_SemWait() with a timeout in milliseconds, returns 0 if + the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait does not succeed in + the allotted time, and -1 on error. + On some platforms this function is implemented by looping with a delay + of 1 ms, and so should be avoided if possible. +*/ +extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem *sem, Uint32 ms); + +/* Atomically increases the semaphore's count (not blocking), returns 0, + or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem *sem); + +/* Returns the current count of the semaphore */ +extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem *sem); + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* Condition variable functions */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* The SDL condition variable structure, defined in SDL_cond.c */ +struct SDL_cond; +typedef struct SDL_cond SDL_cond; + +/* Create a condition variable */ +extern DECLSPEC SDL_cond * SDLCALL SDL_CreateCond(void); + +/* Destroy a condition variable */ +extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond *cond); + +/* Restart one of the threads that are waiting on the condition variable, + returns 0 or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond *cond); + +/* Restart all threads that are waiting on the condition variable, + returns 0 or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond *cond); + +/* Wait on the condition variable, unlocking the provided mutex. + The mutex must be locked before entering this function! + Returns 0 when it is signaled, or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond *cond, SDL_mutex *mut); + +/* Waits for at most 'ms' milliseconds, and returns 0 if the condition + variable is signaled, SDL_MUTEX_TIMEDOUT if the condition is not + signaled in the allotted time, and -1 on error. + On some platforms this function is implemented by looping with a delay + of 1 ms, and so should be avoided if possible. +*/ +extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_mutex_h */ diff --git a/SDK/LIBS/dcinclude/SDL/SDL_name.h b/SDK/LIBS/dcinclude/SDL/SDL_name.h new file mode 100644 index 00000000..511619af --- /dev/null +++ b/SDK/LIBS/dcinclude/SDL/SDL_name.h @@ -0,0 +1,11 @@ + +#ifndef _SDLname_h_ +#define _SDLname_h_ + +#if defined(__STDC__) || defined(__cplusplus) +#define NeedFunctionPrototypes 1 +#endif + +#define SDL_NAME(X) SDL_##X + +#endif /* _SDLname_h_ */ diff --git a/SDK/LIBS/dcinclude/SDL/SDL_opengl.h b/SDK/LIBS/dcinclude/SDL/SDL_opengl.h new file mode 100644 index 00000000..89deb87d --- /dev/null +++ b/SDK/LIBS/dcinclude/SDL/SDL_opengl.h @@ -0,0 +1,2974 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id: SDL_opengl.h,v 1.1 2003/02/27 03:46:29 bardtx Exp $"; +#endif + +/* This is a simple file to encapsulate the OpenGL API headers */ + +#ifdef WIN32 +#define WIN32_LEAN_AND_MEAN +#include +#endif +#if defined(__APPLE__) && defined(__MACH__) +#include /* Header File For The OpenGL Library */ +#include /* Header File For The GLU Library */ +#else +#ifndef NO_SDL_GLEXT +#define __glext_h_ /* Don't let gl.h include glext.h */ +#endif +#include /* Header File For The OpenGL Library */ +#include /* Header File For The GLU Library */ +#ifndef NO_SDL_GLEXT +#undef __glext_h_ +#endif +#endif + +/* This file taken from "GLext.h" from the Jeff Molofee OpenGL tutorials. + It is included here because glext.h is not available on some systems. + If you don't want this version included, simply define "NO_SDL_GLEXT" + */ +#ifndef NO_SDL_GLEXT +#if !defined(__glext_h_) && !defined(GL_GLEXT_LEGACY) +#define __glext_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. +*/ + +#ifndef APIENTRY +#define APIENTRY +#endif + +/*************************************************************/ + +/* Header file version number, required by OpenGL ABI for Linux */ +#define GL_GLEXT_VERSION 6 + +#ifndef GL_VERSION_1_2 +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_BLEND_COLOR 0x8005 +#define GL_FUNC_ADD 0x8006 +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +#define GL_BLEND_EQUATION 0x8009 +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#define GL_CONVOLUTION_1D 0x8010 +#define GL_CONVOLUTION_2D 0x8011 +#define GL_SEPARABLE_2D 0x8012 +#define GL_CONVOLUTION_BORDER_MODE 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS 0x8015 +#define GL_REDUCE 0x8016 +#define GL_CONVOLUTION_FORMAT 0x8017 +#define GL_CONVOLUTION_WIDTH 0x8018 +#define GL_CONVOLUTION_HEIGHT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 +#define GL_HISTOGRAM 0x8024 +#define GL_PROXY_HISTOGRAM 0x8025 +#define GL_HISTOGRAM_WIDTH 0x8026 +#define GL_HISTOGRAM_FORMAT 0x8027 +#define GL_HISTOGRAM_RED_SIZE 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C +#define GL_HISTOGRAM_SINK 0x802D +#define GL_MINMAX 0x802E +#define GL_MINMAX_FORMAT 0x802F +#define GL_MINMAX_SINK 0x8030 +#define GL_TABLE_TOO_LARGE 0x8031 +#define GL_UNSIGNED_BYTE_3_3_2 0x8032 +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_INT_8_8_8_8 0x8035 +#define GL_UNSIGNED_INT_10_10_10_2 0x8036 +#define GL_RESCALE_NORMAL 0x803A +#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 +#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 +#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 +#define GL_COLOR_MATRIX 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA +#define GL_COLOR_TABLE 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 +#define GL_PROXY_COLOR_TABLE 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 +#define GL_COLOR_TABLE_SCALE 0x80D6 +#define GL_COLOR_TABLE_BIAS 0x80D7 +#define GL_COLOR_TABLE_FORMAT 0x80D8 +#define GL_COLOR_TABLE_WIDTH 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_TEXTURE_MIN_LOD 0x813A +#define GL_TEXTURE_MAX_LOD 0x813B +#define GL_TEXTURE_BASE_LEVEL 0x813C +#define GL_TEXTURE_MAX_LEVEL 0x813D +#endif + +#ifndef GL_ARB_multitexture +#define GL_TEXTURE0_ARB 0x84C0 +#define GL_TEXTURE1_ARB 0x84C1 +#define GL_TEXTURE2_ARB 0x84C2 +#define GL_TEXTURE3_ARB 0x84C3 +#define GL_TEXTURE4_ARB 0x84C4 +#define GL_TEXTURE5_ARB 0x84C5 +#define GL_TEXTURE6_ARB 0x84C6 +#define GL_TEXTURE7_ARB 0x84C7 +#define GL_TEXTURE8_ARB 0x84C8 +#define GL_TEXTURE9_ARB 0x84C9 +#define GL_TEXTURE10_ARB 0x84CA +#define GL_TEXTURE11_ARB 0x84CB +#define GL_TEXTURE12_ARB 0x84CC +#define GL_TEXTURE13_ARB 0x84CD +#define GL_TEXTURE14_ARB 0x84CE +#define GL_TEXTURE15_ARB 0x84CF +#define GL_TEXTURE16_ARB 0x84D0 +#define GL_TEXTURE17_ARB 0x84D1 +#define GL_TEXTURE18_ARB 0x84D2 +#define GL_TEXTURE19_ARB 0x84D3 +#define GL_TEXTURE20_ARB 0x84D4 +#define GL_TEXTURE21_ARB 0x84D5 +#define GL_TEXTURE22_ARB 0x84D6 +#define GL_TEXTURE23_ARB 0x84D7 +#define GL_TEXTURE24_ARB 0x84D8 +#define GL_TEXTURE25_ARB 0x84D9 +#define GL_TEXTURE26_ARB 0x84DA +#define GL_TEXTURE27_ARB 0x84DB +#define GL_TEXTURE28_ARB 0x84DC +#define GL_TEXTURE29_ARB 0x84DD +#define GL_TEXTURE30_ARB 0x84DE +#define GL_TEXTURE31_ARB 0x84DF +#define GL_ACTIVE_TEXTURE_ARB 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 +#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 +#endif + +#ifndef GL_ARB_transpose_matrix +#define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3 +#define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4 +#define GL_TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5 +#define GL_TRANSPOSE_COLOR_MATRIX_ARB 0x84E6 +#endif + +#ifndef GL_ARB_multisample +#define GL_MULTISAMPLE_ARB 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F +#define GL_SAMPLE_COVERAGE_ARB 0x80A0 +#define GL_SAMPLE_BUFFERS_ARB 0x80A8 +#define GL_SAMPLES_ARB 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB +#define GL_MULTISAMPLE_BIT_ARB 0x20000000 +#endif + +#ifndef GL_ARB_texture_cube_map +#define GL_NORMAL_MAP_ARB 0x8511 +#define GL_REFLECTION_MAP_ARB 0x8512 +#define GL_TEXTURE_CUBE_MAP_ARB 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C +#endif + +#ifndef GL_ARB_texture_compression +#define GL_COMPRESSED_ALPHA_ARB 0x84E9 +#define GL_COMPRESSED_LUMINANCE_ARB 0x84EA +#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB +#define GL_COMPRESSED_INTENSITY_ARB 0x84EC +#define GL_COMPRESSED_RGB_ARB 0x84ED +#define GL_COMPRESSED_RGBA_ARB 0x84EE +#define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0 +#define GL_TEXTURE_COMPRESSED_ARB 0x86A1 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3 +#endif + +#ifndef GL_EXT_abgr +#define GL_ABGR_EXT 0x8000 +#endif + +#ifndef GL_EXT_blend_color +#define GL_CONSTANT_COLOR_EXT 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002 +#define GL_CONSTANT_ALPHA_EXT 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004 +#define GL_BLEND_COLOR_EXT 0x8005 +#endif + +#ifndef GL_EXT_polygon_offset +#define GL_POLYGON_OFFSET_EXT 0x8037 +#define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038 +#define GL_POLYGON_OFFSET_BIAS_EXT 0x8039 +#endif + +#ifndef GL_EXT_texture +#define GL_ALPHA4_EXT 0x803B +#define GL_ALPHA8_EXT 0x803C +#define GL_ALPHA12_EXT 0x803D +#define GL_ALPHA16_EXT 0x803E +#define GL_LUMINANCE4_EXT 0x803F +#define GL_LUMINANCE8_EXT 0x8040 +#define GL_LUMINANCE12_EXT 0x8041 +#define GL_LUMINANCE16_EXT 0x8042 +#define GL_LUMINANCE4_ALPHA4_EXT 0x8043 +#define GL_LUMINANCE6_ALPHA2_EXT 0x8044 +#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 +#define GL_LUMINANCE12_ALPHA4_EXT 0x8046 +#define GL_LUMINANCE12_ALPHA12_EXT 0x8047 +#define GL_LUMINANCE16_ALPHA16_EXT 0x8048 +#define GL_INTENSITY_EXT 0x8049 +#define GL_INTENSITY4_EXT 0x804A +#define GL_INTENSITY8_EXT 0x804B +#define GL_INTENSITY12_EXT 0x804C +#define GL_INTENSITY16_EXT 0x804D +#define GL_RGB2_EXT 0x804E +#define GL_RGB4_EXT 0x804F +#define GL_RGB5_EXT 0x8050 +#define GL_RGB8_EXT 0x8051 +#define GL_RGB10_EXT 0x8052 +#define GL_RGB12_EXT 0x8053 +#define GL_RGB16_EXT 0x8054 +#define GL_RGBA2_EXT 0x8055 +#define GL_RGBA4_EXT 0x8056 +#define GL_RGB5_A1_EXT 0x8057 +#define GL_RGBA8_EXT 0x8058 +#define GL_RGB10_A2_EXT 0x8059 +#define GL_RGBA12_EXT 0x805A +#define GL_RGBA16_EXT 0x805B +#define GL_TEXTURE_RED_SIZE_EXT 0x805C +#define GL_TEXTURE_GREEN_SIZE_EXT 0x805D +#define GL_TEXTURE_BLUE_SIZE_EXT 0x805E +#define GL_TEXTURE_ALPHA_SIZE_EXT 0x805F +#define GL_TEXTURE_LUMINANCE_SIZE_EXT 0x8060 +#define GL_TEXTURE_INTENSITY_SIZE_EXT 0x8061 +#define GL_REPLACE_EXT 0x8062 +#define GL_PROXY_TEXTURE_1D_EXT 0x8063 +#define GL_PROXY_TEXTURE_2D_EXT 0x8064 +#define GL_TEXTURE_TOO_LARGE_EXT 0x8065 +#endif + +#ifndef GL_EXT_texture3D +#define GL_PACK_SKIP_IMAGES 0x806B +#define GL_PACK_SKIP_IMAGES_EXT 0x806B +#define GL_PACK_IMAGE_HEIGHT 0x806C +#define GL_PACK_IMAGE_HEIGHT_EXT 0x806C +#define GL_UNPACK_SKIP_IMAGES 0x806D +#define GL_UNPACK_SKIP_IMAGES_EXT 0x806D +#define GL_UNPACK_IMAGE_HEIGHT 0x806E +#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E +#define GL_TEXTURE_3D 0x806F +#define GL_TEXTURE_3D_EXT 0x806F +#define GL_PROXY_TEXTURE_3D 0x8070 +#define GL_PROXY_TEXTURE_3D_EXT 0x8070 +#define GL_TEXTURE_DEPTH 0x8071 +#define GL_TEXTURE_DEPTH_EXT 0x8071 +#define GL_TEXTURE_WRAP_R 0x8072 +#define GL_TEXTURE_WRAP_R_EXT 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE 0x8073 +#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073 +#endif + +#ifndef GL_SGIS_texture_filter4 +#define GL_FILTER4_SGIS 0x8146 +#define GL_TEXTURE_FILTER4_SIZE_SGIS 0x8147 +#endif + +#ifndef GL_EXT_subtexture +#endif + +#ifndef GL_EXT_copy_texture +#endif + +#ifndef GL_EXT_histogram +#define GL_HISTOGRAM_EXT 0x8024 +#define GL_PROXY_HISTOGRAM_EXT 0x8025 +#define GL_HISTOGRAM_WIDTH_EXT 0x8026 +#define GL_HISTOGRAM_FORMAT_EXT 0x8027 +#define GL_HISTOGRAM_RED_SIZE_EXT 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE_EXT 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE_EXT 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE_EXT 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE_EXT 0x802C +#define GL_HISTOGRAM_SINK_EXT 0x802D +#define GL_MINMAX_EXT 0x802E +#define GL_MINMAX_FORMAT_EXT 0x802F +#define GL_MINMAX_SINK_EXT 0x8030 +#define GL_TABLE_TOO_LARGE_EXT 0x8031 +#endif + +#ifndef GL_EXT_convolution +#define GL_CONVOLUTION_1D_EXT 0x8010 +#define GL_CONVOLUTION_2D_EXT 0x8011 +#define GL_SEPARABLE_2D_EXT 0x8012 +#define GL_CONVOLUTION_BORDER_MODE_EXT 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE_EXT 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS_EXT 0x8015 +#define GL_REDUCE_EXT 0x8016 +#define GL_CONVOLUTION_FORMAT_EXT 0x8017 +#define GL_CONVOLUTION_WIDTH_EXT 0x8018 +#define GL_CONVOLUTION_HEIGHT_EXT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH_EXT 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT_EXT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS_EXT 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023 +#endif + +#ifndef GL_SGI_color_matrix +#define GL_COLOR_MATRIX_SGI 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB +#endif + +#ifndef GL_SGI_color_table +#define GL_COLOR_TABLE_SGI 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2 +#define GL_PROXY_COLOR_TABLE_SGI 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5 +#define GL_COLOR_TABLE_SCALE_SGI 0x80D6 +#define GL_COLOR_TABLE_BIAS_SGI 0x80D7 +#define GL_COLOR_TABLE_FORMAT_SGI 0x80D8 +#define GL_COLOR_TABLE_WIDTH_SGI 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE_SGI 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE_SGI 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE_SGI 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF +#endif + +#ifndef GL_SGIS_pixel_texture +#define GL_PIXEL_TEXTURE_SGIS 0x8353 +#define GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS 0x8354 +#define GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS 0x8355 +#define GL_PIXEL_GROUP_COLOR_SGIS 0x8356 +#endif + +#ifndef GL_SGIX_pixel_texture +#define GL_PIXEL_TEX_GEN_SGIX 0x8139 +#define GL_PIXEL_TEX_GEN_MODE_SGIX 0x832B +#endif + +#ifndef GL_SGIS_texture4D +#define GL_PACK_SKIP_VOLUMES_SGIS 0x8130 +#define GL_PACK_IMAGE_DEPTH_SGIS 0x8131 +#define GL_UNPACK_SKIP_VOLUMES_SGIS 0x8132 +#define GL_UNPACK_IMAGE_DEPTH_SGIS 0x8133 +#define GL_TEXTURE_4D_SGIS 0x8134 +#define GL_PROXY_TEXTURE_4D_SGIS 0x8135 +#define GL_TEXTURE_4DSIZE_SGIS 0x8136 +#define GL_TEXTURE_WRAP_Q_SGIS 0x8137 +#define GL_MAX_4D_TEXTURE_SIZE_SGIS 0x8138 +#define GL_TEXTURE_4D_BINDING_SGIS 0x814F +#endif + +#ifndef GL_SGI_texture_color_table +#define GL_TEXTURE_COLOR_TABLE_SGI 0x80BC +#define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD +#endif + +#ifndef GL_EXT_cmyka +#define GL_CMYK_EXT 0x800C +#define GL_CMYKA_EXT 0x800D +#define GL_PACK_CMYK_HINT_EXT 0x800E +#define GL_UNPACK_CMYK_HINT_EXT 0x800F +#endif + +#ifndef GL_EXT_texture_object +#define GL_TEXTURE_PRIORITY_EXT 0x8066 +#define GL_TEXTURE_RESIDENT_EXT 0x8067 +#define GL_TEXTURE_1D_BINDING_EXT 0x8068 +#define GL_TEXTURE_2D_BINDING_EXT 0x8069 +#define GL_TEXTURE_3D_BINDING_EXT 0x806A +#endif + +#ifndef GL_SGIS_detail_texture +#define GL_DETAIL_TEXTURE_2D_SGIS 0x8095 +#define GL_DETAIL_TEXTURE_2D_BINDING_SGIS 0x8096 +#define GL_LINEAR_DETAIL_SGIS 0x8097 +#define GL_LINEAR_DETAIL_ALPHA_SGIS 0x8098 +#define GL_LINEAR_DETAIL_COLOR_SGIS 0x8099 +#define GL_DETAIL_TEXTURE_LEVEL_SGIS 0x809A +#define GL_DETAIL_TEXTURE_MODE_SGIS 0x809B +#define GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS 0x809C +#endif + +#ifndef GL_SGIS_sharpen_texture +#define GL_LINEAR_SHARPEN_SGIS 0x80AD +#define GL_LINEAR_SHARPEN_ALPHA_SGIS 0x80AE +#define GL_LINEAR_SHARPEN_COLOR_SGIS 0x80AF +#define GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS 0x80B0 +#endif + +#ifndef GL_EXT_packed_pixels +#define GL_UNSIGNED_BYTE_3_3_2_EXT 0x8032 +#define GL_UNSIGNED_SHORT_4_4_4_4_EXT 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1_EXT 0x8034 +#define GL_UNSIGNED_INT_8_8_8_8_EXT 0x8035 +#define GL_UNSIGNED_INT_10_10_10_2_EXT 0x8036 +#endif + +#ifndef GL_SGIS_texture_lod +#define GL_TEXTURE_MIN_LOD_SGIS 0x813A +#define GL_TEXTURE_MAX_LOD_SGIS 0x813B +#define GL_TEXTURE_BASE_LEVEL_SGIS 0x813C +#define GL_TEXTURE_MAX_LEVEL_SGIS 0x813D +#endif + +#ifndef GL_SGIS_multisample +#define GL_MULTISAMPLE_SGIS 0x809D +#define GL_SAMPLE_ALPHA_TO_MASK_SGIS 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_SGIS 0x809F +#define GL_SAMPLE_MASK_SGIS 0x80A0 +#define GL_1PASS_SGIS 0x80A1 +#define GL_2PASS_0_SGIS 0x80A2 +#define GL_2PASS_1_SGIS 0x80A3 +#define GL_4PASS_0_SGIS 0x80A4 +#define GL_4PASS_1_SGIS 0x80A5 +#define GL_4PASS_2_SGIS 0x80A6 +#define GL_4PASS_3_SGIS 0x80A7 +#define GL_SAMPLE_BUFFERS_SGIS 0x80A8 +#define GL_SAMPLES_SGIS 0x80A9 +#define GL_SAMPLE_MASK_VALUE_SGIS 0x80AA +#define GL_SAMPLE_MASK_INVERT_SGIS 0x80AB +#define GL_SAMPLE_PATTERN_SGIS 0x80AC +#endif + +#ifndef GL_EXT_rescale_normal +#define GL_RESCALE_NORMAL_EXT 0x803A +#endif + +#ifndef GL_EXT_vertex_array +#define GL_VERTEX_ARRAY_EXT 0x8074 +#define GL_NORMAL_ARRAY_EXT 0x8075 +#define GL_COLOR_ARRAY_EXT 0x8076 +#define GL_INDEX_ARRAY_EXT 0x8077 +#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078 +#define GL_EDGE_FLAG_ARRAY_EXT 0x8079 +#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A +#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B +#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C +#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D +#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E +#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F +#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080 +#define GL_COLOR_ARRAY_SIZE_EXT 0x8081 +#define GL_COLOR_ARRAY_TYPE_EXT 0x8082 +#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083 +#define GL_COLOR_ARRAY_COUNT_EXT 0x8084 +#define GL_INDEX_ARRAY_TYPE_EXT 0x8085 +#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086 +#define GL_INDEX_ARRAY_COUNT_EXT 0x8087 +#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A +#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B +#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C +#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D +#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E +#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F +#define GL_COLOR_ARRAY_POINTER_EXT 0x8090 +#define GL_INDEX_ARRAY_POINTER_EXT 0x8091 +#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092 +#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093 +#endif + +#ifndef GL_EXT_misc_attribute +#endif + +#ifndef GL_SGIS_generate_mipmap +#define GL_GENERATE_MIPMAP_SGIS 0x8191 +#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192 +#endif + +#ifndef GL_SGIX_clipmap +#define GL_LINEAR_CLIPMAP_LINEAR_SGIX 0x8170 +#define GL_TEXTURE_CLIPMAP_CENTER_SGIX 0x8171 +#define GL_TEXTURE_CLIPMAP_FRAME_SGIX 0x8172 +#define GL_TEXTURE_CLIPMAP_OFFSET_SGIX 0x8173 +#define GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8174 +#define GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX 0x8175 +#define GL_TEXTURE_CLIPMAP_DEPTH_SGIX 0x8176 +#define GL_MAX_CLIPMAP_DEPTH_SGIX 0x8177 +#define GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8178 +#define GL_NEAREST_CLIPMAP_NEAREST_SGIX 0x844D +#define GL_NEAREST_CLIPMAP_LINEAR_SGIX 0x844E +#define GL_LINEAR_CLIPMAP_NEAREST_SGIX 0x844F +#endif + +#ifndef GL_SGIX_shadow +#define GL_TEXTURE_COMPARE_SGIX 0x819A +#define GL_TEXTURE_COMPARE_OPERATOR_SGIX 0x819B +#define GL_TEXTURE_LEQUAL_R_SGIX 0x819C +#define GL_TEXTURE_GEQUAL_R_SGIX 0x819D +#endif + +#ifndef GL_SGIS_texture_edge_clamp +#define GL_CLAMP_TO_EDGE_SGIS 0x812F +#endif + +#ifndef GL_SGIS_texture_border_clamp +#define GL_CLAMP_TO_BORDER_SGIS 0x812D +#endif + +#ifndef GL_EXT_blend_minmax +#define GL_FUNC_ADD_EXT 0x8006 +#define GL_MIN_EXT 0x8007 +#define GL_MAX_EXT 0x8008 +#define GL_BLEND_EQUATION_EXT 0x8009 +#endif + +#ifndef GL_EXT_blend_subtract +#define GL_FUNC_SUBTRACT_EXT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B +#endif + +#ifndef GL_EXT_blend_logic_op +#endif + +#ifndef GL_SGIX_interlace +#define GL_INTERLACE_SGIX 0x8094 +#endif + +#ifndef GL_SGIX_pixel_tiles +#define GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX 0x813E +#define GL_PIXEL_TILE_CACHE_INCREMENT_SGIX 0x813F +#define GL_PIXEL_TILE_WIDTH_SGIX 0x8140 +#define GL_PIXEL_TILE_HEIGHT_SGIX 0x8141 +#define GL_PIXEL_TILE_GRID_WIDTH_SGIX 0x8142 +#define GL_PIXEL_TILE_GRID_HEIGHT_SGIX 0x8143 +#define GL_PIXEL_TILE_GRID_DEPTH_SGIX 0x8144 +#define GL_PIXEL_TILE_CACHE_SIZE_SGIX 0x8145 +#endif + +#ifndef GL_SGIS_texture_select +#define GL_DUAL_ALPHA4_SGIS 0x8110 +#define GL_DUAL_ALPHA8_SGIS 0x8111 +#define GL_DUAL_ALPHA12_SGIS 0x8112 +#define GL_DUAL_ALPHA16_SGIS 0x8113 +#define GL_DUAL_LUMINANCE4_SGIS 0x8114 +#define GL_DUAL_LUMINANCE8_SGIS 0x8115 +#define GL_DUAL_LUMINANCE12_SGIS 0x8116 +#define GL_DUAL_LUMINANCE16_SGIS 0x8117 +#define GL_DUAL_INTENSITY4_SGIS 0x8118 +#define GL_DUAL_INTENSITY8_SGIS 0x8119 +#define GL_DUAL_INTENSITY12_SGIS 0x811A +#define GL_DUAL_INTENSITY16_SGIS 0x811B +#define GL_DUAL_LUMINANCE_ALPHA4_SGIS 0x811C +#define GL_DUAL_LUMINANCE_ALPHA8_SGIS 0x811D +#define GL_QUAD_ALPHA4_SGIS 0x811E +#define GL_QUAD_ALPHA8_SGIS 0x811F +#define GL_QUAD_LUMINANCE4_SGIS 0x8120 +#define GL_QUAD_LUMINANCE8_SGIS 0x8121 +#define GL_QUAD_INTENSITY4_SGIS 0x8122 +#define GL_QUAD_INTENSITY8_SGIS 0x8123 +#define GL_DUAL_TEXTURE_SELECT_SGIS 0x8124 +#define GL_QUAD_TEXTURE_SELECT_SGIS 0x8125 +#endif + +#ifndef GL_SGIX_sprite +#define GL_SPRITE_SGIX 0x8148 +#define GL_SPRITE_MODE_SGIX 0x8149 +#define GL_SPRITE_AXIS_SGIX 0x814A +#define GL_SPRITE_TRANSLATION_SGIX 0x814B +#define GL_SPRITE_AXIAL_SGIX 0x814C +#define GL_SPRITE_OBJECT_ALIGNED_SGIX 0x814D +#define GL_SPRITE_EYE_ALIGNED_SGIX 0x814E +#endif + +#ifndef GL_SGIX_texture_multi_buffer +#define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E +#endif + +#ifndef GL_SGIS_point_parameters +#define GL_POINT_SIZE_MIN_EXT 0x8126 +#define GL_POINT_SIZE_MIN_SGIS 0x8126 +#define GL_POINT_SIZE_MAX_EXT 0x8127 +#define GL_POINT_SIZE_MAX_SGIS 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 +#define GL_POINT_FADE_THRESHOLD_SIZE_SGIS 0x8128 +#define GL_DISTANCE_ATTENUATION_EXT 0x8129 +#define GL_DISTANCE_ATTENUATION_SGIS 0x8129 +#endif + +#ifndef GL_SGIX_instruments +#define GL_INSTRUMENT_BUFFER_POINTER_SGIX 0x8180 +#define GL_INSTRUMENT_MEASUREMENTS_SGIX 0x8181 +#endif + +#ifndef GL_SGIX_texture_scale_bias +#define GL_POST_TEXTURE_FILTER_BIAS_SGIX 0x8179 +#define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A +#define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B +#define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C +#endif + +#ifndef GL_SGIX_framezoom +#define GL_FRAMEZOOM_SGIX 0x818B +#define GL_FRAMEZOOM_FACTOR_SGIX 0x818C +#define GL_MAX_FRAMEZOOM_FACTOR_SGIX 0x818D +#endif + +#ifndef GL_SGIX_tag_sample_buffer +#endif + +#ifndef GL_SGIX_reference_plane +#define GL_REFERENCE_PLANE_SGIX 0x817D +#define GL_REFERENCE_PLANE_EQUATION_SGIX 0x817E +#endif + +#ifndef GL_SGIX_flush_raster +#endif + +#ifndef GL_SGIX_depth_texture +#define GL_DEPTH_COMPONENT16_SGIX 0x81A5 +#define GL_DEPTH_COMPONENT24_SGIX 0x81A6 +#define GL_DEPTH_COMPONENT32_SGIX 0x81A7 +#endif + +#ifndef GL_SGIS_fog_function +#define GL_FOG_FUNC_SGIS 0x812A +#define GL_FOG_FUNC_POINTS_SGIS 0x812B +#define GL_MAX_FOG_FUNC_POINTS_SGIS 0x812C +#endif + +#ifndef GL_SGIX_fog_offset +#define GL_FOG_OFFSET_SGIX 0x8198 +#define GL_FOG_OFFSET_VALUE_SGIX 0x8199 +#endif + +#ifndef GL_HP_image_transform +#define GL_IMAGE_SCALE_X_HP 0x8155 +#define GL_IMAGE_SCALE_Y_HP 0x8156 +#define GL_IMAGE_TRANSLATE_X_HP 0x8157 +#define GL_IMAGE_TRANSLATE_Y_HP 0x8158 +#define GL_IMAGE_ROTATE_ANGLE_HP 0x8159 +#define GL_IMAGE_ROTATE_ORIGIN_X_HP 0x815A +#define GL_IMAGE_ROTATE_ORIGIN_Y_HP 0x815B +#define GL_IMAGE_MAG_FILTER_HP 0x815C +#define GL_IMAGE_MIN_FILTER_HP 0x815D +#define GL_IMAGE_CUBIC_WEIGHT_HP 0x815E +#define GL_CUBIC_HP 0x815F +#define GL_AVERAGE_HP 0x8160 +#define GL_IMAGE_TRANSFORM_2D_HP 0x8161 +#define GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8162 +#define GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8163 +#endif + +#ifndef GL_HP_convolution_border_modes +#define GL_IGNORE_BORDER_HP 0x8150 +#define GL_CONSTANT_BORDER_HP 0x8151 +#define GL_REPLICATE_BORDER_HP 0x8153 +#define GL_CONVOLUTION_BORDER_COLOR_HP 0x8154 +#endif + +#ifndef GL_INGR_palette_buffer +#endif + +#ifndef GL_SGIX_texture_add_env +#define GL_TEXTURE_ENV_BIAS_SGIX 0x80BE +#endif + +#ifndef GL_EXT_color_subtable +#endif + +#ifndef GL_PGI_vertex_hints +#define GL_VERTEX_DATA_HINT_PGI 0x1A22A +#define GL_VERTEX_CONSISTENT_HINT_PGI 0x1A22B +#define GL_MATERIAL_SIDE_HINT_PGI 0x1A22C +#define GL_MAX_VERTEX_HINT_PGI 0x1A22D +#define GL_COLOR3_BIT_PGI 0x00010000 +#define GL_COLOR4_BIT_PGI 0x00020000 +#define GL_EDGEFLAG_BIT_PGI 0x00040000 +#define GL_INDEX_BIT_PGI 0x00080000 +#define GL_MAT_AMBIENT_BIT_PGI 0x00100000 +#define GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000 +#define GL_MAT_DIFFUSE_BIT_PGI 0x00400000 +#define GL_MAT_EMISSION_BIT_PGI 0x00800000 +#define GL_MAT_COLOR_INDEXES_BIT_PGI 0x01000000 +#define GL_MAT_SHININESS_BIT_PGI 0x02000000 +#define GL_MAT_SPECULAR_BIT_PGI 0x04000000 +#define GL_NORMAL_BIT_PGI 0x08000000 +#define GL_TEXCOORD1_BIT_PGI 0x10000000 +#define GL_TEXCOORD2_BIT_PGI 0x20000000 +#define GL_TEXCOORD3_BIT_PGI 0x40000000 +#define GL_TEXCOORD4_BIT_PGI 0x80000000 +#define GL_VERTEX23_BIT_PGI 0x00000004 +#define GL_VERTEX4_BIT_PGI 0x00000008 +#endif + +#ifndef GL_PGI_misc_hints +#define GL_PREFER_DOUBLEBUFFER_HINT_PGI 0x1A1F8 +#define GL_CONSERVE_MEMORY_HINT_PGI 0x1A1FD +#define GL_RECLAIM_MEMORY_HINT_PGI 0x1A1FE +#define GL_NATIVE_GRAPHICS_HANDLE_PGI 0x1A202 +#define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 0x1A203 +#define GL_NATIVE_GRAPHICS_END_HINT_PGI 0x1A204 +#define GL_ALWAYS_FAST_HINT_PGI 0x1A20C +#define GL_ALWAYS_SOFT_HINT_PGI 0x1A20D +#define GL_ALLOW_DRAW_OBJ_HINT_PGI 0x1A20E +#define GL_ALLOW_DRAW_WIN_HINT_PGI 0x1A20F +#define GL_ALLOW_DRAW_FRG_HINT_PGI 0x1A210 +#define GL_ALLOW_DRAW_MEM_HINT_PGI 0x1A211 +#define GL_STRICT_DEPTHFUNC_HINT_PGI 0x1A216 +#define GL_STRICT_LIGHTING_HINT_PGI 0x1A217 +#define GL_STRICT_SCISSOR_HINT_PGI 0x1A218 +#define GL_FULL_STIPPLE_HINT_PGI 0x1A219 +#define GL_CLIP_NEAR_HINT_PGI 0x1A220 +#define GL_CLIP_FAR_HINT_PGI 0x1A221 +#define GL_WIDE_LINE_HINT_PGI 0x1A222 +#define GL_BACK_NORMALS_HINT_PGI 0x1A223 +#endif + +#ifndef GL_EXT_paletted_texture +#define GL_COLOR_INDEX1_EXT 0x80E2 +#define GL_COLOR_INDEX2_EXT 0x80E3 +#define GL_COLOR_INDEX4_EXT 0x80E4 +#define GL_COLOR_INDEX8_EXT 0x80E5 +#define GL_COLOR_INDEX12_EXT 0x80E6 +#define GL_COLOR_INDEX16_EXT 0x80E7 +#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED +#endif + +#ifndef GL_EXT_clip_volume_hint +#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0 +#endif + +#ifndef GL_SGIX_list_priority +#define GL_LIST_PRIORITY_SGIX 0x8182 +#endif + +#ifndef GL_SGIX_ir_instrument1 +#define GL_IR_INSTRUMENT1_SGIX 0x817F +#endif + +#ifndef GL_SGIX_calligraphic_fragment +#define GL_CALLIGRAPHIC_FRAGMENT_SGIX 0x8183 +#endif + +#ifndef GL_SGIX_texture_lod_bias +#define GL_TEXTURE_LOD_BIAS_S_SGIX 0x818E +#define GL_TEXTURE_LOD_BIAS_T_SGIX 0x818F +#define GL_TEXTURE_LOD_BIAS_R_SGIX 0x8190 +#endif + +#ifndef GL_SGIX_shadow_ambient +#define GL_SHADOW_AMBIENT_SGIX 0x80BF +#endif + +#ifndef GL_EXT_index_texture +#endif + +#ifndef GL_EXT_index_material +#define GL_INDEX_MATERIAL_EXT 0x81B8 +#define GL_INDEX_MATERIAL_PARAMETER_EXT 0x81B9 +#define GL_INDEX_MATERIAL_FACE_EXT 0x81BA +#endif + +#ifndef GL_EXT_index_func +#define GL_INDEX_TEST_EXT 0x81B5 +#define GL_INDEX_TEST_FUNC_EXT 0x81B6 +#define GL_INDEX_TEST_REF_EXT 0x81B7 +#endif + +#ifndef GL_EXT_index_array_formats +#define GL_IUI_V2F_EXT 0x81AD +#define GL_IUI_V3F_EXT 0x81AE +#define GL_IUI_N3F_V2F_EXT 0x81AF +#define GL_IUI_N3F_V3F_EXT 0x81B0 +#define GL_T2F_IUI_V2F_EXT 0x81B1 +#define GL_T2F_IUI_V3F_EXT 0x81B2 +#define GL_T2F_IUI_N3F_V2F_EXT 0x81B3 +#define GL_T2F_IUI_N3F_V3F_EXT 0x81B4 +#endif + +#ifndef GL_EXT_compiled_vertex_array +#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8 +#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9 +#endif + +#ifndef GL_EXT_cull_vertex +#define GL_CULL_VERTEX_EXT 0x81AA +#define GL_CULL_VERTEX_EYE_POSITION_EXT 0x81AB +#define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC +#endif + +#ifndef GL_SGIX_ycrcb +#define GL_YCRCB_422_SGIX 0x81BB +#define GL_YCRCB_444_SGIX 0x81BC +#endif + +#ifndef GL_SGIX_fragment_lighting +#define GL_FRAGMENT_LIGHTING_SGIX 0x8400 +#define GL_FRAGMENT_COLOR_MATERIAL_SGIX 0x8401 +#define GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX 0x8402 +#define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX 0x8403 +#define GL_MAX_FRAGMENT_LIGHTS_SGIX 0x8404 +#define GL_MAX_ACTIVE_LIGHTS_SGIX 0x8405 +#define GL_CURRENT_RASTER_NORMAL_SGIX 0x8406 +#define GL_LIGHT_ENV_MODE_SGIX 0x8407 +#define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX 0x8408 +#define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX 0x8409 +#define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX 0x840A +#define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX 0x840B +#define GL_FRAGMENT_LIGHT0_SGIX 0x840C +#define GL_FRAGMENT_LIGHT1_SGIX 0x840D +#define GL_FRAGMENT_LIGHT2_SGIX 0x840E +#define GL_FRAGMENT_LIGHT3_SGIX 0x840F +#define GL_FRAGMENT_LIGHT4_SGIX 0x8410 +#define GL_FRAGMENT_LIGHT5_SGIX 0x8411 +#define GL_FRAGMENT_LIGHT6_SGIX 0x8412 +#define GL_FRAGMENT_LIGHT7_SGIX 0x8413 +#endif + +#ifndef GL_IBM_rasterpos_clip +#define GL_RASTER_POSITION_UNCLIPPED_IBM 0x19262 +#endif + +#ifndef GL_HP_texture_lighting +#define GL_TEXTURE_LIGHTING_MODE_HP 0x8167 +#define GL_TEXTURE_POST_SPECULAR_HP 0x8168 +#define GL_TEXTURE_PRE_SPECULAR_HP 0x8169 +#endif + +#ifndef GL_EXT_draw_range_elements +#define GL_MAX_ELEMENTS_VERTICES_EXT 0x80E8 +#define GL_MAX_ELEMENTS_INDICES_EXT 0x80E9 +#endif + +#ifndef GL_WIN_phong_shading +#define GL_PHONG_WIN 0x80EA +#define GL_PHONG_HINT_WIN 0x80EB +#endif + +#ifndef GL_WIN_specular_fog +#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC +#endif + +#ifndef GL_EXT_light_texture +#define GL_FRAGMENT_MATERIAL_EXT 0x8349 +#define GL_FRAGMENT_NORMAL_EXT 0x834A +#define GL_FRAGMENT_COLOR_EXT 0x834C +#define GL_ATTENUATION_EXT 0x834D +#define GL_SHADOW_ATTENUATION_EXT 0x834E +#define GL_TEXTURE_APPLICATION_MODE_EXT 0x834F +#define GL_TEXTURE_LIGHT_EXT 0x8350 +#define GL_TEXTURE_MATERIAL_FACE_EXT 0x8351 +#define GL_TEXTURE_MATERIAL_PARAMETER_EXT 0x8352 +/* reuse GL_FRAGMENT_DEPTH_EXT */ +#endif + +#ifndef GL_SGIX_blend_alpha_minmax +#define GL_ALPHA_MIN_SGIX 0x8320 +#define GL_ALPHA_MAX_SGIX 0x8321 +#endif + +#ifndef GL_EXT_bgra +#define GL_BGR_EXT 0x80E0 +#define GL_BGRA_EXT 0x80E1 +#endif + +#ifndef GL_INTEL_texture_scissor +#endif + +#ifndef GL_INTEL_parallel_arrays +#define GL_PARALLEL_ARRAYS_INTEL 0x83F4 +#define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5 +#define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6 +#define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7 +#define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8 +#endif + +#ifndef GL_HP_occlusion_test +#define GL_OCCLUSION_TEST_HP 0x8165 +#define GL_OCCLUSION_TEST_RESULT_HP 0x8166 +#endif + +#ifndef GL_EXT_pixel_transform +#define GL_PIXEL_TRANSFORM_2D_EXT 0x8330 +#define GL_PIXEL_MAG_FILTER_EXT 0x8331 +#define GL_PIXEL_MIN_FILTER_EXT 0x8332 +#define GL_PIXEL_CUBIC_WEIGHT_EXT 0x8333 +#define GL_CUBIC_EXT 0x8334 +#define GL_AVERAGE_EXT 0x8335 +#define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336 +#define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337 +#define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT 0x8338 +#endif + +#ifndef GL_EXT_pixel_transform_color_table +#endif + +#ifndef GL_EXT_shared_texture_palette +#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB +#endif + +#ifndef GL_EXT_separate_specular_color +#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8 +#define GL_SINGLE_COLOR_EXT 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA +#endif + +#ifndef GL_EXT_secondary_color +#define GL_COLOR_SUM_EXT 0x8458 +#define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459 +#define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A +#define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B +#define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C +#define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D +#define GL_SECONDARY_COLOR_ARRAY_EXT 0x845E +#endif + +#ifndef GL_EXT_texture_perturb_normal +#define GL_PERTURB_EXT 0x85AE +#define GL_TEXTURE_NORMAL_EXT 0x85AF +#endif + +#ifndef GL_EXT_multi_draw_arrays +#endif + +#ifndef GL_EXT_fog_coord +#define GL_FOG_COORDINATE_SOURCE_EXT 0x8450 +#define GL_FOG_COORDINATE_EXT 0x8451 +#define GL_FRAGMENT_DEPTH_EXT 0x8452 +#define GL_CURRENT_FOG_COORDINATE_EXT 0x8453 +#define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454 +#define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455 +#define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456 +#define GL_FOG_COORDINATE_ARRAY_EXT 0x8457 +#endif + +#ifndef GL_REND_screen_coordinates +#define GL_SCREEN_COORDINATES_REND 0x8490 +#define GL_INVERTED_SCREEN_W_REND 0x8491 +#endif + +#ifndef GL_EXT_coordinate_frame +#define GL_TANGENT_ARRAY_EXT 0x8439 +#define GL_BINORMAL_ARRAY_EXT 0x843A +#define GL_CURRENT_TANGENT_EXT 0x843B +#define GL_CURRENT_BINORMAL_EXT 0x843C +#define GL_TANGENT_ARRAY_TYPE_EXT 0x843E +#define GL_TANGENT_ARRAY_STRIDE_EXT 0x843F +#define GL_BINORMAL_ARRAY_TYPE_EXT 0x8440 +#define GL_BINORMAL_ARRAY_STRIDE_EXT 0x8441 +#define GL_TANGENT_ARRAY_POINTER_EXT 0x8442 +#define GL_BINORMAL_ARRAY_POINTER_EXT 0x8443 +#define GL_MAP1_TANGENT_EXT 0x8444 +#define GL_MAP2_TANGENT_EXT 0x8445 +#define GL_MAP1_BINORMAL_EXT 0x8446 +#define GL_MAP2_BINORMAL_EXT 0x8447 +#endif + +#ifndef GL_EXT_texture_env_combine +#define GL_COMBINE_EXT 0x8570 +#define GL_COMBINE_RGB_EXT 0x8571 +#define GL_COMBINE_ALPHA_EXT 0x8572 +#define GL_RGB_SCALE_EXT 0x8573 +#define GL_ADD_SIGNED_EXT 0x8574 +#define GL_INTERPOLATE_EXT 0x8575 +#define GL_CONSTANT_EXT 0x8576 +#define GL_PRIMARY_COLOR_EXT 0x8577 +#define GL_PREVIOUS_EXT 0x8578 +#define GL_SOURCE0_RGB_EXT 0x8580 +#define GL_SOURCE1_RGB_EXT 0x8581 +#define GL_SOURCE2_RGB_EXT 0x8582 +#define GL_SOURCE3_RGB_EXT 0x8583 +#define GL_SOURCE4_RGB_EXT 0x8584 +#define GL_SOURCE5_RGB_EXT 0x8585 +#define GL_SOURCE6_RGB_EXT 0x8586 +#define GL_SOURCE7_RGB_EXT 0x8587 +#define GL_SOURCE0_ALPHA_EXT 0x8588 +#define GL_SOURCE1_ALPHA_EXT 0x8589 +#define GL_SOURCE2_ALPHA_EXT 0x858A +#define GL_SOURCE3_ALPHA_EXT 0x858B +#define GL_SOURCE4_ALPHA_EXT 0x858C +#define GL_SOURCE5_ALPHA_EXT 0x858D +#define GL_SOURCE6_ALPHA_EXT 0x858E +#define GL_SOURCE7_ALPHA_EXT 0x858F +#define GL_OPERAND0_RGB_EXT 0x8590 +#define GL_OPERAND1_RGB_EXT 0x8591 +#define GL_OPERAND2_RGB_EXT 0x8592 +#define GL_OPERAND3_RGB_EXT 0x8593 +#define GL_OPERAND4_RGB_EXT 0x8594 +#define GL_OPERAND5_RGB_EXT 0x8595 +#define GL_OPERAND6_RGB_EXT 0x8596 +#define GL_OPERAND7_RGB_EXT 0x8597 +#define GL_OPERAND0_ALPHA_EXT 0x8598 +#define GL_OPERAND1_ALPHA_EXT 0x8599 +#define GL_OPERAND2_ALPHA_EXT 0x859A +#define GL_OPERAND3_ALPHA_EXT 0x859B +#define GL_OPERAND4_ALPHA_EXT 0x859C +#define GL_OPERAND5_ALPHA_EXT 0x859D +#define GL_OPERAND6_ALPHA_EXT 0x859E +#define GL_OPERAND7_ALPHA_EXT 0x859F +#endif + +#ifndef GL_APPLE_specular_vector +#define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0 +#endif + +#ifndef GL_APPLE_transform_hint +#define GL_TRANSFORM_HINT_APPLE 0x85B1 +#endif + +#ifndef GL_SGIX_fog_scale +#define GL_FOG_SCALE_SGIX 0x81FC +#define GL_FOG_SCALE_VALUE_SGIX 0x81FD +#endif + +#ifndef GL_SUNX_constant_data +#define GL_UNPACK_CONSTANT_DATA_SUNX 0x81D5 +#define GL_TEXTURE_CONSTANT_DATA_SUNX 0x81D6 +#endif + +#ifndef GL_SUN_global_alpha +#define GL_GLOBAL_ALPHA_SUN 0x81D9 +#define GL_GLOBAL_ALPHA_FACTOR_SUN 0x81DA +#endif + +#ifndef GL_SUN_triangle_list +#define GL_RESTART_SUN 0x01 +#define GL_REPLACE_MIDDLE_SUN 0x02 +#define GL_REPLACE_OLDEST_SUN 0x03 +#define GL_TRIANGLE_LIST_SUN 0x81D7 +#define GL_REPLACEMENT_CODE_SUN 0x81D8 +#define GL_REPLACEMENT_CODE_ARRAY_SUN 0x85C0 +#define GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN 0x85C1 +#define GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN 0x85C2 +#define GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN 0x85C3 +#define GL_R1UI_V3F_SUN 0x85C4 +#define GL_R1UI_C4UB_V3F_SUN 0x85C5 +#define GL_R1UI_C3F_V3F_SUN 0x85C6 +#define GL_R1UI_N3F_V3F_SUN 0x85C7 +#define GL_R1UI_C4F_N3F_V3F_SUN 0x85C8 +#define GL_R1UI_T2F_V3F_SUN 0x85C9 +#define GL_R1UI_T2F_N3F_V3F_SUN 0x85CA +#define GL_R1UI_T2F_C4F_N3F_V3F_SUN 0x85CB +#endif + +#ifndef GL_SUN_vertex +#endif + +#ifndef GL_EXT_blend_func_separate +#define GL_BLEND_DST_RGB_EXT 0x80C8 +#define GL_BLEND_SRC_RGB_EXT 0x80C9 +#define GL_BLEND_DST_ALPHA_EXT 0x80CA +#define GL_BLEND_SRC_ALPHA_EXT 0x80CB +#endif + +#ifndef GL_INGR_color_clamp +#define GL_RED_MIN_CLAMP_INGR 0x8560 +#define GL_GREEN_MIN_CLAMP_INGR 0x8561 +#define GL_BLUE_MIN_CLAMP_INGR 0x8562 +#define GL_ALPHA_MIN_CLAMP_INGR 0x8563 +#define GL_RED_MAX_CLAMP_INGR 0x8564 +#define GL_GREEN_MAX_CLAMP_INGR 0x8565 +#define GL_BLUE_MAX_CLAMP_INGR 0x8566 +#define GL_ALPHA_MAX_CLAMP_INGR 0x8567 +#endif + +#ifndef GL_INGR_interlace_read +#define GL_INTERLACE_READ_INGR 0x8568 +#endif + +#ifndef GL_EXT_stencil_wrap +#define GL_INCR_WRAP_EXT 0x8507 +#define GL_DECR_WRAP_EXT 0x8508 +#endif + +#ifndef GL_EXT_422_pixels +#define GL_422_EXT 0x80CC +#define GL_422_REV_EXT 0x80CD +#define GL_422_AVERAGE_EXT 0x80CE +#define GL_422_REV_AVERAGE_EXT 0x80CF +#endif + +#ifndef GL_NV_texgen_reflection +#define GL_NORMAL_MAP_NV 0x8511 +#define GL_REFLECTION_MAP_NV 0x8512 +#endif + +#ifndef GL_EXT_texture_cube_map +#define GL_NORMAL_MAP_EXT 0x8511 +#define GL_REFLECTION_MAP_EXT 0x8512 +#define GL_TEXTURE_CUBE_MAP_EXT 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP_EXT 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP_EXT 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT 0x851C +#endif + +#ifndef GL_SUN_convolution_border_modes +#define GL_WRAP_BORDER_SUN 0x81D4 +#endif + +#ifndef GL_EXT_texture_env_add +#endif + +#ifndef GL_EXT_texture_lod_bias +#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD +#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500 +#define GL_TEXTURE_LOD_BIAS_EXT 0x8501 +#endif + +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF +#endif + +#ifndef GL_EXT_vertex_weighting +#define GL_MODELVIEW0_STACK_DEPTH_EXT GL_MODELVIEW_STACK_DEPTH +#define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502 +#define GL_MODELVIEW0_MATRIX_EXT GL_MODELVIEW_MATRIX +#define GL_MODELVIEW_MATRIX1_EXT 0x8506 +#define GL_VERTEX_WEIGHTING_EXT 0x8509 +#define GL_MODELVIEW0_EXT GL_MODELVIEW +#define GL_MODELVIEW1_EXT 0x850A +#define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850B +#define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850C +#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850D +#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850E +#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F +#define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510 +#endif + +#ifndef GL_NV_light_max_exponent +#define GL_MAX_SHININESS_NV 0x8504 +#define GL_MAX_SPOT_EXPONENT_NV 0x8505 +#endif + +#ifndef GL_NV_vertex_array_range +#define GL_VERTEX_ARRAY_RANGE_NV 0x851D +#define GL_VERTEX_ARRAY_RANGE_LENGTH_NV 0x851E +#define GL_VERTEX_ARRAY_RANGE_VALID_NV 0x851F +#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520 +#define GL_VERTEX_ARRAY_RANGE_POINTER_NV 0x8521 +#endif + +#ifndef GL_NV_register_combiners +#define GL_REGISTER_COMBINERS_NV 0x8522 +#define GL_VARIABLE_A_NV 0x8523 +#define GL_VARIABLE_B_NV 0x8524 +#define GL_VARIABLE_C_NV 0x8525 +#define GL_VARIABLE_D_NV 0x8526 +#define GL_VARIABLE_E_NV 0x8527 +#define GL_VARIABLE_F_NV 0x8528 +#define GL_VARIABLE_G_NV 0x8529 +#define GL_CONSTANT_COLOR0_NV 0x852A +#define GL_CONSTANT_COLOR1_NV 0x852B +#define GL_PRIMARY_COLOR_NV 0x852C +#define GL_SECONDARY_COLOR_NV 0x852D +#define GL_SPARE0_NV 0x852E +#define GL_SPARE1_NV 0x852F +#define GL_DISCARD_NV 0x8530 +#define GL_E_TIMES_F_NV 0x8531 +#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532 +#define GL_UNSIGNED_IDENTITY_NV 0x8536 +#define GL_UNSIGNED_INVERT_NV 0x8537 +#define GL_EXPAND_NORMAL_NV 0x8538 +#define GL_EXPAND_NEGATE_NV 0x8539 +#define GL_HALF_BIAS_NORMAL_NV 0x853A +#define GL_HALF_BIAS_NEGATE_NV 0x853B +#define GL_SIGNED_IDENTITY_NV 0x853C +#define GL_SIGNED_NEGATE_NV 0x853D +#define GL_SCALE_BY_TWO_NV 0x853E +#define GL_SCALE_BY_FOUR_NV 0x853F +#define GL_SCALE_BY_ONE_HALF_NV 0x8540 +#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541 +#define GL_COMBINER_INPUT_NV 0x8542 +#define GL_COMBINER_MAPPING_NV 0x8543 +#define GL_COMBINER_COMPONENT_USAGE_NV 0x8544 +#define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545 +#define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546 +#define GL_COMBINER_MUX_SUM_NV 0x8547 +#define GL_COMBINER_SCALE_NV 0x8548 +#define GL_COMBINER_BIAS_NV 0x8549 +#define GL_COMBINER_AB_OUTPUT_NV 0x854A +#define GL_COMBINER_CD_OUTPUT_NV 0x854B +#define GL_COMBINER_SUM_OUTPUT_NV 0x854C +#define GL_MAX_GENERAL_COMBINERS_NV 0x854D +#define GL_NUM_GENERAL_COMBINERS_NV 0x854E +#define GL_COLOR_SUM_CLAMP_NV 0x854F +#define GL_COMBINER0_NV 0x8550 +#define GL_COMBINER1_NV 0x8551 +#define GL_COMBINER2_NV 0x8552 +#define GL_COMBINER3_NV 0x8553 +#define GL_COMBINER4_NV 0x8554 +#define GL_COMBINER5_NV 0x8555 +#define GL_COMBINER6_NV 0x8556 +#define GL_COMBINER7_NV 0x8557 +/* reuse GL_TEXTURE0_ARB */ +/* reuse GL_TEXTURE1_ARB */ +/* reuse GL_ZERO */ +/* reuse GL_NONE */ +/* reuse GL_FOG */ +#endif + +#ifndef GL_NV_fog_distance +#define GL_FOG_DISTANCE_MODE_NV 0x855A +#define GL_EYE_RADIAL_NV 0x855B +#define GL_EYE_PLANE_ABSOLUTE_NV 0x855C +/* reuse GL_EYE_PLANE */ +#endif + +#ifndef GL_NV_texgen_emboss +#define GL_EMBOSS_LIGHT_NV 0x855D +#define GL_EMBOSS_CONSTANT_NV 0x855E +#define GL_EMBOSS_MAP_NV 0x855F +#endif + +#ifndef GL_NV_blend_square +#endif + +#ifndef GL_NV_texture_env_combine4 +#define GL_COMBINE4_NV 0x8503 +#define GL_SOURCE3_RGB_NV 0x8583 +#define GL_SOURCE3_ALPHA_NV 0x858B +#define GL_OPERAND3_RGB_NV 0x8593 +#define GL_OPERAND3_ALPHA_NV 0x859B +#endif + +#ifndef GL_MESA_resize_buffers +#endif + +#ifndef GL_MESA_window_pos +#endif + +#ifndef GL_EXT_texture_compression_s3tc +#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 +#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 +#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 +#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 +#endif + +#ifndef GL_IBM_cull_vertex +#define GL_CULL_VERTEX_IBM 103050 +#endif + +#ifndef GL_IBM_multimode_draw_arrays +#endif + +#ifndef GL_IBM_vertex_array_lists +#define GL_VERTEX_ARRAY_LIST_IBM 103070 +#define GL_NORMAL_ARRAY_LIST_IBM 103071 +#define GL_COLOR_ARRAY_LIST_IBM 103072 +#define GL_INDEX_ARRAY_LIST_IBM 103073 +#define GL_TEXTURE_COORD_ARRAY_LIST_IBM 103074 +#define GL_EDGE_FLAG_ARRAY_LIST_IBM 103075 +#define GL_FOG_COORDINATE_ARRAY_LIST_IBM 103076 +#define GL_SECONDARY_COLOR_ARRAY_LIST_IBM 103077 +#define GL_VERTEX_ARRAY_LIST_STRIDE_IBM 103080 +#define GL_NORMAL_ARRAY_LIST_STRIDE_IBM 103081 +#define GL_COLOR_ARRAY_LIST_STRIDE_IBM 103082 +#define GL_INDEX_ARRAY_LIST_STRIDE_IBM 103083 +#define GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM 103084 +#define GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM 103085 +#define GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM 103086 +#define GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM 103087 +#endif + +#ifndef GL_SGIX_subsample +#define GL_PACK_SUBSAMPLE_RATE_SGIX 0x85A0 +#define GL_UNPACK_SUBSAMPLE_RATE_SGIX 0x85A1 +#define GL_PIXEL_SUBSAMPLE_4444_SGIX 0x85A2 +#define GL_PIXEL_SUBSAMPLE_2424_SGIX 0x85A3 +#define GL_PIXEL_SUBSAMPLE_4242_SGIX 0x85A4 +#endif + +#ifndef GL_SGIX_ycrcb_subsample +#endif + +#ifndef GL_SGIX_ycrcba +#define GL_YCRCB_SGIX 0x8318 +#define GL_YCRCBA_SGIX 0x8319 +#endif + +#ifndef GL_SGI_depth_pass_instrument +#define GL_DEPTH_PASS_INSTRUMENT_SGIX 0x8310 +#define GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX 0x8311 +#define GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX 0x8312 +#endif + +#ifndef GL_3DFX_texture_compression_FXT1 +#define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0 +#define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1 +#endif + +#ifndef GL_3DFX_multisample +#define GL_MULTISAMPLE_3DFX 0x86B2 +#define GL_SAMPLE_BUFFERS_3DFX 0x86B3 +#define GL_SAMPLES_3DFX 0x86B4 +#define GL_MULTISAMPLE_BIT_3DFX 0x20000000 +#endif + +#ifndef GL_3DFX_tbuffer +#endif + +#ifndef GL_EXT_multisample +#define GL_MULTISAMPLE_EXT 0x809D +#define GL_SAMPLE_ALPHA_TO_MASK_EXT 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F +#define GL_SAMPLE_MASK_EXT 0x80A0 +#define GL_1PASS_EXT 0x80A1 +#define GL_2PASS_0_EXT 0x80A2 +#define GL_2PASS_1_EXT 0x80A3 +#define GL_4PASS_0_EXT 0x80A4 +#define GL_4PASS_1_EXT 0x80A5 +#define GL_4PASS_2_EXT 0x80A6 +#define GL_4PASS_3_EXT 0x80A7 +#define GL_SAMPLE_BUFFERS_EXT 0x80A8 +#define GL_SAMPLES_EXT 0x80A9 +#define GL_SAMPLE_MASK_VALUE_EXT 0x80AA +#define GL_SAMPLE_MASK_INVERT_EXT 0x80AB +#define GL_SAMPLE_PATTERN_EXT 0x80AC +#endif + +#ifndef GL_SGIX_vertex_preclip +#define GL_VERTEX_PRECLIP_SGIX 0x83EE +#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF +#endif + +#ifndef GL_SGIX_convolution_accuracy +#define GL_CONVOLUTION_HINT_SGIX 0x8316 +#endif + +#ifndef GL_SGIX_resample +#define GL_PACK_RESAMPLE_SGIX 0x842C +#define GL_UNPACK_RESAMPLE_SGIX 0x842D +#define GL_RESAMPLE_REPLICATE_SGIX 0x842E +#define GL_RESAMPLE_ZERO_FILL_SGIX 0x842F +#define GL_RESAMPLE_DECIMATE_SGIX 0x8430 +#endif + +#ifndef GL_SGIS_point_line_texgen +#define GL_EYE_DISTANCE_TO_POINT_SGIS 0x81F0 +#define GL_OBJECT_DISTANCE_TO_POINT_SGIS 0x81F1 +#define GL_EYE_DISTANCE_TO_LINE_SGIS 0x81F2 +#define GL_OBJECT_DISTANCE_TO_LINE_SGIS 0x81F3 +#define GL_EYE_POINT_SGIS 0x81F4 +#define GL_OBJECT_POINT_SGIS 0x81F5 +#define GL_EYE_LINE_SGIS 0x81F6 +#define GL_OBJECT_LINE_SGIS 0x81F7 +#endif + +#ifndef GL_SGIS_texture_color_mask +#define GL_TEXTURE_COLOR_WRITEMASK_SGIS 0x81EF +#endif + + +/*************************************************************/ + +#ifndef GL_VERSION_1_2 +#define GL_VERSION_1_2 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glBlendColor (GLclampf, GLclampf, GLclampf, GLclampf); +extern void APIENTRY glBlendEquation (GLenum); +extern void APIENTRY glDrawRangeElements (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *); +extern void APIENTRY glColorTable (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +extern void APIENTRY glColorTableParameterfv (GLenum, GLenum, const GLfloat *); +extern void APIENTRY glColorTableParameteriv (GLenum, GLenum, const GLint *); +extern void APIENTRY glCopyColorTable (GLenum, GLenum, GLint, GLint, GLsizei); +extern void APIENTRY glGetColorTable (GLenum, GLenum, GLenum, GLvoid *); +extern void APIENTRY glGetColorTableParameterfv (GLenum, GLenum, GLfloat *); +extern void APIENTRY glGetColorTableParameteriv (GLenum, GLenum, GLint *); +extern void APIENTRY glColorSubTable (GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +extern void APIENTRY glCopyColorSubTable (GLenum, GLsizei, GLint, GLint, GLsizei); +extern void APIENTRY glConvolutionFilter1D (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +extern void APIENTRY glConvolutionFilter2D (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +extern void APIENTRY glConvolutionParameterf (GLenum, GLenum, GLfloat); +extern void APIENTRY glConvolutionParameterfv (GLenum, GLenum, const GLfloat *); +extern void APIENTRY glConvolutionParameteri (GLenum, GLenum, GLint); +extern void APIENTRY glConvolutionParameteriv (GLenum, GLenum, const GLint *); +extern void APIENTRY glCopyConvolutionFilter1D (GLenum, GLenum, GLint, GLint, GLsizei); +extern void APIENTRY glCopyConvolutionFilter2D (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei); +extern void APIENTRY glGetConvolutionFilter (GLenum, GLenum, GLenum, GLvoid *); +extern void APIENTRY glGetConvolutionParameterfv (GLenum, GLenum, GLfloat *); +extern void APIENTRY glGetConvolutionParameteriv (GLenum, GLenum, GLint *); +extern void APIENTRY glGetSeparableFilter (GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *); +extern void APIENTRY glSeparableFilter2D (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *); +extern void APIENTRY glGetHistogram (GLenum, GLboolean, GLenum, GLenum, GLvoid *); +extern void APIENTRY glGetHistogramParameterfv (GLenum, GLenum, GLfloat *); +extern void APIENTRY glGetHistogramParameteriv (GLenum, GLenum, GLint *); +extern void APIENTRY glGetMinmax (GLenum, GLboolean, GLenum, GLenum, GLvoid *); +extern void APIENTRY glGetMinmaxParameterfv (GLenum, GLenum, GLfloat *); +extern void APIENTRY glGetMinmaxParameteriv (GLenum, GLenum, GLint *); +extern void APIENTRY glHistogram (GLenum, GLsizei, GLenum, GLboolean); +extern void APIENTRY glMinmax (GLenum, GLenum, GLboolean); +extern void APIENTRY glResetHistogram (GLenum); +extern void APIENTRY glResetMinmax (GLenum); +extern void APIENTRY glTexImage3D (GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +extern void APIENTRY glTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +extern void APIENTRY glCopyTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +typedef void (APIENTRY * PFNGLBLENDEQUATIONPROC) (GLenum mode); +typedef void (APIENTRY * PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +typedef void (APIENTRY * PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +typedef void (APIENTRY * PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRY * PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRY * PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRY * PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); +typedef void (APIENTRY * PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRY * PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRY * PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); +typedef void (APIENTRY * PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +typedef void (APIENTRY * PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRY * PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params); +typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params); +typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRY * PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRY * PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRY * PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); +typedef void (APIENTRY * PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRY * PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRY * PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); +typedef void (APIENTRY * PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); +typedef void (APIENTRY * PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRY * PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRY * PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRY * PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRY * PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRY * PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRY * PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +typedef void (APIENTRY * PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink); +typedef void (APIENTRY * PFNGLRESETHISTOGRAMPROC) (GLenum target); +typedef void (APIENTRY * PFNGLRESETMINMAXPROC) (GLenum target); +typedef void (APIENTRY * PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRY * PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRY * PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +#endif + +#ifndef GL_ARB_multitexture +#define GL_ARB_multitexture 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glActiveTextureARB (GLenum); +extern void APIENTRY glClientActiveTextureARB (GLenum); +extern void APIENTRY glMultiTexCoord1dARB (GLenum, GLdouble); +extern void APIENTRY glMultiTexCoord1dvARB (GLenum, const GLdouble *); +extern void APIENTRY glMultiTexCoord1fARB (GLenum, GLfloat); +extern void APIENTRY glMultiTexCoord1fvARB (GLenum, const GLfloat *); +extern void APIENTRY glMultiTexCoord1iARB (GLenum, GLint); +extern void APIENTRY glMultiTexCoord1ivARB (GLenum, const GLint *); +extern void APIENTRY glMultiTexCoord1sARB (GLenum, GLshort); +extern void APIENTRY glMultiTexCoord1svARB (GLenum, const GLshort *); +extern void APIENTRY glMultiTexCoord2dARB (GLenum, GLdouble, GLdouble); +extern void APIENTRY glMultiTexCoord2dvARB (GLenum, const GLdouble *); +extern void APIENTRY glMultiTexCoord2fARB (GLenum, GLfloat, GLfloat); +extern void APIENTRY glMultiTexCoord2fvARB (GLenum, const GLfloat *); +extern void APIENTRY glMultiTexCoord2iARB (GLenum, GLint, GLint); +extern void APIENTRY glMultiTexCoord2ivARB (GLenum, const GLint *); +extern void APIENTRY glMultiTexCoord2sARB (GLenum, GLshort, GLshort); +extern void APIENTRY glMultiTexCoord2svARB (GLenum, const GLshort *); +extern void APIENTRY glMultiTexCoord3dARB (GLenum, GLdouble, GLdouble, GLdouble); +extern void APIENTRY glMultiTexCoord3dvARB (GLenum, const GLdouble *); +extern void APIENTRY glMultiTexCoord3fARB (GLenum, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glMultiTexCoord3fvARB (GLenum, const GLfloat *); +extern void APIENTRY glMultiTexCoord3iARB (GLenum, GLint, GLint, GLint); +extern void APIENTRY glMultiTexCoord3ivARB (GLenum, const GLint *); +extern void APIENTRY glMultiTexCoord3sARB (GLenum, GLshort, GLshort, GLshort); +extern void APIENTRY glMultiTexCoord3svARB (GLenum, const GLshort *); +extern void APIENTRY glMultiTexCoord4dARB (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); +extern void APIENTRY glMultiTexCoord4dvARB (GLenum, const GLdouble *); +extern void APIENTRY glMultiTexCoord4fARB (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glMultiTexCoord4fvARB (GLenum, const GLfloat *); +extern void APIENTRY glMultiTexCoord4iARB (GLenum, GLint, GLint, GLint, GLint); +extern void APIENTRY glMultiTexCoord4ivARB (GLenum, const GLint *); +extern void APIENTRY glMultiTexCoord4sARB (GLenum, GLshort, GLshort, GLshort, GLshort); +extern void APIENTRY glMultiTexCoord4svARB (GLenum, const GLshort *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (APIENTRY * PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (APIENTRY * PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s); +typedef void (APIENTRY * PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRY * PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s); +typedef void (APIENTRY * PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRY * PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s); +typedef void (APIENTRY * PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRY * PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s); +typedef void (APIENTRY * PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRY * PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t); +typedef void (APIENTRY * PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRY * PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t); +typedef void (APIENTRY * PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRY * PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t); +typedef void (APIENTRY * PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRY * PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t); +typedef void (APIENTRY * PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRY * PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); +typedef void (APIENTRY * PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRY * PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); +typedef void (APIENTRY * PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRY * PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r); +typedef void (APIENTRY * PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRY * PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r); +typedef void (APIENTRY * PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRY * PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (APIENTRY * PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRY * PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (APIENTRY * PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRY * PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); +typedef void (APIENTRY * PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRY * PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (APIENTRY * PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v); +#endif + +#ifndef GL_ARB_transpose_matrix +#define GL_ARB_transpose_matrix 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glLoadTransposeMatrixfARB (const GLfloat *); +extern void APIENTRY glLoadTransposeMatrixdARB (const GLdouble *); +extern void APIENTRY glMultTransposeMatrixfARB (const GLfloat *); +extern void APIENTRY glMultTransposeMatrixdARB (const GLdouble *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLLOADTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); +typedef void (APIENTRY * PFNGLLOADTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); +typedef void (APIENTRY * PFNGLMULTTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); +typedef void (APIENTRY * PFNGLMULTTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); +#endif + +#ifndef GL_ARB_multisample +#define GL_ARB_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glSampleCoverageARB (GLclampf, GLboolean); +extern void APIENTRY glSamplePassARB (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRY * PFNGLSAMPLEPASSARBPROC) (GLenum pass); +#endif + +#ifndef GL_ARB_texture_env_add +#define GL_ARB_texture_env_add 1 +#endif + +#ifndef GL_ARB_texture_cube_map +#define GL_ARB_texture_cube_map 1 +#endif + +#ifndef GL_ARB_texture_compression +#define GL_ARB_texture_compression 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glCompressedTexImage3DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +extern void APIENTRY glCompressedTexImage2DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +extern void APIENTRY glCompressedTexImage1DARB (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *); +extern void APIENTRY glCompressedTexSubImage3DARB (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +extern void APIENTRY glCompressedTexSubImage2DARB (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +extern void APIENTRY glCompressedTexSubImage1DARB (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *); +extern void APIENTRY glGetCompressedTexImageARB (GLenum, GLint, void *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRY * PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRY * PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRY * PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint level, void *img); +#endif + +#ifndef GL_EXT_abgr +#define GL_EXT_abgr 1 +#endif + +#ifndef GL_EXT_blend_color +#define GL_EXT_blend_color 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glBlendColorEXT (GLclampf, GLclampf, GLclampf, GLclampf); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLBLENDCOLOREXTPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +#endif + +#ifndef GL_EXT_polygon_offset +#define GL_EXT_polygon_offset 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glPolygonOffsetEXT (GLfloat, GLfloat); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bias); +#endif + +#ifndef GL_EXT_texture +#define GL_EXT_texture 1 +#endif + +#ifndef GL_EXT_texture3D +#define GL_EXT_texture3D 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glTexImage3DEXT (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +#endif + +#ifndef GL_EXT_subtexture +/*#define GL_EXT_subtexture 1*/ +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +#endif + +#ifndef GL_SGIS_texture_filter4 +#define GL_SGIS_texture_filter4 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glGetTexFilterFuncSGIS (GLenum, GLenum, GLfloat *); +extern void APIENTRY glTexFilterFuncSGIS (GLenum, GLenum, GLsizei, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLGETTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLfloat *weights); +typedef void (APIENTRY * PFNGLTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights); +#endif + +#ifndef GL_EXT_subtexture +#define GL_EXT_subtexture 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glTexSubImage1DEXT (GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *); +extern void APIENTRY glTexSubImage2DEXT (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRY * PFNGLTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); +#endif + +#ifndef GL_EXT_copy_texture +#define GL_EXT_copy_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glCopyTexImage1DEXT (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint); +extern void APIENTRY glCopyTexImage2DEXT (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint); +extern void APIENTRY glCopyTexSubImage1DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei); +extern void APIENTRY glCopyTexSubImage2DEXT (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); +extern void APIENTRY glCopyTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLCOPYTEXIMAGE1DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +typedef void (APIENTRY * PFNGLCOPYTEXIMAGE2DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +typedef void (APIENTRY * PFNGLCOPYTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +typedef void (APIENTRY * PFNGLCOPYTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRY * PFNGLCOPYTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +#endif + +#ifndef GL_EXT_histogram +#define GL_EXT_histogram 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glGetHistogramEXT (GLenum, GLboolean, GLenum, GLenum, GLvoid *); +extern void APIENTRY glGetHistogramParameterfvEXT (GLenum, GLenum, GLfloat *); +extern void APIENTRY glGetHistogramParameterivEXT (GLenum, GLenum, GLint *); +extern void APIENTRY glGetMinmaxEXT (GLenum, GLboolean, GLenum, GLenum, GLvoid *); +extern void APIENTRY glGetMinmaxParameterfvEXT (GLenum, GLenum, GLfloat *); +extern void APIENTRY glGetMinmaxParameterivEXT (GLenum, GLenum, GLint *); +extern void APIENTRY glHistogramEXT (GLenum, GLsizei, GLenum, GLboolean); +extern void APIENTRY glMinmaxEXT (GLenum, GLenum, GLboolean); +extern void APIENTRY glResetHistogramEXT (GLenum); +extern void APIENTRY glResetMinmaxEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLGETHISTOGRAMEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRY * PFNGLGETHISTOGRAMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRY * PFNGLGETHISTOGRAMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRY * PFNGLGETMINMAXEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRY * PFNGLGETMINMAXPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRY * PFNGLGETMINMAXPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRY * PFNGLHISTOGRAMEXTPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +typedef void (APIENTRY * PFNGLMINMAXEXTPROC) (GLenum target, GLenum internalformat, GLboolean sink); +typedef void (APIENTRY * PFNGLRESETHISTOGRAMEXTPROC) (GLenum target); +typedef void (APIENTRY * PFNGLRESETMINMAXEXTPROC) (GLenum target); +#endif + +#ifndef GL_EXT_convolution +#define GL_EXT_convolution 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glConvolutionFilter1DEXT (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +extern void APIENTRY glConvolutionFilter2DEXT (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +extern void APIENTRY glConvolutionParameterfEXT (GLenum, GLenum, GLfloat); +extern void APIENTRY glConvolutionParameterfvEXT (GLenum, GLenum, const GLfloat *); +extern void APIENTRY glConvolutionParameteriEXT (GLenum, GLenum, GLint); +extern void APIENTRY glConvolutionParameterivEXT (GLenum, GLenum, const GLint *); +extern void APIENTRY glCopyConvolutionFilter1DEXT (GLenum, GLenum, GLint, GLint, GLsizei); +extern void APIENTRY glCopyConvolutionFilter2DEXT (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei); +extern void APIENTRY glGetConvolutionFilterEXT (GLenum, GLenum, GLenum, GLvoid *); +extern void APIENTRY glGetConvolutionParameterfvEXT (GLenum, GLenum, GLfloat *); +extern void APIENTRY glGetConvolutionParameterivEXT (GLenum, GLenum, GLint *); +extern void APIENTRY glGetSeparableFilterEXT (GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *); +extern void APIENTRY glSeparableFilter2DEXT (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRY * PFNGLCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat params); +typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint params); +typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRY * PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRY * PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRY * PFNGLGETCONVOLUTIONFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); +typedef void (APIENTRY * PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRY * PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRY * PFNGLGETSEPARABLEFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); +typedef void (APIENTRY * PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); +#endif + +#ifndef GL_EXT_color_matrix +#define GL_EXT_color_matrix 1 +#endif + +#ifndef GL_SGI_color_table +#define GL_SGI_color_table 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glColorTableSGI (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +extern void APIENTRY glColorTableParameterfvSGI (GLenum, GLenum, const GLfloat *); +extern void APIENTRY glColorTableParameterivSGI (GLenum, GLenum, const GLint *); +extern void APIENTRY glCopyColorTableSGI (GLenum, GLenum, GLint, GLint, GLsizei); +extern void APIENTRY glGetColorTableSGI (GLenum, GLenum, GLenum, GLvoid *); +extern void APIENTRY glGetColorTableParameterfvSGI (GLenum, GLenum, GLfloat *); +extern void APIENTRY glGetColorTableParameterivSGI (GLenum, GLenum, GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +typedef void (APIENTRY * PFNGLCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRY * PFNGLCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRY * PFNGLCOPYCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRY * PFNGLGETCOLORTABLESGIPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); +typedef void (APIENTRY * PFNGLGETCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRY * PFNGLGETCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, GLint *params); +#endif + +#ifndef GL_SGIX_pixel_texture +#define GL_SGIX_pixel_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glPixelTexGenSGIX (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLPIXELTEXGENSGIXPROC) (GLenum mode); +#endif + +#ifndef GL_SGIS_pixel_texture +#define GL_SGIS_pixel_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glPixelTexGenParameteriSGIS (GLenum, GLint); +extern void APIENTRY glPixelTexGenParameterivSGIS (GLenum, const GLint *); +extern void APIENTRY glPixelTexGenParameterfSGIS (GLenum, GLfloat); +extern void APIENTRY glPixelTexGenParameterfvSGIS (GLenum, const GLfloat *); +extern void APIENTRY glGetPixelTexGenParameterivSGIS (GLenum, GLint *); +extern void APIENTRY glGetPixelTexGenParameterfvSGIS (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLPIXELTEXGENPARAMETERISGISPROC) (GLenum pname, GLint param); +typedef void (APIENTRY * PFNGLPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRY * PFNGLPIXELTEXGENPARAMETERFSGISPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRY * PFNGLPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRY * PFNGLGETPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, GLint *params); +typedef void (APIENTRY * PFNGLGETPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, GLfloat *params); +#endif + +#ifndef GL_SGIS_texture4D +#define GL_SGIS_texture4D 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glTexImage4DSGIS (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +extern void APIENTRY glTexSubImage4DSGIS (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLTEXIMAGE4DSGISPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRY * PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid *pixels); +#endif + +#ifndef GL_SGI_texture_color_table +#define GL_SGI_texture_color_table 1 +#endif + +#ifndef GL_EXT_cmyka +#define GL_EXT_cmyka 1 +#endif + +#ifndef GL_EXT_texture_object +#define GL_EXT_texture_object 1 +#ifdef GL_GLEXT_PROTOTYPES +extern GLboolean APIENTRY glAreTexturesResidentEXT (GLsizei, const GLuint *, GLboolean *); +extern void APIENTRY glBindTextureEXT (GLenum, GLuint); +extern void APIENTRY glDeleteTexturesEXT (GLsizei, const GLuint *); +extern void APIENTRY glGenTexturesEXT (GLsizei, GLuint *); +extern GLboolean APIENTRY glIsTextureEXT (GLuint); +extern void APIENTRY glPrioritizeTexturesEXT (GLsizei, const GLuint *, const GLclampf *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLboolean (APIENTRY * PFNGLARETEXTURESRESIDENTEXTPROC) (GLsizei n, const GLuint *textures, GLboolean *residences); +typedef void (APIENTRY * PFNGLBINDTEXTUREEXTPROC) (GLenum target, GLuint texture); +typedef void (APIENTRY * PFNGLDELETETEXTURESEXTPROC) (GLsizei n, const GLuint *textures); +typedef void (APIENTRY * PFNGLGENTEXTURESEXTPROC) (GLsizei n, GLuint *textures); +typedef GLboolean (APIENTRY * PFNGLISTEXTUREEXTPROC) (GLuint texture); +typedef void (APIENTRY * PFNGLPRIORITIZETEXTURESEXTPROC) (GLsizei n, const GLuint *textures, const GLclampf *priorities); +#endif + +#ifndef GL_SGIS_detail_texture +#define GL_SGIS_detail_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glDetailTexFuncSGIS (GLenum, GLsizei, const GLfloat *); +extern void APIENTRY glGetDetailTexFuncSGIS (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLDETAILTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); +typedef void (APIENTRY * PFNGLGETDETAILTEXFUNCSGISPROC) (GLenum target, GLfloat *points); +#endif + +#ifndef GL_SGIS_sharpen_texture +#define GL_SGIS_sharpen_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glSharpenTexFuncSGIS (GLenum, GLsizei, const GLfloat *); +extern void APIENTRY glGetSharpenTexFuncSGIS (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLSHARPENTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); +typedef void (APIENTRY * PFNGLGETSHARPENTEXFUNCSGISPROC) (GLenum target, GLfloat *points); +#endif + +#ifndef GL_EXT_packed_pixels +#define GL_EXT_packed_pixels 1 +#endif + +#ifndef GL_SGIS_texture_lod +#define GL_SGIS_texture_lod 1 +#endif + +#ifndef GL_SGIS_multisample +#define GL_SGIS_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glSampleMaskSGIS (GLclampf, GLboolean); +extern void APIENTRY glSamplePatternSGIS (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLSAMPLEMASKSGISPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRY * PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern); +#endif + +#ifndef GL_EXT_rescale_normal +#define GL_EXT_rescale_normal 1 +#endif + +#ifndef GL_EXT_vertex_array +#define GL_EXT_vertex_array 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glArrayElementEXT (GLint); +extern void APIENTRY glColorPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); +extern void APIENTRY glDrawArraysEXT (GLenum, GLint, GLsizei); +extern void APIENTRY glEdgeFlagPointerEXT (GLsizei, GLsizei, const GLboolean *); +extern void APIENTRY glGetPointervEXT (GLenum, GLvoid* *); +extern void APIENTRY glIndexPointerEXT (GLenum, GLsizei, GLsizei, const GLvoid *); +extern void APIENTRY glNormalPointerEXT (GLenum, GLsizei, GLsizei, const GLvoid *); +extern void APIENTRY glTexCoordPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); +extern void APIENTRY glVertexPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLARRAYELEMENTEXTPROC) (GLint i); +typedef void (APIENTRY * PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRY * PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count); +typedef void (APIENTRY * PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, const GLboolean *pointer); +typedef void (APIENTRY * PFNGLGETPOINTERVEXTPROC) (GLenum pname, GLvoid* *params); +typedef void (APIENTRY * PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRY * PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRY * PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRY * PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +#endif + +#ifndef GL_EXT_misc_attribute +#define GL_EXT_misc_attribute 1 +#endif + +#ifndef GL_SGIS_generate_mipmap +#define GL_SGIS_generate_mipmap 1 +#endif + +#ifndef GL_SGIX_clipmap +#define GL_SGIX_clipmap 1 +#endif + +#ifndef GL_SGIX_shadow +#define GL_SGIX_shadow 1 +#endif + +#ifndef GL_SGIS_texture_edge_clamp +#define GL_SGIS_texture_edge_clamp 1 +#endif + +#ifndef GL_SGIS_texture_border_clamp +#define GL_SGIS_texture_border_clamp 1 +#endif + +#ifndef GL_EXT_blend_minmax +#define GL_EXT_blend_minmax 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glBlendEquationEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLBLENDEQUATIONEXTPROC) (GLenum mode); +#endif + +#ifndef GL_EXT_blend_subtract +#define GL_EXT_blend_subtract 1 +#endif + +#ifndef GL_EXT_blend_logic_op +#define GL_EXT_blend_logic_op 1 +#endif + +#ifndef GL_SGIX_interlace +#define GL_SGIX_interlace 1 +#endif + +#ifndef GL_SGIX_pixel_tiles +#define GL_SGIX_pixel_tiles 1 +#endif + +#ifndef GL_SGIX_texture_select +#define GL_SGIX_texture_select 1 +#endif + +#ifndef GL_SGIX_sprite +#define GL_SGIX_sprite 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glSpriteParameterfSGIX (GLenum, GLfloat); +extern void APIENTRY glSpriteParameterfvSGIX (GLenum, const GLfloat *); +extern void APIENTRY glSpriteParameteriSGIX (GLenum, GLint); +extern void APIENTRY glSpriteParameterivSGIX (GLenum, const GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLSPRITEPARAMETERFSGIXPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRY * PFNGLSPRITEPARAMETERFVSGIXPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRY * PFNGLSPRITEPARAMETERISGIXPROC) (GLenum pname, GLint param); +typedef void (APIENTRY * PFNGLSPRITEPARAMETERIVSGIXPROC) (GLenum pname, const GLint *params); +#endif + +#ifndef GL_SGIX_texture_multi_buffer +#define GL_SGIX_texture_multi_buffer 1 +#endif + +#ifndef GL_EXT_point_parameters +#define GL_EXT_point_parameters 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glPointParameterfEXT (GLenum, GLfloat); +extern void APIENTRY glPointParameterfvEXT (GLenum, const GLfloat *); +extern void APIENTRY glPointParameterfSGIS (GLenum, GLfloat); +extern void APIENTRY glPointParameterfvSGIS (GLenum, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRY * PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRY * PFNGLPOINTPARAMETERFSGISPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRY * PFNGLPOINTPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); +#endif + +#ifndef GL_SGIX_instruments +#define GL_SGIX_instruments 1 +#ifdef GL_GLEXT_PROTOTYPES +extern GLint APIENTRY glGetInstrumentsSGIX (void); +extern void APIENTRY glInstrumentsBufferSGIX (GLsizei, GLint *); +extern GLint APIENTRY glPollInstrumentsSGIX (GLint *); +extern void APIENTRY glReadInstrumentsSGIX (GLint); +extern void APIENTRY glStartInstrumentsSGIX (void); +extern void APIENTRY glStopInstrumentsSGIX (GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLint (APIENTRY * PFNGLGETINSTRUMENTSSGIXPROC) (void); +typedef void (APIENTRY * PFNGLINSTRUMENTSBUFFERSGIXPROC) (GLsizei size, GLint *buffer); +typedef GLint (APIENTRY * PFNGLPOLLINSTRUMENTSSGIXPROC) (GLint *marker_p); +typedef void (APIENTRY * PFNGLREADINSTRUMENTSSGIXPROC) (GLint marker); +typedef void (APIENTRY * PFNGLSTARTINSTRUMENTSSGIXPROC) (void); +typedef void (APIENTRY * PFNGLSTOPINSTRUMENTSSGIXPROC) (GLint marker); +#endif + +#ifndef GL_SGIX_texture_scale_bias +#define GL_SGIX_texture_scale_bias 1 +#endif + +#ifndef GL_SGIX_framezoom +#define GL_SGIX_framezoom 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glFrameZoomSGIX (GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLFRAMEZOOMSGIXPROC) (GLint factor); +#endif + +#ifndef GL_SGIX_tag_sample_buffer +#define GL_SGIX_tag_sample_buffer 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glTagSampleBufferSGIX (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLTAGSAMPLEBUFFERSGIXPROC) (void); +#endif + +#ifndef GL_SGIX_reference_plane +#define GL_SGIX_reference_plane 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glReferencePlaneSGIX (const GLdouble *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLREFERENCEPLANESGIXPROC) (const GLdouble *equation); +#endif + +#ifndef GL_SGIX_flush_raster +#define GL_SGIX_flush_raster 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glFlushRasterSGIX (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLFLUSHRASTERSGIXPROC) (void); +#endif + +#ifndef GL_SGIX_depth_texture +#define GL_SGIX_depth_texture 1 +#endif + +#ifndef GL_SGIS_fog_function +#define GL_SGIS_fog_function 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glFogFuncSGIS (GLsizei, const GLfloat *); +extern void APIENTRY glGetFogFuncSGIS (const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLFOGFUNCSGISPROC) (GLsizei n, const GLfloat *points); +typedef void (APIENTRY * PFNGLGETFOGFUNCSGISPROC) (const GLfloat *points); +#endif + +#ifndef GL_SGIX_fog_offset +#define GL_SGIX_fog_offset 1 +#endif + +#ifndef GL_HP_image_transform +#define GL_HP_image_transform 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glImageTransformParameteriHP (GLenum, GLenum, GLint); +extern void APIENTRY glImageTransformParameterfHP (GLenum, GLenum, GLfloat); +extern void APIENTRY glImageTransformParameterivHP (GLenum, GLenum, const GLint *); +extern void APIENTRY glImageTransformParameterfvHP (GLenum, GLenum, const GLfloat *); +extern void APIENTRY glGetImageTransformParameterivHP (GLenum, GLenum, GLint *); +extern void APIENTRY glGetImageTransformParameterfvHP (GLenum, GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLIMAGETRANSFORMPARAMETERIHPPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRY * PFNGLIMAGETRANSFORMPARAMETERFHPPROC) (GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRY * PFNGLIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRY * PFNGLIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRY * PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRY * PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, GLfloat *params); +#endif + +#ifndef GL_HP_convolution_border_modes +#define GL_HP_convolution_border_modes 1 +#endif + +#ifndef GL_SGIX_texture_add_env +#define GL_SGIX_texture_add_env 1 +#endif + +#ifndef GL_EXT_color_subtable +#define GL_EXT_color_subtable 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glColorSubTableEXT (GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +extern void APIENTRY glCopyColorSubTableEXT (GLenum, GLsizei, GLint, GLint, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); +typedef void (APIENTRY * PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +#endif + +#ifndef GL_PGI_vertex_hints +#define GL_PGI_vertex_hints 1 +#endif + +#ifndef GL_PGI_misc_hints +#define GL_PGI_misc_hints 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glHintPGI (GLenum, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLHINTPGIPROC) (GLenum target, GLint mode); +#endif + +#ifndef GL_EXT_paletted_texture +#define GL_EXT_paletted_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glColorTableEXT (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +extern void APIENTRY glGetColorTableEXT (GLenum, GLenum, GLenum, GLvoid *); +extern void APIENTRY glGetColorTableParameterivEXT (GLenum, GLenum, GLint *); +extern void APIENTRY glGetColorTableParameterfvEXT (GLenum, GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +typedef void (APIENTRY * PFNGLGETCOLORTABLEEXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *data); +typedef void (APIENTRY * PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRY * PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +#endif + +#ifndef GL_EXT_clip_volume_hint +#define GL_EXT_clip_volume_hint 1 +#endif + +#ifndef GL_SGIX_list_priority +#define GL_SGIX_list_priority 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glGetListParameterfvSGIX (GLuint, GLenum, GLfloat *); +extern void APIENTRY glGetListParameterivSGIX (GLuint, GLenum, GLint *); +extern void APIENTRY glListParameterfSGIX (GLuint, GLenum, GLfloat); +extern void APIENTRY glListParameterfvSGIX (GLuint, GLenum, const GLfloat *); +extern void APIENTRY glListParameteriSGIX (GLuint, GLenum, GLint); +extern void APIENTRY glListParameterivSGIX (GLuint, GLenum, const GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLGETLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, GLfloat *params); +typedef void (APIENTRY * PFNGLGETLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, GLint *params); +typedef void (APIENTRY * PFNGLLISTPARAMETERFSGIXPROC) (GLuint list, GLenum pname, GLfloat param); +typedef void (APIENTRY * PFNGLLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, const GLfloat *params); +typedef void (APIENTRY * PFNGLLISTPARAMETERISGIXPROC) (GLuint list, GLenum pname, GLint param); +typedef void (APIENTRY * PFNGLLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, const GLint *params); +#endif + +#ifndef GL_SGIX_ir_instrument1 +#define GL_SGIX_ir_instrument1 1 +#endif + +#ifndef GL_SGIX_calligraphic_fragment +#define GL_SGIX_calligraphic_fragment 1 +#endif + +#ifndef GL_SGIX_texture_lod_bias +#define GL_SGIX_texture_lod_bias 1 +#endif + +#ifndef GL_SGIX_shadow_ambient +#define GL_SGIX_shadow_ambient 1 +#endif + +#ifndef GL_EXT_index_texture +#define GL_EXT_index_texture 1 +#endif + +#ifndef GL_EXT_index_material +#define GL_EXT_index_material 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glIndexMaterialEXT (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLINDEXMATERIALEXTPROC) (GLenum face, GLenum mode); +#endif + +#ifndef GL_EXT_index_func +#define GL_EXT_index_func 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glIndexFuncEXT (GLenum, GLclampf); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLINDEXFUNCEXTPROC) (GLenum func, GLclampf ref); +#endif + +#ifndef GL_EXT_index_array_formats +#define GL_EXT_index_array_formats 1 +#endif + +#ifndef GL_EXT_compiled_vertex_array +#define GL_EXT_compiled_vertex_array 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glLockArraysEXT (GLint, GLsizei); +extern void APIENTRY glUnlockArraysEXT (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count); +typedef void (APIENTRY * PFNGLUNLOCKARRAYSEXTPROC) (void); +#endif + +#ifndef GL_EXT_cull_vertex +#define GL_EXT_cull_vertex 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glCullParameterdvEXT (GLenum, GLdouble *); +extern void APIENTRY glCullParameterfvEXT (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLCULLPARAMETERDVEXTPROC) (GLenum pname, GLdouble *params); +typedef void (APIENTRY * PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat *params); +#endif + +#ifndef GL_SGIX_ycrcb +#define GL_SGIX_ycrcb 1 +#endif + +#ifndef GL_SGIX_fragment_lighting +#define GL_SGIX_fragment_lighting 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glFragmentColorMaterialSGIX (GLenum, GLenum); +extern void APIENTRY glFragmentLightfSGIX (GLenum, GLenum, GLfloat); +extern void APIENTRY glFragmentLightfvSGIX (GLenum, GLenum, const GLfloat *); +extern void APIENTRY glFragmentLightiSGIX (GLenum, GLenum, GLint); +extern void APIENTRY glFragmentLightivSGIX (GLenum, GLenum, const GLint *); +extern void APIENTRY glFragmentLightModelfSGIX (GLenum, GLfloat); +extern void APIENTRY glFragmentLightModelfvSGIX (GLenum, const GLfloat *); +extern void APIENTRY glFragmentLightModeliSGIX (GLenum, GLint); +extern void APIENTRY glFragmentLightModelivSGIX (GLenum, const GLint *); +extern void APIENTRY glFragmentMaterialfSGIX (GLenum, GLenum, GLfloat); +extern void APIENTRY glFragmentMaterialfvSGIX (GLenum, GLenum, const GLfloat *); +extern void APIENTRY glFragmentMaterialiSGIX (GLenum, GLenum, GLint); +extern void APIENTRY glFragmentMaterialivSGIX (GLenum, GLenum, const GLint *); +extern void APIENTRY glGetFragmentLightfvSGIX (GLenum, GLenum, GLfloat *); +extern void APIENTRY glGetFragmentLightivSGIX (GLenum, GLenum, GLint *); +extern void APIENTRY glGetFragmentMaterialfvSGIX (GLenum, GLenum, GLfloat *); +extern void APIENTRY glGetFragmentMaterialivSGIX (GLenum, GLenum, GLint *); +extern void APIENTRY glLightEnviSGIX (GLenum, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLFRAGMENTCOLORMATERIALSGIXPROC) (GLenum face, GLenum mode); +typedef void (APIENTRY * PFNGLFRAGMENTLIGHTFSGIXPROC) (GLenum light, GLenum pname, GLfloat param); +typedef void (APIENTRY * PFNGLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, const GLfloat *params); +typedef void (APIENTRY * PFNGLFRAGMENTLIGHTISGIXPROC) (GLenum light, GLenum pname, GLint param); +typedef void (APIENTRY * PFNGLFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, const GLint *params); +typedef void (APIENTRY * PFNGLFRAGMENTLIGHTMODELFSGIXPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRY * PFNGLFRAGMENTLIGHTMODELFVSGIXPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRY * PFNGLFRAGMENTLIGHTMODELISGIXPROC) (GLenum pname, GLint param); +typedef void (APIENTRY * PFNGLFRAGMENTLIGHTMODELIVSGIXPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRY * PFNGLFRAGMENTMATERIALFSGIXPROC) (GLenum face, GLenum pname, GLfloat param); +typedef void (APIENTRY * PFNGLFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat *params); +typedef void (APIENTRY * PFNGLFRAGMENTMATERIALISGIXPROC) (GLenum face, GLenum pname, GLint param); +typedef void (APIENTRY * PFNGLFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint *params); +typedef void (APIENTRY * PFNGLGETFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, GLfloat *params); +typedef void (APIENTRY * PFNGLGETFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, GLint *params); +typedef void (APIENTRY * PFNGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, GLfloat *params); +typedef void (APIENTRY * PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, GLint *params); +typedef void (APIENTRY * PFNGLLIGHTENVISGIXPROC) (GLenum pname, GLint param); +#endif + +#ifndef GL_IBM_rasterpos_clip +#define GL_IBM_rasterpos_clip 1 +#endif + +#ifndef GL_HP_texture_lighting +#define GL_HP_texture_lighting 1 +#endif + +#ifndef GL_EXT_draw_range_elements +#define GL_EXT_draw_range_elements 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glDrawRangeElementsEXT (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +#endif + +#ifndef GL_WIN_phong_shading +#define GL_WIN_phong_shading 1 +#endif + +#ifndef GL_WIN_specular_fog +#define GL_WIN_specular_fog 1 +#endif + +#ifndef GL_EXT_light_texture +#define GL_EXT_light_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glApplyTextureEXT (GLenum); +extern void APIENTRY glTextureLightEXT (GLenum); +extern void APIENTRY glTextureMaterialEXT (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLAPPLYTEXTUREEXTPROC) (GLenum mode); +typedef void (APIENTRY * PFNGLTEXTURELIGHTEXTPROC) (GLenum pname); +typedef void (APIENTRY * PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode); +#endif + +#ifndef GL_SGIX_blend_alpha_minmax +#define GL_SGIX_blend_alpha_minmax 1 +#endif + +#ifndef GL_EXT_bgra +#define GL_EXT_bgra 1 +#endif + +#ifndef GL_INTEL_parallel_arrays +#define GL_INTEL_parallel_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glVertexPointervINTEL (GLint, GLenum, const GLvoid* *); +extern void APIENTRY glNormalPointervINTEL (GLenum, const GLvoid* *); +extern void APIENTRY glColorPointervINTEL (GLint, GLenum, const GLvoid* *); +extern void APIENTRY glTexCoordPointervINTEL (GLint, GLenum, const GLvoid* *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLVERTEXPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); +typedef void (APIENTRY * PFNGLNORMALPOINTERVINTELPROC) (GLenum type, const GLvoid* *pointer); +typedef void (APIENTRY * PFNGLCOLORPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); +typedef void (APIENTRY * PFNGLTEXCOORDPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); +#endif + +#ifndef GL_HP_occlusion_test +#define GL_HP_occlusion_test 1 +#endif + +#ifndef GL_EXT_pixel_transform +#define GL_EXT_pixel_transform 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glPixelTransformParameteriEXT (GLenum, GLenum, GLint); +extern void APIENTRY glPixelTransformParameterfEXT (GLenum, GLenum, GLfloat); +extern void APIENTRY glPixelTransformParameterivEXT (GLenum, GLenum, const GLint *); +extern void APIENTRY glPixelTransformParameterfvEXT (GLenum, GLenum, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRY * PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRY * PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRY * PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); +#endif + +#ifndef GL_EXT_pixel_transform_color_table +#define GL_EXT_pixel_transform_color_table 1 +#endif + +#ifndef GL_EXT_shared_texture_palette +#define GL_EXT_shared_texture_palette 1 +#endif + +#ifndef GL_EXT_separate_specular_color +#define GL_EXT_separate_specular_color 1 +#endif + +#ifndef GL_EXT_secondary_color +#define GL_EXT_secondary_color 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glSecondaryColor3bEXT (GLbyte, GLbyte, GLbyte); +extern void APIENTRY glSecondaryColor3bvEXT (const GLbyte *); +extern void APIENTRY glSecondaryColor3dEXT (GLdouble, GLdouble, GLdouble); +extern void APIENTRY glSecondaryColor3dvEXT (const GLdouble *); +extern void APIENTRY glSecondaryColor3fEXT (GLfloat, GLfloat, GLfloat); +extern void APIENTRY glSecondaryColor3fvEXT (const GLfloat *); +extern void APIENTRY glSecondaryColor3iEXT (GLint, GLint, GLint); +extern void APIENTRY glSecondaryColor3ivEXT (const GLint *); +extern void APIENTRY glSecondaryColor3sEXT (GLshort, GLshort, GLshort); +extern void APIENTRY glSecondaryColor3svEXT (const GLshort *); +extern void APIENTRY glSecondaryColor3ubEXT (GLubyte, GLubyte, GLubyte); +extern void APIENTRY glSecondaryColor3ubvEXT (const GLubyte *); +extern void APIENTRY glSecondaryColor3uiEXT (GLuint, GLuint, GLuint); +extern void APIENTRY glSecondaryColor3uivEXT (const GLuint *); +extern void APIENTRY glSecondaryColor3usEXT (GLushort, GLushort, GLushort); +extern void APIENTRY glSecondaryColor3usvEXT (const GLushort *); +extern void APIENTRY glSecondaryColorPointerEXT (GLint, GLenum, GLsizei, GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3DEXTPROC) (GLdouble red, GLdouble green, GLdouble blue); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3DVEXTPROC) (const GLdouble *v); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3IEXTPROC) (GLint red, GLint green, GLint blue); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3IVEXTPROC) (const GLint *v); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3SEXTPROC) (GLshort red, GLshort green, GLshort blue); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3SVEXTPROC) (const GLshort *v); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3UIEXTPROC) (GLuint red, GLuint green, GLuint blue); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3UIVEXTPROC) (const GLuint *v); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3USEXTPROC) (GLushort red, GLushort green, GLushort blue); +typedef void (APIENTRY * PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v); +typedef void (APIENTRY * PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLvoid *pointer); +#endif + +#ifndef GL_EXT_texture_perturb_normal +#define GL_EXT_texture_perturb_normal 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glTextureNormalEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLTEXTURENORMALEXTPROC) (GLenum mode); +#endif + +#ifndef GL_EXT_multi_draw_arrays +#define GL_EXT_multi_draw_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei); +extern void APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); +typedef void (APIENTRY * PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); +#endif + +#ifndef GL_EXT_fog_coord +#define GL_EXT_fog_coord 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glFogCoordfEXT (GLfloat); +extern void APIENTRY glFogCoordfvEXT (const GLfloat *); +extern void APIENTRY glFogCoorddEXT (GLdouble); +extern void APIENTRY glFogCoorddvEXT (const GLdouble *); +extern void APIENTRY glFogCoordPointerEXT (GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLFOGCOORDFEXTPROC) (GLfloat coord); +typedef void (APIENTRY * PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord); +typedef void (APIENTRY * PFNGLFOGCOORDDEXTPROC) (GLdouble coord); +typedef void (APIENTRY * PFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord); +typedef void (APIENTRY * PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_REND_screen_coordinates +#define GL_REND_screen_coordinates 1 +#endif + +#ifndef GL_EXT_coordinate_frame +#define GL_EXT_coordinate_frame 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glTangent3bEXT (GLbyte, GLbyte, GLbyte); +extern void APIENTRY glTangent3bvEXT (const GLbyte *); +extern void APIENTRY glTangent3dEXT (GLdouble, GLdouble, GLdouble); +extern void APIENTRY glTangent3dvEXT (const GLdouble *); +extern void APIENTRY glTangent3fEXT (GLfloat, GLfloat, GLfloat); +extern void APIENTRY glTangent3fvEXT (const GLfloat *); +extern void APIENTRY glTangent3iEXT (GLint, GLint, GLint); +extern void APIENTRY glTangent3ivEXT (const GLint *); +extern void APIENTRY glTangent3sEXT (GLshort, GLshort, GLshort); +extern void APIENTRY glTangent3svEXT (const GLshort *); +extern void APIENTRY glBinormal3bEXT (GLbyte, GLbyte, GLbyte); +extern void APIENTRY glBinormal3bvEXT (const GLbyte *); +extern void APIENTRY glBinormal3dEXT (GLdouble, GLdouble, GLdouble); +extern void APIENTRY glBinormal3dvEXT (const GLdouble *); +extern void APIENTRY glBinormal3fEXT (GLfloat, GLfloat, GLfloat); +extern void APIENTRY glBinormal3fvEXT (const GLfloat *); +extern void APIENTRY glBinormal3iEXT (GLint, GLint, GLint); +extern void APIENTRY glBinormal3ivEXT (const GLint *); +extern void APIENTRY glBinormal3sEXT (GLshort, GLshort, GLshort); +extern void APIENTRY glBinormal3svEXT (const GLshort *); +extern void APIENTRY glTangentPointerEXT (GLenum, GLsizei, const GLvoid *); +extern void APIENTRY glBinormalPointerEXT (GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLTANGENT3BEXTPROC) (GLbyte tx, GLbyte ty, GLbyte tz); +typedef void (APIENTRY * PFNGLTANGENT3BVEXTPROC) (const GLbyte *v); +typedef void (APIENTRY * PFNGLTANGENT3DEXTPROC) (GLdouble tx, GLdouble ty, GLdouble tz); +typedef void (APIENTRY * PFNGLTANGENT3DVEXTPROC) (const GLdouble *v); +typedef void (APIENTRY * PFNGLTANGENT3FEXTPROC) (GLfloat tx, GLfloat ty, GLfloat tz); +typedef void (APIENTRY * PFNGLTANGENT3FVEXTPROC) (const GLfloat *v); +typedef void (APIENTRY * PFNGLTANGENT3IEXTPROC) (GLint tx, GLint ty, GLint tz); +typedef void (APIENTRY * PFNGLTANGENT3IVEXTPROC) (const GLint *v); +typedef void (APIENTRY * PFNGLTANGENT3SEXTPROC) (GLshort tx, GLshort ty, GLshort tz); +typedef void (APIENTRY * PFNGLTANGENT3SVEXTPROC) (const GLshort *v); +typedef void (APIENTRY * PFNGLBINORMAL3BEXTPROC) (GLbyte bx, GLbyte by, GLbyte bz); +typedef void (APIENTRY * PFNGLBINORMAL3BVEXTPROC) (const GLbyte *v); +typedef void (APIENTRY * PFNGLBINORMAL3DEXTPROC) (GLdouble bx, GLdouble by, GLdouble bz); +typedef void (APIENTRY * PFNGLBINORMAL3DVEXTPROC) (const GLdouble *v); +typedef void (APIENTRY * PFNGLBINORMAL3FEXTPROC) (GLfloat bx, GLfloat by, GLfloat bz); +typedef void (APIENTRY * PFNGLBINORMAL3FVEXTPROC) (const GLfloat *v); +typedef void (APIENTRY * PFNGLBINORMAL3IEXTPROC) (GLint bx, GLint by, GLint bz); +typedef void (APIENTRY * PFNGLBINORMAL3IVEXTPROC) (const GLint *v); +typedef void (APIENTRY * PFNGLBINORMAL3SEXTPROC) (GLshort bx, GLshort by, GLshort bz); +typedef void (APIENTRY * PFNGLBINORMAL3SVEXTPROC) (const GLshort *v); +typedef void (APIENTRY * PFNGLTANGENTPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRY * PFNGLBINORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_EXT_texture_env_combine +#define GL_EXT_texture_env_combine 1 +#endif + +#ifndef GL_APPLE_specular_vector +#define GL_APPLE_specular_vector 1 +#endif + +#ifndef GL_APPLE_transform_hint +#define GL_APPLE_transform_hint 1 +#endif + +#ifndef GL_SGIX_fog_scale +#define GL_SGIX_fog_scale 1 +#endif + +#ifndef GL_SUNX_constant_data +#define GL_SUNX_constant_data 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glFinishTextureSUNX (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLFINISHTEXTURESUNXPROC) (void); +#endif + +#ifndef GL_SUN_global_alpha +#define GL_SUN_global_alpha 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glGlobalAlphaFactorbSUN (GLbyte); +extern void APIENTRY glGlobalAlphaFactorsSUN (GLshort); +extern void APIENTRY glGlobalAlphaFactoriSUN (GLint); +extern void APIENTRY glGlobalAlphaFactorfSUN (GLfloat); +extern void APIENTRY glGlobalAlphaFactordSUN (GLdouble); +extern void APIENTRY glGlobalAlphaFactorubSUN (GLubyte); +extern void APIENTRY glGlobalAlphaFactorusSUN (GLushort); +extern void APIENTRY glGlobalAlphaFactoruiSUN (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORBSUNPROC) (GLbyte factor); +typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORSSUNPROC) (GLshort factor); +typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORISUNPROC) (GLint factor); +typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORFSUNPROC) (GLfloat factor); +typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORDSUNPROC) (GLdouble factor); +typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORUBSUNPROC) (GLubyte factor); +typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORUSSUNPROC) (GLushort factor); +typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORUISUNPROC) (GLuint factor); +#endif + +#ifndef GL_SUN_triangle_list +#define GL_SUN_triangle_list 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glReplacementCodeuiSUN (GLuint); +extern void APIENTRY glReplacementCodeusSUN (GLushort); +extern void APIENTRY glReplacementCodeubSUN (GLubyte); +extern void APIENTRY glReplacementCodeuivSUN (const GLuint *); +extern void APIENTRY glReplacementCodeusvSUN (const GLushort *); +extern void APIENTRY glReplacementCodeubvSUN (const GLubyte *); +extern void APIENTRY glReplacementCodePointerSUN (GLenum, GLsizei, const GLvoid* *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUISUNPROC) (GLuint code); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUSSUNPROC) (GLushort code); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUBSUNPROC) (GLubyte code); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUIVSUNPROC) (const GLuint *code); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUSVSUNPROC) (const GLushort *code); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUBVSUNPROC) (const GLubyte *code); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEPOINTERSUNPROC) (GLenum type, GLsizei stride, const GLvoid* *pointer); +#endif + +#ifndef GL_SUN_vertex +#define GL_SUN_vertex 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glColor4ubVertex2fSUN (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat); +extern void APIENTRY glColor4ubVertex2fvSUN (const GLubyte *, const GLfloat *); +extern void APIENTRY glColor4ubVertex3fSUN (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glColor4ubVertex3fvSUN (const GLubyte *, const GLfloat *); +extern void APIENTRY glColor3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glColor3fVertex3fvSUN (const GLfloat *, const GLfloat *); +extern void APIENTRY glNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *); +extern void APIENTRY glColor4fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glColor4fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); +extern void APIENTRY glTexCoord2fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glTexCoord2fVertex3fvSUN (const GLfloat *, const GLfloat *); +extern void APIENTRY glTexCoord4fVertex4fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glTexCoord4fVertex4fvSUN (const GLfloat *, const GLfloat *); +extern void APIENTRY glTexCoord2fColor4ubVertex3fSUN (GLfloat, GLfloat, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glTexCoord2fColor4ubVertex3fvSUN (const GLfloat *, const GLubyte *, const GLfloat *); +extern void APIENTRY glTexCoord2fColor3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glTexCoord2fColor3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); +extern void APIENTRY glTexCoord2fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glTexCoord2fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); +extern void APIENTRY glTexCoord2fColor4fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glTexCoord2fColor4fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); +extern void APIENTRY glTexCoord4fColor4fNormal3fVertex4fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glTexCoord4fColor4fNormal3fVertex4fvSUN (const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); +extern void APIENTRY glReplacementCodeuiVertex3fSUN (GLenum, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glReplacementCodeuiVertex3fvSUN (const GLenum *, const GLfloat *); +extern void APIENTRY glReplacementCodeuiColor4ubVertex3fSUN (GLenum, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glReplacementCodeuiColor4ubVertex3fvSUN (const GLenum *, const GLubyte *, const GLfloat *); +extern void APIENTRY glReplacementCodeuiColor3fVertex3fSUN (GLenum, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glReplacementCodeuiColor3fVertex3fvSUN (const GLenum *, const GLfloat *, const GLfloat *); +extern void APIENTRY glReplacementCodeuiNormal3fVertex3fSUN (GLenum, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glReplacementCodeuiNormal3fVertex3fvSUN (const GLenum *, const GLfloat *, const GLfloat *); +extern void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fSUN (GLenum, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fvSUN (const GLenum *, const GLfloat *, const GLfloat *, const GLfloat *); +extern void APIENTRY glReplacementCodeuiTexCoord2fVertex3fSUN (GLenum, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glReplacementCodeuiTexCoord2fVertex3fvSUN (const GLenum *, const GLfloat *, const GLfloat *); +extern void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (GLenum, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (const GLenum *, const GLfloat *, const GLfloat *, const GLfloat *); +extern void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (GLenum, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (const GLenum *, const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLCOLOR4UBVERTEX2FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y); +typedef void (APIENTRY * PFNGLCOLOR4UBVERTEX2FVSUNPROC) (const GLubyte *c, const GLfloat *v); +typedef void (APIENTRY * PFNGLCOLOR4UBVERTEX3FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLCOLOR4UBVERTEX3FVSUNPROC) (const GLubyte *c, const GLfloat *v); +typedef void (APIENTRY * PFNGLCOLOR3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *v); +typedef void (APIENTRY * PFNGLNORMAL3FVERTEX3FSUNPROC) (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *n, const GLfloat *v); +typedef void (APIENTRY * PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRY * PFNGLTEXCOORD2FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLTEXCOORD2FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRY * PFNGLTEXCOORD4FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRY * PFNGLTEXCOORD4FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRY * PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC) (const GLfloat *tc, const GLubyte *c, const GLfloat *v); +typedef void (APIENTRY * PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *v); +typedef void (APIENTRY * PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRY * PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRY * PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRY * PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC) (GLenum rc, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC) (const GLenum *rc, const GLfloat *v); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC) (GLenum rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC) (const GLenum *rc, const GLubyte *c, const GLfloat *v); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC) (GLenum rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC) (const GLenum *rc, const GLfloat *c, const GLfloat *v); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC) (GLenum rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC) (const GLenum *rc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLenum rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLenum *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC) (GLenum rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC) (const GLenum *rc, const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLenum rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLenum *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLenum rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLenum *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +#endif + +#ifndef GL_EXT_blend_func_separate +#define GL_EXT_blend_func_separate 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glBlendFuncSeparateEXT (GLenum, GLenum, GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +#endif + +#ifndef GL_INGR_color_clamp +#define GL_INGR_color_clamp 1 +#endif + +#ifndef GL_INGR_interlace_read +#define GL_INGR_interlace_read 1 +#endif + +#ifndef GL_EXT_stencil_wrap +#define GL_EXT_stencil_wrap 1 +#endif + +#ifndef GL_EXT_422_pixels +#define GL_EXT_422_pixels 1 +#endif + +#ifndef GL_NV_texgen_reflection +#define GL_NV_texgen_reflection 1 +#endif + +#ifndef GL_SUN_convolution_border_modes +#define GL_SUN_convolution_border_modes 1 +#endif + +#ifndef GL_EXT_texture_env_add +#define GL_EXT_texture_env_add 1 +#endif + +#ifndef GL_EXT_texture_lod_bias +#define GL_EXT_texture_lod_bias 1 +#endif + +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_EXT_texture_filter_anisotropic 1 +#endif + +#ifndef GL_EXT_vertex_weighting +#define GL_EXT_vertex_weighting 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glVertexWeightfEXT (GLfloat); +extern void APIENTRY glVertexWeightfvEXT (const GLfloat *); +extern void APIENTRY glVertexWeightPointerEXT (GLsizei, GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight); +typedef void (APIENTRY * PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight); +typedef void (APIENTRY * PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_NV_light_max_exponent +#define GL_NV_light_max_exponent 1 +#endif + +#ifndef GL_NV_vertex_array_range +#define GL_NV_vertex_array_range 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glFlushVertexArrayRangeNV (void); +extern void APIENTRY glVertexArrayRangeNV (GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void); +typedef void (APIENTRY * PFNGLVERTEXARRAYRANGENVPROC) (GLsizei size, const GLvoid *pointer); +#endif + +#ifndef GL_NV_register_combiners +#define GL_NV_register_combiners 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glCombinerParameterfvNV (GLenum, const GLfloat *); +extern void APIENTRY glCombinerParameterfNV (GLenum, GLfloat); +extern void APIENTRY glCombinerParameterivNV (GLenum, const GLint *); +extern void APIENTRY glCombinerParameteriNV (GLenum, GLint); +extern void APIENTRY glCombinerInputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum); +extern void APIENTRY glCombinerOutputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean); +extern void APIENTRY glFinalCombinerInputNV (GLenum, GLenum, GLenum, GLenum); +extern void APIENTRY glGetCombinerInputParameterfvNV (GLenum, GLenum, GLenum, GLenum, GLfloat *); +extern void APIENTRY glGetCombinerInputParameterivNV (GLenum, GLenum, GLenum, GLenum, GLint *); +#ifdef VMS + #define glGetCombinerOutputParameterfvNV glGetCombinerOutputParameterfvN + #define glGetCombinerOutputParameterivNV glGetCombinerOutputParameterivN + #define glGetFinalCombinerInputParameterfvNV glGetFinalCombinerInputParafvNV + #define glGetFinalCombinerInputParameterivNV glGetFinalCombinerInputParaivNV +#endif +extern void APIENTRY glGetCombinerOutputParameterfvNV (GLenum, GLenum, GLenum, GLfloat *); +extern void APIENTRY glGetCombinerOutputParameterivNV (GLenum, GLenum, GLenum, GLint *); +extern void APIENTRY glGetFinalCombinerInputParameterfvNV (GLenum, GLenum, GLfloat *); +extern void APIENTRY glGetFinalCombinerInputParameterivNV (GLenum, GLenum, GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRY * PFNGLCOMBINERPARAMETERFNVPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRY * PFNGLCOMBINERPARAMETERIVNVPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRY * PFNGLCOMBINERPARAMETERINVPROC) (GLenum pname, GLint param); +typedef void (APIENTRY * PFNGLCOMBINERINPUTNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +typedef void (APIENTRY * PFNGLCOMBINEROUTPUTNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); +typedef void (APIENTRY * PFNGLFINALCOMBINERINPUTNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +typedef void (APIENTRY * PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params); +typedef void (APIENTRY * PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params); +typedef void (APIENTRY * PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLfloat *params); +typedef void (APIENTRY * PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLint *params); +typedef void (APIENTRY * PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC) (GLenum variable, GLenum pname, GLfloat *params); +typedef void (APIENTRY * PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC) (GLenum variable, GLenum pname, GLint *params); +#endif + +#ifndef GL_NV_fog_distance +#define GL_NV_fog_distance 1 +#endif + +#ifndef GL_NV_texgen_emboss +#define GL_NV_texgen_emboss 1 +#endif + +#ifndef GL_NV_blend_square +#define GL_NV_blend_square 1 +#endif + +#ifndef GL_NV_texture_env_combine4 +#define GL_NV_texture_env_combine4 1 +#endif + +#ifndef GL_MESA_resize_buffers +#define GL_MESA_resize_buffers 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glResizeBuffersMESA (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLRESIZEBUFFERSMESAPROC) (void); +#endif + +#ifndef GL_MESA_window_pos +#define GL_MESA_window_pos 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glWindowPos2dMESA (GLdouble, GLdouble); +extern void APIENTRY glWindowPos2dvMESA (const GLdouble *); +extern void APIENTRY glWindowPos2fMESA (GLfloat, GLfloat); +extern void APIENTRY glWindowPos2fvMESA (const GLfloat *); +extern void APIENTRY glWindowPos2iMESA (GLint, GLint); +extern void APIENTRY glWindowPos2ivMESA (const GLint *); +extern void APIENTRY glWindowPos2sMESA (GLshort, GLshort); +extern void APIENTRY glWindowPos2svMESA (const GLshort *); +extern void APIENTRY glWindowPos3dMESA (GLdouble, GLdouble, GLdouble); +extern void APIENTRY glWindowPos3dvMESA (const GLdouble *); +extern void APIENTRY glWindowPos3fMESA (GLfloat, GLfloat, GLfloat); +extern void APIENTRY glWindowPos3fvMESA (const GLfloat *); +extern void APIENTRY glWindowPos3iMESA (GLint, GLint, GLint); +extern void APIENTRY glWindowPos3ivMESA (const GLint *); +extern void APIENTRY glWindowPos3sMESA (GLshort, GLshort, GLshort); +extern void APIENTRY glWindowPos3svMESA (const GLshort *); +extern void APIENTRY glWindowPos4dMESA (GLdouble, GLdouble, GLdouble, GLdouble); +extern void APIENTRY glWindowPos4dvMESA (const GLdouble *); +extern void APIENTRY glWindowPos4fMESA (GLfloat, GLfloat, GLfloat, GLfloat); +extern void APIENTRY glWindowPos4fvMESA (const GLfloat *); +extern void APIENTRY glWindowPos4iMESA (GLint, GLint, GLint, GLint); +extern void APIENTRY glWindowPos4ivMESA (const GLint *); +extern void APIENTRY glWindowPos4sMESA (GLshort, GLshort, GLshort, GLshort); +extern void APIENTRY glWindowPos4svMESA (const GLshort *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLWINDOWPOS2DMESAPROC) (GLdouble x, GLdouble y); +typedef void (APIENTRY * PFNGLWINDOWPOS2DVMESAPROC) (const GLdouble *v); +typedef void (APIENTRY * PFNGLWINDOWPOS2FMESAPROC) (GLfloat x, GLfloat y); +typedef void (APIENTRY * PFNGLWINDOWPOS2FVMESAPROC) (const GLfloat *v); +typedef void (APIENTRY * PFNGLWINDOWPOS2IMESAPROC) (GLint x, GLint y); +typedef void (APIENTRY * PFNGLWINDOWPOS2IVMESAPROC) (const GLint *v); +typedef void (APIENTRY * PFNGLWINDOWPOS2SMESAPROC) (GLshort x, GLshort y); +typedef void (APIENTRY * PFNGLWINDOWPOS2SVMESAPROC) (const GLshort *v); +typedef void (APIENTRY * PFNGLWINDOWPOS3DMESAPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRY * PFNGLWINDOWPOS3DVMESAPROC) (const GLdouble *v); +typedef void (APIENTRY * PFNGLWINDOWPOS3FMESAPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLWINDOWPOS3FVMESAPROC) (const GLfloat *v); +typedef void (APIENTRY * PFNGLWINDOWPOS3IMESAPROC) (GLint x, GLint y, GLint z); +typedef void (APIENTRY * PFNGLWINDOWPOS3IVMESAPROC) (const GLint *v); +typedef void (APIENTRY * PFNGLWINDOWPOS3SMESAPROC) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRY * PFNGLWINDOWPOS3SVMESAPROC) (const GLshort *v); +typedef void (APIENTRY * PFNGLWINDOWPOS4DMESAPROC) (GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRY * PFNGLWINDOWPOS4DVMESAPROC) (const GLdouble *v); +typedef void (APIENTRY * PFNGLWINDOWPOS4FMESAPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRY * PFNGLWINDOWPOS4FVMESAPROC) (const GLfloat *v); +typedef void (APIENTRY * PFNGLWINDOWPOS4IMESAPROC) (GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRY * PFNGLWINDOWPOS4IVMESAPROC) (const GLint *v); +typedef void (APIENTRY * PFNGLWINDOWPOS4SMESAPROC) (GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRY * PFNGLWINDOWPOS4SVMESAPROC) (const GLshort *v); +#endif + +#ifndef GL_IBM_cull_vertex +#define GL_IBM_cull_vertex 1 +#endif + +#ifndef GL_IBM_multimode_draw_arrays +#define GL_IBM_multimode_draw_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glMultiModeDrawArraysIBM (GLenum, const GLint *, const GLsizei *, GLsizei, GLint); +extern void APIENTRY glMultiModeDrawElementsIBM (const GLenum *, const GLsizei *, GLenum, const GLvoid* *, GLsizei, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLMULTIMODEDRAWARRAYSIBMPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride); +typedef void (APIENTRY * PFNGLMULTIMODEDRAWELEMENTSIBMPROC) (const GLenum *mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount, GLint modestride); +#endif + +#ifndef GL_IBM_vertex_array_lists +#define GL_IBM_vertex_array_lists 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glColorPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); +extern void APIENTRY glSecondaryColorPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); +extern void APIENTRY glEdgeFlagPointerListIBM (GLint, const GLboolean* *, GLint); +extern void APIENTRY glFogCoordPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); +extern void APIENTRY glIndexPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); +extern void APIENTRY glNormalPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); +extern void APIENTRY glTexCoordPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); +extern void APIENTRY glVertexPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRY * PFNGLSECONDARYCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRY * PFNGLEDGEFLAGPOINTERLISTIBMPROC) (GLint stride, const GLboolean* *pointer, GLint ptrstride); +typedef void (APIENTRY * PFNGLFOGCOORDPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRY * PFNGLINDEXPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRY * PFNGLNORMALPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRY * PFNGLTEXCOORDPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRY * PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +#endif + +#ifndef GL_SGIX_subsample +#define GL_SGIX_subsample 1 +#endif + +#ifndef GL_SGIX_ycrcba +#define GL_SGIX_ycrcba 1 +#endif + +#ifndef GL_SGIX_ycrcb_subsample +#define GL_SGIX_ycrcb_subsample 1 +#endif + +#ifndef GL_SGIX_depth_pass_instrument +#define GL_SGIX_depth_pass_instrument 1 +#endif + +#ifndef GL_3DFX_texture_compression_FXT1 +#define GL_3DFX_texture_compression_FXT1 1 +#endif + +#ifndef GL_3DFX_multisample +#define GL_3DFX_multisample 1 +#endif + +#ifndef GL_3DFX_tbuffer +#define GL_3DFX_tbuffer 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glTbufferMask3DFX (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLTBUFFERMASK3DFXPROC) (GLuint mask); +#endif + +#ifndef GL_EXT_multisample +#define GL_EXT_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glSampleMaskEXT (GLclampf, GLboolean); +extern void APIENTRY glSamplePatternEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLSAMPLEMASKEXTPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRY * PFNGLSAMPLEPATTERNEXTPROC) (GLenum pattern); +#endif + +#ifndef GL_SGI_vertex_preclip +#define GL_SGI_vertex_preclip 1 +#endif + +#ifndef GL_SGIX_convolution_accuracy +#define GL_SGIX_convolution_accuracy 1 +#endif + +#ifndef GL_SGIX_resample +#define GL_SGIX_resample 1 +#endif + +#ifndef GL_SGIS_point_line_texgen +#define GL_SGIS_point_line_texgen 1 +#endif + +#ifndef GL_SGIS_texture_color_mask +#define GL_SGIS_texture_color_mask 1 +#ifdef GL_GLEXT_PROTOTYPES +extern void APIENTRY glTextureColorMaskSGIS (GLboolean, GLboolean, GLboolean, GLboolean); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRY * PFNGLTEXTURECOLORMASKSGISPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* __glext_h_ */ +#endif /* NO_SDL_GLEXT */ diff --git a/SDK/LIBS/dcinclude/SDL/SDL_quit.h b/SDK/LIBS/dcinclude/SDL/SDL_quit.h new file mode 100644 index 00000000..ac96d0dd --- /dev/null +++ b/SDK/LIBS/dcinclude/SDL/SDL_quit.h @@ -0,0 +1,52 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id: SDL_quit.h,v 1.1 2003/02/27 03:46:29 bardtx Exp $"; +#endif + +/* Include file for SDL quit event handling */ + +#ifndef _SDL_quit_h +#define _SDL_quit_h + +/* + An SDL_QUITEVENT is generated when the user tries to close the application + window. If it is ignored or filtered out, the window will remain open. + If it is not ignored or filtered, it is queued normally and the window + is allowed to close. When the window is closed, screen updates will + complete, but have no effect. + + SDL_Init() installs signal handlers for SIGINT (keyboard interrupt) + and SIGTERM (system termination request), if handlers do not already + exist, that generate SDL_QUITEVENT events as well. There is no way + to determine the cause of an SDL_QUITEVENT, but setting a signal + handler in your application will override the default generation of + quit events for that signal. +*/ + +/* There are no functions directly affecting the quit event */ +#define SDL_QuitRequested() \ + (SDL_PumpEvents(), SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUITMASK)) + +#endif /* _SDL_quit_h */ diff --git a/SDK/LIBS/dcinclude/SDL/SDL_rwops.h b/SDK/LIBS/dcinclude/SDL/SDL_rwops.h new file mode 100644 index 00000000..78c3299e --- /dev/null +++ b/SDK/LIBS/dcinclude/SDL/SDL_rwops.h @@ -0,0 +1,113 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id: SDL_rwops.h,v 1.1 2003/02/27 03:46:29 bardtx Exp $"; +#endif + +/* This file provides a general interface for SDL to read and write + data sources. It can easily be extended to files, memory, etc. +*/ + +#ifndef _SDL_RWops_h +#define _SDL_RWops_h + +#include + +#include "SDL_types.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* This is the read/write operation structure -- very basic */ + +typedef struct SDL_RWops { + /* Seek to 'offset' relative to whence, one of stdio's whence values: + SEEK_SET, SEEK_CUR, SEEK_END + Returns the final offset in the data source. + */ + int (*seek)(struct SDL_RWops *context, int offset, int whence); + + /* Read up to 'num' objects each of size 'objsize' from the data + source to the area pointed at by 'ptr'. + Returns the number of objects read, or -1 if the read failed. + */ + int (*read)(struct SDL_RWops *context, void *ptr, int size, int maxnum); + + /* Write exactly 'num' objects each of size 'objsize' from the area + pointed at by 'ptr' to data source. + Returns 'num', or -1 if the write failed. + */ + int (*write)(struct SDL_RWops *context, const void *ptr, int size, int num); + + /* Close and free an allocated SDL_FSops structure */ + int (*close)(struct SDL_RWops *context); + + Uint32 type; + union { + struct { + int autoclose; + FILE *fp; + } stdio; + struct { + Uint8 *base; + Uint8 *here; + Uint8 *stop; + } mem; + struct { + void *data1; + } unknown; + } hidden; + +} SDL_RWops; + + +/* Functions to create SDL_RWops structures from various data sources */ + +extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFile(const char *file, const char *mode); + +extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFP(FILE *fp, int autoclose); + +extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromMem(void *mem, int size); + +extern DECLSPEC SDL_RWops * SDLCALL SDL_AllocRW(void); +extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops *area); + +/* Macros to easily read and write from an SDL_RWops structure */ +#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence) +#define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, SEEK_CUR) +#define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n) +#define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n) +#define SDL_RWclose(ctx) (ctx)->close(ctx) + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_RWops_h */ diff --git a/SDK/LIBS/dcinclude/SDL/SDL_syswm.h b/SDK/LIBS/dcinclude/SDL/SDL_syswm.h new file mode 100644 index 00000000..d4dcfab6 --- /dev/null +++ b/SDK/LIBS/dcinclude/SDL/SDL_syswm.h @@ -0,0 +1,167 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id: SDL_syswm.h,v 1.1 2003/02/27 03:46:29 bardtx Exp $"; +#endif + +/* Include file for SDL custom system window manager hooks */ + +#ifndef _SDL_syswm_h +#define _SDL_syswm_h + +#include "SDL_version.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Your application has access to a special type of event 'SDL_SYSWMEVENT', + which contains window-manager specific information and arrives whenever + an unhandled window event occurs. This event is ignored by default, but + you can enable it with SDL_EventState() +*/ +#ifdef SDL_PROTOTYPES_ONLY +struct SDL_SysWMinfo; +typedef struct SDL_SysWMinfo SDL_SysWMinfo; +#else + +/* This is the structure for custom window manager events */ +#if (defined(unix) || defined(__unix__) || defined(_AIX) || defined(__OpenBSD__)) && \ + (!defined(DISABLE_X11) && !defined(__CYGWIN32__) && !defined(ENABLE_NANOX)) + /* AIX is unix, of course, but the native compiler CSet doesn't define unix */ +#include +#include + +/* These are the various supported subsystems under UNIX */ +typedef enum { + SDL_SYSWM_X11 +} SDL_SYSWM_TYPE; + +/* The UNIX custom event structure */ +struct SDL_SysWMmsg { + SDL_version version; + SDL_SYSWM_TYPE subsystem; + union { + XEvent xevent; + } event; +}; + +/* The UNIX custom window manager information structure. + When this structure is returned, it holds information about which + low level system it is using, and will be one of SDL_SYSWM_TYPE. + */ +typedef struct { + SDL_version version; + SDL_SYSWM_TYPE subsystem; + union { + struct { + Display *display; /* The X11 display */ + Window window; /* The X11 display window */ + /* These locking functions should be called around + any X11 functions using the display variable. + They lock the event thread, so should not be + called around event functions or from event filters. + */ + void (*lock_func)(void); + void (*unlock_func)(void); + + /* Introduced in SDL 1.0.2 */ + Window fswindow; /* The X11 fullscreen window */ + Window wmwindow; /* The X11 managed input window */ + } x11; + } info; +} SDL_SysWMinfo; + +#elif defined(ENABLE_NANOX) +#include + +/* The generic custom event structure */ +struct SDL_SysWMmsg { + SDL_version version; + int data; +}; + +/* The windows custom window manager information structure */ +typedef struct { + SDL_version version ; + GR_WINDOW_ID window ; /* The display window */ +} SDL_SysWMinfo; + +#elif defined(WIN32) +#define WIN32_LEAN_AND_MEAN +#include + +/* The windows custom event structure */ +struct SDL_SysWMmsg { + SDL_version version; + HWND hwnd; /* The window for the message */ + UINT msg; /* The type of message */ + WPARAM wParam; /* WORD message parameter */ + LPARAM lParam; /* LONG message parameter */ +}; + +/* The windows custom window manager information structure */ +typedef struct { + SDL_version version; + HWND window; /* The Win32 display window */ + HGLRC hglrc; /* The OpenGL context, if any */ +} SDL_SysWMinfo; + +#else + +/* The generic custom event structure */ +struct SDL_SysWMmsg { + SDL_version version; + int data; +}; + +/* The generic custom window manager information structure */ +typedef struct { + SDL_version version; + int data; +} SDL_SysWMinfo; + +#endif /* OS type */ + +#endif /* SDL_PROTOTYPES_ONLY */ + +/* Function prototypes */ +/* + * This function gives you custom hooks into the window manager information. + * It fills the structure pointed to by 'info' with custom information and + * returns 1 if the function is implemented. If it's not implemented, or + * the version member of the 'info' structure is invalid, it returns 0. + */ +extern DECLSPEC int SDLCALL SDL_GetWMInfo(SDL_SysWMinfo *info); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_syswm_h */ diff --git a/SDK/LIBS/dcinclude/SDL/SDL_thread.h b/SDK/LIBS/dcinclude/SDL/SDL_thread.h new file mode 100644 index 00000000..c73bdf4a --- /dev/null +++ b/SDK/LIBS/dcinclude/SDL/SDL_thread.h @@ -0,0 +1,79 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id: SDL_thread.h,v 1.1 2003/02/27 03:46:29 bardtx Exp $"; +#endif + +#ifndef _SDL_thread_h +#define _SDL_thread_h + +/* Header for the SDL thread management routines + + These are independent of the other SDL routines. +*/ + +#include "SDL_main.h" +#include "SDL_types.h" + +/* Thread synchronization primitives */ +#include "SDL_mutex.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* The SDL thread structure, defined in SDL_thread.c */ +struct SDL_Thread; +typedef struct SDL_Thread SDL_Thread; + +/* Create a thread */ +extern DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (*fn)(void *), void *data); + +/* Get the 32-bit thread identifier for the current thread */ +extern DECLSPEC Uint32 SDLCALL SDL_ThreadID(void); + +/* Get the 32-bit thread identifier for the specified thread, + equivalent to SDL_ThreadID() if the specified thread is NULL. + */ +extern DECLSPEC Uint32 SDLCALL SDL_GetThreadID(SDL_Thread *thread); + +/* Wait for a thread to finish. + The return code for the thread function is placed in the area + pointed to by 'status', if 'status' is not NULL. + */ +extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread *thread, int *status); + +/* Forcefully kill a thread without worrying about its state */ +extern DECLSPEC void SDLCALL SDL_KillThread(SDL_Thread *thread); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_thread_h */ diff --git a/SDK/LIBS/dcinclude/SDL/SDL_timer.h b/SDK/LIBS/dcinclude/SDL/SDL_timer.h new file mode 100644 index 00000000..cbc919cd --- /dev/null +++ b/SDK/LIBS/dcinclude/SDL/SDL_timer.h @@ -0,0 +1,118 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id: SDL_timer.h,v 1.1 2003/02/27 03:46:29 bardtx Exp $"; +#endif + +#ifndef _SDL_timer_h +#define _SDL_timer_h + +/* Header for the SDL time management routines */ + +#include "SDL_main.h" +#include "SDL_types.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* This is the OS scheduler timeslice, in milliseconds */ +#define SDL_TIMESLICE 10 + +/* This is the maximum resolution of the SDL timer on all platforms */ +#define TIMER_RESOLUTION 10 /* Experimentally determined */ + +/* Get the number of milliseconds since the SDL library initialization. + * Note that this value wraps if the program runs for more than ~49 days. + */ +extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void); + +/* Wait a specified number of milliseconds before returning */ +extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms); + +/* Function prototype for the timer callback function */ +typedef Uint32 (SDLCALL *SDL_TimerCallback)(Uint32 interval); + +/* Set a callback to run after the specified number of milliseconds has + * elapsed. The callback function is passed the current timer interval + * and returns the next timer interval. If the returned value is the + * same as the one passed in, the periodic alarm continues, otherwise a + * new alarm is scheduled. If the callback returns 0, the periodic alarm + * is cancelled. + * + * To cancel a currently running timer, call SDL_SetTimer(0, NULL); + * + * The timer callback function may run in a different thread than your + * main code, and so shouldn't call any functions from within itself. + * + * The maximum resolution of this timer is 10 ms, which means that if + * you request a 16 ms timer, your callback will run approximately 20 ms + * later on an unloaded system. If you wanted to set a flag signaling + * a frame update at 30 frames per second (every 33 ms), you might set a + * timer for 30 ms: + * SDL_SetTimer((33/10)*10, flag_update); + * + * If you use this function, you need to pass SDL_INIT_TIMER to SDL_Init(). + * + * Under UNIX, you should not use raise or use SIGALRM and this function + * in the same program, as it is implemented using setitimer(). You also + * should not use this function in multi-threaded applications as signals + * to multi-threaded apps have undefined behavior in some implementations. + */ +extern DECLSPEC int SDLCALL SDL_SetTimer(Uint32 interval, SDL_TimerCallback callback); + +/* New timer API, supports multiple timers + * Written by Stephane Peter + */ + +/* Function prototype for the new timer callback function. + * The callback function is passed the current timer interval and returns + * the next timer interval. If the returned value is the same as the one + * passed in, the periodic alarm continues, otherwise a new alarm is + * scheduled. If the callback returns 0, the periodic alarm is cancelled. + */ +typedef Uint32 (SDLCALL *SDL_NewTimerCallback)(Uint32 interval, void *param); + +/* Definition of the timer ID type */ +typedef struct _SDL_TimerID *SDL_TimerID; + +/* Add a new timer to the pool of timers already running. + Returns a timer ID, or NULL when an error occurs. + */ +extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, SDL_NewTimerCallback callback, void *param); + +/* Remove one of the multiple timers knowing its ID. + * Returns a boolean value indicating success. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID t); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_timer_h */ diff --git a/SDK/LIBS/dcinclude/SDL/SDL_types.h b/SDK/LIBS/dcinclude/SDL/SDL_types.h new file mode 100644 index 00000000..ffad5f23 --- /dev/null +++ b/SDK/LIBS/dcinclude/SDL/SDL_types.h @@ -0,0 +1,103 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id: SDL_types.h,v 1.1 2003/02/27 03:46:29 bardtx Exp $"; +#endif + +/* General data types used by the SDL library */ + +#ifndef _SDL_types_h +#define _SDL_types_h + +/* The number of elements in a table */ +#define SDL_TABLESIZE(table) (sizeof(table)/sizeof(table[0])) + +/* Basic data types */ +typedef enum { + SDL_FALSE = 0, + SDL_TRUE = 1 +} SDL_bool; +typedef unsigned char Uint8; +typedef signed char Sint8; +typedef unsigned short Uint16; +typedef signed short Sint16; +typedef unsigned int Uint32; +typedef signed int Sint32; + +/* Figure out how to support 64-bit datatypes */ +#if !defined(__STRICT_ANSI__) +#if defined(__GNUC__) || defined(__MWERKS__) || defined(__SUNPRO_C) +#define SDL_HAS_64BIT_TYPE long long +#elif defined(_MSC_VER) /* VC++ */ +#define SDL_HAS_64BIT_TYPE __int64 +#endif +#endif /* !__STRICT_ANSI__ */ + +/* The 64-bit type isn't available on EPOC/Symbian OS */ +#ifdef __SYMBIAN32__ +#undef SDL_HAS_64BIT_TYPE +#endif + +/* The 64-bit datatype isn't supported on all platforms */ +#ifdef SDL_HAS_64BIT_TYPE +typedef unsigned SDL_HAS_64BIT_TYPE Uint64; +typedef SDL_HAS_64BIT_TYPE Sint64; +#else +/* This is really just a hack to prevent the compiler from complaining */ +typedef struct { + Uint32 hi; + Uint32 lo; +} Uint64, Sint64; +#endif + +/* Make sure the types really have the right sizes */ +#define SDL_COMPILE_TIME_ASSERT(name, x) \ + typedef int SDL_dummy_ ## name[(x) * 2 - 1] + +SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1); +SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1); +SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2); +SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2); +SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4); +SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4); +SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8); +SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8); + +/* Check to make sure enums are the size of ints, for structure packing. + For both Watcom C/C++ and Borland C/C++ the compiler option that makes + enums having the size of an int must be enabled. + This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11). +*/ +typedef enum { + DUMMY_ENUM_VALUE +} SDL_DUMMY_ENUM; + +SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int)); + +#undef SDL_COMPILE_TIME_ASSERT + +/* General keyboard/mouse state definitions */ +enum { SDL_PRESSED = 0x01, SDL_RELEASED = 0x00 }; + +#endif diff --git a/SDK/LIBS/dcinclude/SDL/SDL_version.h b/SDK/LIBS/dcinclude/SDL/SDL_version.h new file mode 100644 index 00000000..49a0d360 --- /dev/null +++ b/SDK/LIBS/dcinclude/SDL/SDL_version.h @@ -0,0 +1,90 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id: SDL_version.h,v 1.1 2003/02/27 03:46:29 bardtx Exp $"; +#endif + +/* This header defines the current SDL version */ + +#ifndef _SDL_version_h +#define _SDL_version_h + +#include "SDL_types.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL +*/ +#define SDL_MAJOR_VERSION 1 +#define SDL_MINOR_VERSION 2 +#define SDL_PATCHLEVEL 5 + +typedef struct { + Uint8 major; + Uint8 minor; + Uint8 patch; +} SDL_version; + +/* This macro can be used to fill a version structure with the compile-time + * version of the SDL library. + */ +#define SDL_VERSION(X) \ +{ \ + (X)->major = SDL_MAJOR_VERSION; \ + (X)->minor = SDL_MINOR_VERSION; \ + (X)->patch = SDL_PATCHLEVEL; \ +} + +/* This macro turns the version numbers into a numeric value: + (1,2,3) -> (1203) + This assumes that there will never be more than 100 patchlevels +*/ +#define SDL_VERSIONNUM(X, Y, Z) \ + (X)*1000 + (Y)*100 + (Z) + +/* This is the version number macro for the current SDL version */ +#define SDL_COMPILEDVERSION \ + SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) + +/* This macro will evaluate to true if compiled with SDL at least X.Y.Z */ +#define SDL_VERSION_ATLEAST(X, Y, Z) \ + (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) + +/* This function gets the version of the dynamically linked SDL library. + it should NOT be used to fill a version structure, instead you should + use the SDL_Version() macro. + */ +extern DECLSPEC const SDL_version * SDLCALL SDL_Linked_Version(void); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_version_h */ diff --git a/SDK/LIBS/dcinclude/SDL/SDL_video.h b/SDK/LIBS/dcinclude/SDL/SDL_video.h new file mode 100644 index 00000000..baecb6a9 --- /dev/null +++ b/SDK/LIBS/dcinclude/SDL/SDL_video.h @@ -0,0 +1,894 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id: SDL_video.h,v 1.1 2003/02/27 03:46:29 bardtx Exp $"; +#endif + +/* Header file for access to the SDL raw framebuffer window */ + +#ifndef _SDL_video_h +#define _SDL_video_h + +#include + +#include "SDL_types.h" +#include "SDL_mutex.h" +#include "SDL_rwops.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Transparency definitions: These define alpha as the opacity of a surface */ +#define SDL_ALPHA_OPAQUE 255 +#define SDL_ALPHA_TRANSPARENT 0 + +/* Useful data types */ +typedef struct { + Sint16 x, y; + Uint16 w, h; +} SDL_Rect; + +typedef struct { + Uint8 r; + Uint8 g; + Uint8 b; + Uint8 unused; +} SDL_Color; + +typedef struct { + int ncolors; + SDL_Color *colors; +} SDL_Palette; + +/* Everything in the pixel format structure is read-only */ +typedef struct SDL_PixelFormat { + SDL_Palette *palette; + Uint8 BitsPerPixel; + Uint8 BytesPerPixel; + Uint8 Rloss; + Uint8 Gloss; + Uint8 Bloss; + Uint8 Aloss; + Uint8 Rshift; + Uint8 Gshift; + Uint8 Bshift; + Uint8 Ashift; + Uint32 Rmask; + Uint32 Gmask; + Uint32 Bmask; + Uint32 Amask; + + /* RGB color key information */ + Uint32 colorkey; + /* Alpha value information (per-surface alpha) */ + Uint8 alpha; +} SDL_PixelFormat; + +/* typedef for private surface blitting functions */ +struct SDL_Surface; +typedef int (*SDL_blit)(struct SDL_Surface *src, SDL_Rect *srcrect, + struct SDL_Surface *dst, SDL_Rect *dstrect); + +/* This structure should be treated as read-only, except for 'pixels', + which, if not NULL, contains the raw pixel data for the surface. +*/ +typedef struct SDL_Surface { + Uint32 flags; /* Read-only */ + SDL_PixelFormat *format; /* Read-only */ + int w, h; /* Read-only */ + Uint16 pitch; /* Read-only */ + void *pixels; /* Read-write */ + int offset; /* Private */ + + /* Hardware-specific surface info */ + struct private_hwdata *hwdata; + + /* clipping information */ + SDL_Rect clip_rect; /* Read-only */ + Uint32 unused1; /* for binary compatibility */ + + /* Allow recursive locks */ + Uint32 locked; /* Private */ + + /* info for fast blit mapping to other surfaces */ + struct SDL_BlitMap *map; /* Private */ + + /* format version, bumped at every change to invalidate blit maps */ + unsigned int format_version; /* Private */ + + /* Reference count -- used when freeing surface */ + int refcount; /* Read-mostly */ +} SDL_Surface; + +/* These are the currently supported flags for the SDL_surface */ +/* Available for SDL_CreateRGBSurface() or SDL_SetVideoMode() */ +#define SDL_SWSURFACE 0x00000000 /* Surface is in system memory */ +#define SDL_HWSURFACE 0x00000001 /* Surface is in video memory */ +#define SDL_ASYNCBLIT 0x00000004 /* Use asynchronous blits if possible */ +/* Available for SDL_SetVideoMode() */ +#define SDL_ANYFORMAT 0x10000000 /* Allow any video depth/pixel-format */ +#define SDL_HWPALETTE 0x20000000 /* Surface has exclusive palette */ +#define SDL_DOUBLEBUF 0x40000000 /* Set up double-buffered video mode */ +#define SDL_FULLSCREEN 0x80000000 /* Surface is a full screen display */ +#define SDL_OPENGL 0x00000002 /* Create an OpenGL rendering context */ +#define SDL_OPENGLBLIT 0x0000000A /* Create an OpenGL rendering context and use it for blitting */ +#define SDL_RESIZABLE 0x00000010 /* This video mode may be resized */ +#define SDL_NOFRAME 0x00000020 /* No window caption or edge frame */ +/* Used internally (read-only) */ +#define SDL_HWACCEL 0x00000100 /* Blit uses hardware acceleration */ +#define SDL_SRCCOLORKEY 0x00001000 /* Blit uses a source color key */ +#define SDL_RLEACCELOK 0x00002000 /* Private flag */ +#define SDL_RLEACCEL 0x00004000 /* Surface is RLE encoded */ +#define SDL_SRCALPHA 0x00010000 /* Blit uses source alpha blending */ +#define SDL_PREALLOC 0x01000000 /* Surface uses preallocated memory */ + +/* Evaluates to true if the surface needs to be locked before access */ +#define SDL_MUSTLOCK(surface) \ + (surface->offset || \ + ((surface->flags & (SDL_HWSURFACE|SDL_ASYNCBLIT|SDL_RLEACCEL)) != 0)) + + +/* Useful for determining the video hardware capabilities */ +typedef struct { + Uint32 hw_available :1; /* Flag: Can you create hardware surfaces? */ + Uint32 wm_available :1; /* Flag: Can you talk to a window manager? */ + Uint32 UnusedBits1 :6; + Uint32 UnusedBits2 :1; + Uint32 blit_hw :1; /* Flag: Accelerated blits HW --> HW */ + Uint32 blit_hw_CC :1; /* Flag: Accelerated blits with Colorkey */ + Uint32 blit_hw_A :1; /* Flag: Accelerated blits with Alpha */ + Uint32 blit_sw :1; /* Flag: Accelerated blits SW --> HW */ + Uint32 blit_sw_CC :1; /* Flag: Accelerated blits with Colorkey */ + Uint32 blit_sw_A :1; /* Flag: Accelerated blits with Alpha */ + Uint32 blit_fill :1; /* Flag: Accelerated color fill */ + Uint32 UnusedBits3 :16; + Uint32 video_mem; /* The total amount of video memory (in K) */ + SDL_PixelFormat *vfmt; /* Value: The format of the video surface */ +} SDL_VideoInfo; + + +/* The most common video overlay formats. + For an explanation of these pixel formats, see: + http://www.webartz.com/fourcc/indexyuv.htm + + For information on the relationship between color spaces, see: + http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html + */ +#define SDL_YV12_OVERLAY 0x32315659 /* Planar mode: Y + V + U (3 planes) */ +#define SDL_IYUV_OVERLAY 0x56555949 /* Planar mode: Y + U + V (3 planes) */ +#define SDL_YUY2_OVERLAY 0x32595559 /* Packed mode: Y0+U0+Y1+V0 (1 plane) */ +#define SDL_UYVY_OVERLAY 0x59565955 /* Packed mode: U0+Y0+V0+Y1 (1 plane) */ +#define SDL_YVYU_OVERLAY 0x55595659 /* Packed mode: Y0+V0+Y1+U0 (1 plane) */ + +/* The YUV hardware video overlay */ +typedef struct SDL_Overlay { + Uint32 format; /* Read-only */ + int w, h; /* Read-only */ + int planes; /* Read-only */ + Uint16 *pitches; /* Read-only */ + Uint8 **pixels; /* Read-write */ + + /* Hardware-specific surface info */ + struct private_yuvhwfuncs *hwfuncs; + struct private_yuvhwdata *hwdata; + + /* Special flags */ + Uint32 hw_overlay :1; /* Flag: This overlay hardware accelerated? */ + Uint32 UnusedBits :31; +} SDL_Overlay; + + +/* Public enumeration for setting the OpenGL window attributes. */ +typedef enum { + SDL_GL_RED_SIZE, + SDL_GL_GREEN_SIZE, + SDL_GL_BLUE_SIZE, + SDL_GL_ALPHA_SIZE, + SDL_GL_BUFFER_SIZE, + SDL_GL_DOUBLEBUFFER, + SDL_GL_DEPTH_SIZE, + SDL_GL_STENCIL_SIZE, + SDL_GL_ACCUM_RED_SIZE, + SDL_GL_ACCUM_GREEN_SIZE, + SDL_GL_ACCUM_BLUE_SIZE, + SDL_GL_ACCUM_ALPHA_SIZE, + SDL_GL_STEREO +} SDL_GLattr; + +/* flags for SDL_SetPalette() */ +#define SDL_LOGPAL 0x01 +#define SDL_PHYSPAL 0x02 + +/* Function prototypes */ + +/* These functions are used internally, and should not be used unless you + * have a specific need to specify the video driver you want to use. + * You should normally use SDL_Init() or SDL_InitSubSystem(). + * + * SDL_VideoInit() initializes the video subsystem -- sets up a connection + * to the window manager, etc, and determines the current video mode and + * pixel format, but does not initialize a window or graphics mode. + * Note that event handling is activated by this routine. + * + * If you use both sound and video in your application, you need to call + * SDL_Init() before opening the sound device, otherwise under Win32 DirectX, + * you won't be able to set full-screen display modes. + */ +extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name, Uint32 flags); +extern DECLSPEC void SDLCALL SDL_VideoQuit(void); + +/* This function fills the given character buffer with the name of the + * video driver, and returns a pointer to it if the video driver has + * been initialized. It returns NULL if no driver has been initialized. + */ +extern DECLSPEC char * SDLCALL SDL_VideoDriverName(char *namebuf, int maxlen); + +/* + * This function returns a pointer to the current display surface. + * If SDL is doing format conversion on the display surface, this + * function returns the publicly visible surface, not the real video + * surface. + */ +extern DECLSPEC SDL_Surface * SDLCALL SDL_GetVideoSurface(void); + +/* + * This function returns a read-only pointer to information about the + * video hardware. If this is called before SDL_SetVideoMode(), the 'vfmt' + * member of the returned structure will contain the pixel format of the + * "best" video mode. + */ +extern DECLSPEC const SDL_VideoInfo * SDLCALL SDL_GetVideoInfo(void); + +/* + * Check to see if a particular video mode is supported. + * It returns 0 if the requested mode is not supported under any bit depth, + * or returns the bits-per-pixel of the closest available mode with the + * given width and height. If this bits-per-pixel is different from the + * one used when setting the video mode, SDL_SetVideoMode() will succeed, + * but will emulate the requested bits-per-pixel with a shadow surface. + * + * The arguments to SDL_VideoModeOK() are the same ones you would pass to + * SDL_SetVideoMode() + */ +extern DECLSPEC int SDLCALL SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags); + +/* + * Return a pointer to an array of available screen dimensions for the + * given format and video flags, sorted largest to smallest. Returns + * NULL if there are no dimensions available for a particular format, + * or (SDL_Rect **)-1 if any dimension is okay for the given format. + * + * If 'format' is NULL, the mode list will be for the format given + * by SDL_GetVideoInfo()->vfmt + */ +extern DECLSPEC SDL_Rect ** SDLCALL SDL_ListModes(SDL_PixelFormat *format, Uint32 flags); + +/* + * Set up a video mode with the specified width, height and bits-per-pixel. + * + * If 'bpp' is 0, it is treated as the current display bits per pixel. + * + * If SDL_ANYFORMAT is set in 'flags', the SDL library will try to set the + * requested bits-per-pixel, but will return whatever video pixel format is + * available. The default is to emulate the requested pixel format if it + * is not natively available. + * + * If SDL_HWSURFACE is set in 'flags', the video surface will be placed in + * video memory, if possible, and you may have to call SDL_LockSurface() + * in order to access the raw framebuffer. Otherwise, the video surface + * will be created in system memory. + * + * If SDL_ASYNCBLIT is set in 'flags', SDL will try to perform rectangle + * updates asynchronously, but you must always lock before accessing pixels. + * SDL will wait for updates to complete before returning from the lock. + * + * If SDL_HWPALETTE is set in 'flags', the SDL library will guarantee + * that the colors set by SDL_SetColors() will be the colors you get. + * Otherwise, in 8-bit mode, SDL_SetColors() may not be able to set all + * of the colors exactly the way they are requested, and you should look + * at the video surface structure to determine the actual palette. + * If SDL cannot guarantee that the colors you request can be set, + * i.e. if the colormap is shared, then the video surface may be created + * under emulation in system memory, overriding the SDL_HWSURFACE flag. + * + * If SDL_FULLSCREEN is set in 'flags', the SDL library will try to set + * a fullscreen video mode. The default is to create a windowed mode + * if the current graphics system has a window manager. + * If the SDL library is able to set a fullscreen video mode, this flag + * will be set in the surface that is returned. + * + * If SDL_DOUBLEBUF is set in 'flags', the SDL library will try to set up + * two surfaces in video memory and swap between them when you call + * SDL_Flip(). This is usually slower than the normal single-buffering + * scheme, but prevents "tearing" artifacts caused by modifying video + * memory while the monitor is refreshing. It should only be used by + * applications that redraw the entire screen on every update. + * + * If SDL_RESIZABLE is set in 'flags', the SDL library will allow the + * window manager, if any, to resize the window at runtime. When this + * occurs, SDL will send a SDL_VIDEORESIZE event to you application, + * and you must respond to the event by re-calling SDL_SetVideoMode() + * with the requested size (or another size that suits the application). + * + * If SDL_NOFRAME is set in 'flags', the SDL library will create a window + * without any title bar or frame decoration. Fullscreen video modes have + * this flag set automatically. + * + * This function returns the video framebuffer surface, or NULL if it fails. + * + * If you rely on functionality provided by certain video flags, check the + * flags of the returned surface to make sure that functionality is available. + * SDL will fall back to reduced functionality if the exact flags you wanted + * are not available. + */ +extern DECLSPEC SDL_Surface * SDLCALL SDL_SetVideoMode + (int width, int height, int bpp, Uint32 flags); + +/* + * Makes sure the given list of rectangles is updated on the given screen. + * If 'x', 'y', 'w' and 'h' are all 0, SDL_UpdateRect will update the entire + * screen. + * These functions should not be called while 'screen' is locked. + */ +extern DECLSPEC void SDLCALL SDL_UpdateRects + (SDL_Surface *screen, int numrects, SDL_Rect *rects); +extern DECLSPEC void SDLCALL SDL_UpdateRect + (SDL_Surface *screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h); + +/* + * On hardware that supports double-buffering, this function sets up a flip + * and returns. The hardware will wait for vertical retrace, and then swap + * video buffers before the next video surface blit or lock will return. + * On hardware that doesn not support double-buffering, this is equivalent + * to calling SDL_UpdateRect(screen, 0, 0, 0, 0); + * The SDL_DOUBLEBUF flag must have been passed to SDL_SetVideoMode() when + * setting the video mode for this function to perform hardware flipping. + * This function returns 0 if successful, or -1 if there was an error. + */ +extern DECLSPEC int SDLCALL SDL_Flip(SDL_Surface *screen); + +/* + * Set the gamma correction for each of the color channels. + * The gamma values range (approximately) between 0.1 and 10.0 + * + * If this function isn't supported directly by the hardware, it will + * be emulated using gamma ramps, if available. If successful, this + * function returns 0, otherwise it returns -1. + */ +extern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue); + +/* + * Set the gamma translation table for the red, green, and blue channels + * of the video hardware. Each table is an array of 256 16-bit quantities, + * representing a mapping between the input and output for that channel. + * The input is the index into the array, and the output is the 16-bit + * gamma value at that index, scaled to the output color precision. + * + * You may pass NULL for any of the channels to leave it unchanged. + * If the call succeeds, it will return 0. If the display driver or + * hardware does not support gamma translation, or otherwise fails, + * this function will return -1. + */ +extern DECLSPEC int SDLCALL SDL_SetGammaRamp(Uint16 *red, Uint16 *green, Uint16 *blue); + +/* + * Retrieve the current values of the gamma translation tables. + * + * You must pass in valid pointers to arrays of 256 16-bit quantities. + * Any of the pointers may be NULL to ignore that channel. + * If the call succeeds, it will return 0. If the display driver or + * hardware does not support gamma translation, or otherwise fails, + * this function will return -1. + */ +extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 *red, Uint16 *green, Uint16 *blue); + +/* + * Sets a portion of the colormap for the given 8-bit surface. If 'surface' + * is not a palettized surface, this function does nothing, returning 0. + * If all of the colors were set as passed to SDL_SetColors(), it will + * return 1. If not all the color entries were set exactly as given, + * it will return 0, and you should look at the surface palette to + * determine the actual color palette. + * + * When 'surface' is the surface associated with the current display, the + * display colormap will be updated with the requested colors. If + * SDL_HWPALETTE was set in SDL_SetVideoMode() flags, SDL_SetColors() + * will always return 1, and the palette is guaranteed to be set the way + * you desire, even if the window colormap has to be warped or run under + * emulation. + */ +extern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface *surface, + SDL_Color *colors, int firstcolor, int ncolors); + +/* + * Sets a portion of the colormap for a given 8-bit surface. + * 'flags' is one or both of: + * SDL_LOGPAL -- set logical palette, which controls how blits are mapped + * to/from the surface, + * SDL_PHYSPAL -- set physical palette, which controls how pixels look on + * the screen + * Only screens have physical palettes. Separate change of physical/logical + * palettes is only possible if the screen has SDL_HWPALETTE set. + * + * The return value is 1 if all colours could be set as requested, and 0 + * otherwise. + * + * SDL_SetColors() is equivalent to calling this function with + * flags = (SDL_LOGPAL|SDL_PHYSPAL). + */ +extern DECLSPEC int SDLCALL SDL_SetPalette(SDL_Surface *surface, int flags, + SDL_Color *colors, int firstcolor, + int ncolors); + +/* + * Maps an RGB triple to an opaque pixel value for a given pixel format + */ +extern DECLSPEC Uint32 SDLCALL SDL_MapRGB + (SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b); + +/* + * Maps an RGBA quadruple to a pixel value for a given pixel format + */ +extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(SDL_PixelFormat *format, + Uint8 r, Uint8 g, Uint8 b, Uint8 a); + +/* + * Maps a pixel value into the RGB components for a given pixel format + */ +extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, SDL_PixelFormat *fmt, + Uint8 *r, Uint8 *g, Uint8 *b); + +/* + * Maps a pixel value into the RGBA components for a given pixel format + */ +extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel, SDL_PixelFormat *fmt, + Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a); + +/* + * Allocate and free an RGB surface (must be called after SDL_SetVideoMode) + * If the depth is 4 or 8 bits, an empty palette is allocated for the surface. + * If the depth is greater than 8 bits, the pixel format is set using the + * flags '[RGB]mask'. + * If the function runs out of memory, it will return NULL. + * + * The 'flags' tell what kind of surface to create. + * SDL_SWSURFACE means that the surface should be created in system memory. + * SDL_HWSURFACE means that the surface should be created in video memory, + * with the same format as the display surface. This is useful for surfaces + * that will not change much, to take advantage of hardware acceleration + * when being blitted to the display surface. + * SDL_ASYNCBLIT means that SDL will try to perform asynchronous blits with + * this surface, but you must always lock it before accessing the pixels. + * SDL will wait for current blits to finish before returning from the lock. + * SDL_SRCCOLORKEY indicates that the surface will be used for colorkey blits. + * If the hardware supports acceleration of colorkey blits between + * two surfaces in video memory, SDL will try to place the surface in + * video memory. If this isn't possible or if there is no hardware + * acceleration available, the surface will be placed in system memory. + * SDL_SRCALPHA means that the surface will be used for alpha blits and + * if the hardware supports hardware acceleration of alpha blits between + * two surfaces in video memory, to place the surface in video memory + * if possible, otherwise it will be placed in system memory. + * If the surface is created in video memory, blits will be _much_ faster, + * but the surface format must be identical to the video surface format, + * and the only way to access the pixels member of the surface is to use + * the SDL_LockSurface() and SDL_UnlockSurface() calls. + * If the requested surface actually resides in video memory, SDL_HWSURFACE + * will be set in the flags member of the returned surface. If for some + * reason the surface could not be placed in video memory, it will not have + * the SDL_HWSURFACE flag set, and will be created in system memory instead. + */ +#define SDL_AllocSurface SDL_CreateRGBSurface +extern DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurface + (Uint32 flags, int width, int height, int depth, + Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); +extern DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels, + int width, int height, int depth, int pitch, + Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); +extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface *surface); + +/* + * SDL_LockSurface() sets up a surface for directly accessing the pixels. + * Between calls to SDL_LockSurface()/SDL_UnlockSurface(), you can write + * to and read from 'surface->pixels', using the pixel format stored in + * 'surface->format'. Once you are done accessing the surface, you should + * use SDL_UnlockSurface() to release it. + * + * Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates + * to 0, then you can read and write to the surface at any time, and the + * pixel format of the surface will not change. In particular, if the + * SDL_HWSURFACE flag is not given when calling SDL_SetVideoMode(), you + * will not need to lock the display surface before accessing it. + * + * No operating system or library calls should be made between lock/unlock + * pairs, as critical system locks may be held during this time. + * + * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked. + */ +extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface *surface); +extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface *surface); + +/* + * Load a surface from a seekable SDL data source (memory or file.) + * If 'freesrc' is non-zero, the source will be closed after being read. + * Returns the new surface, or NULL if there was an error. + * The new surface should be freed with SDL_FreeSurface(). + */ +extern DECLSPEC SDL_Surface * SDLCALL SDL_LoadBMP_RW(SDL_RWops *src, int freesrc); + +/* Convenience macro -- load a surface from a file */ +#define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1) + +/* + * Save a surface to a seekable SDL data source (memory or file.) + * If 'freedst' is non-zero, the source will be closed after being written. + * Returns 0 if successful or -1 if there was an error. + */ +extern DECLSPEC int SDLCALL SDL_SaveBMP_RW + (SDL_Surface *surface, SDL_RWops *dst, int freedst); + +/* Convenience macro -- save a surface to a file */ +#define SDL_SaveBMP(surface, file) \ + SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1) + +/* + * Sets the color key (transparent pixel) in a blittable surface. + * If 'flag' is SDL_SRCCOLORKEY (optionally OR'd with SDL_RLEACCEL), + * 'key' will be the transparent pixel in the source image of a blit. + * SDL_RLEACCEL requests RLE acceleration for the surface if present, + * and removes RLE acceleration if absent. + * If 'flag' is 0, this function clears any current color key. + * This function returns 0, or -1 if there was an error. + */ +extern DECLSPEC int SDLCALL SDL_SetColorKey + (SDL_Surface *surface, Uint32 flag, Uint32 key); + +/* + * This function sets the alpha value for the entire surface, as opposed to + * using the alpha component of each pixel. This value measures the range + * of transparency of the surface, 0 being completely transparent to 255 + * being completely opaque. An 'alpha' value of 255 causes blits to be + * opaque, the source pixels copied to the destination (the default). Note + * that per-surface alpha can be combined with colorkey transparency. + * + * If 'flag' is 0, alpha blending is disabled for the surface. + * If 'flag' is SDL_SRCALPHA, alpha blending is enabled for the surface. + * OR:ing the flag with SDL_RLEACCEL requests RLE acceleration for the + * surface; if SDL_RLEACCEL is not specified, the RLE accel will be removed. + * + * The 'alpha' parameter is ignored for surfaces that have an alpha channel. + */ +extern DECLSPEC int SDLCALL SDL_SetAlpha(SDL_Surface *surface, Uint32 flag, Uint8 alpha); + +/* + * Sets the clipping rectangle for the destination surface in a blit. + * + * If the clip rectangle is NULL, clipping will be disabled. + * If the clip rectangle doesn't intersect the surface, the function will + * return SDL_FALSE and blits will be completely clipped. Otherwise the + * function returns SDL_TRUE and blits to the surface will be clipped to + * the intersection of the surface area and the clipping rectangle. + * + * Note that blits are automatically clipped to the edges of the source + * and destination surfaces. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface *surface, const SDL_Rect *rect); + +/* + * Gets the clipping rectangle for the destination surface in a blit. + * 'rect' must be a pointer to a valid rectangle which will be filled + * with the correct values. + */ +extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface *surface, SDL_Rect *rect); + +/* + * Creates a new surface of the specified format, and then copies and maps + * the given surface to it so the blit of the converted surface will be as + * fast as possible. If this function fails, it returns NULL. + * + * The 'flags' parameter is passed to SDL_CreateRGBSurface() and has those + * semantics. You can also pass SDL_RLEACCEL in the flags parameter and + * SDL will try to RLE accelerate colorkey and alpha blits in the resulting + * surface. + * + * This function is used internally by SDL_DisplayFormat(). + */ +extern DECLSPEC SDL_Surface * SDLCALL SDL_ConvertSurface + (SDL_Surface *src, SDL_PixelFormat *fmt, Uint32 flags); + +/* + * This performs a fast blit from the source surface to the destination + * surface. It assumes that the source and destination rectangles are + * the same size. If either 'srcrect' or 'dstrect' are NULL, the entire + * surface (src or dst) is copied. The final blit rectangles are saved + * in 'srcrect' and 'dstrect' after all clipping is performed. + * If the blit is successful, it returns 0, otherwise it returns -1. + * + * The blit function should not be called on a locked surface. + * + * The blit semantics for surfaces with and without alpha and colorkey + * are defined as follows: + * + * RGBA->RGB: + * SDL_SRCALPHA set: + * alpha-blend (using alpha-channel). + * SDL_SRCCOLORKEY ignored. + * SDL_SRCALPHA not set: + * copy RGB. + * if SDL_SRCCOLORKEY set, only copy the pixels matching the + * RGB values of the source colour key, ignoring alpha in the + * comparison. + * + * RGB->RGBA: + * SDL_SRCALPHA set: + * alpha-blend (using the source per-surface alpha value); + * set destination alpha to opaque. + * SDL_SRCALPHA not set: + * copy RGB, set destination alpha to source per-surface alpha value. + * both: + * if SDL_SRCCOLORKEY set, only copy the pixels matching the + * source colour key. + * + * RGBA->RGBA: + * SDL_SRCALPHA set: + * alpha-blend (using the source alpha channel) the RGB values; + * leave destination alpha untouched. [Note: is this correct?] + * SDL_SRCCOLORKEY ignored. + * SDL_SRCALPHA not set: + * copy all of RGBA to the destination. + * if SDL_SRCCOLORKEY set, only copy the pixels matching the + * RGB values of the source colour key, ignoring alpha in the + * comparison. + * + * RGB->RGB: + * SDL_SRCALPHA set: + * alpha-blend (using the source per-surface alpha value). + * SDL_SRCALPHA not set: + * copy RGB. + * both: + * if SDL_SRCCOLORKEY set, only copy the pixels matching the + * source colour key. + * + * If either of the surfaces were in video memory, and the blit returns -2, + * the video memory was lost, so it should be reloaded with artwork and + * re-blitted: + while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) { + while ( SDL_LockSurface(image) < 0 ) + Sleep(10); + -- Write image pixels to image->pixels -- + SDL_UnlockSurface(image); + } + * This happens under DirectX 5.0 when the system switches away from your + * fullscreen application. The lock will also fail until you have access + * to the video memory again. + */ +/* You should call SDL_BlitSurface() unless you know exactly how SDL + blitting works internally and how to use the other blit functions. +*/ +#define SDL_BlitSurface SDL_UpperBlit + +/* This is the public blit function, SDL_BlitSurface(), and it performs + rectangle validation and clipping before passing it to SDL_LowerBlit() +*/ +extern DECLSPEC int SDLCALL SDL_UpperBlit + (SDL_Surface *src, SDL_Rect *srcrect, + SDL_Surface *dst, SDL_Rect *dstrect); +/* This is a semi-private blit function and it performs low-level surface + blitting only. +*/ +extern DECLSPEC int SDLCALL SDL_LowerBlit + (SDL_Surface *src, SDL_Rect *srcrect, + SDL_Surface *dst, SDL_Rect *dstrect); + +/* + * This function performs a fast fill of the given rectangle with 'color' + * The given rectangle is clipped to the destination surface clip area + * and the final fill rectangle is saved in the passed in pointer. + * If 'dstrect' is NULL, the whole surface will be filled with 'color' + * The color should be a pixel of the format used by the surface, and + * can be generated by the SDL_MapRGB() function. + * This function returns 0 on success, or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_FillRect + (SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color); + +/* + * This function takes a surface and copies it to a new surface of the + * pixel format and colors of the video framebuffer, suitable for fast + * blitting onto the display surface. It calls SDL_ConvertSurface() + * + * If you want to take advantage of hardware colorkey or alpha blit + * acceleration, you should set the colorkey and alpha value before + * calling this function. + * + * If the conversion fails or runs out of memory, it returns NULL + */ +extern DECLSPEC SDL_Surface * SDLCALL SDL_DisplayFormat(SDL_Surface *surface); + +/* + * This function takes a surface and copies it to a new surface of the + * pixel format and colors of the video framebuffer (if possible), + * suitable for fast alpha blitting onto the display surface. + * The new surface will always have an alpha channel. + * + * If you want to take advantage of hardware colorkey or alpha blit + * acceleration, you should set the colorkey and alpha value before + * calling this function. + * + * If the conversion fails or runs out of memory, it returns NULL + */ +extern DECLSPEC SDL_Surface * SDLCALL SDL_DisplayFormatAlpha(SDL_Surface *surface); + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* YUV video surface overlay functions */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* This function creates a video output overlay + Calling the returned surface an overlay is something of a misnomer because + the contents of the display surface underneath the area where the overlay + is shown is undefined - it may be overwritten with the converted YUV data. +*/ +extern DECLSPEC SDL_Overlay * SDLCALL SDL_CreateYUVOverlay(int width, int height, + Uint32 format, SDL_Surface *display); + +/* Lock an overlay for direct access, and unlock it when you are done */ +extern DECLSPEC int SDLCALL SDL_LockYUVOverlay(SDL_Overlay *overlay); +extern DECLSPEC void SDLCALL SDL_UnlockYUVOverlay(SDL_Overlay *overlay); + +/* Blit a video overlay to the display surface. + The contents of the video surface underneath the blit destination are + not defined. + The width and height of the destination rectangle may be different from + that of the overlay, but currently only 2x scaling is supported. +*/ +extern DECLSPEC int SDLCALL SDL_DisplayYUVOverlay(SDL_Overlay *overlay, SDL_Rect *dstrect); + +/* Free a video overlay */ +extern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay *overlay); + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* OpenGL support functions. */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Dynamically load a GL driver, if SDL is built with dynamic GL. + * + * SDL links normally with the OpenGL library on your system by default, + * but you can compile it to dynamically load the GL driver at runtime. + * If you do this, you need to retrieve all of the GL functions used in + * your program from the dynamic library using SDL_GL_GetProcAddress(). + * + * This is disabled in default builds of SDL. + */ +extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path); + +/* + * Get the address of a GL function (for extension functions) + */ +extern DECLSPEC void * SDLCALL SDL_GL_GetProcAddress(const char* proc); + +/* + * Set an attribute of the OpenGL subsystem before intialization. + */ +extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value); + +/* + * Get an attribute of the OpenGL subsystem from the windowing + * interface, such as glX. This is of course different from getting + * the values from SDL's internal OpenGL subsystem, which only + * stores the values you request before initialization. + * + * Developers should track the values they pass into SDL_GL_SetAttribute + * themselves if they want to retrieve these values. + */ +extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int* value); + +/* + * Swap the OpenGL buffers, if double-buffering is supported. + */ +extern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void); + +/* + * Internal functions that should not be called unless you have read + * and understood the source code for these functions. + */ +extern DECLSPEC void SDLCALL SDL_GL_UpdateRects(int numrects, SDL_Rect* rects); +extern DECLSPEC void SDLCALL SDL_GL_Lock(void); +extern DECLSPEC void SDLCALL SDL_GL_Unlock(void); + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* These functions allow interaction with the window manager, if any. */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Sets/Gets the title and icon text of the display window + */ +extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title, const char *icon); +extern DECLSPEC void SDLCALL SDL_WM_GetCaption(char **title, char **icon); + +/* + * Sets the icon for the display window. + * This function must be called before the first call to SDL_SetVideoMode(). + * It takes an icon surface, and a mask in MSB format. + * If 'mask' is NULL, the entire icon surface will be used as the icon. + */ +extern DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask); + +/* + * This function iconifies the window, and returns 1 if it succeeded. + * If the function succeeds, it generates an SDL_APPACTIVE loss event. + * This function is a noop and returns 0 in non-windowed environments. + */ +extern DECLSPEC int SDLCALL SDL_WM_IconifyWindow(void); + +/* + * Toggle fullscreen mode without changing the contents of the screen. + * If the display surface does not require locking before accessing + * the pixel information, then the memory pointers will not change. + * + * If this function was able to toggle fullscreen mode (change from + * running in a window to fullscreen, or vice-versa), it will return 1. + * If it is not implemented, or fails, it returns 0. + * + * The next call to SDL_SetVideoMode() will set the mode fullscreen + * attribute based on the flags parameter - if SDL_FULLSCREEN is not + * set, then the display will be windowed by default where supported. + * + * This is currently only implemented in the X11 video driver. + */ +extern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface *surface); + +/* + * This function allows you to set and query the input grab state of + * the application. It returns the new input grab state. + */ +typedef enum { + SDL_GRAB_QUERY = -1, + SDL_GRAB_OFF = 0, + SDL_GRAB_ON = 1, + SDL_GRAB_FULLSCREEN /* Used internally */ +} SDL_GrabMode; +/* + * Grabbing means that the mouse is confined to the application window, + * and nearly all keyboard input is passed directly to the application, + * and not interpreted by a window manager, if any. + */ +extern DECLSPEC SDL_GrabMode SDLCALL SDL_WM_GrabInput(SDL_GrabMode mode); + +/* Not in public API at the moment - do not use! */ +extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface *src, SDL_Rect *srcrect, + SDL_Surface *dst, SDL_Rect *dstrect); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_video_h */ diff --git a/SDK/LIBS/dcinclude/SDL/begin_code.h b/SDK/LIBS/dcinclude/SDL/begin_code.h new file mode 100644 index 00000000..261238e8 --- /dev/null +++ b/SDK/LIBS/dcinclude/SDL/begin_code.h @@ -0,0 +1,136 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/* This file sets things up for C dynamic library function definitions, + static inlined functions, and structures aligned at 4-byte alignment. + If you don't like ugly C preprocessor code, don't look at this file. :) +*/ + +/* This shouldn't be nested -- included it around code only. */ +#ifdef _begin_code_h +#error Nested inclusion of begin_code.h +#endif +#define _begin_code_h + +/* Make sure the correct platform symbols are defined */ +#if !defined(WIN32) && defined(_WIN32) +#define WIN32 +#endif /* Windows */ + +/* Some compilers use a special export keyword */ +#ifndef DECLSPEC +# ifdef __BEOS__ +# if defined(__GNUC__) +# define DECLSPEC __declspec(dllexport) +# else +# define DECLSPEC __declspec(export) +# endif +# else +# ifdef WIN32 +# ifdef __BORLANDC__ +# ifdef BUILD_SDL +# define DECLSPEC __declspec(dllexport) +# else +# define DECLSPEC __declspec(dllimport) +# endif +# else +# define DECLSPEC __declspec(dllexport) +# endif +# else +# define DECLSPEC +# endif +# endif +#endif + +/* By default SDL uses the C calling convention */ +#ifndef SDLCALL +#ifdef WIN32 +#define SDLCALL __cdecl +#else +#define SDLCALL +#endif +#endif /* SDLCALL */ + +/* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ +#ifdef __SYMBIAN32__ +#undef DECLSPEC +#define DECLSPEC +#endif /* __SYMBIAN32__ */ + +/* Force structure packing at 4 byte alignment. + This is necessary if the header is included in code which has structure + packing set to an alternate value, say for loading structures from disk. + The packing is reset to the previous value in close_code.h + */ +#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) +#ifdef _MSC_VER +#pragma warning(disable: 4103) +#endif +#ifdef __BORLANDC__ +#pragma nopackwarning +#endif +#pragma pack(push,4) +#elif (defined(__MWERKS__) && defined(macintosh)) +#pragma options align=mac68k4byte +#pragma enumsalwaysint on +#endif /* Compiler needs structure packing set */ + +/* Set up compiler-specific options for inlining functions */ +#ifndef SDL_INLINE_OKAY +#ifdef __GNUC__ +#define SDL_INLINE_OKAY +#else +/* Add any special compiler-specific cases here */ +#if defined(_MSC_VER) || defined(__BORLANDC__) || \ + defined(__DMC__) || defined(__SC__) || \ + defined(__WATCOMC__) || defined(__LCC__) +#ifndef __inline__ +#define __inline__ __inline +#endif +#define SDL_INLINE_OKAY +#else +#if !defined(__MRC__) && !defined(_SGI_SOURCE) +#define __inline__ inline +#define SDL_INLINE_OKAY +#endif /* Not a funky compiler */ +#endif /* Visual C++ */ +#endif /* GNU C */ +#endif /* SDL_INLINE_OKAY */ + +/* If inlining isn't supported, remove "__inline__", turning static + inlined functions into static functions (resulting in code bloat + in all files which include the offending header files) +*/ +#ifndef SDL_INLINE_OKAY +#define __inline__ +#endif + +/* Apparently this is needed by several Windows compilers */ +#if !defined(__MACH__) +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif /* NULL */ +#endif /* ! MacOS X - breaks precompiled headers */ diff --git a/SDK/LIBS/dcinclude/SDL/close_code.h b/SDK/LIBS/dcinclude/SDL/close_code.h new file mode 100644 index 00000000..732416eb --- /dev/null +++ b/SDK/LIBS/dcinclude/SDL/close_code.h @@ -0,0 +1,41 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/* This file reverses the effects of begin_code.h and should be included + after you finish any function and structure declarations in your headers +*/ + +#undef _begin_code_h + +/* Reset structure packing at previous byte alignment */ +#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) +#ifdef __BORLANDC__ +#pragma nopackwarning +#endif +#if (defined(__MWERKS__) && defined(macintosh)) +#pragma options align=reset +#pragma enumsalwaysint reset +#else +#pragma pack(pop) +#endif +#endif /* Compiler needs structure packing set */ + diff --git a/SDK/LIBS/dcinclude/arch/arch.h b/SDK/LIBS/dcinclude/arch/arch.h new file mode 100644 index 00000000..c91dcae3 --- /dev/null +++ b/SDK/LIBS/dcinclude/arch/arch.h @@ -0,0 +1,155 @@ +/* KallistiOS 1.2.0 + + arch/dreamcast/include/arch.h + (c)2001 Dan Potter + + $Id: arch.h,v 1.19 2003/02/25 07:39:37 bardtx Exp $ +*/ + +#ifndef __ARCH_ARCH_H +#define __ARCH_ARCH_H + +#include +__BEGIN_DECLS + +#include + +/* Page size info (for MMU) */ +#define PAGESIZE 4096 +#define PAGESIZE_BITS 12 +#define PAGEMASK (PAGESIZE - 1) + +/* Page count variable; in this case it's static, so we can + optimize this quite a bit. */ +#define page_count ((16*1024*1024 - 0x10000) / PAGESIZE) + +/* Base address of available physical pages */ +#define page_phys_base 0x8c010000 + +/* Number of timer ticks per second */ +#define HZ 100 + +/* Default thread stack size */ +#define THD_STACK_SIZE 8192 + +/* Default video mode */ +#define DEFAULT_VID_MODE DM_640x480 +#define DEFAULT_PIXEL_MODE PM_RGB565 + +/* Default serial parameters */ +#define DEFAULT_SERIAL_BAUD 57600 +#define DEFAULT_SERIAL_FIFO 1 + +/* Panic function */ +void panic(const char *str) __noreturn; + +/* Prototype for the portable kernel main() */ +int kernel_main(const char *args); + +/* Kernel C-level entry point */ +int arch_main(); + +/* Potential exit paths from the kernel on arch_exit() */ +#define ARCH_EXIT_RETURN 1 +#define ARCH_EXIT_MENU 2 +#define ARCH_EXIT_REBOOT 3 + +/* Set the exit path (default is RETURN) */ +void arch_set_exit_path(int path); + +/* Generic kernel "exit" point */ +void arch_exit() __noreturn; + +/* Kernel "return" point */ +void arch_return() __noreturn; + +/* Kernel "abort" point */ +void arch_abort() __noreturn; + +/* Kernel "reboot" call */ +void arch_reboot() __noreturn; + +/* Kernel "exit to menu" call */ +void arch_menu() __noreturn; + +/* Call to run all ctors / dtors */ +void arch_ctors(); +void arch_dtors(); + +/* Hook to ensure linking of crtend.c */ +void __crtend_pullin(); + +/* Use this macro to determine the level of initialization you'd like in + your program by default. The defaults line will be fine for most things. */ +#define KOS_INIT_FLAGS(flags) uint32 __kos_init_flags = (flags) + +extern uint32 __kos_init_flags; + +/* Defaults */ +#define INIT_DEFAULT \ + (INIT_IRQ | INIT_THD_PREEMPT) + +/* Define a romdisk for your program, if you'd like one */ +#define KOS_INIT_ROMDISK(rd) void * __kos_romdisk = (rd) + +extern void * __kos_romdisk; + +/* State that you don't want a romdisk */ +#define KOS_INIT_ROMDISK_NONE NULL + +/* Constants for the above */ +#define INIT_NONE 0x0000 /* Kernel enables */ +#define INIT_IRQ 0x0001 +#define INIT_THD_PREEMPT 0x0002 +#define INIT_NET 0x0004 +#define INIT_MALLOCSTATS 0x0008 +#define INIT_QUIET 0x0010 + +/* DC-specific stuff */ +#define INIT_OCRAM 0x10000 +#define INIT_NO_DCLOAD 0x20000 + +/* Dreamcast-specific arch init things */ +void arch_real_exit() __noreturn; +int hardware_sys_init(); +int hardware_periph_init(); +void hardware_shutdown(); +void syscall_init(); + +/* Dreamcast specific sleep mode function */ +#define arch_sleep() do { \ + __asm__ __volatile__("sleep"); \ + } while(0) + +/* DC specific function to get the return address from the current function */ +#define arch_get_ret_addr() ({ \ + uint32 pr; \ + __asm__ __volatile__("sts pr,%0\n" \ + : "=&z" (pr) \ + : /* no inputs */ \ + : "memory" ); \ + pr; }) + +/* Please note that all of the following frame pointer macros are ONLY + valid if you have compiled your code WITHOUT -fomit-frame-pointer. These + are mainly useful for getting a stack trace from an error. */ + +/* DC specific function to get the frame pointer from the current function */ +#define arch_get_fptr() ({ \ + uint32 fp; \ + __asm__ __volatile__("mov r14,%0\n" \ + : "=&z" (fp) \ + : /* no inputs */ \ + : "memory" ); \ + fp; }) + +/* Pass in a frame pointer value to get the return address for the given frame */ +#define arch_fptr_ret_addr(fptr) (*((uint32*)fptr)) + +/* Pass in a frame pointer value to get the previous frame pointer for the given frame */ +#define arch_fptr_next(fptr) (*((uint32*)(fptr+4))) + +__END_DECLS + +#endif /* __ARCH_ARCH_H */ + diff --git a/SDK/LIBS/dcinclude/arch/atexit.h b/SDK/LIBS/dcinclude/arch/atexit.h new file mode 100644 index 00000000..f6b238d3 --- /dev/null +++ b/SDK/LIBS/dcinclude/arch/atexit.h @@ -0,0 +1,28 @@ +/* KallistiOS 1.2.0 + + arch/dreamcast/include/arch/atexit.h + (c)2002 Florian Schulze + + $Id: atexit.h,v 1.1 2002/02/15 20:20:46 bardtx Exp $ +*/ + +#ifndef __ARCH_ATEXIT_H +#define __ARCH_ATEXIT_H + +#include +__BEGIN_DECLS + +struct arch_atexit_handler { + struct arch_atexit_handler *next; + void (*handler)(void); +}; + +extern struct arch_atexit_handler *arch_atexit_handlers; + +/* Call all the atexit() handlers */ +void arch_atexit(); + +__END_DECLS + +#endif /* __ARCH_ATEXIT_H */ + diff --git a/SDK/LIBS/dcinclude/arch/cache.h b/SDK/LIBS/dcinclude/arch/cache.h new file mode 100644 index 00000000..c622b100 --- /dev/null +++ b/SDK/LIBS/dcinclude/arch/cache.h @@ -0,0 +1,29 @@ +/* KallistiOS 1.2.0 + + arch/dreamcast/include/cache.h + (c)2001 Dan Potter + + $Id: cache.h,v 1.2 2002/01/05 07:33:50 bardtx Exp $ +*/ + +#ifndef __ARCH_CACHE_H +#define __ARCH_CACHE_H + +#include +__BEGIN_DECLS + +#include + +/* Flush a range of i-cache, given a physical address range */ +void icache_flush_range(uint32 start, uint32 count); + +/* Invalidate a range of o-cache/d-cache, given a physical address range */ +void dcache_inval_range(uint32 start, uint32 count); + +/* Flush a range of o-cache/d-cache, given a physical address range */ +void dcache_flush_range(uint32 start, uint32 count); + +__END_DECLS + +#endif /* __ARCH_CACHE_H */ + diff --git a/SDK/LIBS/dcinclude/arch/dbgio.h b/SDK/LIBS/dcinclude/arch/dbgio.h new file mode 100644 index 00000000..ac70473d --- /dev/null +++ b/SDK/LIBS/dcinclude/arch/dbgio.h @@ -0,0 +1,63 @@ +/* KallistiOS 1.2.0 + + arch/dreamcast/include/dbgio.h + (c)2000 Dan Potter + + $Id: dbgio.h,v 1.4 2002/04/06 23:40:32 bardtx Exp $ + +*/ + +#ifndef __ARCH_DBGIO_H +#define __ARCH_DBGIO_H + +#include +__BEGIN_DECLS + +#include + +/* Set another function to capture all debug output */ +typedef void (*dbgio_printk_func)(const char *); +dbgio_printk_func dbgio_set_printk(dbgio_printk_func func); + +extern dbgio_printk_func dbgio_printk; + + +/* Set serial parameters; this is not platform independent like I want + it to be, but it should be generic enough to be useful. */ +void dbgio_set_parameters(int baud, int fifo); + +/* Initialize the SCIF port */ +void dbgio_init(); + +/* Write one char to the serial port (call serial_flush()!)*/ +void dbgio_write(int c); + +/* Flush all FIFO'd bytes out of the serial port buffer */ +void dbgio_flush(); + +/* Send an entire buffer */ +void dbgio_write_buffer(const uint8 *data, int len); + +/* Read an entire buffer (block) */ +void dbgio_read_buffer(uint8 *data, int len); + +/* Send a string (null-terminated) */ +void dbgio_write_str(const char *str); + +/* Null write-string function for pre-init */ +void dbgio_null_write(const char *str); + +/* Read one char from the serial port (-1 if nothing to read) */ +int dbgio_read(); + +/* Enable / Disable debug I/O globally */ +void dbgio_disable(); +void dbgio_enable(); + +/* Printf functionality */ +int dbgio_printf(const char *fmt, ...) __printflike(1, 2); + +__END_DECLS + +#endif /* __ARCH_DBGIO_H */ + diff --git a/SDK/LIBS/dcinclude/arch/exec.h b/SDK/LIBS/dcinclude/arch/exec.h new file mode 100644 index 00000000..df1cd518 --- /dev/null +++ b/SDK/LIBS/dcinclude/arch/exec.h @@ -0,0 +1,23 @@ +/* KallistiOS 1.2.0 + + arch/dreamcast/include/arch/exec.h + (c)2002 Dan Potter + + $Id: exec.h,v 1.2 2002/06/13 01:13:28 bardtx Exp $ +*/ + +#ifndef __ARCH_EXEC_H +#define __ARCH_EXEC_H + +#include +__BEGIN_DECLS + +/* Replace the currently running image with whatever is at + the pointer; note that this call will never return. */ +void arch_exec_at(const void *image, uint32 length, uint32 address) __noreturn; +void arch_exec(const void *image, uint32 length) __noreturn; + +__END_DECLS + +#endif /* __ARCH_EXEC_H */ + diff --git a/SDK/LIBS/dcinclude/arch/gdb.h b/SDK/LIBS/dcinclude/arch/gdb.h new file mode 100644 index 00000000..4544609f --- /dev/null +++ b/SDK/LIBS/dcinclude/arch/gdb.h @@ -0,0 +1,24 @@ +/* KallistiOS 1.2.0 + + arch/dreamcast/include/arch/gdb.h + (c)2002 Dan Potter + + $Id: gdb.h,v 1.1 2002/09/13 05:19:39 bardtx Exp $ +*/ + +#ifndef __ARCH_GDB_H +#define __ARCH_GDB_H + +#include +__BEGIN_DECLS + +/* Initialize the GDB stub */ +void gdb_init(); + +/* Manually raise a GDB breakpoint */ +void gdb_breakpoint(); + +__END_DECLS + +#endif /* __ARCH_GDB_H */ + diff --git a/SDK/LIBS/dcinclude/arch/irq.h b/SDK/LIBS/dcinclude/arch/irq.h new file mode 100644 index 00000000..da3a5dad --- /dev/null +++ b/SDK/LIBS/dcinclude/arch/irq.h @@ -0,0 +1,188 @@ +/* KallistiOS 1.2.0 + + arch/dreamcast/include/irq.h + (c)2000-2001 Dan Potter + + $Id: irq.h,v 1.9 2003/02/14 06:33:47 bardtx Exp $ + +*/ + +#ifndef __ARCH_IRQ_H +#define __ARCH_IRQ_H + +#include +__BEGIN_DECLS + +#include + +/* The number of bytes required to save thread context. This should + include all general CPU registers, FP registers, and status regs (even + if not all of these are actually used). */ +#define REG_BYTE_CNT 256 /* Currently really 228 */ + +/* Architecture-specific structure for holding the processor state (register + values, etc). The size of this structure should be less than or equal + to the above value. */ +typedef struct irq_context { + uint32 r[16]; /* 16 general purpose regs */ + uint32 pc, pr, gbr, vbr; /* Various system words */ + uint32 mach, macl, sr; + uint32 frbank[16]; /* Secondary float regs */ + uint32 fr[16]; /* Primary float regs */ + uint32 fpscr, fpul; /* Float control regs */ +} irq_context_t; + +/* A couple of architecture independent access macros */ +#define CONTEXT_PC(c) ((c).pc) +#define CONTEXT_FP(c) ((c).r[14]) +#define CONTEXT_SP(c) ((c).r[15]) +#define CONTEXT_RET(c) ((c).r[0]) + +/* Dreamcast-specific exception codes.. use these when getting or setting an + exception code value. */ + +/* Reset type */ +#define EXC_RESET_POWERON 0x0000 /* Power-on reset */ +#define EXC_RESET_MANUAL 0x0020 /* Manual reset */ +#define EXC_RESET_UDI 0x0000 /* Hitachi UDI reset */ +#define EXC_ITLB_MULTIPLE 0x0140 /* Instruction TLB multiple hit */ +#define EXC_DTLB_MULTIPLE 0x0140 /* Data TLB multiple hit */ + +/* Re-Execution type */ +#define EXC_USER_BREAK_PRE 0x01e0 /* User break before instruction */ +#define EXC_INSTR_ADDRESS 0x00e0 /* Instruction address */ +#define EXC_ITLB_MISS 0x0040 /* Instruction TLB miss */ +#define EXC_ITLB_PV 0x00a0 /* Instruction TLB protection violation */ +#define EXC_ILLEGAL_INSTR 0x0180 /* Illegal instruction */ +#define EXC_SLOT_ILLEGAL_INSTR 0x01a0 /* Slot illegal instruction */ +#define EXC_GENERAL_FPU 0x0800 /* General FPU exception */ +#define EXC_SLOT_FPU 0x0820 /* Slot FPU exception */ +#define EXC_DATA_ADDRESS_READ 0x00e0 /* Data address (read) */ +#define EXC_DATA_ADDRESS_WRITE 0x0100 /* Data address (write) */ +#define EXC_DTLB_MISS_READ 0x0040 /* Data TLB miss (read) */ +#define EXC_DTLB_MISS_WRITE 0x0060 /* Data TLB miss (write) */ +#define EXC_DTLB_PV_READ 0x00a0 /* Data TLB P.V. (read) */ +#define EXC_DTLB_PV_WRITE 0x00c0 /* Data TLB P.V. (write) */ +#define EXC_FPU 0x0120 /* FPU exception */ +#define EXC_INITIAL_PAGE_WRITE 0x0080 /* Initial page write exception */ + +/* Completion type */ +#define EXC_TRAPA 0x0160 /* Unconditional trap */ +#define EXC_USER_BREAK_POST 0x01e0 /* User break after instruction */ + +/* Interrupt (completion type) */ +#define EXC_NMI 0x01c0 /* Nonmaskable interrupt */ +#define EXC_IRQ0 0x0200 /* External IRL requests */ +#define EXC_IRQ1 0x0220 +#define EXC_IRQ2 0x0240 +#define EXC_IRQ3 0x0260 +#define EXC_IRQ4 0x0280 +#define EXC_IRQ5 0x02a0 +#define EXC_IRQ6 0x02c0 +#define EXC_IRQ7 0x02e0 +#define EXC_IRQ8 0x0300 +#define EXC_IRQ9 0x0320 +#define EXC_IRQA 0x0340 +#define EXC_IRQB 0x0360 +#define EXC_IRQC 0x0380 +#define EXC_IRQD 0x03a0 +#define EXC_IRQE 0x03c0 +#define EXC_TMU0_TUNI0 0x0400 /* TMU0 underflow */ +#define EXC_TMU1_TUNI1 0x0420 /* TMU1 underflow */ +#define EXC_TMU2_TUNI2 0x0440 /* TMU2 underflow */ +#define EXC_TMU2_TICPI2 0x0460 /* TMU2 input capture */ +#define EXC_RTC_ATI 0x0480 +#define EXC_RTC_PRI 0x04a0 +#define EXC_RTC_CUI 0x04c0 +#define EXC_SCI_ERI 0x04e0 /* SCI Error receive */ +#define EXC_SCI_RXI 0x0500 /* Receive ready */ +#define EXC_SCI_TXI 0x0520 /* Transmit ready */ +#define EXC_SCI_TEI 0x0540 /* Transmit error */ +#define EXC_WDT_ITI 0x0560 /* Watchdog timer */ +#define EXC_REF_RCMI 0x0580 +#define EXC_REF_ROVI 0x05a0 +#define EXC_UDI 0x0600 /* Hitachi UDI */ +#define EXC_GPIO_GPIOI 0x0620 +#define EXC_DMAC_DMTE0 0x0640 +#define EXC_DMAC_DMTE1 0x0660 +#define EXC_DMAC_DMTE2 0x0680 +#define EXC_DMAC_DMTE3 0x06a0 +#define EXC_DMA_DMAE 0x06c0 +#define EXC_SCIF_ERI 0x0700 /* SCIF Error receive */ +#define EXC_SCIF_RXI 0x0720 +#define EXC_SCIF_BRI 0x0740 +#define EXC_SCIF_TXI 0x0760 + +/* This is a software-generated one (double-fault) for when an exception + happens inside an ISR. */ +#define EXC_DOUBLE_FAULT 0x0ff0 + +/* Software-generated for unhandled exception */ +#define EXC_UNHANDLED_EXC 0x0fe0 + +/* The following are a table of "type offsets" (see the Hitachi PDF). + These are the 0x000, 0x100, 0x400, and 0x600 offsets. */ +#define EXC_OFFSET_000 0 +#define EXC_OFFSET_100 1 +#define EXC_OFFSET_400 2 +#define EXC_OFFSET_600 3 + +/* The value of the timer IRQ */ +#define TIMER_IRQ EXC_TMU0_TUNI0 + +/* The type of an interrupt identifier */ +typedef uint32 irq_t; + +/* The type of an IRQ handler */ +typedef void (*irq_handler)(irq_t source, irq_context_t *context); + +/* Are we inside an interrupt handler? */ +int irq_inside_int(); + +/* Pretend like we just came in from an interrupt and force + a context switch back to the "current" context. Make sure + you've called irq_set_context()! */ +void irq_force_return(); + +/* Set a handler, or remove a handler (see codes above) */ +int irq_set_handler(irq_t source, irq_handler hnd); + +/* Get the address of the current handler */ +irq_handler irq_get_handler(irq_t source); + +/* Set or remove a trapa handler */ +int trapa_set_handler(irq_t code, irq_handler hnd); + +/* Set a global exception handler */ +int irq_set_global_handler(irq_handler hnd); + +/* Get the global exception handler */ +irq_handler irq_get_global_handler(); + +/* Switch out contexts (for interrupt return) */ +void irq_set_context(irq_context_t *regbank); + +/* Return the current IRQ context */ +irq_context_t *irq_get_context(); + +/* Fill a newly allocated context block for usage with supervisor/kernel + or user mode. The given parameters will be passed to the called routine (up + to the architecture maximum). */ +void irq_create_context(irq_context_t *context, uint32 stack_pointer, + uint32 routine, uint32 *args, int usermode); + +/* Enable/Disable interrupts */ +int irq_disable(); /* Will leave exceptions enabled */ +void irq_enable(); /* Enables all ints including external */ +void irq_restore(int v); + +/* Init routine */ +int irq_init(); + +/* Shutdown */ +void irq_shutdown(); + +__END_DECLS + +#endif /* __ARCH_IRQ_H */ + diff --git a/SDK/LIBS/dcinclude/arch/mmu.h b/SDK/LIBS/dcinclude/arch/mmu.h new file mode 100644 index 00000000..66a3e77e --- /dev/null +++ b/SDK/LIBS/dcinclude/arch/mmu.h @@ -0,0 +1,168 @@ +/* KallistiOS 1.2.0 + + arch/dreamcast/include/arch/mmu.h + (c)2001 Dan Potter + + $Id: mmu.h,v 1.3 2002/10/08 07:46:20 bardtx Exp $ +*/ + +#ifndef __ARCH_MMU_H +#define __ARCH_MMU_H + +#include +__BEGIN_DECLS + +#include +#include + +/* Since the software has to handle TLB misses on the SH-4, we have freedom + to use any page table format we want (and thus save space), but we must + make it quick to access. The SH-4 can address a maximum of 512M of address + space per "area", but we only care about one area, so this is the total + maximum addressable space. With 4K pages, that works out to 2^17 pages + that must be mappable, or 17 bits. We use 18 bits just to be sure (there + are a few left over). + + Page tables (per-process) are a sparse two-level array. The virtual address + space is actually 2^30 bytes, or 2^(30-12)=2^18 pages, so there must be + a possibility of having that many page entries per process space. A full + page table for a process would be 1M, so this is obviously too big!! Thus + the sparse array. + + The bottom layer of the page tables consists of a sub-context array for + 512 pages, which translates into 2K of storage space. The process then + has the possibility of using one or more of the 512 top-level slots. For + a very small process (using one page for code/data and one for stack), it + should be possible to achieve a page table footprint of one page. The tables + can grow from there as neccessary. + + Virtual addresses are broken up as follows: + + Bits 31 - 22 10 bits top-level page directory + Bits 21 - 13 9 bits bottom-level page entry + Bits 11 - 0 Byte index into page + + */ + +#define MMU_TOP_SHIFT 21 +#define MMU_TOP_BITS 10 +#define MMU_TOP_MASK ((1 << MMU_TOP_BITS) - 1) +#define MMU_BOT_SHIFT 12 +#define MMU_BOT_BITS 9 +#define MMU_BOT_MASK ((1 << MMU_BOT_BITS) - 1) +#define MMU_IND_SHIFT 0 +#define MMU_IND_BITS 12 +#define MMU_IND_MASK ((1 << MMU_IND_BITS) - 1) + +/* MMU TLB entry for a single page (one 32-bit word) */ +typedef struct mmupage { + /*uint32 virtual; */ /* implicit */ + uint32 physical:18; /* Physical page ID -- 18 bits */ + uint32 prkey:2; /* Protection key data -- 2 bits */ + uint32 valid:1; /* Valid mapping -- 1 bit */ + uint32 shared:1; /* Shared between procs -- 1 bit */ + uint32 cache:1; /* Cacheable -- 1 bit */ + uint32 dirty:1; /* Dirty -- 1 bit */ + uint32 wthru:1; /* Write-thru enable -- 1 bit */ + uint32 blank:7; /* Reserved -- 7 bits */ +} mmupage_t; + +/* MMU sub-context type. We have two-level page tables on + SH-4, and each sub-context contains 512 entries. */ +#define MMU_SUB_PAGES 512 +typedef struct mmusubcontext { + mmupage_t page[MMU_SUB_PAGES]; /* 512 pages */ +} mmusubcontext_t; + +/* MMU Context type */ +#define MMU_PAGES 1024 +typedef struct mmucontext { + mmusubcontext_t *sub[MMU_PAGES]; /* 1024 sub-contexts */ + int asid; /* Address Space ID */ +} mmucontext_t; + +/* "Current" page tables (for TLB exception handling) */ +extern mmucontext_t *mmu_cxt_current; + +/* Set the "current" page tables for TLB handling */ +void mmu_use_table(mmucontext_t *context); + +/* Allocate a new MMU context; each process should have exactly one of + these, and these should not exist without a process. */ +mmucontext_t *mmu_context_create(int asid); + +/* Destroy an MMU context when a process is being destroyed. */ +void mmu_context_destroy(mmucontext_t *context); + +/* Using the given page tables, translate the virtual page ID to a + physical page ID. Return -1 on failure. */ +int mmu_virt_to_phys(mmucontext_t *context, int virtpage); + +/* Using the given page tables, translate the physical page ID to a + virtual page ID. Return -1 on failure. */ +int mmu_phys_to_virt(mmucontext_t *context, int physpage); + +/* Switch to the given context; invalidate any caches as neccessary */ +void mmu_switch_context(mmucontext_t *context); + +/* Set the given virtual page as invalid (unmap it) */ +void mmu_page_invalidate(mmucontext_t *context, int virtpage, int count); + +/* Set the given virtual page to map to the given physical page; implies + turning on the "valid" bit. Also sets the other named attributes.*/ +void mmu_page_map(mmucontext_t *context, int virtpage, int physpage, + int count, int prot, int cache, int share, int dirty); + +/* Set the page protection to the given values */ +#define MMU_KERNEL_RDONLY 0 +#define MMU_KERNEL_RDWR 1 +#define MMU_ALL_RDONLY 2 +#define MMU_ALL_RDWR 3 +void mmu_page_protect(mmucontext_t *context, int virtpage, int count, + int prot); + +/* Set the cacheing type to the given values */ +#define MMU_NO_CACHE 1 +#define MMU_CACHE_BACK 2 /* Write-back */ +#define MMU_CACHE_WT 3 /* Write-thru */ +#define MMU_CACHEABLE MMU_CACHE_BACK +void mmu_page_cache(mmucontext_t *context, int virtpage, int count, int cache); + +/* Set a page as shared or not */ +#define MMU_NOT_SHARED 0 +#define MMU_SHARED 1 +void mmu_page_share(mmucontext_t *context, int virtpage, int count, int share); + +/* Read the "dirty" bit of the page; potentially reset the bit. */ +#define MMU_NO_CHANGE 0 +#define MMU_CLEAN 1 +#define MMU_DIRTY 2 +int mmu_page_dirty(mmucontext_t *context, int virtpage, int count, int reset); + +/* Copy a chunk of data from a process' address space into a + kernel buffer, taking into account page mappings. */ +int mmu_copyin(mmucontext_t *context, uint32 srcaddr, uint32 srccnt, void *buffer); + +/* Copy a chunk of data from one process' address space to another + process' address space, taking into account page mappings. */ +int mmu_copyv(mmucontext_t *context1, iovec_t *iov1, int iovcnt1, + mmucontext_t *context2, iovec_t *iov2, int iovcnt2); + +/* MMU syscalls */ +void sc_mmu_mmap(uint32 dst, size_t len, uint32 src); + +/* Get/set thefunction to handle virt->phys page mapping; the function + should return a pointer to an mmupage_t on success, or NULL on + failure. */ +typedef mmupage_t * (*mmu_mapfunc_t)(mmucontext_t * context, int virtpage); +mmu_mapfunc_t mmu_map_get_callback(); +mmu_mapfunc_t mmu_map_set_callback(mmu_mapfunc_t newfunc); + +/* Init / shutdown MMU */ +int mmu_init(); +void mmu_shutdown(); + +__END_DECLS + +#endif /* __ARCH_MMU_H */ + diff --git a/SDK/LIBS/dcinclude/arch/rtc.h b/SDK/LIBS/dcinclude/arch/rtc.h new file mode 100644 index 00000000..04b5f7ab --- /dev/null +++ b/SDK/LIBS/dcinclude/arch/rtc.h @@ -0,0 +1,33 @@ +/* KallistiOS 1.2.0 + + arch/dreamcast/include/rtc.h + (c)2000-2001 Dan Potter + + $Id: rtc.h,v 1.4 2002/11/16 02:11:58 bardtx Exp $ + + */ + +#ifndef __ARCH_RTC_H +#define __ARCH_RTC_H + +#include +__BEGIN_DECLS + +#include + +/* Returns the date/time value as a UNIX epoch time stamp */ +time_t rtc_unix_secs(); + +/* Returns the date/time that the system was booted as a UNIX epoch time + stamp. Adding this to the value from timer_ms_gettime() will + produce a current timestamp. */ +time_t rtc_boot_time(); + +/* Init / Shutdown */ +int rtc_init(); +void rtc_shutdown(); + +__END_DECLS + +#endif /* __ARCH_RTC_H */ + diff --git a/SDK/LIBS/dcinclude/arch/spinlock.h b/SDK/LIBS/dcinclude/arch/spinlock.h new file mode 100644 index 00000000..43244f66 --- /dev/null +++ b/SDK/LIBS/dcinclude/arch/spinlock.h @@ -0,0 +1,57 @@ +/* KallistiOS 1.2.0 + + arch/dreamcast/include/spinlock.h + (c)2001 Dan Potter + + $Id: spinlock.h,v 1.6 2002/11/13 02:05:15 bardtx Exp $ +*/ + +#ifndef __ARCH_SPINLOCK_H +#define __ARCH_SPINLOCK_H + +/* Defines processor specific spinlocks */ + +#include +__BEGIN_DECLS + +/* DC implementation uses threads most of the time */ +#include + +/* Spinlock data type */ +typedef volatile int spinlock_t; + +/* Value initializer */ +#define SPINLOCK_INITIALIZER 0 + +/* Initialize a spinlock */ +#define spinlock_init(A) *(A) = SPINLOCK_INITIALIZER + +/* Note here that even if threads aren't enabled, we'll still set the + lock so that it can be used for anti-IRQ protection (e.g., malloc) */ + +/* Spin on a lock */ +#define spinlock_lock(A) do { \ + spinlock_t * __lock = A; \ + int __gotlock = 0; \ + while(1) { \ + asm volatile ("tas.b @%1\n\t" \ + "movt %0\n\t" \ + : "=r" (__gotlock) : "r" (__lock) : "t", "memory"); \ + if (!__gotlock) \ + thd_pass(); \ + else break; \ + } \ +} while (0) + +/* Free a lock */ +#define spinlock_unlock(A) do { \ + *(A) = 0; \ + } while (0) + +__END_DECLS + +/* Determine if a lock is locked */ +#define spinlock_is_locked(A) ( *(A) != 0 ) + +#endif /* __ARCH_SPINLOCK_H */ + diff --git a/SDK/LIBS/dcinclude/arch/stack.h b/SDK/LIBS/dcinclude/arch/stack.h new file mode 100644 index 00000000..0f55eaef --- /dev/null +++ b/SDK/LIBS/dcinclude/arch/stack.h @@ -0,0 +1,28 @@ +/* KallistiOS 1.2.0 + + arch/dreamcast/include/arch/stack.h + (c)2002 Dan Potter + + $Id: stack.h,v 1.1 2002/09/13 04:40:52 bardtx Exp $ +*/ + +#ifndef __ARCH_STACK_H +#define __ARCH_STACK_H + +#include +__BEGIN_DECLS + +#include + +/* Do a stack trace from the current function; leave off the first n frames + (i.e., in assert()). */ +void arch_stk_trace(int n); + +/* Do a stack trace from the given frame pointer (useful for things like + tracing from an ISR); leave off the first n frames. */ +void arch_stk_trace_at(uint32 fp, int n); + +__END_DECLS + +#endif /* __ARCH_EXEC_H */ + diff --git a/SDK/LIBS/dcinclude/arch/syscall.h b/SDK/LIBS/dcinclude/arch/syscall.h new file mode 100644 index 00000000..248c94b4 --- /dev/null +++ b/SDK/LIBS/dcinclude/arch/syscall.h @@ -0,0 +1,61 @@ +/* KallistiOS 1.2.0 + + arch/dreamcast/include/syscall.h + (c)2000-2001 Dan Potter + + $Id: syscall.h,v 1.4 2002/11/14 06:55:46 bardtx Exp $ + +*/ + +#ifndef __ARCH_SYSCALL_H +#define __ARCH_SYSCALL_H + +#include +__BEGIN_DECLS + +#include +#include + +/* Set the return value for a syscall for a dormant thread */ +void syscall_set_return(irq_context_t *context, int value); + +/* Handles all the nasty work */ +#define SET_RETURN(thread, value) \ + syscall_set_return(&(thread->context), (value)) + +/* Ditto */ +#define SET_MY_RETURN(value) \ + SET_RETURN(thd_current, value) + +/* Ditto */ +#define RETURN(value) do { \ + SET_RETURN(thd_current, value); \ + /* if (thd_current->state != STATE_RUNNING) */ \ + thd_schedule(0); \ + return; } while(0) + + +/* This macro can be used in normal mode to jump into kernel + mode convienently. Up to 4 parameters can be passed. An + int value will be returned. You can pass dummy values for + any of the four parameters and/or ignore the return value. */ +#define SYSCALL(routine, p1, p2, p3, p4) ({ \ + register uint32 __routine __asm__("r3") = (uint32)(routine); \ + register uint32 __p1 __asm__("r4") = (uint32)(p1); \ + register uint32 __p2 __asm__("r5") = (uint32)(p2); \ + register uint32 __p3 __asm__("r6") = (uint32)(p3); \ + register uint32 __p4 __asm__("r7") = (uint32)(p4); \ + int __value; \ + __asm__ volatile( \ + "trapa #0\n" \ + : "=r"(__value) \ + : "r"(__routine), "r"(__p1), "r"(__p2), "r"(__p3), "r"(__p4) \ + ); \ + __value; }) + +__END_DECLS + +#endif /* __ARCH_SYSCALL_H */ + + + diff --git a/SDK/LIBS/dcinclude/arch/timer.h b/SDK/LIBS/dcinclude/arch/timer.h new file mode 100644 index 00000000..dd970659 --- /dev/null +++ b/SDK/LIBS/dcinclude/arch/timer.h @@ -0,0 +1,89 @@ +/* KallistiOS 1.2.0 + + arch/dreamcast/include/timer.h + (c)2000-2001 Dan Potter + + $Id: timer.h,v 1.5 2003/02/15 02:45:52 bardtx Exp $ + +*/ + +#ifndef __ARCH_TIMER_H +#define __ARCH_TIMER_H + +#include +__BEGIN_DECLS + +#include +#include + +/* Timer sources -- we get four on the SH4 */ +#define TMU0 0 /* Off limits during thread operation */ +#define TMU1 1 /* Used for timer_spin_sleep() */ +#define TMU2 2 /* Used for timer_get_ticks() */ +#define WDT 3 /* Not supported yet */ + +/* The main timer for the task switcher to use */ +#define TIMER_ID TMU0 + +/* Pre-initialize a timer; set values but don't start it */ +int timer_prime(int which, uint32 speed, int interrupts); + +/* Start a timer -- starts it running (and interrupts if applicable) */ +int timer_start(int which); + +/* Stop a timer -- and disables its interrupt */ +int timer_stop(int which); + +/* Returns the count value of a timer */ +uint32 timer_count(int which); + +/* Clears the timer underflow bit and returns what its value was */ +int timer_clear(int which); + +/* Spin-loop kernel sleep func: uses the secondary timer in the + SH-4 to very accurately delay even when interrupts are disabled */ +void timer_spin_sleep(int ms); + +/* Enable timer interrupts (high priority); needs to move + to irq.c sometime. */ +void timer_enable_ints(int which); + +/* Disable timer interrupts; needs to move to irq.c sometime. */ +void timer_disable_ints(int which); + +/* Check whether ints are enabled */ +int timer_ints_enabled(int which); + +/* Enable the millisecond timer */ +void timer_ms_enable(); +void timer_ms_disable(); + +/* Return the number of ticks since KOS was booted */ +void timer_ms_gettime(uint32 *secs, uint32 *msecs); + +/* Does the same as timer_ms_gettime(), but it merges both values + into a single 64-bit millisecond counter. May be more handy + in some situations. */ +uint64 timer_ms_gettime64(); + +/* Set the callback target for the primary timer. Set to NULL + to disable callbacks. Returns the address of the previous + handler. */ +typedef void (*timer_primary_callback_t)(irq_context_t *); +timer_primary_callback_t timer_primary_set_callback(timer_primary_callback_t callback); + +/* Request a wakeup in approximately N milliseconds. You only get one + simultaneous wakeup. Any subsequent calls here will replace any + pending wakeup. */ +void timer_primary_wakeup(uint32 millis); + +/* Init function */ +int timer_init(); + +/* Shutdown */ +void timer_shutdown(); + +__END_DECLS + +#endif /* __ARCH_TIMER_H */ + diff --git a/SDK/LIBS/dcinclude/arch/types.h b/SDK/LIBS/dcinclude/arch/types.h new file mode 100644 index 00000000..c5666c69 --- /dev/null +++ b/SDK/LIBS/dcinclude/arch/types.h @@ -0,0 +1,64 @@ +/* KallistiOS 1.2.0 + + arch/dreamcast/include/types.h + (c)2000-2001 Dan Potter + + $Id: types.h,v 1.2 2002/01/05 07:33:50 bardtx Exp $ +*/ + +#ifndef __ARCH_TYPES_H +#define __ARCH_TYPES_H + +#include +__BEGIN_DECLS + +#include + +/* Generic types */ +typedef unsigned long long uint64; +typedef unsigned long uint32; +typedef unsigned short uint16; +typedef unsigned char uint8; +typedef long long int64; +typedef long int32; +typedef short int16; +typedef char int8; + +/* Volatile types */ +typedef volatile uint64 vuint64; +typedef volatile uint32 vuint32; +typedef volatile uint16 vuint16; +typedef volatile uint8 vuint8; +typedef volatile int64 vint64; +typedef volatile int32 vint32; +typedef volatile int16 vint16; +typedef volatile int8 vint8; + +/* Pointer arithmetic types */ +typedef uint32 ptr_t; + +/* another format for type names */ +typedef unsigned char u_char; +typedef unsigned short u_short; +typedef unsigned int u_int; +typedef unsigned long u_long; +typedef unsigned short ushort; +typedef unsigned int uint; + +/* File-specific types */ +typedef size_t ssize_t; +typedef size_t off_t; + +/* This type may be used for any generic handle type that is allowed + to be negative (for errors) and has no specific bit count + restraints. */ +typedef int handle_t; + +/* Thread and priority types */ +typedef handle_t tid_t; +typedef handle_t prio_t; + +__END_DECLS + +#endif /* __ARCH_TYPES_H */ + diff --git a/SDK/LIBS/dcinclude/assert.h b/SDK/LIBS/dcinclude/assert.h new file mode 100644 index 00000000..6f412c20 --- /dev/null +++ b/SDK/LIBS/dcinclude/assert.h @@ -0,0 +1,43 @@ +/* KallistiOS 1.2.0 + + assert.h + (c)2002 Dan Potter + + $Id: assert.h,v 1.2 2002/09/13 04:41:57 bardtx Exp $ +*/ + +#ifndef __ASSERT_H +#define __ASSERT_H + +#include +__BEGIN_DECLS + +/* This is nice and simple, modeled after the BSD one like most of KOS; + the addition here is assert_msg(), which allows you to provide an + error message. */ +#define _assert(e) assert(e) + +/* __FUNCTION__ is not ANSI, it's GCC, but we depend on GCC anyway.. */ +#ifdef NDEBUG +# define assert(e) ((void)0) +# define assert_msg(e, m) ((void)0) +#else +# define assert(e) ((e) ? (void)0 : __assert(__FILE__, __LINE__, #e, NULL, __FUNCTION__)) +# define assert_msg(e, m) ((e) ? (void)0 : __assert(__FILE__, __LINE__, #e, m, __FUNCTION__)) +#endif + +/* Defined in assert.c */ +void __assert(const char *file, int line, const char *expr, + const char *msg, const char *func); + +/* Set an "assert handler" which is called whenever an assert happens. + By default, this will print a message and call abort(). Returns the old + handler's address. */ +typedef void (*assert_handler_t)(const char * file, int line, const char * expr, + const char * msg, const char * func); +assert_handler_t assert_set_handler(assert_handler_t hnd); + +__END_DECLS + +#endif /* __ASSERT_H */ + diff --git a/SDK/LIBS/dcinclude/bzlib/bzlib.h b/SDK/LIBS/dcinclude/bzlib/bzlib.h new file mode 100644 index 00000000..9ac43a16 --- /dev/null +++ b/SDK/LIBS/dcinclude/bzlib/bzlib.h @@ -0,0 +1,321 @@ + +/*-------------------------------------------------------------*/ +/*--- Public header file for the library. ---*/ +/*--- bzlib.h ---*/ +/*-------------------------------------------------------------*/ + +/*-- + This file is a part of bzip2 and/or libbzip2, a program and + library for lossless, block-sorting data compression. + + Copyright (C) 1996-2002 Julian R Seward. 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. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product + documentation would be appreciated but is not required. + + 3. Altered source versions must be plainly marked as such, and must + not be misrepresented as being the original software. + + 4. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. + + Julian Seward, Cambridge, UK. + jseward@acm.org + bzip2/libbzip2 version 1.0 of 21 March 2000 + + This program is based on (at least) the work of: + Mike Burrows + David Wheeler + Peter Fenwick + Alistair Moffat + Radford Neal + Ian H. Witten + Robert Sedgewick + Jon L. Bentley + + For more information on these sources, see the manual. +--*/ + + +#ifndef _BZLIB_H +#define _BZLIB_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define BZ_RUN 0 +#define BZ_FLUSH 1 +#define BZ_FINISH 2 + +#define BZ_OK 0 +#define BZ_RUN_OK 1 +#define BZ_FLUSH_OK 2 +#define BZ_FINISH_OK 3 +#define BZ_STREAM_END 4 +#define BZ_SEQUENCE_ERROR (-1) +#define BZ_PARAM_ERROR (-2) +#define BZ_MEM_ERROR (-3) +#define BZ_DATA_ERROR (-4) +#define BZ_DATA_ERROR_MAGIC (-5) +#define BZ_IO_ERROR (-6) +#define BZ_UNEXPECTED_EOF (-7) +#define BZ_OUTBUFF_FULL (-8) +#define BZ_CONFIG_ERROR (-9) + +typedef + struct { + char *next_in; + unsigned int avail_in; + unsigned int total_in_lo32; + unsigned int total_in_hi32; + + char *next_out; + unsigned int avail_out; + unsigned int total_out_lo32; + unsigned int total_out_hi32; + + void *state; + + void *(*bzalloc)(void *,int,int); + void (*bzfree)(void *,void *); + void *opaque; + } + bz_stream; + + +#ifndef BZ_IMPORT +#define BZ_EXPORT +#endif + +/* Need a definitition for FILE */ +#include + +#ifdef _WIN32 +# include +# ifdef small + /* windows.h define small to char */ +# undef small +# endif +# ifdef BZ_EXPORT +# define BZ_API(func) WINAPI func +# define BZ_EXTERN extern +# else + /* import windows dll dynamically */ +# define BZ_API(func) (WINAPI * func) +# define BZ_EXTERN +# endif +#else +# define BZ_API(func) func +# define BZ_EXTERN extern +#endif + + +/*-- Core (low-level) library functions --*/ + +BZ_EXTERN int BZ_API(BZ2_bzCompressInit) ( + bz_stream* strm, + int blockSize100k, + int verbosity, + int workFactor + ); + +BZ_EXTERN int BZ_API(BZ2_bzCompress) ( + bz_stream* strm, + int action + ); + +BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) ( + bz_stream* strm + ); + +BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) ( + bz_stream *strm, + int verbosity, + int small + ); + +BZ_EXTERN int BZ_API(BZ2_bzDecompress) ( + bz_stream* strm + ); + +BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) ( + bz_stream *strm + ); + + + +/*-- High(er) level library functions --*/ + +#ifndef BZ_NO_STDIO +#define BZ_MAX_UNUSED 5000 + +typedef void BZFILE; + +BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) ( + int* bzerror, + FILE* f, + int verbosity, + int small, + void* unused, + int nUnused + ); + +BZ_EXTERN void BZ_API(BZ2_bzReadClose) ( + int* bzerror, + BZFILE* b + ); + +BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) ( + int* bzerror, + BZFILE* b, + void** unused, + int* nUnused + ); + +BZ_EXTERN int BZ_API(BZ2_bzRead) ( + int* bzerror, + BZFILE* b, + void* buf, + int len + ); + +BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) ( + int* bzerror, + FILE* f, + int blockSize100k, + int verbosity, + int workFactor + ); + +BZ_EXTERN void BZ_API(BZ2_bzWrite) ( + int* bzerror, + BZFILE* b, + void* buf, + int len + ); + +BZ_EXTERN void BZ_API(BZ2_bzWriteClose) ( + int* bzerror, + BZFILE* b, + int abandon, + unsigned int* nbytes_in, + unsigned int* nbytes_out + ); + +BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) ( + int* bzerror, + BZFILE* b, + int abandon, + unsigned int* nbytes_in_lo32, + unsigned int* nbytes_in_hi32, + unsigned int* nbytes_out_lo32, + unsigned int* nbytes_out_hi32 + ); +#endif + + +/*-- Utility functions --*/ + +BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) ( + char* dest, + unsigned int* destLen, + char* source, + unsigned int sourceLen, + int blockSize100k, + int verbosity, + int workFactor + ); + +BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) ( + char* dest, + unsigned int* destLen, + char* source, + unsigned int sourceLen, + int small, + int verbosity + ); + + +/*-- + Code contributed by Yoshioka Tsuneo + (QWF00133@niftyserve.or.jp/tsuneo-y@is.aist-nara.ac.jp), + to support better zlib compatibility. + This code is not _officially_ part of libbzip2 (yet); + I haven't tested it, documented it, or considered the + threading-safeness of it. + If this code breaks, please contact both Yoshioka and me. +--*/ + +BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) ( + void + ); + +#ifndef BZ_NO_STDIO +BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) ( + const char *path, + const char *mode + ); + +BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) ( + int fd, + const char *mode + ); + +BZ_EXTERN int BZ_API(BZ2_bzread) ( + BZFILE* b, + void* buf, + int len + ); + +BZ_EXTERN int BZ_API(BZ2_bzwrite) ( + BZFILE* b, + void* buf, + int len + ); + +BZ_EXTERN int BZ_API(BZ2_bzflush) ( + BZFILE* b + ); + +BZ_EXTERN void BZ_API(BZ2_bzclose) ( + BZFILE* b + ); + +BZ_EXTERN const char * BZ_API(BZ2_bzerror) ( + BZFILE *b, + int *errnum + ); +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +/*-------------------------------------------------------------*/ +/*--- end bzlib.h ---*/ +/*-------------------------------------------------------------*/ diff --git a/SDK/LIBS/dcinclude/conio/conio.h b/SDK/LIBS/dcinclude/conio/conio.h new file mode 100644 index 00000000..ca6b6ad5 --- /dev/null +++ b/SDK/LIBS/dcinclude/conio/conio.h @@ -0,0 +1,77 @@ +/* KallistiOS 1.2.0 + + conio.h + + (c)2002 Dan Potter + + Adapted from Kosh, (c)2000 Jordan DeLong + + $Id: conio.h,v 1.1 2003/02/27 03:46:29 bardtx Exp $ + +*/ + +#ifndef __CONIO_CONIO_H +#define __CONIO_CONIO_H + +#include +__BEGIN_DECLS + +/* some defines */ +#define CONIO_NUM_ROWS 18 +#define CONIO_NUM_COLS 48 + +/* our cursor */ +typedef struct { int row, col; } conio_cursor_t; +extern conio_cursor_t conio_cursor; + +/* the virtual screen */ +extern char conio_virtscr[CONIO_NUM_ROWS][CONIO_NUM_COLS]; + +#include +#include + +/* functions */ +void conio_scroll(); +void conio_deadvance_cursor(); +void conio_advance_cursor(); +void conio_gotoxy(int x, int y); +int conio_getch(); +int conio_check_getch(); +void conio_setch(int ch); +void conio_putch(int ch); +void conio_putstr(char *str); +int conio_printf(const char *fmt, ...); +void conio_clear(); +void conio_freeze(); +void conio_thaw(); +void conio_set_theme(int theme); + +/* Themes: + - PLAIN is white text on a black background + - MATRIX is green text on a black background + - C64 is cyan text on a blue background, with a cyan border + */ +#define CONIO_THEME_PLAIN 0 +#define CONIO_THEME_MATRIX 1 +#define CONIO_THEME_C64 2 + +/* Init modes: + - TTY can be serial or PVR console + - Input mode can be NONE, LINE, CHAR + + The only valid combination for now is TTY_PVR and INPUT_LINE */ +#define CONIO_TTY_NONE 0 +#define CONIO_TTY_PVR 1 +#define CONIO_TTY_SERIAL 2 +#define CONIO_INPUT_NONE 0 +#define CONIO_INPUT_LINE 1 +#define CONIO_INPUT_CHAR 2 + +extern int conio_ttymode, conio_inputmode, conio_theme; + +int conio_init(int ttymode, int inputmode); +int conio_shutdown(); + +__END_DECLS + +#endif /* __CONIO_CONIO_H */ diff --git a/SDK/LIBS/dcinclude/conio/draw.h b/SDK/LIBS/dcinclude/conio/draw.h new file mode 100644 index 00000000..51cfa4d3 --- /dev/null +++ b/SDK/LIBS/dcinclude/conio/draw.h @@ -0,0 +1,34 @@ +/* KallistiOS 1.2.0 + + draw.h + + (c)2002 Dan Potter + + Adapted from Kosh, (c)2000 Jordan DeLong + + $Id: draw.h,v 1.1 2003/02/27 03:46:29 bardtx Exp $ + +*/ + +#ifndef __CONIO_DRAW_H +#define __CONIO_DRAW_H + +/* font size constants */ +#define CONIO_FONT_WIDTH 12 +#define CONIO_FONT_HEIGHT 24 + +/* screen size constants */ +#define CONIO_SCREEN_WIDTH 640 +#define CONIO_SCREEN_HEIGHT 480 + +/* more constants */ +#define CONIO_SCREEN_FIRSTCOL ( (CONIO_SCREEN_WIDTH - CONIO_FONT_WIDTH * CONIO_NUM_COLS) / 2 ) +#define CONIO_SCREEN_LASTCOL (CONIO_SCREEN_WIDTH - CONIO_SCREEN_FIRSTCOL) + +/* functions */ +void conio_draw_init(); +void conio_draw_shutdown(); +void conio_draw_frame(); + +#endif /* __CONIO_DRAW_H */ + diff --git a/SDK/LIBS/dcinclude/conio/input.h b/SDK/LIBS/dcinclude/conio/input.h new file mode 100644 index 00000000..9e37aac1 --- /dev/null +++ b/SDK/LIBS/dcinclude/conio/input.h @@ -0,0 +1,31 @@ +/* KallistiOS 1.2.0 + + input.h + + (c)2002 Dan Potter + + Adapted from Kosh, (c)2000 Jordan DeLong + + $Id: input.h,v 1.1 2003/02/27 03:46:29 bardtx Exp $ +*/ + +#ifndef __CONIO_INPUT_H +#define __CONIO_INPUT_H + +/* size of the input buffer */ +#define CONIO_INPUT_BUFFSIZE 256 + +/* functions */ +void conio_input_frame(); +void conio_input_init(); +void conio_input_shutdown(); + +typedef void (*conio_input_callback_t)(const char *str); +void conio_input_callback(conio_input_callback_t cb); + +/* Default conio input system: call with block = 1 to wait for the user + to type something; the output will be placed in dst, which should + be at least dstcnt bytes large. Returns 0 on success, -1 on failure. */ +int conio_input_getline(int block, char *dst, int dstcnt); + +#endif diff --git a/SDK/LIBS/dcinclude/ctype.h b/SDK/LIBS/dcinclude/ctype.h new file mode 100644 index 00000000..5a6c85c6 --- /dev/null +++ b/SDK/LIBS/dcinclude/ctype.h @@ -0,0 +1,68 @@ +/* KallistiOS 1.2.0 + + ctype.h + (c)2000-2001 Jordan DeLong and Dan Potter + + $Id: ctype.h,v 1.1 2002/02/09 06:15:42 bardtx Exp $ +*/ + +#ifndef __CTYPE_H +#define __CTYPE_H + +#include + +__BEGIN_DECLS + +/* Unix specification requires the definition of these as functions too */ +int isalpha(int); +int isupper(int); +int islower(int); +int isdigit(int); +int isxdigit(int); +int isspace(int); +int ispunct(int); +int isalnum(int); +int isblank(int); +int isprint(int); +int isgraph(int); +int iscntrl(int); +int isascii(int); +int toascii(int); +int tolower(int); +int toupper(int); + +#define _U 0x01 /* upper */ +#define _L 0x02 /* lower */ +#define _N 0x04 /* number */ +#define _S 0x08 /* space */ +#define _P 0x10 /* punct */ +#define _C 0x20 /* control */ +#define _X 0x40 /* hex number */ +#define _B 0x80 /* blank */ + +extern const char _ctype_[]; + +#define isalpha(c) (_ctype_[(unsigned)(c)] & (_U|_L)) +#define isupper(c) (_ctype_[(unsigned)(c)] & _U) +#define islower(c) (_ctype_[(unsigned)(c)] & _L) +#define isdigit(c) (_ctype_[(unsigned)(c)] & _N) +#define isxdigit(c) (_ctype_[(unsigned)(c)] & (_X|_N)) +#define isspace(c) (_ctype_[(unsigned)(c)] & _S) +#define ispunct(c) (_ctype_[(unsigned)(c)] & _P) +#define isalnum(c) (_ctype_[(unsigned)(c)] & (_U|_L|_N)) +#define isblank(c) (_ctype_[(unsigned)(c)] & _B) +#define isprint(c) (_ctype_[(unsigned)(c)] & (_P|_U|_L|_N|_B)) +#define isgraph(c) (_ctype_[(unsigned)(c)] & (_P|_U|_L|_N)) +#define iscntrl(c) (_ctype_[(unsigned)(c)] & _C) +#define isascii(c) (((c) & ~0x7F) == 0) +#define toascii(c) ((c) & 0x7f) +#define tolower(c) (isupper(c) ? ((c) + ('a' - 'A')) : (c)) +#define toupper(c) (islower(c) ? ((c) - ('a' - 'A')) : (c)) +#define _tolower(c) ((c) + ('a' - 'A')) +#define _toupper(c) ((c) - ('a' - 'A')) + +__END_DECLS + +#endif + + diff --git a/SDK/LIBS/dcinclude/dc/asic.h b/SDK/LIBS/dcinclude/dc/asic.h new file mode 100644 index 00000000..5344ba75 --- /dev/null +++ b/SDK/LIBS/dcinclude/dc/asic.h @@ -0,0 +1,96 @@ +/* KallistiOS 1.2.0 + + dc/asic.h + (c)2001-2002 Dan Potter + + $Id: asic.h,v 1.4 2003/02/25 07:39:37 bardtx Exp $ + +*/ + +#ifndef __DC_ASIC_H +#define __DC_ASIC_H + +#include +__BEGIN_DECLS + +#include + +/* All event codes are two 8-bit integers; the top integer is the event code + register to look in to check the event (and to acknolwedge it). The + register to check is 0xa05f6900+4*regnum. The bottom integer is the + bit index within that register. */ + +/* Event codes for the PVR chip */ +#define ASIC_EVT_PVR_RENDERDONE 0x0002 /* Render completed */ +#define ASIC_EVT_PVR_SCANINT1 0x0003 /* Scanline interrupt 1 */ +#define ASIC_EVT_PVR_SCANINT2 0x0004 /* Scanline interrupt 2 */ +#define ASIC_EVT_PVR_VBLINT 0x0005 /* VBL interrupt */ +#define ASIC_EVT_PVR_OPAQUEDONE 0x0007 /* Opaque list completed */ +#define ASIC_EVT_PVR_OPAQUEMODDONE 0x0008 /* Opaque modifiers completed */ +#define ASIC_EVT_PVR_TRANSDONE 0x0009 /* Transparent list completed */ +#define ASIC_EVT_PVR_TRANSMODDONE 0x000a /* Transparent modifiers completed */ +#define ASIC_EVT_PVR_DMA 0x0013 /* PVR DMA complete */ +#define ASIC_EVT_PVR_PTDONE 0x0015 /* Punch-thrus completed */ +#define ASIC_EVT_PVR_PRIMOUTOFMEM 0x0202 /* Out of primitive memory */ +#define ASIC_EVT_PVR_MATOUTOFMEM 0x0203 /* Out of matrix memory */ + +/* Event codes for the GD controller */ +#define ASIC_EVT_GD_COMMAND 0x0100 /* GD-Rom Command Status */ +#define ASIC_EVT_GD_DMA 0x000e /* GD-Rom DMA complete */ + +/* Event codes for the Maple controller */ +#define ASIC_EVT_MAPLE_DMA 0x000c /* Maple DMA complete */ +#define ASIC_EVT_MAPLE_ERROR 0x000d /* Maple error (?) */ + +/* Event codes for the SPU */ +#define ASIC_EVT_SPU_DMA 0x000f /* SPU DMA complete */ +#define ASIC_EVT_SPU_IRQ 0x0101 /* SPU interrupt */ + +/* Event codes for the external port */ +#define ASIC_EVT_EXP_8BIT 0x0102 /* Modem / Lan Adapter */ +#define ASIC_EVT_EXP_PCI 0x0103 /* BBA IRQ */ + +/* ASIC registers */ +#define ASIC_IRQD_A (*(vuint32*)0xa05f6910) +#define ASIC_IRQD_B (*(vuint32*)0xa05f6914) +#define ASIC_IRQD_C (*(vuint32*)0xa05f6918) +#define ASIC_IRQB_A (*(vuint32*)0xa05f6920) +#define ASIC_IRQB_B (*(vuint32*)0xa05f6924) +#define ASIC_IRQB_C (*(vuint32*)0xa05f6928) +#define ASIC_IRQ9_A (*(vuint32*)0xa05f6930) +#define ASIC_IRQ9_B (*(vuint32*)0xa05f6934) +#define ASIC_IRQ9_C (*(vuint32*)0xa05f6938) + +#define ASIC_ACK_A (*(vuint32*)0xa05f6900) +#define ASIC_ACK_B (*(vuint32*)0xa05f6904) +#define ASIC_ACK_C (*(vuint32*)0xa05f6908) + +/* ASIC IRQ priorities (pick one at hook time, or don't choose anything and + we'll choose a default) */ +#define ASIC_IRQ9 1 +#define ASIC_IRQB 2 +#define ASIC_IRQD 3 +#define ASIC_IRQ_DEFAULT 0 + +/* The type of a ASIC event handler */ +typedef void (*asic_evt_handler)(uint32 code); + +/* Set a handler, or remove a handler (see codes above); handler + functions have one parameter, which is the exception code. */ +int asic_evt_set_handler(uint32 code, asic_evt_handler handler); + +/* Enable/Disable ASIC events; only enable a given event on one irqlevel! */ +void asic_evt_disable_all(); +void asic_evt_disable(uint32 code, int irqlevel); +void asic_evt_enable(uint32 code, int irqlevel); + +/* Init routine */ +void asic_init(); + +/* Shutdown */ +void asic_shutdown(); + +__END_DECLS + +#endif /* __DC_ASIC_H */ + diff --git a/SDK/LIBS/dcinclude/dc/biosfont.h b/SDK/LIBS/dcinclude/dc/biosfont.h new file mode 100644 index 00000000..5206ba09 --- /dev/null +++ b/SDK/LIBS/dcinclude/dc/biosfont.h @@ -0,0 +1,39 @@ +/* KallistiOS 1.2.0 + + dc/biosfont.h + (c)2000-2001 Dan Potter + Japanese Functions (c)2002 Kazuaki Matsumoto + + $Id: biosfont.h,v 1.3 2002/06/27 23:24:43 bardtx Exp $ + +*/ + + +#ifndef __DC_BIOSFONT_H +#define __DC_BIOSFONT_H + +#include +__BEGIN_DECLS + +#include + +/* Constants for the function below */ +#define BFONT_CODE_ISO8859_1 0 /* DEFAULT */ +#define BFONT_CODE_EUC 1 +#define BFONT_CODE_SJIS 2 + +/* Select an encoding for Japanese (or disable) */ +void bfont_set_encoding(int enc); + +uint8 *bfont_find_char(int ch); +uint8 *bfont_find_char_jp(int ch); +uint8 *bfont_find_char_jp_half(int ch); + +void bfont_draw(uint16 *buffer, int bufwidth, int opaque, int c); +void bfont_draw_thin(uint16 *buffer, int bufwidth, int opaque, int c, int iskana); +void bfont_draw_wide(uint16 *buffer, int bufwidth, int opaque, int c); +void bfont_draw_str(uint16 *buffer, int width, int opaque, char *str); + +__END_DECLS + +#endif /* __DC_BIOSFONT_H */ diff --git a/SDK/LIBS/dcinclude/dc/cdrom.h b/SDK/LIBS/dcinclude/dc/cdrom.h new file mode 100644 index 00000000..13784e09 --- /dev/null +++ b/SDK/LIBS/dcinclude/dc/cdrom.h @@ -0,0 +1,111 @@ +/* KallistiOS 1.2.0 + + dc/cdrom.h + (c)2000-2001 Dan Potter + + $Id: cdrom.h,v 1.4 2002/09/13 05:11:43 bardtx Exp $ + +*/ + +#ifndef __DC_CDROM_H +#define __DC_CDROM_H + +#include +__BEGIN_DECLS + +#include + +/* Command codes (thanks maiwe) */ +#define CMD_PIOREAD 16 +#define CMD_DMAREAD 17 +#define CMD_GETTOC 18 +#define CMD_GETTOC2 19 +#define CMD_PLAY 20 +#define CMD_PLAY2 21 +#define CMD_PAUSE 22 +#define CMD_RELEASE 23 +#define CMD_INIT 24 +#define CMD_SEEK 27 +#define CMD_READ 28 +#define CMD_STOP 33 +#define CMD_GETSCD 34 +#define CMD_GETSES 35 + +/* Command responses */ +#define ERR_OK 0 +#define ERR_NO_DISC 1 +#define ERR_DISC_CHG 2 +#define ERR_SYS 3 + +/* CDDA Read Modes */ +#define CDDA_TRACKS 1 +#define CDDA_SECTORS 2 + +/* Status values */ +#define CD_STATUS_BUSY 0 +#define CD_STATUS_PAUSED 1 +#define CD_STATUS_STANDBY 2 +#define CD_STATUS_PLAYING 3 +#define CD_STATUS_SEEKING 4 +#define CD_STATUS_SCANNING 5 +#define CD_STATUS_OPEN 6 +#define CD_STATUS_NO_DISC 7 + +/* Disk types */ +#define CD_CDDA 0 +#define CD_CDROM 0x10 +#define CD_CDROM_XA 0x20 +#define CD_CDI 0x30 +#define CD_GDROM 0x80 + +/* TOC structure returned by the BIOS */ +typedef struct { + uint32 entry[99]; + uint32 first, last; + uint32 leadout_sector; +} CDROM_TOC; + +/* TOC access macros */ +#define TOC_LBA(n) ((n) & 0x00ffffff) +#define TOC_ADR(n) ( ((n) & 0x0f000000) >> 24 ) +#define TOC_CTRL(n) ( ((n) & 0xf0000000) >> 28 ) +#define TOC_TRACK(n) ( ((n) & 0x00ff0000) >> 16 ) + +/* Command execution sequence */ +int cdrom_exec_cmd(int cmd, void *param); + +/* Return the status of the drive as two integers (see constants) */ +int cdrom_get_status(int *status, int *disc_type); + +/* Re-init the drive, e.g., after a disc change, etc */ +int cdrom_reinit(); + +/* Read the table of contents */ +int cdrom_read_toc(CDROM_TOC *toc_buffer, int session); + +/* Read one or more sectors */ +int cdrom_read_sectors(void *buffer, int sector, int cnt); + +/* Locate the LBA sector of the data track */ +uint32 cdrom_locate_data_track(CDROM_TOC *toc); + +/* Play CDDA audio tracks or sectors */ +int cdrom_cdda_play(uint32 start, uint32 end, uint32 loops, int mode); + +/* Pause CDDA audio playback */ +int cdrom_cdda_pause(); + +/* Resume CDDA audio playback */ +int cdrom_cdda_resume(); + +/* Spin down the CD */ +int cdrom_spin_down(); + +/* Initialize */ +int cdrom_init(); +void cdrom_shutdown(); + +__END_DECLS + +#endif /* __DC_CDROM_H */ + diff --git a/SDK/LIBS/dcinclude/dc/flashrom.h b/SDK/LIBS/dcinclude/dc/flashrom.h new file mode 100644 index 00000000..3f3a6249 --- /dev/null +++ b/SDK/LIBS/dcinclude/dc/flashrom.h @@ -0,0 +1,115 @@ +/* KallistiOS 1.2.0 + + kernel/arch/dreamcast/include/dc/flashrom.h + Copyright (C)2003 Dan Potter + + $Id: flashrom.h,v 1.4 2003/03/10 01:45:32 bardtx Exp $ +*/ + + +#ifndef __DC_FLASHROM_H +#define __DC_FLASHROM_H + +#include +__BEGIN_DECLS + +#include + +/** + \file Implements wrappers for the BIOS flashrom syscalls, and some + utilities to make it easier to use the flashrom info. Note that + because the flash writing can be such a dangerous thing potentially + (I haven't deleted my flash to see what happens, but given the + info stored here it sounds like a Bad Idea(tm)) the syscalls for + the WRITE and DELETE operations are not enabled by default. If you + are 100% sure you really want to be writing to the flash and you + know what you're doing, then you can edit flashrom.c and re-enable + them there. */ + +/** + An enumeration of partitions available in the flashrom. */ +#define FLASHROM_PT_SYSTEM 0 //< Factory settings (read-only, 8K) +#define FLASHROM_PT_RESERVED 1 //< reserved (all 0s, 8K) +#define FLASHROM_PT_BLOCK_1 2 //< Block allocated (16K) +#define FLASHROM_PT_SETTINGS 3 //< Game settings (block allocated, 32K) +#define FLASHROM_PT_BLOCK_2 4 //< Block allocated (64K) + +/** + Implements the FLASHROM_INFO syscall; given a partition ID, + return two ints specifying the beginning and the size of + the partition (respectively) inside the flashrom. Returns zero + if successful, -1 otherwise. */ +int flashrom_info(int part, int * start_out, int * size_out); + +/** + Implements the FLASHROM_READ syscall; given a flashrom offset, + an output buffer, and a count, this reads data from the + flashrom. Returns the number of bytes read if successful, + or -1 otherwise. */ +int flashrom_read(int offset, void * buffer_out, int bytes); + +/** + Implements the FLASHROM_WRITE syscall; given a flashrom offset, + an input buffer, and a count, this writes data to the flashrom. + Returns the number of bytes written if successful, -1 otherwise. + + NOTE: It is not possible to write ones to the flashrom over zeros. + If you want to do this, you must save the old data in the flashrom, + delete it out, and save the new data back. */ +int flashrom_write(int offset, void * buffer, int bytes); + +/** + Implements the FLASHROM_DELETE syscall; given a partition offset, + that entire partition of the flashrom will be deleted and all data + will be reset to FFs. Returns zero if successful, -1 on failure. */ +int flashrom_delete(int offset); + + + +/* Higher level functions */ + +/** + Language settings possible in the BIOS menu. These will be returned + from flashrom_get_language(). */ +#define FLASHROM_LANG_JAPANESE 0 +#define FLASHROM_LANG_ENGLISH 1 +#define FLASHROM_LANG_GERMAN 2 +#define FLASHROM_LANG_FRENCH 3 +#define FLASHROM_LANG_SPANISH 4 +#define FLASHROM_LANG_ITALIAN 5 + +/** + This struct will be filled by calling the flashrom_get_syscfg call + below. */ +typedef struct flashrom_syscfg { + int language; //< Language setting (see defines above) + int audio; //< 0 == mono, 1 == stereo + int autostart; //< 0 == off, 1 == on +} flashrom_syscfg_t; + +/** + Retrieves the current syscfg settings and fills them into the struct + passed in to us. */ +int flashrom_get_syscfg(flashrom_syscfg_t * out); + + +/** + Region settings possible in the system flash (partition 0). */ +#define FLASHROM_REGION_UNKNOWN 0 +#define FLASHROM_REGION_JAPAN 1 +#define FLASHROM_REGION_US 2 +#define FLASHROM_REGION_EUROPE 3 + +/** + Retrieves the console's region code. This is still somewhat + experimental, it may not function 100% on all DCs. Returns + one of the codes above or -1 on error. */ +int flashrom_get_region(); + + +/* More to come later */ + +__END_DECLS + +#endif /* __DC_FLASHROM_H */ + diff --git a/SDK/LIBS/dcinclude/dc/fmath.h b/SDK/LIBS/dcinclude/dc/fmath.h new file mode 100644 index 00000000..fdc5c864 --- /dev/null +++ b/SDK/LIBS/dcinclude/dc/fmath.h @@ -0,0 +1,149 @@ +/* KallistiOS 1.2.0 + + dc/fmath.h + (C)2001 Andrew Kieschnick + + $Id: fmath.h,v 1.3 2002/01/05 07:33:51 bardtx Exp $ + +*/ + +#ifndef __DC_FMATH_H +#define __DC_FMATH_H + +#include +__BEGIN_DECLS + +#include + +/* Inline functions for the DC's special math instructions */ + +/* PI constant (if you don't want full math.h) */ +#define F_PI 3.1415926f + + +#define __fsin(x) \ +({ float __value, __arg = (x), __scale = 10430.37835; \ + asm( "fmul %2,%1\n\t" \ + "ftrc %1,fpul\n\t" \ + ".short 0xf0fd\n\t" \ + "fmov fr0,%0" \ + : "=f" (__value), "+&f" (__scale) \ + : "f" (__arg) \ + : "fpul", "fr0", "fr1"); \ + __value; }) + +#define __fcos(x) \ +({ float __value, __arg = (x), __scale = 10430.37835; \ + asm( "fmul %2,%1\n\t" \ + "ftrc %1,fpul\n\t" \ + ".short 0xf0fd\n\t" \ + "fmov fr1,%0" \ + : "=f" (__value), "+&f" (__scale) \ + : "f" (__arg) \ + : "fpul", "fr0", "fr1"); \ + __value; }) + +#define __ftan(x) \ +({ float __value, __arg = (x), __scale = 10430.37835; \ + asm( "fmul %2,%1\n\t" \ + "ftrc %1,fpul\n\t" \ + ".short 0xf0fd\n\t" \ + "fdiv fr1, fr0\n\t" \ + "fmov fr0,%0" \ + : "=f" (__value), "+&f" (__scale) \ + : "f" (__arg) \ + : "fpul", "fr0", "fr1"); \ + __value; }) + + +#define __fisin(x) \ +({ float __value, __arg = (x); \ + asm( "lds %1,fpul\n\t" \ + ".short 0xf0fd\n\t" \ + "fmov fr0,%0" \ + : "=f" (__value) \ + : "r" (__arg) \ + : "fpul", "fr0", "fr1"); \ + __value; }) + +#define __ficos(x) \ +({ float __value, __arg = (x); \ + asm( "lds %1,fpul\n\t" \ + ".short 0xf0fd\n\t" \ + "fmov fr1,%0" \ + : "=f" (__value) \ + : "r" (__arg) \ + : "fpul", "fr0", "fr1"); \ + __value; }) + +#define __fitan(x) \ +({ float __value, __arg = (x); \ + asm( "lds %1,fpul\n\t" \ + ".short 0xf0fd\n\t" \ + "fdiv fr1, fr0\n\t" \ + "fmov fr0,%0" \ + : "=f" (__value) \ + : "r" (__arg) \ + : "fpul", "fr0", "fr1"); \ + __value; }) + + +#define __fsqrt(x) \ +({ float __arg = (x); \ + asm( "fsqrt %0\n\t" \ + : "=f" (__arg) : "0" (__arg)); \ + __arg; }) + +#define __frsqrt(x) \ +({ float __value, __arg = (x); \ + asm( "fmov %1,fr0\n\t" \ + ".short 0xf07d\n\t" \ + "fmov fr0,%0\n\t" \ + : "=f" (__value) : "f" (__arg)); \ + __value; }) + + +/* Returns sin(r), where r is [0..2*PI] */ +extern inline float fsin(float r) { + return __fsin(r); +} + +/* Returns cos(r), where r is [0..2*PI] */ +extern inline float fcos(float r) { + return __fcos(r); +} + +/* Returns tan(r), where r is [0..2*PI] */ +extern inline float ftan(float r) { + return __ftan(r); +} + +/* Returns sin(d), where d is [0..65535] */ +extern inline float fisin(int d) { + return __fisin(d); +} + +/* Returns cos(d), where d is [0..65535] */ +extern inline float ficos(int d) { + return __ficos(d); +} + +/* Returns tan(d), where d is [0..65535] */ +extern inline float fitan(int d) { + return __fitan(d); +} + +/* Returns sqrt(f) */ +extern inline float fsqrt(float f) { + return __fsqrt(f); +} + +/* Returns 1.0f / sqrt(f) */ +extern inline float frsqrt(float f) { + return __frsqrt(f); +} + +__END_DECLS + +#endif /* __DC_FMATH_H */ + diff --git a/SDK/LIBS/dcinclude/dc/fs_dclnative.h b/SDK/LIBS/dcinclude/dc/fs_dclnative.h new file mode 100644 index 00000000..dc166946 --- /dev/null +++ b/SDK/LIBS/dcinclude/dc/fs_dclnative.h @@ -0,0 +1,45 @@ +/* KallistiOS 1.2.0 + + kernel/arch/dreamcast/include/dc/fs_dclnative.h + Copyright (C)2003 Dan Potter + +*/ + +#ifndef __DC_FS_DCLNATIVE_H +#define __DC_FS_DCLNATIVE_H + +/* Definitions for the "dcload-ip native" file system. This is like, + dc-load, but it uses KOS' ethernet drivers to talk directly to the + installed network adapter. This is far faster and more reliable as + long as you're not debugging interrupts or something. :) When KOS + exits, control will be handed back to the resident dcload-ip + instance. */ + +#include +__BEGIN_DECLS + +#include + +/* Printk replacement */ +void dclnative_printk(const char *str); + +/* File functions */ +file_t dclnative_open(vfs_handler_t * vfs, const char *fn, int mode); +void dclnative_close(file_t hnd); +ssize_t dclnative_read(file_t hnd, void *buf, size_t cnt); +off_t dclnative_seek(file_t hnd, off_t offset, int whence); +off_t dclnative_tell(file_t hnd); +size_t dclnative_total(file_t hnd); +dirent_t* dclnative_readdir(file_t hnd); +int dclnative_rename(vfs_handler_t * vfs, const char *fn1, const char *fn2); +int dclnative_unlink(vfs_handler_t * vfs, const char *fn); + +/* Init/Shutdown */ +int fs_dclnative_init(); +int fs_dclnative_shutdown(); + +__END_DECLS + +#endif /* __DC_FS_DCLNATIVE_H */ + + diff --git a/SDK/LIBS/dcinclude/dc/fs_dcload.h b/SDK/LIBS/dcinclude/dc/fs_dcload.h new file mode 100644 index 00000000..7d5cf8f9 --- /dev/null +++ b/SDK/LIBS/dcinclude/dc/fs_dcload.h @@ -0,0 +1,120 @@ +/* KallistiOS 1.2.0 + + kernel/arch/dreamcast/include/dc/fs_dcload.h + (c)2002 Andrew Kieschnick + +*/ + +#ifndef __DC_FS_DCLOAD_H +#define __DC_FS_DCLOAD_H + +/* Definitions for the "dcload" file system */ + +#include +__BEGIN_DECLS + +#include +#include +#include + +/* dcload magic value */ +#define DCLOADMAGICVALUE 0xdeadbeef +#define DCLOADMAGICADDR (unsigned int *)0x8c004004 + +/* Are we using dc-load-serial or dc-load-ip? */ +#define DCLOAD_TYPE_NONE -1 +#define DCLOAD_TYPE_SER 0 +#define DCLOAD_TYPE_IP 1 +extern int dcload_type; + +/* Available dcload console commands */ + +#define DCLOAD_READ 0 +#define DCLOAD_WRITE 1 +#define DCLOAD_OPEN 2 +#define DCLOAD_CLOSE 3 +#define DCLOAD_CREAT 4 +#define DCLOAD_LINK 5 +#define DCLOAD_UNLINK 6 +#define DCLOAD_CHDIR 7 +#define DCLOAD_CHMOD 8 +#define DCLOAD_LSEEK 9 +#define DCLOAD_FSTAT 10 +#define DCLOAD_TIME 11 +#define DCLOAD_STAT 12 +#define DCLOAD_UTIME 13 +#define DCLOAD_ASSIGNWRKMEM 14 +#define DCLOAD_EXIT 15 +#define DCLOAD_OPENDIR 16 +#define DCLOAD_CLOSEDIR 17 +#define DCLOAD_READDIR 18 + +/* dcload syscall function */ + +int dcloadsyscall(unsigned int syscall, ...); + +/* dcload dirent */ + +struct dcload_dirent { + long d_ino; /* inode number */ + off_t d_off; /* offset to the next dirent */ + unsigned short d_reclen;/* length of this record */ + unsigned char d_type; /* type of file */ + char d_name[256]; /* filename */ +}; + +typedef struct dcload_dirent dcload_dirent_t; + +/* dcload stat */ + +struct dcload_stat { + unsigned short st_dev; + unsigned short st_ino; + int st_mode; + unsigned short st_nlink; + unsigned short st_uid; + unsigned short st_gid; + unsigned short st_rdev; + long st_size; + long st_atime; + long st_spare1; + long st_mtime; + long st_spare2; + long st_ctime; + long st_spare3; + long st_blksize; + long st_blocks; + long st_spare4[2]; +}; + +typedef struct dcload_stat dcload_stat_t; + +#define S_IFDIR 0040000 /* directory */ + +/* Printk replacement */ +void dcload_printk(const char *str); + +/* File functions */ +uint32 dcload_open(vfs_handler_t * vfs, const char *fn, int mode); +void dcload_close(uint32 hnd); +ssize_t dcload_read(uint32 hnd, void *buf, size_t cnt); +off_t dcload_seek(uint32 hnd, off_t offset, int whence); +off_t dcload_tell(uint32 hnd); +size_t dcload_total(uint32 hnd); +dirent_t* dcload_readdir(uint32 hnd); +int dcload_rename(vfs_handler_t * vfs, const char *fn1, const char *fn2); +int dcload_unlink(vfs_handler_t * vfs, const char *fn); + +/* Init func */ +void fs_dcload_init_console(); +int fs_dcload_init(); +int fs_dcload_shutdown(); + +/* Init func for dcload-ip + lwIP */ +int fs_dcload_init_lwip(void *p); + +__END_DECLS + +#endif /* __KALLISTI_FS_DCLOAD_H */ + + diff --git a/SDK/LIBS/dcinclude/dc/fs_iso9660.h b/SDK/LIBS/dcinclude/dc/fs_iso9660.h new file mode 100644 index 00000000..29f1e353 --- /dev/null +++ b/SDK/LIBS/dcinclude/dc/fs_iso9660.h @@ -0,0 +1,32 @@ +/* KallistiOS 1.2.0 + + dc/fs/iso9660.h + (c)2000-2001 Dan Potter + + $Id: fs_iso9660.h,v 1.5 2003/04/24 03:14:20 bardtx Exp $ +*/ + +#ifndef __DC_FS_ISO9660_H +#define __DC_FS_ISO9660_H + +#include +__BEGIN_DECLS + +#include +#include +#include + +#define MAX_ISO_FILES 8 + +/* Call to reset the cache and generally assume that a new disc + has been (or will be) inserted. This is equivalent to the old + iso_ioctl() call. */ +int iso_reset(); + +int fs_iso9660_init(); +int fs_iso9660_shutdown(); + +__END_DECLS + +#endif /* __DC_FS_ISO9660_H */ + diff --git a/SDK/LIBS/dcinclude/dc/fs_vmu.h b/SDK/LIBS/dcinclude/dc/fs_vmu.h new file mode 100644 index 00000000..ca8d8460 --- /dev/null +++ b/SDK/LIBS/dcinclude/dc/fs_vmu.h @@ -0,0 +1,25 @@ +/* KallistiOS 1.2.0 + + dc/fs_vmu.h + (c)2000-2001 Jordan DeLong + + $Id: fs_vmu.h,v 1.3 2002/08/12 07:25:58 bardtx Exp $ + +*/ + +#ifndef __DC_FS_VMU_H +#define __DC_FS_VMU_H + +#include +__BEGIN_DECLS + +#include + +/* Initialization */ +int fs_vmu_init(); +int fs_vmu_shutdown(); + +__END_DECLS + +#endif /* __DC_FS_VMU_H */ + diff --git a/SDK/LIBS/dcinclude/dc/g2bus.h b/SDK/LIBS/dcinclude/dc/g2bus.h new file mode 100644 index 00000000..a7a0ecc9 --- /dev/null +++ b/SDK/LIBS/dcinclude/dc/g2bus.h @@ -0,0 +1,54 @@ +/* KallistiOS 1.2.0 + + g2bus.h + (c)2002 Dan Potter + + $Id: g2bus.h,v 1.5 2002/09/13 06:44:41 bardtx Exp $ +*/ + +#ifndef __DC_G2BUS_H +#define __DC_G2BUS_H + +#include +__BEGIN_DECLS + +#include + +/* Read one byte from G2 */ +uint8 g2_read_8(uint32 address); + +/* Write one byte to G2 */ +void g2_write_8(uint32 address, uint8 value); + +/* Read one word from G2 */ +uint16 g2_read_16(uint32 address); + +/* Write one word to G2 */ +void g2_write_16(uint32 address, uint16 value); + +/* Read one dword from G2 */ +uint32 g2_read_32(uint32 address); + +/* Write one dword to G2 */ +void g2_write_32(uint32 address, uint32 value); + +/* Read a block of 8-bit values from G2 */ +void g2_read_block_8(uint8 * output, uint32 address, int amt); + +/* Write a block 8-bit values to G2 */ +void g2_write_block_8(const uint8 * input, uint32 address, int amt); + +/* Read a block of 32-bit values from G2 */ +void g2_read_block_32(uint32 * output, uint32 address, int amt); + +/* Write a block of 32-bit values to G2 */ +void g2_write_block_32(const uint32 * input, uint32 address, int amt); + +/* When writing to the SPU RAM, this is required at least every 8 32-bit + writes that you execute */ +void g2_fifo_wait(); + +__END_DECLS + +#endif /* __DC_G2BUS_H */ + diff --git a/SDK/LIBS/dcinclude/dc/maple.h b/SDK/LIBS/dcinclude/dc/maple.h new file mode 100644 index 00000000..5e8c0f65 --- /dev/null +++ b/SDK/LIBS/dcinclude/dc/maple.h @@ -0,0 +1,426 @@ +/* KallistiOS 1.2.0 + + kernel/arch/dreamcast/include/dc/maple.h + (C)2002 Dan Potter + + $Id: maple.h,v 1.10 2003/04/24 03:14:47 bardtx Exp $ + + This new driver's design is based loosely on the LinuxDC maple + bus driver. +*/ + +#ifndef __DC_MAPLE_H +#define __DC_MAPLE_H + +#include +__BEGIN_DECLS + +#include +#include + +/* Enabling this line will add massive amounts of processing time + to the maple system, but it can verify DMA errors */ +#define MAPLE_DMA_DEBUG 0 + +/* Enabling this will turn on intra-interrupt debugging messages, which + can cause problems if you're using a dc-load console rather than raw + serial output. Disable for normal usage. */ +#define MAPLE_IRQ_DEBUG 0 + +/* Maple Bus registers */ +#define MAPLE_BASE 0xa05f6c00 +#define MAPLE_DMAADDR (MAPLE_BASE+0x04) +#define MAPLE_RESET2 (MAPLE_BASE+0x10) +#define MAPLE_ENABLE (MAPLE_BASE+0x14) +#define MAPLE_STATE (MAPLE_BASE+0x18) +#define MAPLE_SPEED (MAPLE_BASE+0x80) +#define MAPLE_RESET1 (MAPLE_BASE+0x8c) + +/* Some register define values */ +#define MAPLE_RESET2_MAGIC 0 +#define MAPLE_ENABLE_ENABLED 1 +#define MAPLE_ENABLE_DISABLED 0 +#define MAPLE_STATE_IDLE 0 +#define MAPLE_STATE_DMA 1 +#define MAPLE_SPEED_2MBPS 0 +#define MAPLE_SPEED_TIMEOUT(n) ((n) << 16) +#define MAPLE_RESET1_MAGIC 0x6155404f + +/* Command and response codes */ +#define MAPLE_RESPONSE_FILEERR -5 +#define MAPLE_RESPONSE_AGAIN -4 +#define MAPLE_RESPONSE_BADCMD -3 +#define MAPLE_RESPONSE_BADFUNC -2 +#define MAPLE_RESPONSE_NONE -1 +#define MAPLE_COMMAND_DEVINFO 1 +#define MAPLE_COMMAND_ALLINFO 2 +#define MAPLE_COMMAND_RESET 3 +#define MAPLE_COMMAND_KILL 4 +#define MAPLE_RESPONSE_DEVINFO 5 +#define MAPLE_RESPONSE_ALLINFO 6 +#define MAPLE_RESPONSE_OK 7 +#define MAPLE_RESPONSE_DATATRF 8 +#define MAPLE_COMMAND_GETCOND 9 +#define MAPLE_COMMAND_GETMINFO 10 +#define MAPLE_COMMAND_BREAD 11 +#define MAPLE_COMMAND_BWRITE 12 +#define MAPLE_COMMAND_BSYNC 13 +#define MAPLE_COMMAND_SETCOND 14 + +/* Function codes; most sources claim that these numbers are little + endian, and for all I know, they might be; but since it's a bitmask + it doesn't really make much different. We'll just reverse our constants + from the "big-endian" version. */ +#define MAPLE_FUNC_PURUPURU 0x00010000 +#define MAPLE_FUNC_MOUSE 0x00020000 +#define MAPLE_FUNC_CONTROLLER 0x01000000 +#define MAPLE_FUNC_MEMCARD 0x02000000 +#define MAPLE_FUNC_LCD 0x04000000 +#define MAPLE_FUNC_CLOCK 0x08000000 +#define MAPLE_FUNC_MICROPHONE 0x10000000 +#define MAPLE_FUNC_ARGUN 0x20000000 +#define MAPLE_FUNC_KEYBOARD 0x40000000 +#define MAPLE_FUNC_LIGHTGUN 0x80000000 + +/* Pre-define list/queue types */ +struct maple_frame; +TAILQ_HEAD(maple_frame_queue, maple_frame); + +struct maple_driver; +LIST_HEAD(maple_driver_list, maple_driver); + +/* Maple frame to be queued for transport */ +typedef struct maple_frame { + /* Send queue handle */ + TAILQ_ENTRY(maple_frame) frameq; + + int cmd; /* Command (defined above) */ + int dst_port, dst_unit; /* Maple destination address */ + int length; /* Data transfer length in 32-bit words */ + volatile int state; /* Has this frame been sent / responded to? */ + volatile int queued; /* Are we on the queue? */ + + void *send_buf; /* The data which will be sent (if any) */ + uint8 *recv_buf; /* Points into recv_buf_arr, but 32-byte aligned */ + + struct maple_device *dev; /* Does this belong to a device? */ + + void (*callback)(struct maple_frame *); /* Response callback */ + +#if MAPLE_DMA_DEBUG + uint8 recv_buf_arr[1024 + 1024 + 32]; /* Response receive area */ +#else + uint8 recv_buf_arr[1024 + 32]; /* Response receive area */ +#endif +} maple_frame_t; + +#define MAPLE_FRAME_VACANT 0 /* Ready to be used */ +#define MAPLE_FRAME_UNSENT 1 /* Ready to be sent */ +#define MAPLE_FRAME_SENT 2 /* Frame has been sent, but no response yet */ +#define MAPLE_FRAME_RESPONDED 3 /* Frame has a response */ + +/* Maple device info structure (used by hardware) */ +typedef struct maple_devinfo { + uint32 functions; + uint32 function_data[3]; + uint8 area_code; + uint8 connector_direction; + char product_name[30]; + char product_license[60]; + uint16 standby_power; + uint16 max_power; +} maple_devinfo_t; + +/* Response frame structure (used by hardware) */ +typedef struct maple_response { + int8 response; /* Response */ + uint8 dst_addr; /* Destination address */ + uint8 src_addr; /* Source address */ + uint8 data_len; /* Data length (in 32-bit words) */ + uint8 data[0]; /* Data (if any) */ +} maple_response_t; + +/* One maple device; note that we duplicate the port/unit info which + is normally somewhat implicit so that we can pass around a pointer + to a particular device struct. */ +typedef struct maple_device { + /* Public */ + int valid; /* Is this a valid device? */ + int port, unit; /* Maple address */ + maple_devinfo_t info; /* Device info struct */ + + /* Private */ + int dev_mask; /* Device-present mask for unit 0's */ + maple_frame_t frame; /* Give each device one rx/tx frame */ + struct maple_driver * drv; /* Driver which handles this device */ + + volatile int status_valid; /* Have we got our first status update? */ + uint8 status[1024]; /* Status buffer (for pollable devices) */ +} maple_device_t; + +/* One maple port; each maple port can contain up to 6 devices, the first + one of which is always the port itself. */ +#define MAPLE_PORT_COUNT 4 +#define MAPLE_UNIT_COUNT 6 +typedef struct maple_port { + int port; /* Port ID */ + maple_device_t units[MAPLE_UNIT_COUNT]; /* Pointers to active units */ +} maple_port_t; + +/* A maple device driver; anything which is added to this list is capable + of handling one or more maple device types. When a device of the given + type is connected (includes startup "connection"), the driver is + invoked. This same process happens for disconnection, response + receipt, and on a periodic interval (for normal updates). */ +typedef struct maple_driver { + /* Driver list handle */ + LIST_ENTRY(maple_driver) drv_list; + + uint32 functions; /* One or more MAPLE_FUNC_* or'd together */ + const char * name; /* The driver name */ + + /* Callbacks, to be filled in by the driver */ + void (*periodic)(struct maple_driver *drv); + int (*attach)(struct maple_driver *drv, maple_device_t *dev); + void (*detach)(struct maple_driver *drv, maple_device_t *dev); +} maple_driver_t; + +/* Maple state structure; we put everything in here to keep from + polluting the global namespace too much */ +typedef struct maple_state_str { + /* Maple device driver list; NOTE: Do not manipulate directly */ + struct maple_driver_list driver_list; + + /* Maple frame submission queue; NOTE: Do not manipulate directly */ + struct maple_frame_queue frame_queue; + + /* Maple device info structure */ + maple_port_t ports[MAPLE_PORT_COUNT]; + + /* Interrupt counters */ + volatile int dma_cntr, vbl_cntr; + + /* DMA send buffer */ + uint8 *dma_buffer; + volatile int dma_in_progress; + + /* Next unit which will be auto-detected */ + int detect_port_next; + int detect_unit_next; + volatile int detect_wrapped; + + /* Our vblank handler handle */ + int vbl_handle; +} maple_state_t; + +/* Maple DMA buffer size; increase if you do a _LOT_ of maple stuff + on every periodic interrupt */ +#define MAPLE_DMA_SIZE 16384 + +/* Maple memory read/write functions; these are just hooks in case + we need to do something else later */ +#define maple_read(A) ( *((vuint32*)(A)) ) +#define maple_write(A, V) ( *((vuint32*)(A)) = (V) ) + +/* Return codes from maple access functions */ +#define MAPLE_EOK 0 +#define MAPLE_EFAIL -1 +#define MAPLE_EAGAIN -2 +#define MAPLE_EINVALID -3 +#define MAPLE_ENOTSUPP -4 +#define MAPLE_ETIMEOUT -5 + +/**************************************************************************/ +/* maple_globals.c */ + +/* Global state info */ +extern maple_state_t maple_state; + +/**************************************************************************/ +/* maple_utils.c */ + +/* Enable / Disable the bus */ +void maple_bus_enable(); +void maple_bus_disable(); + +/* Start / Stop DMA */ +void maple_dma_start(); +void maple_dma_stop(); +int maple_dma_in_progress(); + +/* Set DMA address */ +void maple_dma_addr(void *ptr); + +/* Return a "maple address" for a port,unit pair */ +uint8 maple_addr(int port, int unit); + +/* Decompose a "maple address" into a port,unit pair */ +/* WARNING: Won't work on multi-cast addresses! */ +void maple_raddr(uint8 addr, int * port, int * unit); + +/* Return a string with the capabilities of a given driver; NOT THREAD SAFE */ +const char * maple_pcaps(uint32 functions); + +/* Return a string representing the maple response code */ +const char * maple_perror(int response); + +/* Determine if a given device is valid */ +int maple_dev_valid(int p, int u); + +#if MAPLE_DMA_DEBUG +/* Debugging help */ +void maple_sentinel_setup(void * buffer, int bufsize); +void maple_sentinel_verify(const char * bufname, void * buffer, int bufsize); +#endif + +/**************************************************************************/ +/* maple_queue.c */ + +/* Send all queued frames */ +void maple_queue_flush(); + +/* Submit a frame for queueing; this will generally be called inside the + periodic interrupt; however, if you need to do something asynchronously + (e.g., VMU access) then it might cause some problems. In this case, the + function will automatically do locking by disabling interrupts + temporarily. In any case, the callback will be done inside an IRQ context. */ +int maple_queue_frame(maple_frame_t *frame); + +/* Remove a used frame from the queue; same semantics as above */ +int maple_queue_remove(maple_frame_t *frame); + +/* Initialize a new frame to prepare it to be placed on the queue; call + this _before_ you fill it in */ +void maple_frame_init(maple_frame_t *frame); + +/* Lock a frame so that someone else can't use it in the mean time; if the + frame is already locked, an error will be returned. */ +int maple_frame_lock(maple_frame_t *frame); + +/* Unlock a frame */ +void maple_frame_unlock(maple_frame_t *frame); + +/**************************************************************************/ +/* maple_driver.c */ + +/* Register a maple device driver; do this before maple_init() */ +int maple_driver_reg(maple_driver_t *driver); + +/* Unregister a maple device driver */ +int maple_driver_unreg(maple_driver_t *driver); + +/* Attach a maple device to a driver, if possible */ +int maple_driver_attach(maple_frame_t *det); + +/* Detach an attached maple device */ +int maple_driver_detach(int p, int u); + +/* For each device which the given driver controls, call the callback */ +int maple_driver_foreach(maple_driver_t *drv, int (*callback)(maple_device_t *)); + +/**************************************************************************/ +/* maple_irq.c */ + +/* Called on every VBL (~60fps) */ +void maple_vbl_irq_hnd(uint32 code); + +/* Called after a Maple DMA send / receive pair completes */ +void maple_dma_irq_hnd(uint32 code); + +/**************************************************************************/ +/* maple_enum.c */ + +/* Return the number of connected devices */ +int maple_enum_count(); + +/* Return a raw device info struct for the given device */ +maple_device_t * maple_enum_dev(int p, int u); + +/* Return the Nth device of the requested type (where N is zero-indexed) */ +maple_device_t * maple_enum_type(int n, uint32 func); + +/* Get the status struct for the requested maple device; wait until it's + valid before returning. Cast to the appropriate type you're expecting. */ +void * maple_dev_status(maple_device_t *dev); + +/**************************************************************************/ +/* maple_compat.h */ + +/* Utility function used by other compat functions */ +int maple_compat_resolve(uint8 addr, maple_device_t **dev, uint32 funcs); + +/* Retrieve function code... */ +uint32 maple_device_func(int port, int unit); + +/* First with a given function code... */ +uint8 maple_first_device(int code); + +/* First controller */ +uint8 maple_first_controller(); + +/* First mouse */ +uint8 maple_first_mouse(); + +/* First keyboard */ +uint8 maple_first_kb(); + +/* First LCD unit */ +uint8 maple_first_lcd(); + +/* First VMU */ +uint8 maple_first_vmu(); + +/* NOP now */ +#define maple_rescan_bus(Q) /* NADA */ + +/* Renamed */ +#define maple_create_addr(A, B) maple_addr(A, B) + +/**************************************************************************/ +/* maple_init.c */ + +/* Init / Shutdown */ +int maple_init(); +void maple_shutdown(); + +/* Wait for the initial bus scan to complete */ +void maple_wait_scan(); + +/**************************************************************************/ +/* Convienence macros */ + +/* A "foreach" loop to scan all maple devices of a given type. It is used + like this: + + MAPLE_FOREACH_BEGIN(MAPLE_FUNC_CONTROLLER, cont_state_t, st) + if (st->buttons & CONT_START) + return -1; + MAPLE_FOREACH_END() + + The peripheral index can be obtained with __i, and the raw device struct + with __dev. The code inside the loop is guaranteed to be inside a block + (i.e., { code }) + */ + +#define MAPLE_FOREACH_BEGIN(TYPE, VARTYPE, VAR) \ +do { \ + maple_device_t * __dev; \ + VARTYPE * VAR; \ + int __i; \ +\ + __i = 0; \ + while ( (__dev = maple_enum_type(__i, TYPE)) ) { \ + VAR = (VARTYPE *)maple_dev_status(__dev); \ + do { + +#define MAPLE_FOREACH_END() \ + } while(0); \ + __i++; \ + } \ +} while(0); + + +__END_DECLS + +#endif /* __DC_MAPLE_H */ + diff --git a/SDK/LIBS/dcinclude/dc/maple/controller.h b/SDK/LIBS/dcinclude/dc/maple/controller.h new file mode 100644 index 00000000..1c159b24 --- /dev/null +++ b/SDK/LIBS/dcinclude/dc/maple/controller.h @@ -0,0 +1,81 @@ +/* KallistiOS 1.2.0 + + dc/maple/controller.h + (C)2000-2002 Jordan DeLong, Dan Potter + + $Id: controller.h,v 1.4 2002/05/24 06:47:26 bardtx Exp $ + + Thanks to Marcus Comstedt for information on the controller. +*/ + +#ifndef __DC_MAPLE_CONTROLLER_H +#define __DC_MAPLE_CONTROLLER_H + +#include +__BEGIN_DECLS + +#include + +/* Buttons bitfield defines */ +#define CONT_C (1<<0) +#define CONT_B (1<<1) +#define CONT_A (1<<2) +#define CONT_START (1<<3) +#define CONT_DPAD_UP (1<<4) +#define CONT_DPAD_DOWN (1<<5) +#define CONT_DPAD_LEFT (1<<6) +#define CONT_DPAD_RIGHT (1<<7) +#define CONT_Z (1<<8) +#define CONT_Y (1<<9) +#define CONT_X (1<<10) +#define CONT_D (1<<11) +#define CONT_DPAD2_UP (1<<12) +#define CONT_DPAD2_DOWN (1<<13) +#define CONT_DPAD2_LEFT (1<<14) +#define CONT_DPAD2_RIGHT (1<<15) + +/* Raw controller condition structure */ +typedef struct { + uint16 buttons; /* buttons bitfield */ + uint8 rtrig; /* right trigger */ + uint8 ltrig; /* left trigger */ + uint8 joyx; /* joystick X */ + uint8 joyy; /* joystick Y */ + uint8 joy2x; /* second joystick X */ + uint8 joy2y; /* second joystick Y */ +} cont_cond_t; + +/* Our more civilized structure. Note that there are some fairly + significant differences in value interpretations here between + this struct and the old one: + + - "buttons" is zero based: a 1-bit means the button is PRESSED. + - "joyx", "joyy", "joy2x", and "joy2y" are all zero based: zero + means they are in the center, negative values are up/left, + and positive values are down/right. + + Note also that this is the struct you will get back if you call + maple_dev_status(), NOT a cont_cond_t. However, cont_get_cond() will + return the old compatible struct for now. */ +typedef struct { + uint32 buttons; /* Buttons bitfield */ + int ltrig, rtrig; /* Triggers */ + int joyx, joyy; /* Joystick X/Y */ + int joy2x, joy2y; /* Second Joystick X/Y (if applicable) */ +} cont_state_t; + +/* Init / Shutdown */ +int cont_init(); +void cont_shutdown(); + +/* Compat function */ +int cont_get_cond(uint8 addr, cont_cond_t *cond); + +/* Set a controller callback for a button combo; set addr=0 for any controller */ +typedef void (*cont_btn_callback_t)(uint8 addr, uint32 btns); +void cont_btn_callback(uint8 addr, uint32 btns, cont_btn_callback_t cb); + +__END_DECLS + +#endif /* __DC_MAPLE_CONTROLLER_H */ + diff --git a/SDK/LIBS/dcinclude/dc/maple/keyboard.h b/SDK/LIBS/dcinclude/dc/maple/keyboard.h new file mode 100644 index 00000000..5c23bb18 --- /dev/null +++ b/SDK/LIBS/dcinclude/dc/maple/keyboard.h @@ -0,0 +1,174 @@ +/* KallistiOS 1.2.0 + + dc/maple/keyboard.h + (C)2000-2002 Jordan DeLong and Dan Potter + + $Id: keyboard.h,v 1.3 2002/05/18 07:11:44 bardtx Exp $ +*/ + +#ifndef __DC_MAPLE_KEYBOARD_H +#define __DC_MAPLE_KEYBOARD_H + +#include +__BEGIN_DECLS + +#include + +/* modifier keys */ +#define KBD_MOD_LCTRL (1<<0) +#define KBD_MOD_LSHIFT (1<<1) +#define KBD_MOD_LALT (1<<2) +#define KBD_MOD_S1 (1<<3) +#define KBD_MOD_RCTRL (1<<4) +#define KBD_MOD_RSHIFT (1<<5) +#define KBD_MOD_RALT (1<<6) +#define KBD_MOD_S2 (1<<7) + +/* bits for leds : this is not comprensive (need for japanese kbds also) */ +#define KBD_LED_NUMLOCK (1<<0) +#define KBD_LED_CAPSLOCK (1<<1) +#define KBD_LED_SCRLOCK (1<<2) + +/* defines for the keys (argh...) */ +#define KBD_KEY_NONE 0x00 +#define KBD_KEY_ERROR 0x01 +#define KBD_KEY_A 0x04 +#define KBD_KEY_B 0x05 +#define KBD_KEY_C 0x06 +#define KBD_KEY_D 0x07 +#define KBD_KEY_E 0x08 +#define KBD_KEY_F 0x09 +#define KBD_KEY_G 0x0a +#define KBD_KEY_H 0x0b +#define KBD_KEY_I 0x0c +#define KBD_KEY_J 0x0d +#define KBD_KEY_K 0x0e +#define KBD_KEY_L 0x0f +#define KBD_KEY_M 0x10 +#define KBD_KEY_N 0x11 +#define KBD_KEY_O 0x12 +#define KBD_KEY_P 0x13 +#define KBD_KEY_Q 0x14 +#define KBD_KEY_R 0x15 +#define KBD_KEY_S 0x16 +#define KBD_KEY_T 0x17 +#define KBD_KEY_U 0x18 +#define KBD_KEY_V 0x19 +#define KBD_KEY_W 0x1a +#define KBD_KEY_X 0x1b +#define KBD_KEY_Y 0x1c +#define KBD_KEY_Z 0x1d +#define KBD_KEY_1 0x1e +#define KBD_KEY_2 0x1f +#define KBD_KEY_3 0x20 +#define KBD_KEY_4 0x21 +#define KBD_KEY_5 0x22 +#define KBD_KEY_6 0x23 +#define KBD_KEY_7 0x24 +#define KBD_KEY_8 0x25 +#define KBD_KEY_9 0x26 +#define KBD_KEY_0 0x27 +#define KBD_KEY_ENTER 0x28 +#define KBD_KEY_ESCAPE 0x29 +#define KBD_KEY_BACKSPACE 0x2a +#define KBD_KEY_TAB 0x2b +#define KBD_KEY_SPACE 0x2c +#define KBD_KEY_MINUS 0x2d +#define KBD_KEY_PLUS 0x2e +#define KBD_KEY_LBRACKET 0x2f +#define KBD_KEY_RBRACKET 0x30 +#define KBD_KEY_BACKSLASH 0x31 +#define KBD_KEY_SEMICOLON 0x33 +#define KBD_KEY_QUOTE 0x34 +#define KBD_KEY_TILDE 0x35 +#define KBD_KEY_COMMA 0x36 +#define KBD_KEY_PERIOD 0x37 +#define KBD_KEY_SLASH 0x38 +#define KBD_KEY_CAPSLOCK 0x39 +#define KBD_KEY_F1 0x3a +#define KBD_KEY_F2 0x3b +#define KBD_KEY_F3 0x3c +#define KBD_KEY_F4 0x3d +#define KBD_KEY_F5 0x3e +#define KBD_KEY_F6 0x3f +#define KBD_KEY_F7 0x40 +#define KBD_KEY_F8 0x41 +#define KBD_KEY_F9 0x42 +#define KBD_KEY_F10 0x43 +#define KBD_KEY_F11 0x44 +#define KBD_KEY_F12 0x45 +#define KBD_KEY_PRINT 0x46 +#define KBD_KEY_SCRLOCK 0x47 +#define KBD_KEY_PAUSE 0x48 +#define KBD_KEY_INSERT 0x49 +#define KBD_KEY_HOME 0x4a +#define KBD_KEY_PGUP 0x4b +#define KBD_KEY_DEL 0x4c +#define KBD_KEY_END 0x4d +#define KBD_KEY_PGDOWN 0x4e +#define KBD_KEY_RIGHT 0x4f +#define KBD_KEY_LEFT 0x50 +#define KBD_KEY_DOWN 0x51 +#define KBD_KEY_UP 0x52 +#define KBD_KEY_PAD_NUMLOCK 0x53 +#define KBD_KEY_PAD_DIVIDE 0x54 +#define KBD_KEY_PAD_MULTIPLY 0x55 +#define KBD_KEY_PAD_MINUS 0x56 +#define KBD_KEY_PAD_PLUS 0x57 +#define KBD_KEY_PAD_ENTER 0x58 +#define KBD_KEY_PAD_1 0x59 +#define KBD_KEY_PAD_2 0x5a +#define KBD_KEY_PAD_3 0x5b +#define KBD_KEY_PAD_4 0x5c +#define KBD_KEY_PAD_5 0x5d +#define KBD_KEY_PAD_6 0x5e +#define KBD_KEY_PAD_7 0x5f +#define KBD_KEY_PAD_8 0x60 +#define KBD_KEY_PAD_9 0x61 +#define KBD_KEY_PAD_0 0x62 +#define KBD_KEY_PAD_PERIOD 0x63 +#define KBD_KEY_S3 0x65 + +/* Raw condition structure */ +typedef struct { + uint8 modifiers; /* bitmask of shift keys/etc */ + uint8 leds; /* bitmask of leds that are lit */ + uint8 keys[6]; /* codes for up to 6 currently pressed keys */ +} kbd_cond_t; + +/* This is the structure of the 'state' space. This is what you will + get back if you call maple_dev_state(). */ +typedef struct kbd_state { + /* The latest raw keyboard condition */ + kbd_cond_t cond; + + /* The key matrix array -- this is an array that lists the status of all + keys on the keyboard. This is mainly used for key repeat and debouncing. */ + uint8 matrix[256]; + + /* Shift key status */ + int shift_keys; +} kbd_state_t; + +/* Turn keyboard queueing on or off. This is mainly useful if you want + to use the keys for a game where individual keypresses don't mean + as much as having the keys up or down. Setting this state to + a new value will clear the queue. */ +void kbd_set_queue(int active); + +/* Take a key scancode, encode it appropriate, and place it on the + keyboard queue. At the moment we assume no key overflows. */ +/* int kbd_enqueue(uint8 keycode); */ + +/* Take a key off the key queue, or return -1 if there is none waiting */ +int kbd_get_key(); + +/* Init / Shutdown */ +int kbd_init(); +void kbd_shutdown(); + +__END_DECLS + +#endif /* __DC_MAPLE_KEYBOARD_H */ + + diff --git a/SDK/LIBS/dcinclude/dc/maple/mouse.h b/SDK/LIBS/dcinclude/dc/maple/mouse.h new file mode 100644 index 00000000..39ea65db --- /dev/null +++ b/SDK/LIBS/dcinclude/dc/maple/mouse.h @@ -0,0 +1,61 @@ +/* KallistiOS 1.2.0 + + dc/maple/mouse.h + (C)2000-2002 Jordan DeLong and Dan Potter + + $Id: mouse.h,v 1.3 2002/05/24 06:47:26 bardtx Exp $ + +*/ + +#ifndef __DC_MAPLE_MOUSE_H +#define __DC_MAPLE_MOUSE_H + +#include +__BEGIN_DECLS + +#include + +/* mouse defines */ +#define MOUSE_RIGHTBUTTON (1<<1) +#define MOUSE_LEFTBUTTON (1<<2) +#define MOUSE_SIDEBUTTON (1<<3) + +#define MOUSE_DELTA_CENTER 0x200 + +/* Raw mouse condition structure */ +typedef struct { + uint16 buttons; + uint16 dummy1; + int16 dx; + int16 dy; + int16 dz; + uint16 dummy2; + uint32 dummy3; + uint32 dummy4; +} mouse_cond_t; + +/* More civilized mouse structure. There are several significant + differences in data interpretation between the "cooked" and + the old "raw" structs: + + - buttons are zero-based: a 1-bit means the button is PRESSED + - no dummy values + + Note that this is what maple_dev_status() will return. + */ +typedef struct { + uint32 buttons; + int dx, dy, dz; +} mouse_state_t; + +/* Old maple interface */ +int mouse_get_cond(uint8 addr, mouse_cond_t *cond); + +/* Init / Shutdown */ +int mouse_init(); +void mouse_shutdown(); + +__END_DECLS + +#endif /* __DC_MAPLE_MOUSE_H */ + diff --git a/SDK/LIBS/dcinclude/dc/maple/purupuru.h b/SDK/LIBS/dcinclude/dc/maple/purupuru.h new file mode 100644 index 00000000..d9ad680c --- /dev/null +++ b/SDK/LIBS/dcinclude/dc/maple/purupuru.h @@ -0,0 +1,25 @@ +/* KallistiOS 1.2.0 + + dc/maple/purupuru.h + Copyright (C)2003 Dan Potter + + $Id: purupuru.h,v 1.1 2003/03/15 00:47:24 bardtx Exp $ + +*/ + +#ifndef __DC_MAPLE_PURUPURU_H +#define __DC_MAPLE_PURUPURU_H + +#include +__BEGIN_DECLS + +#include + +/* Init / Shutdown */ +int purupuru_init(); +void purupuru_shutdown(); + +__END_DECLS + +#endif /* __DC_MAPLE_PURUPURU_H */ + diff --git a/SDK/LIBS/dcinclude/dc/maple/vmu.h b/SDK/LIBS/dcinclude/dc/maple/vmu.h new file mode 100644 index 00000000..0ba50428 --- /dev/null +++ b/SDK/LIBS/dcinclude/dc/maple/vmu.h @@ -0,0 +1,33 @@ +/* KallistiOS 1.2.0 + + dc/maple/vmu.h + (C)2000-2002 Jordan DeLong and Dan Potter + + $Id: vmu.h,v 1.3 2002/09/04 03:38:42 bardtx Exp $ + +*/ + +#ifndef __DC_MAPLE_VMU_H +#define __DC_MAPLE_VMU_H + +#include +__BEGIN_DECLS + +#include + +int vmu_draw_lcd(maple_device_t * dev, void *bitmap); +int vmu_block_read(maple_device_t * dev, uint16 blocknum, uint8 *buffer); +int vmu_block_write(maple_device_t * dev, uint16 blocknum, uint8 *buffer); + +/* Utility function which sets the icon on all available VMUs + from an Xwindows XBM. Imported from libdcutils. */ +void vmu_set_icon(const char *vmu_icon); + +/* Init / Shutdown */ +int vmu_init(); +void vmu_shutdown(); + +__END_DECLS + +#endif /* __DC_MAPLE_VMU_H */ + diff --git a/SDK/LIBS/dcinclude/dc/matrix.h b/SDK/LIBS/dcinclude/dc/matrix.h new file mode 100644 index 00000000..478679a2 --- /dev/null +++ b/SDK/LIBS/dcinclude/dc/matrix.h @@ -0,0 +1,95 @@ +/* KallistiOS 1.2.0 + + matrix.h + (c)2000 Dan Potter + + $Id: matrix.h,v 1.2 2002/09/06 06:29:08 bardtx Exp $ +*/ + +#ifndef __DC_MATRIX_H +#define __DC_MATRIX_H + +#include +__BEGIN_DECLS + +#include + +/* Copy the internal matrix out to a memory one */ +void mat_store(matrix_t *out); + +/* Copy a memory matrix into the internal one */ +void mat_load(matrix_t *out); + +/* Clear internal to an identity matrix */ +void mat_identity(); + +/* "Apply" a matrix: multiply a matrix onto the "internal" one */ +void mat_apply(matrix_t *src); + +/* Transform zero or more sets of vectors using the current internal + matrix. Each vector is three floats long. */ +void mat_transform(vector_t *invecs, vector_t *outvecs, int veccnt, int vecskip); + +/* Inline mat_transform which works on the three coordinates passed in; + this works most efficiently if you've already got the three numbers + (x,y,z) in the right registers (fr0,fr1,fr2). */ +#define mat_trans_single(x, y, z) { \ + register float __x __asm__("fr0") = (x); \ + register float __y __asm__("fr1") = (y); \ + register float __z __asm__("fr2") = (z); \ + __asm__ __volatile__( \ + "fldi1 fr3\n" \ + "ftrv xmtrx,fv0\n" \ + "fdiv fr3,fr0\n" \ + "fdiv fr3,fr1\n" \ + "fldi1 fr2\n" \ + "fdiv fr3,fr2\n" \ + : "=f" (__x), "=f" (__y), "=f" (__z) \ + : "0" (__x), "1" (__y), "2" (__z) \ + : "fr3" ); \ + x = __x; y = __y; z = __z; \ +} + +/* Same as above, but allows an input to and preserves the Z/W value */ +#define mat_trans_single4(x, y, z, w) { \ + register float __x __asm__("fr0") = (x); \ + register float __y __asm__("fr1") = (y); \ + register float __z __asm__("fr2") = (z); \ + register float __w __asm__("fr3") = (w); \ + __asm__ __volatile__( \ + "ftrv xmtrx,fv0\n" \ + "fdiv fr3,fr0\n" \ + "fdiv fr3,fr1\n" \ + "fdiv fr3,fr2\n" \ + "fldi1 fr4\n" \ + "fdiv fr3,fr4\n" \ + "fmov fr4,fr3\n" \ + : "=f" (__x), "=f" (__y), "=f" (__z), "=f" (__w) \ + : "0" (__x), "1" (__y), "2" (__z), "3" (__w) \ + : "fr4" ); \ + x = __x; y = __y; z = __z; w = __w; \ +} + +/* This is like mat_trans_single, but it leaves z/w instead of 1/w + for the z component. */ +#define mat_trans_single3(x, y, z) { \ + register float __x __asm__("fr0") = (x); \ + register float __y __asm__("fr1") = (y); \ + register float __z __asm__("fr2") = (z); \ + __asm__ __volatile__( \ + "fldi1 fr3\n" \ + "ftrv xmtrx,fv0\n" \ + "fdiv fr3,fr0\n" \ + "fdiv fr3,fr1\n" \ + "fdiv fr3,fr2\n" \ + : "=f" (__x), "=f" (__y), "=f" (__z) \ + : "0" (__x), "1" (__y), "2" (__z) \ + : "fr3" ); \ + x = __x; y = __y; z = __z; \ +} + + +__END_DECLS + +#endif /* __DC_MATRIX_H */ + diff --git a/SDK/LIBS/dcinclude/dc/matrix3d.h b/SDK/LIBS/dcinclude/dc/matrix3d.h new file mode 100644 index 00000000..0a238fdf --- /dev/null +++ b/SDK/LIBS/dcinclude/dc/matrix3d.h @@ -0,0 +1,41 @@ +/* KallistiOS 1.2.0 + + matrix3d.h + (c)2000 Dan Potter and Jordan DeLong + + $Id: matrix3d.h,v 1.1 2002/09/05 07:32:57 bardtx Exp $ + +*/ + +#ifndef __KOS_MATRIX3D_H +#define __KOS_MATRIX3D_H + +#include +__BEGIN_DECLS + +#include + +void mat_rotate_x(float r); +void mat_rotate_y(float r); +void mat_rotate_z(float r); +void mat_rotate(float xr, float yr, float zr); +void mat_translate(float x, float y, float z); +void mat_scale(float x, float y, float z); + +/** + This sets up a perspective view frustum for basic 3D usage. The xcenter + and ycenter parameters are dependent on your screen resolution (or however + you want to do it); cot_fovy_2 is 1.0/tan(view_angle/2). Use 1.0 for a + normal 90' view. znear and zfar are what they sound like. */ +void mat_perspective(float xcenter, float ycenter, float cot_fovy_2, + float znear, float zfar); + +/** + Performs a "camera" function with rotations and translations. */ +void mat_lookat(const point_t * eye, const point_t * center, const vector_t * up); + +__END_DECLS + +#endif /* __KOS_MATRIX3D_H */ + + diff --git a/SDK/LIBS/dcinclude/dc/modem/mconst.h b/SDK/LIBS/dcinclude/dc/modem/mconst.h new file mode 100644 index 00000000..071c5c27 --- /dev/null +++ b/SDK/LIBS/dcinclude/dc/modem/mconst.h @@ -0,0 +1,54 @@ +/* KallistiOS 1.2.0 + + mconst.h + Copyright (C)2002 Nick Kochakian + + Distributed under the terms of the KOS license. + + $Id: mconst.h,v 1.1 2003/05/23 02:05:02 bardtx Exp $ +*/ + +/* Modem constants are defined here. Automatically included by modem.h */ +#ifndef __MCONST_H +#define __MCONST_H + +/* Each speed constant contains information about the data rate in bps and the + protocol that's being used. The first 4 bits identify the the speed that's + being used, and the last 4 bits identify the protocol. + + And don't try to create your own custom speeds from these, you'll cause + something very bad to happen. Only use the MODEM_SPEED_* constants defined + in modem.h! */ + +/* Speeds */ +#define MODEM_SPEED_1200 0x0 +#define MODEM_SPEED_2400 0x1 +#define MODEM_SPEED_4800 0x2 +#define MODEM_SPEED_7200 0x3 +#define MODEM_SPEED_9600 0x4 +#define MODEM_SPEED_12000 0x5 +#define MODEM_SPEED_14400 0x6 +#define MODEM_SPEED_16800 0x7 +#define MODEM_SPEED_19200 0x8 +#define MODEM_SPEED_21600 0x9 +#define MODEM_SPEED_24000 0xA +#define MODEM_SPEED_26400 0xB +#define MODEM_SPEED_28000 0xC +#define MODEM_SPEED_31200 0xD +#define MODEM_SPEED_33600 0xE + +/* Protocols */ +#define MODEM_PROTOCOL_V17 0x0 +#define MODEM_PROTOCOL_V22 0x1 +#define MODEM_PROTOCOL_V22BIS 0x2 +#define MODEM_PROTOCOL_V32 0x3 +#define MODEM_PROTOCOL_V32BIS 0x4 +#define MODEM_PROTOCOL_V34 0x5 + +#define MODEM_SPEED_GET_PROTOCOL(x) ((mspeed_t)(x) >> 4) +#define MODEM_SPEED_GET_SPEED(x) ((mspeed_t)(x) & 0xF) +#define MODEM_MAKE_SPEED(p, s) ((mspeed_t)((((p) & 0xF) << 4) | ((s) & 0xF))) + +typedef unsigned char mspeed_t; + +#endif diff --git a/SDK/LIBS/dcinclude/dc/modem/modem.h b/SDK/LIBS/dcinclude/dc/modem/modem.h new file mode 100644 index 00000000..3e00f915 --- /dev/null +++ b/SDK/LIBS/dcinclude/dc/modem/modem.h @@ -0,0 +1,80 @@ +/* KallistiOS 1.2.0 + + modem.h + Copyright (C)2002 Nick Kochakian + + Distributed under the terms of the KOS license. + + $Id: modem.h,v 1.1 2003/05/23 02:05:02 bardtx Exp $ +*/ + +/* + Dreamcast modem driver v1.1 + 11/1/2002 by NickK + http://www.boob.co.uk/ + + Modem tech info can be found for a limited time at + http://ev.dhs.org/dreamcast/ +*/ + +#ifndef __MODEM_H +#define __MODEM_H + +#include "mconst.h" + +#define MAKE_DSP_ADDR(x) ((x) & 0xFF), (((x) >> 8) & 0xF) + +#define MODEM_MODE_REMOTE 0 /* Dial a remote computer */ +#define MODEM_MODE_DIRECT 1 /* Wait for a handshake signal */ +#define MODEM_MODE_ANSWER 2 /* Answer a call when a ring is detected */ +#define MODEM_MODE_NULL 255 /* Not doing anything. Don't give this to + any function! */ + +/* V.22 bis modes */ +#define MODEM_SPEED_V22BIS_1200 MODEM_MAKE_SPEED(MODEM_PROTOCOL_V22BIS, MODEM_SPEED_1200) +#define MODEM_SPEED_V22BIS_2400 MODEM_MAKE_SPEED(MODEM_PROTOCOL_V22BIS, MODEM_SPEED_2400) + +/* V.22 modes */ +#define MODEM_SPEED_V22_1200 MODEM_MAKE_SPEED(MODEM_PROTOCOL_V22, MODEM_SPEED_1200) + +/* V.32 modes */ +#define MODEM_SPEED_V32_4800 MODEM_MAKE_SPEED(MODEM_PROTOCOL_V32, MODEM_SPEED_4800) +#define MODEM_SPEED_V32_9600 MODEM_MAKE_SPEED(MODEM_PROTOCOL_V32, MODEM_SPEED_9600) + +/* V.32 bis modes */ +#define MODEM_SPEED_V32BIS_7200 MODEM_MAKE_SPEED(MODEM_PROTOCOL_V32BIS, MODEM_SPEED_7200) +#define MODEM_SPEED_V32BIS_12000 MODEM_MAKE_SPEED(MODEM_PROTOCOL_V32BIS, MODEM_SPEED_12000) +#define MODEM_SPEED_V32BIS_14400 MODEM_MAKE_SPEED(MODEM_PROTOCOL_V32BIS, MODEM_SPEED_14400) + +/* V.34 modes */ +#define MODEM_SPEED_V34_2400 MODEM_MAKE_SPEED(MODEM_PROTOCOL_V34, MODEM_SPEED_2400) +#define MODEM_SPEED_V34_4800 MODEM_MAKE_SPEED(MODEM_PROTOCOL_V34, MODEM_SPEED_4800) +#define MODEM_SPEED_V34_7200 MODEM_MAKE_SPEED(MODEM_PROTOCOL_V34, MODEM_SPEED_7200) +#define MODEM_SPEED_V34_9600 MODEM_MAKE_SPEED(MODEM_PROTOCOL_V34, MODEM_SPEED_9600) +#define MODEM_SPEED_V34_12000 MODEM_MAKE_SPEED(MODEM_PROTOCOL_V34, MODEM_SPEED_12000) +#define MODEM_SPEED_V34_14400 MODEM_MAKE_SPEED(MODEM_PROTOCOL_V34, MODEM_SPEED_14400) +#define MODEM_SPEED_V34_16800 MODEM_MAKE_SPEED(MODEM_PROTOCOL_V34, MODEM_SPEED_16800) +#define MODEM_SPEED_V34_19200 MODEM_MAKE_SPEED(MODEM_PROTOCOL_V34, MODEM_SPEED_19200) +#define MODEM_SPEED_V34_21600 MODEM_MAKE_SPEED(MODEM_PROTOCOL_V34, MODEM_SPEED_21600) +#define MODEM_SPEED_V34_24000 MODEM_MAKE_SPEED(MODEM_PROTOCOL_V34, MODEM_SPEED_24000) +#define MODEM_SPEED_V34_26400 MODEM_MAKE_SPEED(MODEM_PROTOCOL_V34, MODEM_SPEED_26400) +#define MODEM_SPEED_V34_28000 MODEM_MAKE_SPEED(MODEM_PROTOCOL_V34, MODEM_SPEED_28000) +#define MODEM_SPEED_V34_31200 MODEM_MAKE_SPEED(MODEM_PROTOCOL_V34, MODEM_SPEED_31200) +#define MODEM_SPEED_V34_33600 MODEM_MAKE_SPEED(MODEM_PROTOCOL_V34, MODEM_SPEED_33600) +#define MODEM_SPEED_V34_AUTO MODEM_MAKE_SPEED(MODEM_PROTOCOL_V34, MODEM_SPEED_1200) + +//From modem.c: +int modem_init(void); +void modem_shutdown(void); +int modem_set_mode(int mode, mspeed_t speed); +void modem_disconnect(void); +int modem_is_connecting(void); +int modem_is_connected(void); +unsigned long modem_get_connection_rate(void); + +//From mdata.c: +int modem_read_data(unsigned char *data, int size); +int modem_write_data(unsigned char *data, int size); +int modem_has_data(void); + +#endif diff --git a/SDK/LIBS/dcinclude/dc/net/broadband_adapter.h b/SDK/LIBS/dcinclude/dc/net/broadband_adapter.h new file mode 100644 index 00000000..20a050e9 --- /dev/null +++ b/SDK/LIBS/dcinclude/dc/net/broadband_adapter.h @@ -0,0 +1,111 @@ +/* KallistiOS 1.2.0 + * + * dc/net/broadband_adapter.h + * + * (c)2001-2002 Dan Potter + * + * $Id: broadband_adapter.h,v 1.2 2002/02/10 20:32:58 bardtx Exp $ + */ + +#ifndef __DC_NET_BROADBAND_ADAPTER_H +#define __DC_NET_BROADBAND_ADAPTER_H + +#include +__BEGIN_DECLS + +/* RTL8139C register definitions */ +#define RT_IDR0 0x00 /* Mac address */ +#define RT_MAR0 0x08 /* Multicast filter */ +#define RT_TXSTATUS0 0x10 /* Transmit status (4 32bit regs) */ +#define RT_TXADDR0 0x20 /* Tx descriptors (also 4 32bit) */ +#define RT_RXBUF 0x30 /* Receive buffer start address */ +#define RT_RXEARLYCNT 0x34 /* Early Rx byte count */ +#define RT_RXEARLYSTATUS 0x36 /* Early Rx status */ +#define RT_CHIPCMD 0x37 /* Command register */ +#define RT_RXBUFTAIL 0x38 /* Current address of packet read (queue tail) */ +#define RT_RXBUFHEAD 0x3A /* Current buffer address (queue head) */ +#define RT_INTRMASK 0x3C /* Interrupt mask */ +#define RT_INTRSTATUS 0x3E /* Interrupt status */ +#define RT_TXCONFIG 0x40 /* Tx config */ +#define RT_RXCONFIG 0x44 /* Rx config */ +#define RT_TIMER 0x48 /* A general purpose counter */ +#define RT_RXMISSED 0x4C /* 24 bits valid, write clears */ +#define RT_CFG9346 0x50 /* 93C46 command register */ +#define RT_CONFIG0 0x51 /* Configuration reg 0 */ +#define RT_CONFIG1 0x52 /* Configuration reg 1 */ +#define RT_TIMERINT 0x54 /* Timer interrupt register (32 bits) */ +#define RT_MEDIASTATUS 0x58 /* Media status register */ +#define RT_CONFIG3 0x59 /* Config register 3 */ +#define RT_CONFIG4 0x5A /* Config register 4 */ +#define RT_MULTIINTR 0x5C /* Multiple interrupt select */ +#define RT_MII_TSAD 0x60 /* Transmit status of all descriptors (16 bits) */ +#define RT_MII_BMCR 0x62 /* Basic Mode Control Register (16 bits) */ +#define RT_MII_BMSR 0x64 /* Basic Mode Status Register (16 bits) */ +#define RT_AS_ADVERT 0x66 /* Auto-negotiation advertisement reg (16 bits) */ +#define RT_AS_LPAR 0x68 /* Auto-negotiation link partner reg (16 bits) */ +#define RT_AS_EXPANSION 0x6A /* Auto-negotiation expansion reg (16 bits) */ + +/* RTL8193C command bits; or these together and write teh resulting value + into CHIPCMD to execute it. */ +#define RT_CMD_RESET 0x10 +#define RT_CMD_RX_ENABLE 0x08 +#define RT_CMD_TX_ENABLE 0x04 +#define RT_CMD_RX_BUF_EMPTY 0x01 + +/* RTL8139C interrupt status bits */ +#define RT_INT_PCIERR 0x8000 /* PCI Bus error */ +#define RT_INT_TIMEOUT 0x4000 /* Set when TCTR reaches TimerInt value */ +#define RT_INT_RXFIFO_OVERFLOW 0x0040 /* Rx FIFO overflow */ +#define RT_INT_RXFIFO_UNDERRUN 0x0020 /* Packet underrun / link change */ +#define RT_INT_LINK_CHANGE 0x0020 /* Packet underrun / link change */ +#define RT_INT_RXBUF_OVERFLOW 0x0010 /* Rx BUFFER overflow */ +#define RT_INT_TX_ERR 0x0008 +#define RT_INT_TX_OK 0x0004 +#define RT_INT_RX_ERR 0x0002 +#define RT_INT_RX_OK 0x0001 + +/* RTL8139C transmit status bits */ +#define RT_TX_CARRIER_LOST 0x80000000 /* Carrier sense lost */ +#define RT_TX_ABORTED 0x40000000 /* Transmission aborted */ +#define RT_TX_OUT_OF_WINDOW 0x20000000 /* Out of window collision */ +#define RT_TX_STATUS_OK 0x00008000 /* Status ok: a good packet was transmitted */ +#define RT_TX_UNDERRUN 0x00004000 /* Transmit FIFO underrun */ +#define RT_TX_HOST_OWNS 0x00002000 /* Set to 1 when DMA operation is completed */ +#define RT_TX_SIZE_MASK 0x00001fff /* Descriptor size mask */ + +/* RTL8139C receive status bits */ +#define RT_RX_MULTICAST 0x00008000 /* Multicast packet */ +#define RT_RX_PAM 0x00004000 /* Physical address matched */ +#define RT_RX_BROADCAST 0x00002000 /* Broadcast address matched */ +#define RT_RX_BAD_SYMBOL 0x00000020 /* Invalid symbol in 100TX packet */ +#define RT_RX_RUNT 0x00000010 /* Packet size is <64 bytes */ +#define RT_RX_TOO_LONG 0x00000008 /* Packet size is >4K bytes */ +#define RT_RX_CRC_ERR 0x00000004 /* CRC error */ +#define RT_RX_FRAME_ALIGN 0x00000002 /* Frame alignment error */ +#define RT_RX_STATUS_OK 0x00000001 /* Status ok: a good packet was received */ + +/* Reads the MAC address of the BBA into the specified array */ +void bba_get_mac(uint8 *arr); + +/* Set an ethernet packet receive callback */ +typedef void (*eth_rx_callback_t)(uint8 *pkt, int len); +void bba_set_rx_callback(eth_rx_callback_t cb); + +/* Transmit a single packet */ +#define BBA_TX_OK 0 +#define BBA_TX_ERROR -1 +#define BBA_TX_AGAIN -2 +#define BBA_TX_NOWAIT 0 +#define BBA_TX_WAIT 1 +int bba_tx(const uint8 *pkt, int len, int wait); + +/* Initialize */ +int bba_init(); + +/* Shutdown */ +int bba_shutdown(); + +__END_DECLS + +#endif /* __DC_NET_BROADBAND_ADAPTER_H */ + diff --git a/SDK/LIBS/dcinclude/dc/net/lan_adapter.h b/SDK/LIBS/dcinclude/dc/net/lan_adapter.h new file mode 100644 index 00000000..32d3d13a --- /dev/null +++ b/SDK/LIBS/dcinclude/dc/net/lan_adapter.h @@ -0,0 +1,27 @@ +/* KallistiOS 1.2.0 + * + * dc/net/lan_adapter.h + * + * (c)2002 Dan Potter + * + * $Id: lan_adapter.h,v 1.2 2003/02/25 07:39:37 bardtx Exp $ + */ + +#ifndef __DC_NET_LAN_ADAPTER_H +#define __DC_NET_LAN_ADAPTER_H + +#include +__BEGIN_DECLS + +#include + +/* Initialize */ +int la_init(); + +/* Shutdown */ +int la_shutdown(); + +__END_DECLS + +#endif /* __DC_NET_LAN_ADAPTER_H */ + diff --git a/SDK/LIBS/dcinclude/dc/pvr.h b/SDK/LIBS/dcinclude/dc/pvr.h new file mode 100644 index 00000000..15079e4a --- /dev/null +++ b/SDK/LIBS/dcinclude/dc/pvr.h @@ -0,0 +1,819 @@ +/* KallistiOS 1.2.0 + + kernel/arch/dreamcast/include/dc/pvr.h + (C)2002 Dan Potter + + $Id: pvr.h,v 1.28 2003/04/24 03:13:45 bardtx Exp $ + + Low-level PVR 3D interface for the DC + Note: this API does _not_ handle any sort of transformations + (including perspective!) so for that, you should look to KGL. +*/ + + +#ifndef __DC_PVR_H +#define __DC_PVR_H + +#include +__BEGIN_DECLS + +#include +#include +#include + +/* Data types ********************************************************/ + +/* PVR texture memory pointer; unlike the old "TA" system, PVR pointers + in the new system are actually SH-4 compatible pointers and can + be used directly in place of ta_txr_map(). */ +typedef void * pvr_ptr_t; + +/* PVR list specification */ +typedef uint32 pvr_list_t; + +/* Polygon context; you should use this more human readable format for + specifying your polygon contexts, and then compile them into polygon + headers (below) when you are ready to start using them. + + This has embedded structures in it for two reasons; the first reason + is to make it easier for me to add new stuff later without breaking + existing code. The second reason is to make it more readable and + usable. +*/ +typedef struct { + int list_type; + struct { + int alpha; + int shading; + int fog_type; + int culling; + int color_clamp; + int clip_mode; + int modifier_mode; + } gen; + struct { + int src, dst; + int src_enable, dst_enable; + } blend; + struct { + int color; + int uv; + int modifier; + } fmt; + struct { + int comparison; + int write; + } depth; + struct { + int enable; + int filter; /* none, bi-linear, tri-linear, etc */ + int mipmap; + int mipmap_bias; + int uv_flip; + int uv_clamp; + int alpha; + int env; + int width; + int height; + int format; /* bit format, vq, twiddle, stride */ + pvr_ptr_t base; /* texture location */ + } txr; +} pvr_poly_cxt_t; + +/* Constants for the above structure; thanks to Benoit Miller for these */ +/* list_type */ +#define PVR_LIST_OP_POLY 0 /* opaque poly */ +#define PVR_LIST_OP_MOD 1 /* opaque modifier */ +#define PVR_LIST_TR_POLY 2 /* translucent poly */ +#define PVR_LIST_TR_MOD 3 /* translucent modifier */ +#define PVR_LIST_PT_POLY 4 /* punch-thru poly */ + +#define PVR_SHADE_FLAT 0 /* shading */ +#define PVR_SHADE_GOURAUD 1 + +#define PVR_DEPTHCMP_NEVER 0 /* depth_comparison */ +#define PVR_DEPTHCMP_LESS 1 +#define PVR_DEPTHCMP_EQUAL 2 +#define PVR_DEPTHCMP_LEQUAL 3 +#define PVR_DEPTHCMP_GREATER 4 +#define PVR_DEPTHCMP_NOTEQUAL 5 +#define PVR_DEPTHCMP_GEQUAL 6 +#define PVR_DEPTHCMP_ALWAYS 7 + +#define PVR_CULLING_NONE 0 /* culling */ +#define PVR_CULLING_SMALL 1 +#define PVR_CULLING_CCW 2 +#define PVR_CULLING_CW 3 + +#define PVR_DEPTHWRITE_ENABLE 0 /* depth_write */ +#define PVR_DEPTHWRITE_DISABLE 1 + +#define PVR_TEXTURE_DISABLE 0 /* txr_enable */ +#define PVR_TEXTURE_ENABLE 1 + +#define PVR_BLEND_ZERO 0 /* src_blend / dst_blend */ +#define PVR_BLEND_ONE 1 +#define PVR_BLEND_DESTCOLOR 2 +#define PVR_BLEND_INVDESTCOLOR 3 +#define PVR_BLEND_SRCALPHA 4 +#define PVR_BLEND_INVSRCALPHA 5 +#define PVR_BLEND_DESTALPHA 6 +#define PVR_BLEND_INVDESTALPHA 7 + +#define PVR_BLEND_DISABLE 0 /* src_blend_enable / dst_blend_enable */ +#define PVR_BLEND_ENABLE 1 + +#define PVR_FOG_TABLE 0 /* fog_type */ +#define PVR_FOG_VERTEX 1 +#define PVR_FOG_DISABLE 2 +#define PVR_FOG_TABLE2 3 + +#define PVR_USERCLIP_DISABLE 0 /* clip_mode */ +#define PVR_USERCLIP_INSIDE 2 +#define PVR_USERCLIP_OUTSIDE 3 + +#define PVR_CLRCLAMP_DISABLE 0 /* color_clamp */ +#define PVR_CLRCLAMP_ENABLE 1 + +#define PVR_ALPHA_DISABLE 0 /* alpha */ +#define PVR_ALPHA_ENABLE 1 + +#define PVR_TXRALPHA_ENABLE 0 /* txr_alpha */ +#define PVR_TXRALPHA_DISABLE 1 + +#define PVR_UVFLIP_NONE 0 /* txr_uvflip */ +#define PVR_UVFLIP_V 1 +#define PVR_UVFLIP_U 2 +#define PVR_UVFLIP_UV 3 + +#define PVR_UVCLAMP_NONE 0 /* txr_uvclamp */ +#define PVR_UVCLAMP_V 1 +#define PVR_UVCLAMP_U 2 +#define PVR_UVCLAMP_UV 3 + +#define PVR_FILTER_NONE 0 /* txr_filter */ +#define PVR_FILTER_NEAREST 0 +#define PVR_FILTER_BILINEAR 2 +#define PVR_FILTER_TRILINEAR1 4 +#define PVR_FILTER_TRILINEAR2 6 + +#define PVR_MIPBIAS_NORMAL PVR_MIPBIAS_1_00 /* txr_mipmap_bias */ +#define PVR_MIPBIAS_0_25 1 +#define PVR_MIPBIAS_0_50 2 +#define PVR_MIPBIAS_0_75 3 +#define PVR_MIPBIAS_1_00 4 +#define PVR_MIPBIAS_1_25 5 +#define PVR_MIPBIAS_1_50 6 +#define PVR_MIPBIAS_1_75 7 +#define PVR_MIPBIAS_2_00 8 +#define PVR_MIPBIAS_2_25 9 +#define PVR_MIPBIAS_2_50 10 +#define PVR_MIPBIAS_2_75 11 +#define PVR_MIPBIAS_3_00 12 +#define PVR_MIPBIAS_3_25 13 +#define PVR_MIPBIAS_3_50 14 +#define PVR_MIPBIAS_3_75 15 + +/* txr_env */ +#define PVR_TXRENV_REPLACE 0 /* C = Ct, A = At */ +#define PVR_TXRENV_MODULATE 1 /* C = Cs * Ct, A = At */ +#define PVR_TXRENV_DECAL 2 /* C = (Cs * At) + (Cs * (1-At)), A = As */ +#define PVR_TXRENV_MODULATEALPHA 3 /* C = Cs * Ct, A = As * At */ + +#define PVR_MIPMAP_DISABLE 0 /* txr_mipmap */ +#define PVR_MIPMAP_ENABLE 1 + +#define PVR_TXRFMT_NONE 0 /* txr_format */ +#define PVR_TXRFMT_VQ_DISABLE (0 << 30) +#define PVR_TXRFMT_VQ_ENABLE (1 << 30) +#define PVR_TXRFMT_ARGB1555 (0 << 27) +#define PVR_TXRFMT_RGB565 (1 << 27) +#define PVR_TXRFMT_ARGB4444 (2 << 27) +#define PVR_TXRFMT_YUV422 (3 << 27) +#define PVR_TXRFMT_BUMP (4 << 27) +#define PVR_TXRFMT_PAL4BPP (5 << 27) +#define PVR_TXRFMT_PAL8BPP (6 << 27) +#define PVR_TXRFMT_TWIDDLED (0 << 26) +#define PVR_TXRFMT_NONTWIDDLED (1 << 26) +#define PVR_TXRFMT_NOSTRIDE (0 << 21) +#define PVR_TXRFMT_STRIDE (1 << 21) + +/* OR one of these into your texture format if you need it. Note that + these coincide with the twiddled/stride bits, so you can't have a + non-twiddled/strided texture that's paletted! */ +#define PVR_TXRFMT_8BPP_PAL(x) ((x) << 25) +#define PVR_TXRFMT_4BPP_PAL(x) ((x) << 21) + +#define PVR_CLRFMT_ARGBPACKED 0 /* color_format */ +#define PVR_CLRFMT_4FLOATS 1 +#define PVR_CLRFMT_INTENSITY 2 +#define PVR_CLRFMT_INTENSITY_PREV 3 + +#define PVR_UVFMT_32BIT 0 /* txr_uv_format */ +#define PVR_UVFMT_16BIT 1 + +#define PVR_MODIFIER_DISABLE 0 /* modifier_format */ +#define PVR_MODIFIER_ENABLE 1 + +#define PVR_MODIFIER_CHEAP_SHADOW 0 +#define PVR_MODIFIER_NORMAL 1 + +#define PVR_MODIFIER_OTHER_POLY 0 /* PM1 modifer instruction */ +#define PVR_MODIFIER_FIRST_POLY 1 /* ...in inclusion vol */ +#define PVR_MODIFIER_LAST_POLY 2 /* ...in exclusion vol */ + + +/* "Polygon header" -- this is the hardware equivalent of a rendering + context; you'll create one of these from your pvr_poly_context_t and + use it for submission to the hardware. */ +typedef struct { + uint32 cmd; /* TA command */ + uint32 mode1, mode2, mode3; /* mode parameters */ + uint32 d1, d2, d3, d4; /* dummies */ +} pvr_poly_hdr_t; + +/* Generic vertex type; the PVR chip itself supports many more vertex + types, but this is the main one that can be used with both textured + and non-textured polygons, and is fairly fast. You can find other + variants below. */ +typedef struct { + uint32 flags; /* vertex flags */ + float x, y, z; /* the coodinates */ + float u, v; /* texture coords */ + uint32 argb; /* vertex color */ + uint32 oargb; /* offset color */ +} pvr_vertex_t; + +/* Textured, packed color, affected by modifer volume. Note that this + vertex type has two copies of colors, offset colors and texture + coords. The second set of texture coords, colors, and offset colors + are used when enclosed within a modifer volume */ +typedef struct { + uint32 flags; /* vertex flags */ + float x, y, z; /* the coordinates */ + float u0, v0; /* texture coords 0 */ + uint32 argb0; /* vertex color 0 */ + uint32 oargb0; /* offset color 0 */ + float u1, v1; /* texture coords 1 */ + uint32 argb1; /* vertex color 1 */ + uint32 oargb1; /* offset color 1 */ + uint32 d1, d2, d3, d4; /* dummies */ +} pvr_vertex_tpcm_t; + +/* This vertex is only for modifer volumes */ +typedef struct { + uint32 flags; /* vertex flags */ + float ax, ay, az; /* 3 sets of coordinates */ + float bx, by, bz; + float cx, cy, cz; + uint32 d1, d2, d3, d4, d5, d6; /* dummies */ +} pvr_modifier_vol_t; + +/* Small macro for packing float color values */ +#define PVR_PACK_COLOR(a, r, g, b) ( \ + ( ((uint8)( a * 255 ) ) << 24 ) | \ + ( ((uint8)( r * 255 ) ) << 16 ) | \ + ( ((uint8)( g * 255 ) ) << 8 ) | \ + ( ((uint8)( b * 255 ) ) << 0 ) ) + +/* ... other vertex structs omitted for now ... */ + +/* Constants that apply to all primitives */ +#define PVR_CMD_POLYHDR 0x80840000 /* sublist, striplength=2 */ +#define PVR_CMD_VERTEX 0xe0000000 +#define PVR_CMD_VERTEX_EOL 0xf0000000 +#define PVR_CMD_USERCLIP 0x20000000 +#define PVR_CMD_MODIFIER 0x80040000 + +/* Constants and bitmasks for handling polygon headers; note that thanks + to the arrangement of constants above, this is mainly a matter of bit + shifting to compile it... */ +#define PVR_TA_CMD_TYPE_SHIFT 24 +#define PVR_TA_CMD_TYPE_MASK (7 << PVR_TA_CMD_TYPE_SHIFT) + +#define PVR_TA_CMD_USERCLIP_SHIFT 16 +#define PVR_TA_CMD_USERCLIP_MASK (3 << PVR_TA_CMD_USERCLIP_SHIFT) + +#define PVR_TA_CMD_CLRFMT_SHIFT 4 +#define PVR_TA_CMD_CLRFMT_MASK (7 << PVR_TA_CMD_CLRFMT_SHIFT) + +#define PVR_TA_CMD_SHADE_SHIFT 1 +#define PVR_TA_CMD_SHADE_MASK (1 << PVR_TA_CMD_SHADE_SHIFT) + +#define PVR_TA_CMD_UVFMT_SHIFT 0 +#define PVR_TA_CMD_UVFMT_MASK (1 << PVR_TA_CMD_UVFMT_SHIFT) + +#define PVR_TA_CMD_MODIFIER_SHIFT 7 +#define PVR_TA_CMD_MODIFIER_MASK (1 << PVR_TA_CMD_MODIFIER_SHIFT) + +#define PVR_TA_CMD_MODIFIERMODE_SHIFT 6 +#define PVR_TA_CMD_MODIFIERMODE_MASK (1 << PVR_TA_CMD_MODIFIERMODE_SHIFT) + +#define PVR_TA_PM1_DEPTHCMP_SHIFT 29 +#define PVR_TA_PM1_DEPTHCMP_MASK (7 << PVR_TA_PM1_DEPTHCMP_SHIFT) + +#define PVR_TA_PM1_CULLING_SHIFT 27 +#define PVR_TA_PM1_CULLING_MASK (3 << PVR_TA_PM1_CULLING_SHIFT) + +#define PVR_TA_PM1_DEPTHWRITE_SHIFT 26 +#define PVR_TA_PM1_DEPTHWRITE_MASK (1 << PVR_TA_PM1_DEPTHWRITE_SHIFT) + +#define PVR_TA_PM1_TXRENABLE_SHIFT 25 +#define PVR_TA_PM1_TXRENABLE_MASK (1 << PVR_TA_PM1_TXRENABLE_SHIFT) + +#define PVR_TA_PM1_MODIFIERINST_SHIFT 29 +#define PVR_TA_PM1_MODIFIERINST_MASK (2 << PVR_TA_PM1_MODIFIERINST_SHIFT) + +#define PVR_TA_PM2_SRCBLEND_SHIFT 29 +#define PVR_TA_PM2_SRCBLEND_MASK (7 << PVR_TA_PM2_SRCBLEND_SHIFT) + +#define PVR_TA_PM2_DSTBLEND_SHIFT 26 +#define PVR_TA_PM2_DSTBLEND_MASK (7 << PVR_TA_PM2_DSTBLEND_SHIFT) + +#define PVR_TA_PM2_SRCENABLE_SHIFT 25 +#define PVR_TA_PM2_SRCENABLE_MASK (1 << PVR_TA_PM2_SRCENABLE_SHIFT) + +#define PVR_TA_PM2_DSTENABLE_SHIFT 24 +#define PVR_TA_PM2_DSTENABLE_MASK (1 << PVR_TA_PM2_DSTENABLE_SHIFT) + +#define PVR_TA_PM2_FOG_SHIFT 22 +#define PVR_TA_PM2_FOG_MASK (3 << PVR_TA_PM2_FOG_SHIFT) + +#define PVR_TA_PM2_CLAMP_SHIFT 21 +#define PVR_TA_PM2_CLAMP_MASK (1 << PVR_TA_PM2_CLAMP_SHIFT) + +#define PVR_TA_PM2_ALPHA_SHIFT 20 +#define PVR_TA_PM2_ALPHA_MASK (1 << PVR_TA_PM2_ALPHA_SHIFT) + +#define PVR_TA_PM2_TXRALPHA_SHIFT 19 +#define PVR_TA_PM2_TXRALPHA_MASK (1 << PVR_TA_PM2_TXRALPHA_SHIFT) + +#define PVR_TA_PM2_UVFLIP_SHIFT 17 +#define PVR_TA_PM2_UVFLIP_MASK (3 << PVR_TA_PM2_UVFLIP_SHIFT) + +#define PVR_TA_PM2_UVCLAMP_SHIFT 15 +#define PVR_TA_PM2_UVCLAMP_MASK (3 << PVR_TA_PM2_UVCLAMP_SHIFT) + +#define PVR_TA_PM2_FILTER_SHIFT 12 +#define PVR_TA_PM2_FILTER_MASK (7 << PVR_TA_PM2_FILTER_SHIFT) + +#define PVR_TA_PM2_MIPBIAS_SHIFT 8 +#define PVR_TA_PM2_MIPBIAS_MASK (15 << PVR_TA_PM2_MIPBIAS_SHIFT) + +#define PVR_TA_PM2_TXRENV_SHIFT 6 +#define PVR_TA_PM2_TXRENV_MASK (3 << PVR_TA_PM2_TXRENV_SHIFT) + +#define PVR_TA_PM2_USIZE_SHIFT 3 +#define PVR_TA_PM2_USIZE_MASK (7 << PVR_TA_PM2_USIZE_SHIFT) + +#define PVR_TA_PM2_VSIZE_SHIFT 0 +#define PVR_TA_PM2_VSIZE_MASK (7 << PVR_TA_PM2_VSIZE_SHIFT) + +#define PVR_TA_PM3_MIPMAP_SHIFT 31 +#define PVR_TA_PM3_MIPMAP_MASK (1 << PVR_TA_PM3_MIPMAP_SHIFT) + +#define PVR_TA_PM3_TXRFMT_SHIFT 0 +#define PVR_TA_PM3_TXRFMT_MASK 0xffffffff + + + +/**** Register macros ***************************************************/ + +/* We use these macros to do all PVR register access, so that it's + simple later on to hook them for debugging or whatnot. */ + +#define PVR_GET(REG) (* ( (uint32*)( 0xa05f8000 + (REG) ) ) ) +#define PVR_SET(REG, VALUE) PVR_GET(REG) = (VALUE) + +/* The registers themselves; these are from Maiwe's powervr-reg.txt */ +/* Note that 2D specific registers have been excluded for now (like + vsync, hsync, v/h size, etc) */ + +#define PVR_ID 0x0000 /* Chip ID */ +#define PVR_REVISION 0x0004 /* Chip revision */ +#define PVR_RESET 0x0008 /* Reset pins */ +#define PVR_ISP_START 0x0014 /* Start the ISP/TSP */ +#define PVR_UNK_0018 0x0018 /* ?? */ +#define PVR_ISP_VERTBUF_ADDR 0x0020 /* Vertex buffer address for scene rendering */ +#define PVR_ISP_TILEMAT_ADDR 0x002c /* Tile matrix address for scene rendering */ +#define PVR_SPANSORT_CFG 0x0030 /* ?? -- write 0x101 for now */ +#define PVR_FB_CFG_1 0x0044 /* Framebuffer config 1 */ +#define PVR_FB_CFG_2 0x0048 /* Framebuffer config 2 */ +#define PVR_RENDER_MODULO 0x004c /* Render modulo */ +#define PVR_RENDER_ADDR 0x0060 /* Render output address */ +#define PVR_RENDER_ADDR_2 0x0064 /* Output for strip-buffering */ +#define PVR_PCLIP_X 0x0068 /* Horizontal clipping area */ +#define PVR_PCLIP_Y 0x006c /* Vertical clipping area */ +#define PVR_CHEAP_SHADOW 0x0074 /* Cheap shadow control */ +#define PVR_OBJECT_CLIP 0x0078 /* Distance for polygon culling */ +#define PVR_UNK_007C 0x007c /* ?? -- write 0x0027df77 for now */ +#define PVR_UNK_0080 0x0080 /* ?? -- write 7 for now */ +#define PVR_TEXTURE_CLIP 0x0084 /* Distance for texture clipping */ +#define PVR_BGPLANE_Z 0x0088 /* Distance for background plane */ +#define PVR_BGPLANE_CFG 0x008c /* Background plane config */ +#define PVR_UNK_0098 0x0098 /* ?? -- write 0x00800408 for now */ +#define PVR_UNK_00A0 0x00a0 /* ?? -- write 0x20 for now */ +#define PVR_UNK_00A8 0x00a8 /* ?? -- write 0x15d1c951 for now */ +#define PVR_FOG_TABLE_COLOR 0x00b0 /* Table fog color */ +#define PVR_FOG_VERTEX_COLOR 0x00b4 /* Vertex fog color */ +#define PVR_FOG_DENSITY 0x00b8 /* Fog density coefficient */ +#define PVR_COLOR_CLAMP_MAX 0x00bc /* RGB Color clamp max */ +#define PVR_COLOR_CLAMP_MIN 0x00c0 /* RGB Color clamp min */ +#define PVR_GUN_POS 0x00c4 /* Light gun position */ +#define PVR_UNK_00C8 0x00c8 /* ?? -- write same as border H in 00d4 << 16 */ +#define PVR_VPOS_IRQ 0x00cc /* Vertical position IRQ */ +#define PVR_TEXTURE_MODULO 0x00e4 /* Output texture width modulo */ +#define PVR_VIDEO_CFG 0x00e8 /* Misc video config */ +#define PVR_SCALER_CFG 0x00f4 /* Smoothing scaler */ +#define PVR_PALETTE_CFG 0x0108 /* Palette format */ +#define PVR_SYNC_STATUS 0x010c /* V/H blank status */ +#define PVR_UNK_0110 0x0110 /* ?? -- write 0x93f39 for now */ +#define PVR_UNK_0114 0x0114 /* ?? -- write 0x200000 for now */ +#define PVR_UNK_0118 0x0118 /* ?? -- write 0x8040 for now */ +#define PVR_TA_OPB_START 0x0124 /* Object Pointer Buffer start for TA usage */ +#define PVR_TA_VERTBUF_START 0x0128 /* Vertex buffer start for TA usage */ +#define PVR_TA_OPB_END 0x012c /* OPB end for TA usage */ +#define PVR_TA_VERTBUF_END 0x0130 /* Vertex buffer end for TA usage */ +#define PVR_TA_OPB_POS 0x0134 /* Top used memory location in OPB for TA usage */ +#define PVR_TA_VERTBUF_POS 0x0138 /* Top used memory location in vertbuf for TA usage */ +#define PVR_TILEMAT_CFG 0x013c /* Tile matrix size config */ +#define PVR_OPB_CFG 0x0140 /* Active lists / list size */ +#define PVR_TA_INIT 0x0144 /* Initialize vertex reg. params */ +#define PVR_YUV_ADDR 0x0148 /* YUV conversion destination */ +#define PVR_YUV_CFG_1 0x014c /* YUV configuration */ +#define PVR_UNK_0160 0x0160 /* ?? */ +#define PVR_TA_OPB_INIT 0x0164 /* Object pointer buffer position init */ +#define PVR_FOG_TABLE_BASE 0x0200 /* Base of the fog table */ +#define PVR_PALETTE_TABLE_BASE 0x1000 /* Base of the palette table */ + +/* Useful memory locations */ +#define PVR_TA_INPUT 0x10000000 /* TA command input */ +#define PVR_RAM_BASE 0xa5000000 /* PVR RAM (raw) */ +#define PVR_RAM_INT_BASE 0xa4000000 /* PVR RAM (interleaved) */ +#define PVR_RAM_SIZE (8*1024*1024) /* RAM size in bytes */ +#define PVR_RAM_TOP (PVR_RAM_BASE + PVR_RAM_SIZE) /* Top of raw PVR RAM */ +#define PVR_RAM_INT_TOP (PVR_RAM_INT_BASE + PVR_RAM_SIZE) /* Top of int PVR RAM */ + +/* Register content defines, as needed; these will be filled in over time + as the implementation requires them. There's too many to do otherwise. */ + +#define PVR_RESET_ALL 0xffffffff /* PVR_RESET */ +#define PVR_RESET_NONE 0x00000000 +#define PVR_RESET_TA 0x00000001 +#define PVR_RESET_ISPTSP 0x00000002 + +#define PVR_ISP_START_GO 0xffffffff /* PVR_ISP_START */ + +#define PVR_TA_INIT_GO 0x80000000 /* PVR_TA_INIT */ + + +/* Initialization ****************************************************/ + +/* Initialization and shutdown: stuff you should only ever have to do + once in your program. */ + +/* Bin sizes */ +#define PVR_BINSIZE_0 0 +#define PVR_BINSIZE_8 8 +#define PVR_BINSIZE_16 16 +#define PVR_BINSIZE_32 32 + +/* You'll fill in this structure before calling init */ +typedef struct { + /* Bin sizes: opaque polygons, opaque modifiers, translucent + polygons, translucent modifiers, punch-thrus */ + int opb_sizes[5]; + + /* Vertex buffer size (should be a nice round number) */ + int vertex_buf_size; +} pvr_init_params_t; + +/* Initialize the PVR chip to ready status, enabling the specified lists + and using the specified parameters; note that bins and vertex buffers + come from the texture memory pool! Expects that a 2D mode was + initialized already using the vid_* API. */ +int pvr_init(pvr_init_params_t *params); + +/* Simpler function which initializes the PVR using 16/16 for the opaque + and translucent lists, and 0's for everything else; 512k of vertex + buffer. This is equivalent to the old ta_init_defaults() for now. */ +int pvr_init_defaults(); + +/* Shut down the PVR chip from ready status, leaving it in 2D mode as it + was before the init. */ +int pvr_shutdown(); + + +/* Misc parameters ***************************************************/ + +/* These are miscellaneous parameters you can set which affect the + rendering process. */ + +/* Set the background plane color (the area of the screen not covered by + any other polygons) */ +void pvr_set_bg_color(float r, float g, float b); + +/* Return the current VBlank count */ +int pvr_get_vbl_count(); + +/* Statistics structure */ +typedef struct pvr_stats { + uint32 enabled_list_mask; /* Which lists are enabled? */ + uint32 vbl_count; /* VBlank count */ + uint32 frame_last_time; /* Ready-to-Ready length for the last frame in milliseconds */ + float frame_rate; /* Current frame rate (per second) */ + uint32 reg_last_time; /* Registration time for the last frame in milliseconds */ + uint32 rnd_last_time; /* Rendering time for the last frame in milliseconds */ + uint32 vtx_buffer_used; /* Number of bytes used in the vertex buffer for the last frame */ + uint32 vtx_buffer_used_max; /* Number of bytes used in the vertex buffer for the largest frame */ + /* ... more later as it's implemented ... */ +} pvr_stats_t; + +/* Fill in a statistics structure (above) from current data. This + is a super-set of frame count. */ +int pvr_get_stats(pvr_stats_t *stat); + + +/* Palette management ************************************************/ + +/* In addition to its 16-bit truecolor modes, the PVR also supports some + nice paletted modes. These aren't useful for super high quality images + most of the time, but they can be useful for doing some interesting + special effects, like the old cheap "worm hole". */ + +/* Palette formats */ +#define PVR_PAL_ARGB1555 0 +#define PVR_PAL_RGB565 1 +#define PVR_PAL_ARGB4444 2 +#define PVR_PAL_ARGB8888 3 + +/* Set the palette format */ +void pvr_set_pal_format(int fmt); + +/* Set a palette value; note that the format of the table is variable, + so for maximum speed we simply let the user decide what to do here. */ +static inline void pvr_set_pal_entry(uint32 idx, uint32 value) { + PVR_SET(PVR_PALETTE_TABLE_BASE + 4*idx, value); +} + + +/* Hardware Fog parameters *******************************************/ + +/* Thanks to Paul Boese for figuring this stuff out */ + +/* Set the fog table color */ +void pvr_fog_table_color(float a, float r, float g, float b); + +/* Set the fog vertex color */ +void pvr_fog_vertex_color(float a, float r, float g, float b); + +/* Set the fog far depth */ +void pvr_fog_far_depth(float d); + +/* Initialize the fog table using an exp2 algorithm (like GL_EXP2) */ +void pvr_fog_table_exp2(float density); + +/* Initialize the fog table using an exp algorithm (like GL_EXP) */ +void pvr_fog_table_exp(float density); + +/* Initialize the fog table using a linear algorithm (like GL_LINEAR) */ +void pvr_fog_table_linear(float start, float end); + +/* Set a custom fog table from float values */ +void pvr_fog_table_custom(float tbl1[]); + + +/* Memory management *************************************************/ + +/* PVR memory management in KOS uses a modified dlmalloc; see the + source file pvr_mem_core.c for more info. */ + +/* Allocate a chunk of memory from texture space; the returned value + will be relative to the base of texture memory (zero-based) */ +pvr_ptr_t pvr_mem_malloc(size_t size); + +/* Free a previously allocated chunk of memory */ +void pvr_mem_free(pvr_ptr_t chunk); + +/* Return the number of bytes available still in the memory pool */ +uint32 pvr_mem_available(); + +/* Reset the memory pool, equivalent to freeing all textures currently + residing in RAM. */ +void pvr_mem_reset(); + +/* Check the memory block list to see what's allocated */ +/* Only available if you've enabled KM_DBG in pvr_mem.c */ +void pvr_mem_print_list(); + +/* Print some statistics (like mallocstats) */ +void pvr_mem_stats(); + +/* Scene rendering ***************************************************/ + +/* This API is used to submit triangle strips to the PVR via the TA + interace in the chip. + + An important side note about the PVR is that all primitive types + must be submitted grouped together. If you have 10 polygons for each + list type, then the PVR must receive them via the TA by list type, + with a list delimiter in between. + + So there are two modes you can use here. The first mode allows you to + submit data directly to the TA. Your data will be forwarded to the + chip for processing as it is fed to the PVR module. If your data + is easily sorted into the primitive types, then this is the fastest + mode for submitting data. + + The second mode allows you to submit data via main-RAM vertex buffers, + which will be queued until the proper primitive type is active. In this + case, each piece of data is copied into the vertex buffer while the + wrong list is activated, and when the proper list becomes activated, + the data is all sent at once. Ideally this would be via DMA, right + now it is by store queues. This has the advantage of allowing you to + send data in any order and have the PVR functions resolve how it should + get sent to the hardware, but it is slower. + + The nice thing is that any combination of these modes can be used. You + can assign a vertex buffer for any list, and it will be used to hold the + incoming vertex data until the proper list has come up. Or if the proper + list is already up, the data will be submitted directly. So if most of + your polygons are opaque, and you only have a couple of translucents, + you can set a small buffer to gather translucent data and then it will + get sent when you do a pvr_end_scene(). + + Thanks to Mikael Kalms for the idea for this API. + + Another somewhat subtle point that bears mentioning is that in the normal + case (interrupts enabled) an interrupt handler will automatically take + care of starting a frame rendering (after scene_finish()) and also + flipping pages when appropriate. */ + +/* Setup a vertex buffer for one of the list types. If the specified list type + already has a vertex buffer, it will be replaced by the new one; if NULL + is specified as a buffer location, the list type will be switched to direct + mode. The old buffer location will be returned (if any). */ +void * pvr_set_vertex_buffer(pvr_list_t list, void * buffer, int len); + +/* Begin collecting data for a frame of 3D output to the off-screen + frame buffer */ +void pvr_scene_begin(); + +/* Begin collecting data for a frame of 3D output to the specified texture; + pass in the size of the buffer in rx and ry, and the return values in + rx and ry will be the size actually used (if changed). Note that + currently this only supports screen-sized output! */ +void pvr_scene_begin_txr(pvr_ptr_t txr, uint32 *rx, uint32 *ry); + +/* Begin collecting data for the given list type. Lists do not have to be + submitted in any particular order, but all types of a list must be + submitted at once. If the given list has already been closed, then an + error (-1) is returned. */ +int pvr_list_begin(pvr_list_t list); + +/* End collecting data for the current list type. Lists can never be opened + again within a single frame once they have been closed. Thus submitting + a primitive that belongs in a closed list is considered an error. Closing + a list that is already closed is also an error (-1). Note that if you open + a list but do not submit any primitives, a blank one will be submitted to + satisfy the hardware. */ +int pvr_list_finish(); + +/* Submit a primitive of the _current_ list type; note that any values + submitted in this fashion will go directly to the hardware without any + sort of buffering, and submitting a primitive of the wrong type will + quite likely ruin your scene. Note that this also will not work if you + haven't begun any list types (i.e., all data is queued). Returns -1 for + failure. */ +int pvr_prim(void * data, int size); + +/* Initialize a state variable for Direct Rendering; variable should be + of the type pvr_dr_state_t */ +#define pvr_dr_init(vtx_buf_ptr) do { \ + (vtx_buf_ptr) = 0; \ + QACR0 = ((((uint32)PVR_TA_INPUT) >> 26) << 2) & 0x1c; \ + QACR1 = ((((uint32)PVR_TA_INPUT) >> 26) << 2) & 0x1c; \ +} while (0) +#define pvr_dr_state_t uint32 + +/* Obtain the target address for Direct Rendering; this will return a + write-only destination address where a primitive should be written to get + ready to submit it to the TA in DR mode. You must pass in a variable + which was initialized with pvr_dr_init(). */ +#define pvr_dr_target(vtx_buf_ptr) \ + ({ (vtx_buf_ptr) ^= 32; \ + (pvr_vertex_t *)(0xe0000000 | (vtx_buf_ptr)); \ + }) + +/* Commit a primitive written into the Direct Rendering target address; pass + the address returned by pvr_dr_target(). */ +#define pvr_dr_commit(addr) __asm__ __volatile__("pref @%0" : : "r" (addr)) + +/* Submit a primitive of the given list type; if the requested list is not + the current list, then the data will be queued in a vertex buffer if + available, otherwise it will be submitted directly. If a vertex buffer + doesn't exist when one is needed, an error (-1) is returned. */ +int pvr_list_prim(pvr_list_t list, void * data, int size); + +/* Called to flush buffered data of the given list type to the hardware + processor. If there is no vertex buffer for the given type, then an error + (-1) is returned. The list must have been started with pvr_begin_list(). */ +int pvr_list_flush(pvr_list_t list); + +/* Call this after you have finished submitting all data for a frame; once + this has been called, you can not submit any more data until one of the + pvr_scene_begin() functions is called again. An error (-1) is returned if + you have not started a scene already. */ +int pvr_scene_finish(); + +/* Block the caller until the PVR system is ready for another frame to be + started. The PVR system allocates enough space for two frames: one in + data collection mode, and another in rendering mode. If a frame is + currently rendering, and another frame has already been closed, then the + caller cannot do anything else until the rendering frame completes. Note + also that the new frame cannot be activated except during a vertical + blanking period, so this essentially waits until a rendered frame is + complete _AND_ a vertical blank happens. Returns -1 if the wait times + out. Note that once this returns, the PVR system is ready for another + frame's data to be collected. */ +int pvr_wait_ready(); + +/* Same thing as above, but in non-blocking form; returns -1 if the PVR isn't + ready; returns 0 when the PVR has accepted your frame and is ready for + more. */ +int pvr_check_ready(); + + +/* Primitive handling ************************************************/ + +/* These functions help you prepare primitives for loading into the + PVR for scene processing. */ + +/* Compile a polygon context into a polygon header */ +void pvr_poly_compile(pvr_poly_hdr_t *dst, pvr_poly_cxt_t *src); + +/* Create a colored polygon context with parameters similar to + the old "ta" function `ta_poly_hdr_col' */ +void pvr_poly_cxt_col(pvr_poly_cxt_t *dst, pvr_list_t list); + +/* Create a textured polygon context with parameters similar to + the old "ta" function `ta_poly_hdr_txr' */ +void pvr_poly_cxt_txr(pvr_poly_cxt_t *dst, pvr_list_t list, + int textureformat, int tw, int th, pvr_ptr_t textureaddr, + int filtering); + + +/* Texture handling **************************************************/ + +/* Helper functions for handling texture tasks of various kinds. */ + +/* Load raw texture data from an SH-4 buffer into PVR RAM */ +void pvr_txr_load(void * src, pvr_ptr_t dst, uint32 count); + +/* Constants for texture loading */ +#define PVR_TXRLOAD_4BPP 0x01 /* Basic pixel formats */ +#define PVR_TXRLOAD_8BPP 0x02 +#define PVR_TXRLOAD_16BPP 0x03 +#define PVR_TXRLOAD_FMT_MASK 0x0f + +#define PVR_TXRLOAD_VQ_LOAD 0x10 /* Do VQ encoding (not supported yet, if ever) */ +#define PVR_TXRLOAD_INVERT_Y 0x20 /* Invert the Y axis while loading */ +#define PVR_TXRLOAD_FMT_VQ 0x40 /* Texture is already VQ encoded */ +#define PVR_TXRLOAD_FMT_TWIDDLED 0x80 /* Texture is already twiddled */ +#define PVR_TXRLOAD_FMT_NOTWIDDLE 0x80 /* Same sorta thing -- don't twiddle it */ +#define PVR_TXRLOAD_DMA 0x8000 /* Use DMA to load the texture */ +#define PVR_TXRLOAD_NONBLOCK 0x4000 /* Use non-blocking loads (only for DMA) */ +#define PVR_TXRLOAD_SQ 0x2000 /* Use store queues to load */ + +/* Load texture data from an SH-4 buffer into PVR RAM, twiddling it + in the process, among other things (see pvr_texture.c for more + details) */ +void pvr_txr_load_ex(void * src, pvr_ptr_t dst, uint32 w, uint32 h, uint32 flags); + +/* Load a KOS Platform Independent Image (subject to restraint checking) */ +void pvr_txr_load_kimg(kos_img_t *img, pvr_ptr_t dst, uint32 flags); + + +/* PVR DMA ***********************************************************/ + +/** Load a texture using PVR DMA. If block is non-zero, then the function + will not return until the texture DMA is complete. Otherwise, check + the value of pvr_dma_complete() to see if things are ready. */ +void pvr_txr_load_dma(void * src, pvr_ptr_t dest, uint32 count, int block); + +/** Returns non-zero if PVR DMA is inactive. */ +int pvr_dma_complete(); + +/** Initialize PVR DMA */ +void pvr_dma_init(); + +/** Shut down PVR DMA */ +void pvr_dma_shutdown(); + +/*********************************************************************/ + + +__END_DECLS + +#endif + diff --git a/SDK/LIBS/dcinclude/dc/sound/sfxmgr.h b/SDK/LIBS/dcinclude/dc/sound/sfxmgr.h new file mode 100644 index 00000000..be55e96b --- /dev/null +++ b/SDK/LIBS/dcinclude/dc/sound/sfxmgr.h @@ -0,0 +1,42 @@ +/* KallistiOS 1.2.0 + + dc/sound/sfxmgr.h + (c)2002 Dan Potter + + $Id: sfxmgr.h,v 1.6 2003/04/24 03:15:09 bardtx Exp $ + +*/ + +#ifndef __DC_SOUND_SFXMGR_H +#define __DC_SOUND_SFXMGR_H + +#include +__BEGIN_DECLS + +#include + +/* Sound effect handle type */ +typedef uint32 sfxhnd_t; +#define SFXHND_INVALID 0 + +/* Load a sound effect from a WAV file and return a handle to it */ +sfxhnd_t snd_sfx_load(const char *fn); + +/* Unload a single sample */ +void snd_sfx_unload(sfxhnd_t idx); + +/* Unload all loaded samples and free their SPU RAM */ +void snd_sfx_unload_all(); + +/* Play a sound effect with the given volume and panning; if the sound + effect is in stereo, the panning is ignored. */ +void snd_sfx_play(sfxhnd_t idx, int vol, int pan); + +/* Stop all playing sound effects. Doesn't stop channels 0 or 1, which + are assumed to be for streaming. */ +void snd_sfx_stop_all(); + +__END_DECLS + +#endif /* __DC_SOUND_SFXMGR_H */ + diff --git a/SDK/LIBS/dcinclude/dc/sound/sound.h b/SDK/LIBS/dcinclude/dc/sound/sound.h new file mode 100644 index 00000000..7f1349b5 --- /dev/null +++ b/SDK/LIBS/dcinclude/dc/sound/sound.h @@ -0,0 +1,63 @@ +/* KallistiOS 1.2.0 + + dc/sound/sound.h + (c)2002 Dan Potter + + $Id: sound.h,v 1.2 2002/07/06 07:57:32 bardtx Exp $ + +*/ + +#ifndef __DC_SOUND_SOUND_H +#define __DC_SOUND_SOUND_H + +#include +__BEGIN_DECLS + +#include + +/* Allocate a chunk of SPU RAM; we will return an offset into SPU RAM. */ +uint32 snd_mem_malloc(size_t size); + +/* Free a previously allocated chunk of memory */ +void snd_mem_free(uint32 addr); + +/* Return the number of bytes available in the largest free chunk */ +uint32 snd_mem_available(); + +/* Reinitialize the pool with the given RAM base offset */ +int snd_mem_init(uint32 reserve); + +/* Shut down the SPU allocator */ +void snd_mem_shutdown(); + +/* Initialize driver; note that this replaces the AICA program so that + if you had anything else going on, it's gone now! */ +int snd_init(); + +/* Shut everything down and free mem */ +void snd_shutdown(); + +/* Queue up a request to the SH4->AICA queue; size is in uint32's */ +int snd_sh4_to_aica(void *packet, uint32 size); + +/* Start processing requests in the queue */ +void snd_sh4_to_aica_start(); + +/* Stop processing requests in the queue */ +void snd_sh4_to_aica_stop(); + +/* Transfer one packet of data from the AICA->SH4 queue. Expects to + find AICA_CMD_MAX_SIZE dwords of space available. Returns -1 + if failure, 0 for no packets available, 1 otherwise. Failure + might mean a permanent failure since the queue is probably out of sync. */ +int snd_aica_to_sh4(void *packetout); + +/* Poll for responses from the AICA. We assume here that we're not + running in an interrupt handler (thread perhaps, of whoever + is using us). */ +void snd_poll_resp(); + +__END_DECLS + +#endif /* __DC_SOUND_SOUND_H */ + diff --git a/SDK/LIBS/dcinclude/dc/sound/stream.h b/SDK/LIBS/dcinclude/dc/sound/stream.h new file mode 100644 index 00000000..b066a569 --- /dev/null +++ b/SDK/LIBS/dcinclude/dc/sound/stream.h @@ -0,0 +1,70 @@ +/* KallistiOS 1.2.0 + + dc/sound/stream.h + (c)2002 Dan Potter + + $Id: stream.h,v 1.6 2003/03/09 01:26:36 bardtx Exp $ + +*/ + +#ifndef __DC_SOUND_STREAM_H +#define __DC_SOUND_STREAM_H + +#include +__BEGIN_DECLS + +#include + +/* Set "get data" callback */ +void snd_stream_set_callback(void *(*func)(int samples_requested, int *samples_returned)); + +/* Add an effect filter to the sound stream chain. When the stream + buffer filler needs more data, it starts out by calling the initial + callback (set above). It then calls each function in the effect + filter chain, which can modify the buffer and the amount of data + available as well. Filters persist across multiple calls to _init() + but will be emptied by _shutdown(). */ +typedef void (*snd_stream_filter_t)(void * obj, int hz, int channels, void **buffer, int *samplecnt); +void snd_stream_filter_add(snd_stream_filter_t filtfunc, void * obj); + +/* Remove a filter added with the above function */ +void snd_stream_filter_remove(snd_stream_filter_t filtfunc, void * obj); + +/* Load sample data from SH-4 ram into SPU ram (auto-allocate RAM) */ +uint32 snd_stream_load_sample(const uint16 *src, uint32 len); + +/* Dump all loaded sample data */ +void snd_stream_dump_samples(); + +/* Prefill buffers -- do this before calling start() */ +void snd_stream_prefill(); + +/* Initialize stream system */ +int snd_stream_init(void* (*callback)(int, int *)); + +/* Shut everything down and free mem */ +void snd_stream_shutdown(); + +/* Enable / disable stream queueing */ +void snd_stream_queue_enable(); +void snd_stream_queue_disable(); + +/* Actually make it go (in queued mode) */ +void snd_stream_queue_go(); + +/* Start streaming */ +void snd_stream_start(uint32 freq, int st); + +/* Stop streaming */ +void snd_stream_stop(); + +/* Poll streamer to load more data if neccessary */ +int snd_stream_poll(); + +/* Set the volume on the streaming channels */ +void snd_stream_volume(int vol); + +__END_DECLS + +#endif /* __DC_SOUND_STREAM_H */ + diff --git a/SDK/LIBS/dcinclude/dc/spu.h b/SDK/LIBS/dcinclude/dc/spu.h new file mode 100644 index 00000000..d033f0df --- /dev/null +++ b/SDK/LIBS/dcinclude/dc/spu.h @@ -0,0 +1,61 @@ +/* KallistiOS 1.2.0 + + dc/spu.h + (c)2000-2001 Dan Potter + + $Id: spu.h,v 1.7 2002/10/17 06:10:39 bardtx Exp $ + +*/ + +#ifndef __DC_SPU_H +#define __DC_SPU_H + +#include +__BEGIN_DECLS + +#include + +/* Waits for the sound FIFO to empty */ +void spu_write_wait(); + +/* memcpy and memset designed for sound RAM; for addresses, don't + bother to include the 0xa0800000 offset that is implied. 'length' + must be a multiple of 4, but if it is not it will be rounded up. */ +void spu_memload(uint32 to, void *from, int length); +void spu_memread(void *to, uint32 from, int length); +void spu_memset(uint32 to, uint32 what, int length); + +/* DMA copy from SH-4 RAM to SPU RAM; length must be a multiple of 32, + and the source and destination addresses must be aligned on 32-byte + boundaries. */ +void spu_memload_dma(uint32 dest, void *from, int length); + +/* Enable/disable the SPU; note that disable implies reset of the + ARM CPU core. */ +void spu_enable(); +void spu_disable(); + +/* Set CDDA volume: values are 0-15 */ +void spu_cdda_volume(int left_volume, int right_volume); + +/* Set CDDA panning: values are 0-31, 16=center */ +void spu_cdda_pan(int left_pan, int right_pan); + +/* Set master volume (0..15) and mono/stereo settings */ +void spu_master_mixer(int volume, int stereo); + +/* Initialize the SPU; by default it will be left in a state of + reset until you upload a program. */ +int spu_init(); + +/* Shutdown SPU */ +int spu_shutdown(); + +/* These two are seperate because they have to be done at a different time */ +int spu_dma_init(); +void spu_dma_shutdown(); + +__END_DECLS + +#endif /* __DC_SPU_H */ + diff --git a/SDK/LIBS/dcinclude/dc/sq.h b/SDK/LIBS/dcinclude/dc/sq.h new file mode 100644 index 00000000..30de6725 --- /dev/null +++ b/SDK/LIBS/dcinclude/dc/sq.h @@ -0,0 +1,39 @@ +/* KallistiOS 1.2.0 + + kernel/arch/dreamcast/include/dc/sq.h + (C)2000-2001 Andrew Kieschnick + + $Id: sq.h,v 1.2 2002/01/05 07:33:51 bardtx Exp $ +*/ + + +#ifndef __DC_SQ_H +#define __DC_SQ_H + +#include +__BEGIN_DECLS + +#include + +#define QACR0 (*(volatile unsigned int *)(void *)0xff000038) +#define QACR1 (*(volatile unsigned int *)(void *)0xff00003c) + +/* clears n bytes at dest, dest must be 32-byte aligned */ +void sq_clr(void *dest, int n); + +/* copies n bytes from src to dest, dest must be 32-byte aligned */ +void * sq_cpy(void *dest, void *src, int n); + +/* fills n bytes at s with byte c, s must be 32-byte aligned */ +void * sq_set(void *s, uint32 c, int n); + +/* fills n bytes at s with short c, s must be 32-byte aligned */ +void * sq_set16(void *s, uint32 c, int n); + +/* fills n bytes at s with int c, s must be 32-byte aligned */ +void * sq_set32(void *s, uint32 c, int n); + +__END_DECLS + +#endif + diff --git a/SDK/LIBS/dcinclude/dc/ubc.h b/SDK/LIBS/dcinclude/dc/ubc.h new file mode 100644 index 00000000..c2a8ba52 --- /dev/null +++ b/SDK/LIBS/dcinclude/dc/ubc.h @@ -0,0 +1,68 @@ +/* KallistiOS 1.2.0 + + kernel/arch/dreamcast/include/dc/ubc.h + (C)2002 Dan Potter + + $Id: ubc.h,v 1.1 2002/03/16 19:22:03 bardtx Exp $ +*/ + + +#ifndef __DC_UBC_H +#define __DC_UBC_H + +#include +__BEGIN_DECLS + +#include + +/* From the SH-4 PDF */ +#define BARA (*((vuint32*)0xFF200000)) +#define BASRA (*((vuint8*)0xFF000014)) +#define BAMRA (*((vuint8*)0xFF200004)) +#define BBRA (*((vuint16*)0xFF200008)) +#define BARB (*((vuint32*)0xFF20000C)) +#define BASRB (*((vuint8*)0xFF000018)) +#define BAMRB (*((vuint8*)0xFF200010)) +#define BBRB (*((vuint16*)0xFF200014)) +#define BRCR (*((vuint16*)0xFF200020)) + +/* These are inlined to avoid complications with using them */ + +/* Pause after setting UBC parameters */ +static inline void ubc_pause() { + __asm__ __volatile__("nop\n" + "nop\n" + "nop\n" + "nop\n" + "nop\n" + "nop\n" + "nop\n" + "nop\n" + "nop\n" + "nop\n" + "nop\n"); +} + +/* Disable all UBC breakpoints */ +static inline void ubc_disable_all() { + BBRA = 0; + BBRB = 0; + ubc_pause(); +} + +/* Set a UBC data-write breakpoint at the given address */ +static inline void ubc_break_data_write(uint32 address) { + BASRA = 0; /* ASID = 0 */ + BARA = address; /* Break address */ + BAMRA = 4; /* Mask the ASID */ + BRCR = 0; /* Nothing special, clear all flags */ + BBRA = 0x28; /* Operand write cycle, no size constraint */ + ubc_pause(); +} + +/* More to come.... */ + +__END_DECLS + +#endif /* __DC_UBC_H */ + diff --git a/SDK/LIBS/dcinclude/dc/vblank.h b/SDK/LIBS/dcinclude/dc/vblank.h new file mode 100644 index 00000000..f173ef73 --- /dev/null +++ b/SDK/LIBS/dcinclude/dc/vblank.h @@ -0,0 +1,37 @@ +/* KallistiOS 1.2.0 + + dc/vblank.h + Copyright (C)2003 Dan Potter + + $Id: vblank.h,v 1.1 2003/04/24 03:07:20 bardtx Exp $ +*/ + +#ifndef __DC_VBLANK_H +#define __DC_VBLANK_H + +#include +__BEGIN_DECLS + +#include + +/** Add a vblank handler. The function will be called at the start of every + vertical blanking period with the same parameters that were passed to + the original ASIC handler. Returns <0 on failure or a handle otherwise. */ +int vblank_handler_add(asic_evt_handler hnd); + +/** Remove a vblank handler. Pass the handle returned from + vblank_handler_add. */ +int vblank_handler_remove(int handle); + +/** Initialize the vblank handler. This must be called after the asic module + is initialized. */ +int vblank_init(); + +/** Shut down the vblank handler. */ +int vblank_shutdown(); + + +__END_DECLS + +#endif /* __DC_VBLANK_H */ + diff --git a/SDK/LIBS/dcinclude/dc/video.h b/SDK/LIBS/dcinclude/dc/video.h new file mode 100644 index 00000000..b03efc15 --- /dev/null +++ b/SDK/LIBS/dcinclude/dc/video.h @@ -0,0 +1,127 @@ +/* KallistiOS 1.2.0 + * + * dc/video.h + * (c)2001 Anders Clerwall (scav) + * + * $Id: video.h,v 1.6 2002/09/28 19:24:16 bardtx Exp $ + */ + +#ifndef __DC_VIDEO_H +#define __DC_VIDEO_H + +#include +__BEGIN_DECLS + +#include + +//----------------------------------------------------------------------------- +#define CT_ANY -1 // <-- Used ONLY internally with vid_mode +#define CT_VGA 0 +#define CT_RGB 2 +#define CT_COMPOSITE 3 + +//----------------------------------------------------------------------------- +#define PM_RGB555 0 +#define PM_RGB565 1 +#define PM_RGB888 3 + +//----------------------------------------------------------------------------- +// These are more generic modes + +enum { + DM_GENERIC_FIRST = 0x1000, + DM_320x240 = 0x1000, + DM_640x480, + DM_800x608, + DM_256x256, + DM_768x480, + DM_768x576, + DM_GENERIC_LAST = DM_768x576 +}; + +//----------------------------------------------------------------------------- +// More specific modes (and actual indeces into the mode table) + +enum { + DM_INVALID = 0, + // Valid modes below + DM_320x240_VGA = 1, + DM_320x240_NTSC, + DM_640x480_VGA, + DM_640x480_NTSC_IL, + DM_800x608_VGA, + DM_640x480_PAL_IL, + DM_256x256_PAL_IL, + DM_768x480_NTSC_IL, + DM_768x576_PAL_IL, + DM_768x480_PAL_IL, + DM_320x240_PAL, + + // The below is only for counting.. + DM_SENTINEL, + DM_MODE_COUNT +}; + +//----------------------------------------------------------------------------- +#define VID_MAX_FB 4 // <-- This should be enough + +//----------------------------------------------------------------------------- +// These are for the "flags" field of "vid_mode_t" +#define VID_INTERLACE 0x00000001 +#define VID_LINEDOUBLE 0x00000002 // <-- For 240 scanlines on VGA cable +#define VID_PIXELDOUBLE 0x00000004 // <-- For low-res modes (320) +#define VID_PAL 0x00000008 // <-- This sets output to 50Hz PAL if not CT_VGA + +//----------------------------------------------------------------------------- +struct vid_mode { + int generic; // <-- Generic mode identifier (for vid_set_mode) + uint16 width, height; // <-- With and height of screen in pixels + uint32 flags; // <-- Combination of one or more VID_* flags + + int16 cable_type; // <-- One of CT_* + uint16 pm; // <-- Pixel Mode + + uint16 scanlines, clocks; // <-- Scanlines/frame and clocks per scanline. + uint16 bitmapx, bitmapy; // <-- Bitmap window position (bitmapy is automatically increased for PAL) + uint16 scanint1, scanint2; // <-- Scanline interrupt positions (scanint2 automatically doubled for VGA) + uint16 borderx1, borderx2; // <-- Border x start/stop + uint16 bordery1, bordery2; // <-- Border y start/stop + + uint16 fb_curr, fb_count; + uint32 fb_base[VID_MAX_FB]; +}; + +typedef struct vid_mode vid_mode_t; + +extern vid_mode_t vid_builtin[DM_MODE_COUNT]; +extern vid_mode_t *vid_mode; + +//----------------------------------------------------------------------------- +extern uint16 *vram_s; +extern uint32 *vram_l; + +//----------------------------------------------------------------------------- +int vid_check_cable(); + +void vid_set_start(uint32 base); +void vid_flip(int fb); +void vid_border_color(int r, int g, int b); +void vid_clear(int r, int g, int b); +void vid_empty(); +void vid_waitvbl(); +void vid_set_mode(int dm, int pm); +void vid_set_mode_ex(vid_mode_t *mode); + +void vid_init(int disp_mode, int pixel_mode); +void vid_shutdown(); + +//----------------------------------------------------------------------------- + +int vid_screen_shot(const char * destfn); + +//----------------------------------------------------------------------------- + +__END_DECLS + +#endif // __DC_VIDEO_H + diff --git a/SDK/LIBS/dcinclude/dc/vmu_pkg.h b/SDK/LIBS/dcinclude/dc/vmu_pkg.h new file mode 100644 index 00000000..3a6cbe96 --- /dev/null +++ b/SDK/LIBS/dcinclude/dc/vmu_pkg.h @@ -0,0 +1,70 @@ +/* KallistiOS 1.2.0 + + dc/vmu_pkg.h + (c)2002 Dan Potter + + $Id: vmu_pkg.h,v 1.2 2002/06/11 05:55:36 bardtx Exp $ + +*/ + +#ifndef __DC_VMU_PKG_H +#define __DC_VMU_PKG_H + +#include +__BEGIN_DECLS + +#include + +/* Anyone wanting to package a VMU file should create one of these + somewhere; eventually it will be turned into a flat file that you + can save using fs_vmu. */ +typedef struct vmu_pkg { + char desc_short[20]; /* Short file description */ + char desc_long[36]; /* Long file description */ + char app_id[20]; /* Application ID */ + int icon_cnt; /* Number of icons */ + int icon_anim_speed; /* Icon animation speed */ + int eyecatch_type; /* "Eyecatch" type */ + int data_len; /* Number of data (payload) bytes */ + uint16 icon_pal[16]; /* Icon palette (ARGB4444) */ + uint8 *icon_data; /* 512*n bytes of icon data */ + uint8 *eyecatch_data; /* Eyecatch data */ + uint8 *data; /* Payload data */ +} vmu_pkg_t; + +/* Final header format (will go into the VMU file itself) */ +typedef struct vmu_hdr { + char desc_short[16]; /* Space-padded */ + char desc_long[32]; /* Space-padded */ + char app_id[16]; /* Null-padded */ + uint16 icon_cnt; + uint16 icon_anim_speed; + uint16 eyecatch_type; + uint16 crc; + uint32 data_len; + uint8 reserved[20]; + uint16 icon_pal[16]; + /* 512*n Icon Bitmaps */ + /* Eyecatch palette + bitmap */ +} vmu_hdr_t; + +/* Eyecatch types: all eyecatches are 72x56, but the pixel format is variable: */ +#define VMUPKG_EC_NONE 0 +#define VMUPKG_EC_16BIT 1 /* 16-bit ARGB4444 */ +#define VMUPKG_EC_256COL 2 /* 256-color palette */ +#define VMUPKG_EC_16COL 3 /* 16-color palette */ +/* Note that in all of the above cases which use a palette, the palette entries + are in ARGB4444 format and come directly before the pixel data itself. */ + +/* Converts a vmu_pkg_t structure into an array of uint8's which may be + written to a VMU file via fs_vmu, or whatever. */ +int vmu_pkg_build(vmu_pkg_t *src, uint8 ** dst, int * dst_size); +/* Parse an array of uint8's (i.e. a VMU data file) into a + * vmu_pkg_t package structure. */ +int vmu_pkg_parse(uint8 *data, vmu_pkg_t *pkg); + + +__END_DECLS + +#endif /* __DC_VMU_PKG_H */ + diff --git a/SDK/LIBS/dcinclude/dc/vmufs.h b/SDK/LIBS/dcinclude/dc/vmufs.h new file mode 100644 index 00000000..ed3c1beb --- /dev/null +++ b/SDK/LIBS/dcinclude/dc/vmufs.h @@ -0,0 +1,204 @@ +/* KallistiOS 1.2.0 + + dc/vmufs.h + Copyright (C)2003 Dan Potter + +*/ + +#ifndef __DC_VMUFS_H +#define __DC_VMUFS_H + +#include +__BEGIN_DECLS + +#include + +#define __packed__ __attribute__((packed)) +/** BCD timestamp, used several places below */ +typedef struct { + uint8 cent __packed__; + uint8 year __packed__; + uint8 month __packed__; + uint8 day __packed__; + uint8 hour __packed__; + uint8 min __packed__; + uint8 sec __packed__; + uint8 dow __packed__; /* Day of week (0 = monday, etc) */ +} vmu_timestamp_t; + +/** Root block layout */ +typedef struct { + uint8 magic[16] __packed__; /*< All should contain 0x55 */ + uint8 use_custom __packed__; /*< 0 = standard, 1 = custom */ + uint8 custom_color[4] __packed__; /*< blue, green, red, alpha */ + uint8 pad1[27] __packed__; /*< All zeros */ + vmu_timestamp_t timestamp __packed__; /*< BCD timestamp */ + uint8 pad2[8] __packed__; /*< All zeros */ + uint8 unk1[6] __packed__; /*< ??? */ + uint16 fat_loc __packed__; /*< FAT location */ + uint16 fat_size __packed__; /*< FAT size in blocks */ + uint16 dir_loc __packed__; /*< Directory location */ + uint16 dir_size __packed__; /*< Directory size in blocks */ + uint16 icon_shape __packed__; /*< Icon shape for this VMS */ + uint16 blk_cnt __packed__; /*< Number of user blocks */ + uint8 unk2[430] __packed__; /*< ??? */ +} vmu_root_t; + +/** Directory entries, 32 bytes each */ +typedef struct { + uint8 filetype __packed__; /*< 0x00 = no file; 0x33 = data; 0xcc = a game */ + uint8 copyprotect __packed__; /*< 0x00 = copyable; 0xff = copy protected */ + uint16 firstblk __packed__; /*< Location of the first block in the file */ + char filename[12] __packed__; /*< Note: there is no null terminator */ + vmu_timestamp_t timestamp __packed__; /*< File time */ + uint16 filesize __packed__; /*< Size of the file in blocks */ + uint16 hdroff __packed__; /*< Offset of header, in blocks from start of file */ + uint8 dirty __packed__; /*< See header notes */ + uint8 pad1[3] __packed__; /*< All zeros */ +} vmu_dir_t; +#undef __packed__ + +/* Notes about the "dirty" field on vmu_dir_t :) + + This byte should always be zero when written out to the VMU. What this + lets us do, though, is conserve on flash writes. If you only want to + modify one single file (which is the standard case) then re-writing all + of the dir blocks is a big waste. Instead, you should set the dirty flag + on the in-mem copy of the directory, and writing it back out will only + flush the containing block back to the VMU, setting it back to zero + in the process. Loaded blocks should always have zero here (though we + enforce that in the code to make sure) so it will be non-dirty by + default. + */ + + +/* ****************** Low level functions ******************** */ + +/** Fill in the date on a vmu_dir_t for writing */ +void vmufs_dir_fill_time(vmu_dir_t *d); + +/** Reads a selected VMU's root block. Assumes the mutex is held. */ +int vmufs_root_read(maple_device_t * dev, vmu_root_t * root_buf); + +/** Writes a selected VMU's root block. Assumes the mutex is held. */ +int vmufs_root_write(maple_device_t * dev, vmu_root_t * root_buf); + +/** Given a VMU's root block, return the amount of space in bytes required + to hold its directory. */ +int vmufs_dir_blocks(vmu_root_t * root_buf); + +/** Given a VMU's root block, return the amount of space in bytes required + to hold its FAT. */ +int vmufs_fat_blocks(vmu_root_t * root_buf); + +/** Given a selected VMU's root block, read its directory. Assumes the mutex + is held. There must be at least the number of bytes returned by + vmufs_dir_blocks() available in the buffer for this to succeed. */ +int vmufs_dir_read(maple_device_t * dev, vmu_root_t * root_buf, vmu_dir_t * dir_buf); + +/** Given a selected VMU's root block and dir blocks, write the dirty dir blocks + back to the VMU. Assumes the mutex is held. */ +int vmufs_dir_write(maple_device_t * dev, vmu_root_t * root, vmu_dir_t * dir_buf); + +/** Given a selected VMU's root block, read its FAT. Assumes the mutex is held. + There must be at least the number of bytes returned by vmufs_fat_blocks() + available in the buffer for this to succeed. */ +int vmufs_fat_read(maple_device_t * dev, vmu_root_t * root, uint16 * fat_buf); + +/** Given a selected VMU's root block and its FAT, write the FAT blocks + back to the VMU. Assumes the mutex is held. */ +int vmufs_fat_write(maple_device_t * dev, vmu_root_t * root, uint16 * fat_buf); + +/** Given a previously-read directory, locate a file by filename. The index into + the directory array will be returned on success, or <0 on failure. 'fn' will + be checked up to 12 characters. */ +int vmufs_dir_find(vmu_root_t * root, vmu_dir_t * dir, const char * fn); + +/** Given a previously-read directory, add a new dirent to the dir. Another file + with the same name should not exist (delete it first if it does). This function + will _not_ check for dups! Returns 0 on success, or <0 on failure. */ +int vmufs_dir_add(vmu_root_t * root, vmu_dir_t * dir, vmu_dir_t * newdirent); + +/** Given a pointer to a directory struct and a previously loaded FAT, load + the indicated file from the VMU. An appropriate amount of space must + have been allocated previously in the buffer. Assumes the mutex is held. + Returns 0 on success, <0 on failure. */ +int vmufs_file_read(maple_device_t * dev, uint16 * fat, vmu_dir_t * dirent, void * outbuf); + +/** Given a pointer to a mostly-filled directory struct and a previously loaded + directory and FAT, write the indicated file to the VMU. The named file + should not exist in the directory already. The directory and FAT will _not_ + be sync'd back to the VMU, this must be done manually. Assumes the mutex + is held. Returns 0 on success, <0 on failure. The 'size' parameter is in + blocks (512-bytes each). */ +int vmufs_file_write(maple_device_t * dev, vmu_root_t * root, uint16 * fat, + vmu_dir_t * dir, vmu_dir_t * newdirent, void * filebuf, int size); + +/** Given a previously-read FAT and directory, delete the named file. No changes are + made to the VMU itself, just the in-memory structs. */ +int vmufs_file_delete(vmu_root_t * root, uint16 * fat, vmu_dir_t * dir, const char *fn); + +/** Given a previously-read FAT, return the number of blocks available to write + out new file data. */ +int vmufs_fat_free(vmu_root_t * root, uint16 * fat); + +/** Given a previously-read directory, return the number of dirents available + for new files. */ +int vmufs_dir_free(vmu_root_t * root, vmu_dir_t * dir); + +/** Lock the mutex. This should be done before you attempt any low-level ops. */ +int vmufs_mutex_lock(); + +/** Unlock the mutex. This should be done once you're done with any low-level ops. */ +int vmufs_mutex_unlock(); + + +/* ****************** Higher level functions ******************** */ + +/** Reads the directory from a VMU. The output buffer will be allocated for + you using malloc(), and the number of entries will be returned. Returns + 0 on success, or <0 on failure. On failure, 'outbuf' will not contain + a dangling buffer that needs to be freed (no further action required). */ +int vmufs_readdir(maple_device_t * dev, vmu_dir_t ** outbuf, int * outcnt); + +/** Reads a file from the VMU. The output buffer will be allocated for you + using malloc(), and the size of the file will be returned. Returns 0 on + success, or <0 on failure. On failure, 'outbuf' will not contain + a dangling buffer that needs to be freed (no further action required). */ +int vmufs_read(maple_device_t * dev, const char * fn, void ** outbuf, int * outsize); + +/** Same as vmufs_read, but takes a pre-read dirent to speed things up when you + have already done a lookup. */ +int vmufs_read_dirent(maple_device_t * dev, vmu_dir_t * dirent, void ** outbuf, int * outsize); + +/* Flags for vmufs_write */ +#define VMUFS_OVERWRITE 1 /*< Overwrite existing files */ +#define VMUFS_VMUGAME 2 /*< This file is a VMU game */ +#define VMUFS_NOCOPY 4 /*< Set the no-copy flag */ + +/** Writes a file to the VMU. If the named file already exists, then the + function checks 'flags'. If VMUFS_OVERWRITE is set, then the old + file is deleted first before the new one is written (this all happens + atomically). On partial failure, some data blocks may have been written, + but in general the card should not be damaged. Returns 0 on success, + or <0 for failure. */ +int vmufs_write(maple_device_t * dev, const char * fn, void * inbuf, int insize, int flags); + +/** Deletes a file from the VMU. Returns 0 on success, -1 if the file can't be + found, or -2 for some other error. */ +int vmufs_delete(maple_device_t * dev, const char * fn); + +/** Returns the number of user blocks free for file writing. You should check this + number before attempting to write. */ +int vmufs_free_blocks(maple_device_t * dev); + + +/** Initialize vmufs. Must be called before anything else is useful. */ +int vmufs_init(); + +/** Shutdown vmufs. Must be called after everything is finished. */ +int vmufs_shutdown(); + +__END_DECLS + +#endif /* __DC_VMUFS_H */ diff --git a/SDK/LIBS/dcinclude/dcplib/fnt.h b/SDK/LIBS/dcinclude/dcplib/fnt.h new file mode 100644 index 00000000..6607823d --- /dev/null +++ b/SDK/LIBS/dcinclude/dcplib/fnt.h @@ -0,0 +1,358 @@ +/* + PLIB - A Suite of Portable Game Libraries + Copyright (C) 2001 Steve Baker + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For further information visit http://plib.sourceforge.net + + $Id: fnt.h,v 1.1 2003/02/27 03:46:29 bardtx Exp $ +*/ + +// Modified for Dreamcast/KOS by Peter Hatch + +#ifndef _FNT_H_ +#define _FNT_H_ 1 + +#include +#include "sg.h" + +const int FNTMAX_CHAR = 256; + +class fntFont +{ +public: + fntFont () ; + + virtual ~fntFont () ; + + /* Pure virtuals aren't working currently... :( + virtual void getBBox (const char *s, float pointsize, float italic, float *left, float *right, float *bot , float *top) = 0; + virtual void putch (sgVec3 curpos, float pointsize, float italic, char c, float red, float green, float blue, float alpha) = 0; + virtual void puts (sgVec3 curpos, float pointsize, float italic, const char *s, float red, float green, float blue, float alpha) = 0; + virtual void begin () = 0; + virtual void end () = 0; + + virtual bool load (const char *fname) = 0; + + virtual void setFixedPitch (bool fix) = 0; + virtual bool isFixedPitch () const = 0; + + virtual void setWidth (float w) = 0; + virtual void setGap (float g) = 0; + + virtual float getWidth () const = 0; + virtual float getGap () const = 0; + + virtual bool hasGlyph (char c) = 0; + */ + virtual void getBBox (const char *s, float pointsize, float italic, float *left, float *right, float *bot, float *top) {} + virtual void putch (sgVec3 curpos, float pointsize, float italic, char c, float red, float green, float blue, float alpha) {} + virtual void puts (sgVec3 curpos, float pointsize, float italic, const char *s, float red, float green, float blue, float alpha) {} + virtual void begin (int filter_mode) {} + virtual void end () {} + + virtual bool load (const char *fname) { return false; } + + virtual void setFixedPitch (bool fix) {} + virtual bool isFixedPitch () const { return false; } + + virtual void setWidth (float w) {} + virtual void setGap (float g) {} + + virtual float getWidth () const { return 0.0f; } + virtual float getGap () const { return 0.0f; } + + virtual bool hasGlyph (char c) { return false; } +}; + + +class fntTexFont : public fntFont +{ +private: + //uint32 texture; + pvr_ptr_t texture; + uint32 tex_width; + uint32 tex_height; + + bool bound; + bool fixed_pitch; + + float width; /* The width of a character in fixed-width mode */ + float gap; /* Set the gap between characters */ + + bool exists[FNTMAX_CHAR]; /* true if character exists in tex-map */ + + /* + The quadrilaterals that describe the characters + in the font are drawn with the following texture + and spatial coordinates. The texture coordinates + are in (S,T) space, with (0,0) at the bottom left + of the image and (1,1) at the top-right. + + The spatial coordinates are relative to the current + 'cursor' position. They should be scaled such that + 1.0 represent the height of a capital letter. Hence, + characters like 'y' which have a descender will be + given a negative v_bot. Most capitals will have + v_bot==0.0 and v_top==1.0. + */ + + /* Texture coordinates */ + + float t_top [FNTMAX_CHAR]; /* Top edge of each character [0..1] */ + float t_bot [FNTMAX_CHAR]; /* Bottom edge of each character [0..1] */ + float t_left [FNTMAX_CHAR]; /* Left edge of each character [0..1] */ + float t_right[FNTMAX_CHAR]; /* Right edge of each character [0..1] */ + + /* Vertex coordinates. */ + + float v_top [FNTMAX_CHAR]; + float v_bot [FNTMAX_CHAR]; + float v_left [FNTMAX_CHAR]; + float v_right[FNTMAX_CHAR]; + + void bind_texture (int filter_mode) + { + // PSH OPTIMIZE: it would probably make sense to only compile the header once, and store it as a class variable, instead of recalculating it every time. + + assert( texture != NULL ); + pvr_poly_cxt_t polyContext; + pvr_poly_hdr_t polyHeader; + + pvr_poly_cxt_txr (&polyContext, PVR_LIST_TR_POLY, PVR_TXRFMT_ARGB4444 | PVR_TXRFMT_TWIDDLED | PVR_TXRFMT_VQ_ENABLE, tex_width, tex_height, texture, filter_mode); + pvr_poly_compile (&polyHeader, &polyContext); + //pvr_list_prim (PVR_LIST_TR_POLY, &polyHeader, sizeof(polyHeader)); // Not implemented yet + pvr_prim (&polyHeader, sizeof (polyHeader) ); + } + + float low_putch (sgVec3 curpos, float pointsize, float italic, char c, float red, float green, float blue, float alpha); + + bool loadTXF (const char *fname); + +public: + fntTexFont () : fntFont (), texture (0), tex_width (0), tex_height (0), bound (false), fixed_pitch (true), width (1.0f), gap (0.1f) + { + memset (exists, false, FNTMAX_CHAR * sizeof (int) ); + texture = NULL; + } + + fntTexFont (const char *fname) : fntFont (), texture (0), tex_width (0), tex_height (0), bound (false), fixed_pitch (true), width (1.0f), gap (0.1f) + { + memset (exists, false, FNTMAX_CHAR * sizeof (int) ); + texture = NULL; + load (fname); + } + + fntTexFont(const fntTexFont & other) { + assert(false); + } + + ~fntTexFont () + { + if (tex_width > 0) + { + assert( texture != NULL ); + pvr_mem_free (texture); + } + } + + bool load (const char *fname); + + void setFixedPitch (bool fix) + { + fixed_pitch = fix; + } + bool isFixedPitch () const + { + return fixed_pitch; + } + + void setWidth (float w) + { + width = w; + } + void setGap (float g) + { + gap = g; + } + + float getWidth () const + { + return width; + } + float getGap () const + { + return gap; + } + + void setGlyph (char c, float tex_left, float tex_right, float tex_bot, float tex_top, float vtx_left, float vtx_right, float vtx_bot, float vtx_top); + + bool getGlyph (char c, float *tex_left = NULL, float *tex_right = NULL, float *tex_bot = NULL, float *tex_top = NULL, float *vtx_left = NULL, float *vtx_right = NULL, float *vtx_bot = NULL, float *vtx_top = NULL); + + bool hasGlyph (char c) + { + return getGlyph (c); + } + + void getBBox (const char *s, float pointsize, float italic, float *left, float *right, float *bot, float *top); + + void begin (int filter_mode) + { + bind_texture (filter_mode); + bound = true; + } + + void end () + { + bound = false ; + } + + void puts (sgVec3 curpos, float pointsize, float italic, const char *s, float red, float green, float blue, float alpha); + + void putch (sgVec3 curpos, float pointsize, float italic, char c, float red, float green, float blue, float alpha) + { + if (!bound) + { + bind_texture (PVR_FILTER_NONE); + } + low_putch (curpos, pointsize, italic, c, red, green, blue, alpha); + } +}; + + +class fntRenderer +{ + fntFont *font; + + sgVec3 curpos; + + float pointsize; + float italic; + + float red, green, blue, alpha; + + int filter_mode; + +public: + fntRenderer () : pointsize (10.0f), italic (0.0f), red (1.0f), green (1.0f), blue (1.0f), alpha (1.0f), filter_mode (PVR_FILTER_NONE) + { + start2f ( 0.0f, 0.0f ); + font = NULL ; + } + + void start3fv (sgVec3 pos) + { + sgCopyVec3 (curpos, pos); + } + void start2fv (sgVec2 pos) + { + sgCopyVec2 (curpos, pos); + curpos[2] = 512.0f; + } + void start2f (float x, float y ) + { + sgSetVec3 (curpos, x, y, 512.0f); + } + void start3f (float x, float y, float z) + { + sgSetVec3 (curpos, x, y, z); + } + + void getCursor (float *x, float *y, float *z) const + { + if (x != 0) + *x = curpos [0]; + if (y != 0) + *y = curpos [1]; + if (z != 0) + *z = curpos [2]; + } + + void setFont (fntFont *f) + { + font = f; + } + fntFont *getFont () const + { + return font; + } + + void setSlant (float i) + { + italic = i; + } + void setPointSize (float p) + { + pointsize = p; + } + + float getSlant () const + { + return italic; + } + float getPointSize () const + { + return pointsize; + } + + void setColor (float r, float g, float b, float a = 1.0f) + { + red = r; + green = g; + blue = b; + alpha = a; + } + void getColor (float *r, float *g, float *b, float *a = NULL) + { + if (r != 0) + *r = red; + if (g != 0) + *g = green; + if (b != 0) + *b = blue; + if (a != 0) + *a = alpha; + } + + int getFilterMode () + { + return filter_mode; + } + void setFilterMode (int fm) + { + filter_mode = fm; + } + + void begin () + { + font->begin (filter_mode); + } + void end () + { + font->end (); + } + + void putch (char c) + { + font->putch (curpos, pointsize, italic, c, red, green, blue, alpha); + } + void puts (const char *s) + { + font->puts (curpos, pointsize, italic, s, red, green, blue, alpha); + } +}; + +#endif diff --git a/SDK/LIBS/dcinclude/dcplib/sg.h b/SDK/LIBS/dcinclude/dcplib/sg.h new file mode 100644 index 00000000..d48a646e --- /dev/null +++ b/SDK/LIBS/dcinclude/dcplib/sg.h @@ -0,0 +1,2487 @@ +/* + PLIB - A Suite of Portable Game Libraries + Copyright (C) 2001 Steve Baker + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For further information visit http://plib.sourceforge.net + + $Id: sg.h,v 1.1 2003/02/27 03:46:29 bardtx Exp $ +*/ + + +#ifndef SG_H +#define SG_H 1 + +#include "ul.h" +#include +#include + +#define sgFloat float +#define SGfloat float + +#define SG_ZERO 0.0f +#define SG_HALF 0.5f +#define SG_ONE 1.0f +#define SG_TWO 2.0f +#define SG_THREE 3.0f +#define SG_45 45.0f +#define SG_180 180.0f +#define SG_MAX FLT_MAX + +#define SG_X 0 +#define SG_Y 1 +#define SG_Z 2 +#define SG_W 3 + +#ifndef M_PI +#define SG_PI 3.1415926535f +#else +#define SG_PI ((SGfloat) M_PI) +#endif + +#define SG_DEGREES_TO_RADIANS (SG_PI/SG_180) +#define SG_RADIANS_TO_DEGREES (SG_180/SG_PI) + +/* + These are just convenient redefinitions of standard + math library functions to stop float/double warnings. +*/ + +inline SGfloat sgSqrt ( const SGfloat x ) { return (SGfloat) sqrt ( x ) ; } +inline SGfloat sgSquare ( const SGfloat x ) { return x * x ; } +inline SGfloat sgAbs ( const SGfloat a ) { return ( a < SG_ZERO ) ? -a : a ; } + +inline int sgCompareFloat ( const SGfloat a, const SGfloat b, const SGfloat tol ) +{ + if ( ( a + tol ) < b ) return -1 ; + if ( ( b + tol ) < a ) return 1 ; + return 0 ; +} + + +/* + Types used in SG. +*/ + +typedef SGfloat sgVec2 [ 2 ] ; +typedef SGfloat sgVec3 [ 3 ] ; +typedef SGfloat sgVec4 [ 4 ] ; + +typedef sgVec4 sgQuat ; + +typedef SGfloat sgMat3 [3][3] ; +typedef SGfloat sgMat4 [4][4] ; + +struct sgCoord +{ + sgVec3 xyz ; + sgVec3 hpr ; +} ; + +class sgSphere ; +class sgBox ; +class sgFrustum ; + +/* + Some handy constants +*/ + +#define SG_OUTSIDE false +#define SG_INSIDE true +#define SG_STRADDLE 2 + +inline SGfloat sgHeightOfPlaneVec2 ( const sgVec4 plane, const sgVec2 pnt ) +{ + if ( plane[2] == SG_ZERO ) + return SG_ZERO ; + else + return -( plane[0] * pnt[0] + plane[1] * pnt[1] + plane[3] ) / plane[2] ; +} + +/* + Convert a direction vector into a set of euler angles, + (with zero roll) +*/ + +extern void sgHPRfromVec3 ( sgVec3 hpr, const sgVec3 src ) ; + +extern void sgMakeCoordMat4 ( sgMat4 dst, const SGfloat x, const SGfloat y, const SGfloat z, + const SGfloat h, const SGfloat p, const SGfloat r ) ; + +inline void sgMakeCoordMat4( sgMat4 dst, const sgVec3 xyz, const sgVec3 hpr ) +{ + sgMakeCoordMat4 ( dst, xyz[0], xyz[1], xyz[2], + hpr[0], hpr[1], hpr[2] ) ; +} + +inline void sgMakeCoordMat4( sgMat4 dst, const sgCoord *src ) +{ + sgMakeCoordMat4 ( dst, src->xyz, src->hpr ) ; +} + +extern void sgMakeLookAtMat4 ( sgMat4 dst, + const sgVec3 eye, const sgVec3 center, const sgVec3 up ) ; + +extern void sgMakeRotMat4 ( sgMat4 dst, const SGfloat angle, const sgVec3 axis ) ; + +inline void sgMakeRotMat4 ( sgMat4 dst, const sgVec3 hpr ) +{ + sgMakeCoordMat4 ( dst, SG_ZERO, SG_ZERO, SG_ZERO, hpr[0], hpr[1], hpr[2] ) ; +} + +inline void sgMakeRotMat4 ( sgMat4 dst,const SGfloat h, const SGfloat p, const SGfloat r ) +{ + sgMakeCoordMat4 ( dst, SG_ZERO, SG_ZERO, SG_ZERO, h, p, r ) ; +} + +extern void sgMakeTransMat4 ( sgMat4 dst, const sgVec3 xyz ) ; +extern void sgMakeTransMat4 ( sgMat4 dst, const SGfloat x, const SGfloat y, const SGfloat z ) ; + + +extern void sgSetCoord ( sgCoord *coord, const sgMat4 src ) ; + +extern void sgMultMat4 ( sgMat4 dst, const sgMat4 a, const sgMat4 b ) ; +extern void sgPostMultMat4 ( sgMat4 dst, const sgMat4 a ) ; +extern void sgPreMultMat4 ( sgMat4 dst, const sgMat4 a ) ; + +extern void sgTransposeNegateMat4 ( sgMat4 dst ) ; +extern void sgTransposeNegateMat4 ( sgMat4 dst, const sgMat4 src ) ; +extern void sgInvertMat4 ( sgMat4 dst, const sgMat4 src ) ; +inline void sgInvertMat4 ( sgMat4 dst ) { sgInvertMat4 ( dst, dst ) ; } + +extern void sgXformVec3 ( sgVec3 dst, const sgVec3 src, const sgMat4 mat ) ; +extern void sgXformPnt3 ( sgVec3 dst, const sgVec3 src, const sgMat4 mat ) ; +extern void sgXformVec4 ( sgVec4 dst, const sgVec4 src, const sgMat4 mat ) ; +extern void sgXformPnt4 ( sgVec4 dst, const sgVec4 src, const sgMat4 mat ) ; +extern void sgFullXformPnt3 ( sgVec3 dst, const sgVec3 src, const sgMat4 mat ) ; +extern void sgFullXformPnt4 ( sgVec4 dst, const sgVec4 src, const sgMat4 mat ) ; + +inline void sgXformVec3 ( sgVec3 dst, const sgMat4 mat ) { sgXformVec3 ( dst, dst, mat ) ; } +inline void sgXformPnt3 ( sgVec3 dst, const sgMat4 mat ) { sgXformPnt3 ( dst, dst, mat ) ; } +inline void sgXformVec4 ( sgVec4 dst, const sgMat4 mat ) { sgXformVec4 ( dst, dst, mat ) ; } +inline void sgXformPnt4 ( sgVec4 dst, const sgMat4 mat ) { sgXformPnt4 ( dst, dst, mat ) ; } +inline void sgFullXformPnt3 ( sgVec3 dst, const sgMat4 mat ) { sgFullXformPnt3 ( dst, dst, mat ) ; } +inline void sgFullXformPnt4 ( sgVec4 dst, const sgMat4 mat ) { sgFullXformPnt4 ( dst, dst, mat ) ; } + +/* + Basic low-level vector functions. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + For each of Vec2, Vec3 and Vec4, we provide inlines for + + Zero - set all elements to zero. + Set - set each element individually. + Add - add vectors element by element. + Sub - subtract vectors element by element. + Scale - multiply each element of a vector by a variable. + AddScaled - multiply second vector by a constant and add the + result to the first vector. + Negate - negate each element of a vector. + Compare - compare vectors element by element with optional tolerance. + (return TRUE if vectors are equal - within tolerances) + Equal - return TRUE if vectors are exactly equal. + Length - compute length of a vector. + Distance - compute distance between two points. + ScalarProduct - scalar (dot) product. + VectorProduct - vector (cross) product (3-element vectors ONLY!). + Normalise/Normalize - make vector be one unit long. +*/ + +inline void sgZeroVec2 ( sgVec2 dst ) { dst[0]=dst[1]=SG_ZERO ; } +inline void sgZeroVec3 ( sgVec3 dst ) { dst[0]=dst[1]=dst[2]=SG_ZERO ; } +inline void sgZeroVec4 ( sgVec4 dst ) { dst[0]=dst[1]=dst[2]=dst[3]=SG_ZERO ; } + + +inline void sgSetVec2 ( sgVec2 dst, const SGfloat x, const SGfloat y ) +{ + dst [ 0 ] = x ; + dst [ 1 ] = y ; +} + +inline void sgSetVec3 ( sgVec3 dst, const SGfloat x, const SGfloat y, const SGfloat z ) +{ + dst [ 0 ] = x ; + dst [ 1 ] = y ; + dst [ 2 ] = z ; +} + +inline void sgSetVec4 ( sgVec4 dst, const SGfloat x, const SGfloat y, const SGfloat z, const SGfloat w ) +{ + dst [ 0 ] = x ; + dst [ 1 ] = y ; + dst [ 2 ] = z ; + dst [ 3 ] = w ; +} + + +inline void sgCopyVec2 ( sgVec2 dst, const sgVec2 src ) +{ + dst [ 0 ] = src [ 0 ] ; + dst [ 1 ] = src [ 1 ] ; +} + +inline void sgCopyVec3 ( sgVec3 dst, const sgVec3 src ) +{ + dst [ 0 ] = src [ 0 ] ; + dst [ 1 ] = src [ 1 ] ; + dst [ 2 ] = src [ 2 ] ; +} + +inline void sgCopyVec4 ( sgVec4 dst, const sgVec4 src ) +{ + dst [ 0 ] = src [ 0 ] ; + dst [ 1 ] = src [ 1 ] ; + dst [ 2 ] = src [ 2 ] ; + dst [ 3 ] = src [ 3 ] ; +} + + +inline void sgAddVec2 ( sgVec2 dst, const sgVec2 src ) +{ + dst [ 0 ] += src [ 0 ] ; + dst [ 1 ] += src [ 1 ] ; +} + +inline void sgAddVec3 ( sgVec3 dst, const sgVec3 src ) +{ + dst [ 0 ] += src [ 0 ] ; + dst [ 1 ] += src [ 1 ] ; + dst [ 2 ] += src [ 2 ] ; +} + +inline void sgAddVec4 ( sgVec4 dst, const sgVec4 src ) +{ + dst [ 0 ] += src [ 0 ] ; + dst [ 1 ] += src [ 1 ] ; + dst [ 2 ] += src [ 2 ] ; + dst [ 3 ] += src [ 3 ] ; +} + + +inline void sgAddVec2 ( sgVec2 dst, const sgVec2 src1, const sgVec2 src2 ) +{ + dst [ 0 ] = src1 [ 0 ] + src2 [ 0 ] ; + dst [ 1 ] = src1 [ 1 ] + src2 [ 1 ] ; +} + +inline void sgAddVec3 ( sgVec3 dst, const sgVec3 src1, const sgVec3 src2 ) +{ + dst [ 0 ] = src1 [ 0 ] + src2 [ 0 ] ; + dst [ 1 ] = src1 [ 1 ] + src2 [ 1 ] ; + dst [ 2 ] = src1 [ 2 ] + src2 [ 2 ] ; +} + +inline void sgAddVec4 ( sgVec4 dst, const sgVec4 src1, const sgVec4 src2 ) +{ + dst [ 0 ] = src1 [ 0 ] + src2 [ 0 ] ; + dst [ 1 ] = src1 [ 1 ] + src2 [ 1 ] ; + dst [ 2 ] = src1 [ 2 ] + src2 [ 2 ] ; + dst [ 3 ] = src1 [ 3 ] + src2 [ 3 ] ; +} + + +inline void sgSubVec2 ( sgVec2 dst, const sgVec2 src ) +{ + dst [ 0 ] -= src [ 0 ] ; + dst [ 1 ] -= src [ 1 ] ; +} + +inline void sgSubVec3 ( sgVec3 dst, const sgVec3 src ) +{ + dst [ 0 ] -= src [ 0 ] ; + dst [ 1 ] -= src [ 1 ] ; + dst [ 2 ] -= src [ 2 ] ; +} + +inline void sgSubVec4 ( sgVec4 dst, const sgVec4 src ) +{ + dst [ 0 ] -= src [ 0 ] ; + dst [ 1 ] -= src [ 1 ] ; + dst [ 2 ] -= src [ 2 ] ; + dst [ 3 ] -= src [ 3 ] ; +} + +inline void sgSubVec2 ( sgVec2 dst, const sgVec2 src1, const sgVec2 src2 ) +{ + dst [ 0 ] = src1 [ 0 ] - src2 [ 0 ] ; + dst [ 1 ] = src1 [ 1 ] - src2 [ 1 ] ; +} + +inline void sgSubVec3 ( sgVec3 dst, const sgVec3 src1, const sgVec3 src2 ) +{ + dst [ 0 ] = src1 [ 0 ] - src2 [ 0 ] ; + dst [ 1 ] = src1 [ 1 ] - src2 [ 1 ] ; + dst [ 2 ] = src1 [ 2 ] - src2 [ 2 ] ; +} + +inline void sgSubVec4 ( sgVec4 dst, const sgVec4 src1, const sgVec4 src2 ) +{ + dst [ 0 ] = src1 [ 0 ] - src2 [ 0 ] ; + dst [ 1 ] = src1 [ 1 ] - src2 [ 1 ] ; + dst [ 2 ] = src1 [ 2 ] - src2 [ 2 ] ; + dst [ 3 ] = src1 [ 3 ] - src2 [ 3 ] ; +} + + +inline void sgNegateVec2 ( sgVec2 dst ) +{ + dst [ 0 ] = -dst [ 0 ] ; + dst [ 1 ] = -dst [ 1 ] ; +} + +inline void sgNegateVec3 ( sgVec3 dst ) +{ + dst [ 0 ] = -dst [ 0 ] ; + dst [ 1 ] = -dst [ 1 ] ; + dst [ 2 ] = -dst [ 2 ] ; +} + +inline void sgNegateVec4 ( sgVec4 dst ) +{ + dst [ 0 ] = -dst [ 0 ] ; + dst [ 1 ] = -dst [ 1 ] ; + dst [ 2 ] = -dst [ 2 ] ; + dst [ 3 ] = -dst [ 3 ] ; +} + + +inline void sgNegateVec2 ( sgVec2 dst, const sgVec2 src ) +{ + dst [ 0 ] = -src [ 0 ] ; + dst [ 1 ] = -src [ 1 ] ; +} + +inline void sgNegateVec3 ( sgVec3 dst, const sgVec3 src ) +{ + dst [ 0 ] = -src [ 0 ] ; + dst [ 1 ] = -src [ 1 ] ; + dst [ 2 ] = -src [ 2 ] ; +} + +inline void sgNegateVec4 ( sgVec4 dst, const sgVec4 src ) +{ + dst [ 0 ] = -src [ 0 ] ; + dst [ 1 ] = -src [ 1 ] ; + dst [ 2 ] = -src [ 2 ] ; + dst [ 3 ] = -src [ 3 ] ; +} + + +inline void sgScaleVec2 ( sgVec2 dst, const SGfloat s ) +{ + dst [ 0 ] *= s ; + dst [ 1 ] *= s ; +} + +inline void sgScaleVec3 ( sgVec3 dst, const SGfloat s ) +{ + dst [ 0 ] *= s ; + dst [ 1 ] *= s ; + dst [ 2 ] *= s ; +} + +inline void sgScaleVec4 ( sgVec4 dst, const SGfloat s ) +{ + dst [ 0 ] *= s ; + dst [ 1 ] *= s ; + dst [ 2 ] *= s ; + dst [ 3 ] *= s ; +} + +inline void sgScaleVec2 ( sgVec2 dst, const sgVec2 src, const SGfloat s ) +{ + dst [ 0 ] = src [ 0 ] * s ; + dst [ 1 ] = src [ 1 ] * s ; +} + +inline void sgScaleVec3 ( sgVec3 dst, const sgVec3 src, const SGfloat s ) +{ + dst [ 0 ] = src [ 0 ] * s ; + dst [ 1 ] = src [ 1 ] * s ; + dst [ 2 ] = src [ 2 ] * s ; +} + +inline void sgScaleVec4 ( sgVec4 dst, const sgVec4 src, const SGfloat s ) +{ + dst [ 0 ] = src [ 0 ] * s ; + dst [ 1 ] = src [ 1 ] * s ; + dst [ 2 ] = src [ 2 ] * s ; + dst [ 3 ] = src [ 3 ] * s ; +} + + +inline void sgAddScaledVec2 ( sgVec2 dst, const sgVec2 src, const SGfloat s ) +{ + dst [ 0 ] += src [ 0 ] * s ; + dst [ 1 ] += src [ 1 ] * s ; +} + +inline void sgAddScaledVec3 ( sgVec3 dst, const sgVec3 src, const SGfloat s ) +{ + dst [ 0 ] += src [ 0 ] * s ; + dst [ 1 ] += src [ 1 ] * s ; + dst [ 2 ] += src [ 2 ] * s ; +} + +inline void sgAddScaledVec4 ( sgVec4 dst, const sgVec4 src, const SGfloat s ) +{ + dst [ 0 ] += src [ 0 ] * s ; + dst [ 1 ] += src [ 1 ] * s ; + dst [ 2 ] += src [ 2 ] * s ; + dst [ 3 ] += src [ 3 ] * s ; +} + + +inline void sgAddScaledVec2 ( sgVec2 dst, const sgVec2 src1, const sgVec2 src2, const SGfloat s ) +{ + dst [ 0 ] = src1 [ 0 ] + src2 [ 0 ] * s ; + dst [ 1 ] = src1 [ 1 ] + src2 [ 1 ] * s ; +} + +inline void sgAddScaledVec3 ( sgVec3 dst, const sgVec3 src1, const sgVec3 src2, const SGfloat s ) +{ + dst [ 0 ] = src1 [ 0 ] + src2 [ 0 ] * s ; + dst [ 1 ] = src1 [ 1 ] + src2 [ 1 ] * s ; + dst [ 2 ] = src1 [ 2 ] + src2 [ 2 ] * s ; +} + +inline void sgAddScaledVec4 ( sgVec4 dst, const sgVec4 src1, const sgVec4 src2, const SGfloat s ) +{ + dst [ 0 ] = src1 [ 0 ] + src2 [ 0 ] * s ; + dst [ 1 ] = src1 [ 1 ] + src2 [ 1 ] * s ; + dst [ 2 ] = src1 [ 2 ] + src2 [ 2 ] * s ; + dst [ 3 ] = src1 [ 3 ] + src2 [ 3 ] * s ; +} + + +inline int sgCompareVec2 ( const sgVec2 a, const sgVec2 b, const SGfloat tol ) +{ + int val = 0 ; + + if ( ( val = sgCompareFloat( a[0], b[0], tol ) ) != 0 ) return val ; + if ( ( val = sgCompareFloat( a[1], b[1], tol ) ) != 0 ) return val ; + + return 0 ; +} + +inline int sgCompareVec3 ( const sgVec3 a, const sgVec3 b, const SGfloat tol ) +{ + int val = 0 ; + + if ( ( val = sgCompareFloat( a[0], b[0], tol ) ) != 0 ) return val ; + if ( ( val = sgCompareFloat( a[1], b[1], tol ) ) != 0 ) return val ; + if ( ( val = sgCompareFloat( a[2], b[2], tol ) ) != 0 ) return val ; + + return 0 ; +} + +inline int sgCompareVec4 ( const sgVec4 a, const sgVec4 b, const SGfloat tol ) +{ + int val = 0 ; + + if ( ( val = sgCompareFloat( a[0], b[0], tol ) ) != 0 ) return val ; + if ( ( val = sgCompareFloat( a[1], b[1], tol ) ) != 0 ) return val ; + if ( ( val = sgCompareFloat( a[2], b[2], tol ) ) != 0 ) return val ; + if ( ( val = sgCompareFloat( a[3], b[3], tol ) ) != 0 ) return val ; + + return 0 ; +} + + +inline int sgEqualVec2 ( const sgVec2 a, const sgVec2 b ) +{ + return a[0] == b[0] && + a[1] == b[1] ; +} + +inline int sgEqualVec3 ( const sgVec3 a, const sgVec3 b ) +{ + return a[0] == b[0] && + a[1] == b[1] && + a[2] == b[2] ; +} + +inline int sgEqualVec4 ( const sgVec4 a, const sgVec4 b ) +{ + return a[0] == b[0] && + a[1] == b[1] && + a[2] == b[2] && + a[3] == b[3] ; +} + + +inline SGfloat sgScalarProductVec2 ( const sgVec2 a, const sgVec2 b ) +{ + return a[0]*b[0] + a[1]*b[1] ; +} + +inline SGfloat sgScalarProductVec3 ( const sgVec3 a, const sgVec3 b ) +{ + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] ; +} + +inline SGfloat sgScalarProductVec4 ( const sgVec4 a, const sgVec4 b ) +{ + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3] ; +} + + +extern void sgVectorProductVec3 ( sgVec3 dst, const sgVec3 a, const sgVec3 b ) ; + +inline void sgLerpVec4 ( sgVec4 dst, const sgVec4 a, const sgVec4 b, const SGfloat f ) +{ + dst[0] = a[0] + f * ( b[0] - a[0] ) ; + dst[1] = a[1] + f * ( b[1] - a[1] ) ; + dst[2] = a[2] + f * ( b[2] - a[2] ) ; + dst[3] = a[3] + f * ( b[3] - a[3] ) ; +} + +inline void sgLerpVec3 ( sgVec3 dst, const sgVec3 a, const sgVec3 b, const SGfloat f ) +{ + dst[0] = a[0] + f * ( b[0] - a[0] ) ; + dst[1] = a[1] + f * ( b[1] - a[1] ) ; + dst[2] = a[2] + f * ( b[2] - a[2] ) ; +} + +inline void sgLerpVec2 ( sgVec2 dst, const sgVec2 a, const sgVec2 b, const SGfloat f ) +{ + dst[0] = a[0] + f * ( b[0] - a[0] ) ; + dst[1] = a[1] + f * ( b[1] - a[1] ) ; +} + +inline SGfloat sgDistanceSquaredVec2 ( const sgVec2 a, const sgVec2 b ) +{ + return sgSquare ( a[0]-b[0] ) + sgSquare ( a[1]-b[1] ) ; +} + +inline SGfloat sgDistanceSquaredVec3 ( const sgVec3 a, const sgVec3 b ) +{ + return sgSquare ( a[0]-b[0] ) + sgSquare ( a[1]-b[1] ) + + sgSquare ( a[2]-b[2] ) ; +} + +inline SGfloat sgDistanceSquaredVec4 ( const sgVec4 a, const sgVec4 b ) +{ + return sgSquare ( a[0]-b[0] ) + sgSquare ( a[1]-b[1] ) + + sgSquare ( a[2]-b[2] ) + sgSquare ( a[3]-b[3] ) ; +} + +inline SGfloat sgDistanceVec2 ( const sgVec2 a, const sgVec2 b ) +{ + return sgSqrt ( sgSquare ( a[0]-b[0] ) + sgSquare ( a[1]-b[1] ) ) ; +} + +inline SGfloat sgDistanceVec3 ( const sgVec3 a, const sgVec3 b ) +{ + return sgSqrt ( sgSquare ( a[0]-b[0] ) + sgSquare ( a[1]-b[1] ) + + sgSquare ( a[2]-b[2] ) ) ; +} + +inline SGfloat sgDistanceVec4 ( const sgVec4 a, const sgVec4 b ) +{ + return sgSqrt ( sgSquare ( a[0]-b[0] ) + sgSquare ( a[1]-b[1] ) + + sgSquare ( a[2]-b[2] ) + sgSquare ( a[3]-b[3] ) ) ; +} + + +inline SGfloat sgLengthVec2 ( const sgVec2 src ) +{ + return sgSqrt ( sgScalarProductVec2 ( src, src ) ) ; +} + +inline SGfloat sgLengthVec3 ( const sgVec3 src ) +{ + return sgSqrt ( sgScalarProductVec3 ( src, src ) ) ; +} + +inline SGfloat sgLengthVec4 ( const sgVec4 src ) +{ + return sgSqrt ( sgScalarProductVec4 ( src, src ) ) ; +} + +inline SGfloat sgLengthSquaredVec2 ( sgVec2 const src ) +{ + return sgScalarProductVec2 ( src, src ) ; +} + +inline SGfloat sgLengthSquaredVec3 ( sgVec3 const src ) +{ + return sgScalarProductVec3 ( src, src ) ; +} + +inline SGfloat sgLengthSquaredVec4 ( sgVec4 const src ) +{ + return sgScalarProductVec4 ( src, src ) ; +} + + +/* Anglo-US spelling issues. */ +#define sgNormalizeVec2 sgNormaliseVec2 +#define sgNormalizeVec3 sgNormaliseVec3 +#define sgNormalizeVec4 sgNormaliseVec4 +#define sgNormalizeQuat sgNormaliseQuat + +inline void sgNormaliseVec2 ( sgVec2 dst ) +{ + sgScaleVec2 ( dst, SG_ONE / sgLengthVec2 ( dst ) ) ; +} + +inline void sgNormaliseVec3 ( sgVec3 dst ) +{ + sgScaleVec3 ( dst, SG_ONE / sgLengthVec3 ( dst ) ) ; +} + +inline void sgNormaliseVec4 ( sgVec4 dst ) +{ + sgScaleVec4 ( dst, SG_ONE / sgLengthVec4 ( dst ) ) ; +} + +inline void sgNormaliseVec2 ( sgVec2 dst, const sgVec2 src ) +{ + sgScaleVec2 ( dst, src, SG_ONE / sgLengthVec2 ( src ) ) ; +} + +inline void sgNormaliseVec3 ( sgVec3 dst, const sgVec3 src ) +{ + sgScaleVec3 ( dst, src, SG_ONE / sgLengthVec3 ( src ) ) ; +} + +inline void sgNormaliseVec4 ( sgVec4 dst, const sgVec4 src ) +{ + sgScaleVec4 ( dst, src, SG_ONE / sgLengthVec4 ( src ) ) ; +} + + +inline void sgZeroCoord ( sgCoord *dst ) +{ + sgSetVec3 ( dst->xyz, SG_ZERO, SG_ZERO, SG_ZERO ) ; + sgSetVec3 ( dst->hpr, SG_ZERO, SG_ZERO, SG_ZERO ) ; +} + +inline void sgSetCoord ( sgCoord *dst, const SGfloat x, const SGfloat y, const SGfloat z, + const SGfloat h, const SGfloat p, const SGfloat r ) +{ + sgSetVec3 ( dst->xyz, x, y, z ) ; + sgSetVec3 ( dst->hpr, h, p, r ) ; +} + +inline void sgSetCoord ( sgCoord *dst, const sgVec3 xyz, const sgVec3 hpr ) +{ + sgCopyVec3 ( dst->xyz, xyz ) ; + sgCopyVec3 ( dst->hpr, hpr ) ; +} + +inline void sgCopyCoord ( sgCoord *dst, const sgCoord *src ) +{ + sgCopyVec3 ( dst->xyz, src->xyz ) ; + sgCopyVec3 ( dst->hpr, src->hpr ) ; +} + + + +inline void sgCopyMat4 ( sgMat4 dst, const sgMat4 src ) +{ + sgCopyVec4 ( dst[ 0 ], src[ 0 ] ) ; + sgCopyVec4 ( dst[ 1 ], src[ 1 ] ) ; + sgCopyVec4 ( dst[ 2 ], src[ 2 ] ) ; + sgCopyVec4 ( dst[ 3 ], src[ 3 ] ) ; +} + + +inline void sgScaleMat4 ( sgMat4 dst, const sgMat4 src, const SGfloat scale ) +{ + sgScaleVec4 ( dst[0], src[0], scale ) ; + sgScaleVec4 ( dst[1], src[1], scale ) ; + sgScaleVec4 ( dst[2], src[2], scale ) ; + sgScaleVec4 ( dst[3], src[3], scale ) ; +} + + +inline void sgMakeIdentMat4 ( sgMat4 dst ) +{ + sgSetVec4 ( dst[0], SG_ONE , SG_ZERO, SG_ZERO, SG_ZERO ) ; + sgSetVec4 ( dst[1], SG_ZERO, SG_ONE , SG_ZERO, SG_ZERO ) ; + sgSetVec4 ( dst[2], SG_ZERO, SG_ZERO, SG_ONE , SG_ZERO ) ; + sgSetVec4 ( dst[3], SG_ZERO, SG_ZERO, SG_ZERO, SG_ONE ) ; +} + + +extern void sgMakePickMatrix( sgMat4 mat, sgFloat x, sgFloat y, + sgFloat width, sgFloat height, sgVec4 viewport ) ; + +extern int sgCompare3DSqdDist ( const sgVec3 a, const sgVec3 b, const SGfloat sqd_dist ) ; +extern void sgMakeTransMat4 ( sgMat4 m, const SGfloat x, const SGfloat y, const SGfloat z ) ; +extern void sgMakeTransMat4 ( sgMat4 m, const sgVec3 xyz ) ; +extern void sgMakeCoordMat4 ( sgMat4 m, const SGfloat x, const SGfloat y, const SGfloat z, + const SGfloat h, const SGfloat p, const SGfloat r ) ; +extern void sgMakeCoordMat4 ( sgMat4 m, const sgCoord *c ) ; + +inline SGfloat sgDistToLineVec2 ( const sgVec3 line, const sgVec2 pnt ) +{ + return sgScalarProductVec2 ( line, pnt ) + line[2] ; +} + + +struct sgLineSegment3 /* Bounded line segment */ +{ + sgVec3 a ; + sgVec3 b ; +} ; + +struct sgLine3 /* Infinite line */ +{ + sgVec3 point_on_line ; + sgVec3 direction_vector ; /* Should be a unit vector */ +} ; + + +inline void sgLineSegment3ToLine3 ( sgLine3 *line, + const sgLineSegment3 lineseg ) +{ + sgCopyVec3 ( line->point_on_line , lineseg.a ) ; + sgSubVec3 ( line->direction_vector, lineseg.b, lineseg.a ) ; + sgNormaliseVec3 ( line->direction_vector ) ; +} + + +SGfloat sgDistSquaredToLineVec3 ( const sgLine3 line, + const sgVec3 pnt ) ; +SGfloat sgDistSquaredToLineSegmentVec3 ( const sgLineSegment3 line, + const sgVec3 pnt ) ; + + +inline SGfloat sgDistToLineVec3 ( const sgLine3 line, + const sgVec3 pnt ) +{ + return (SGfloat) sqrt ( (double) sgDistSquaredToLineVec3 ( line, pnt ) ); +} + + +inline SGfloat sgDistToLineSegmentVec3 ( const sgLineSegment3 line, + const sgVec3 pnt ) +{ + return (SGfloat) sqrt ( (double) sgDistSquaredToLineSegmentVec3(line,pnt) ) ; +} + + +inline SGfloat sgDistToPlaneVec3 ( const sgVec4 plane, const sgVec3 pnt ) +{ + return sgScalarProductVec3 ( plane, pnt ) + plane[3] ; +} + + +inline SGfloat sgHeightAbovePlaneVec3 ( const sgVec4 plane, const sgVec3 pnt ) +{ + return pnt[3] - sgHeightOfPlaneVec2 ( plane, pnt ) ; +} + +extern void sgReflectInPlaneVec3 ( sgVec3 dst, const sgVec3 src, const sgVec4 plane ) ; + +inline void sgReflectInPlaneVec3 ( sgVec3 dst, const sgVec4 plane ) +{ + sgReflectInPlaneVec3 ( dst, dst, plane ) ; +} + +extern void sgMakeNormal ( sgVec3 dst, const sgVec3 a, const sgVec3 b, const sgVec3 c ) ; + + +inline void sgMake2DLine ( sgVec3 dst, const sgVec2 a, const sgVec2 b ) +{ + dst[0] = b[1]-a[1] ; + dst[1] = -(b[0]-a[0]) ; + sgNormalizeVec2 ( dst ) ; + dst[2] = - ( dst[0]*a[0] + dst[1]*a[1] ) ; +} + +inline void sgMakePlane ( sgVec4 dst, const sgVec3 normal, const sgVec3 pnt ) +{ + sgCopyVec3 ( dst, normal ) ; + dst [ 3 ] = - sgScalarProductVec3 ( normal, pnt ) ; +} + +inline void sgMakePlane ( sgVec4 dst, const sgVec3 a, const sgVec3 b, const sgVec3 c ) +{ + /* + Ax + By + Cz + D == 0 ; + D = - ( Ax + By + Cz ) + = - ( A*a[0] + B*a[1] + C*a[2] ) + = - sgScalarProductVec3 ( normal, a ) ; + */ + + sgMakeNormal ( dst, a, b, c ) ; + + dst [ 3 ] = - sgScalarProductVec3 ( dst, a ) ; +} + +float sgTriArea( sgVec3 p0, sgVec3 p1, sgVec3 p2 ); + + +// Fast code. Result is in the range 0..pi: +inline SGfloat sgAngleBetweenNormalizedVec3 ( sgVec3 v1, sgVec3 v2 ) +{ + return (float)(acos(sgScalarProductVec3(v1,v2))*SG_RADIANS_TO_DEGREES) ; +} + +// Fast code. Result is in the range 0..pi: +SGfloat sgAngleBetweenVec3 ( sgVec3 v1, sgVec3 v2 ); + +// all three have to be normalized. Slow code. Result is in the range 0..2*pi: +SGfloat sgAngleBetweenNormalizedVec3 (sgVec3 first, sgVec3 second, sgVec3 normal); + +// normal has to be normalized. Slow code. Result is in the range 0..2*pi: +SGfloat sgAngleBetweenVec3 ( sgVec3 v1, sgVec3 v2, sgVec3 normal ); + +class sgSphere +{ + sgVec3 center ; + SGfloat radius ; +public: + sgSphere () { empty () ; } + + const SGfloat *getCenter (void) const { return center ; } + + void setCenter ( const sgVec3 c ) + { + sgCopyVec3 ( center, c ) ; + } + + void setCenter ( const SGfloat x, const SGfloat y, const SGfloat z ) + { + sgSetVec3 ( center, x, y, z ) ; + } + + SGfloat getRadius (void) const { return radius ; } + void setRadius ( const SGfloat r ) { radius = r ; } + + int isEmpty (void) const { return radius < SG_ZERO ; } + void empty (void) { radius = - SG_ONE ; } + + void orthoXform ( const sgMat4 m ) + { + sgXformPnt3 ( center, center, m ) ; + // radius *= sgLengthVec3 ( m[0] ) ; -- degrades performance for non-scaled matrices ... + } + + void extend ( const sgSphere *s ) ; + void extend ( const sgBox *b ) ; + void extend ( const sgVec3 v ) ; + + int intersects ( const sgSphere *s ) const + { + return sgCompare3DSqdDist ( center, s->getCenter(), + sgSquare ( radius + s->getRadius() ) ) <= 0 ; + } + + int intersects ( const sgVec4 plane ) const + { + return sgAbs ( sgDistToPlaneVec3 ( plane, center ) ) <= radius ; + } + + int intersects ( const sgBox *b ) const ; +} ; + + +class sgBox +{ + sgVec3 min ; + sgVec3 max ; + +public: + sgBox () { empty () ; } + + const SGfloat *getMin (void) const { return min ; } + const SGfloat *getMax (void) const { return max ; } + + void setMin ( const SGfloat x, const SGfloat y, const SGfloat z ) + { + sgSetVec3 ( min, x, y, z ) ; + } + + void setMin ( const sgVec3 src ) + { + sgCopyVec3 ( min, src ) ; + } + + void setMax ( const SGfloat x, const SGfloat y, const SGfloat z ) + { + sgSetVec3 ( max, x, y, z ) ; + } + + void setMax ( const sgVec3 src ) + { + sgCopyVec3 ( max, src ) ; + } + + int isEmpty(void) const + { + return ( min[0] > max[0] || + min[1] > max[1] || + min[2] > max[2] ) ; + } + + void empty (void) + { + sgSetVec3 ( min, SG_MAX, SG_MAX, SG_MAX ) ; + sgSetVec3 ( max, -SG_MAX, -SG_MAX, -SG_MAX ) ; + } + + void extend ( const sgSphere *s ) ; + void extend ( const sgBox *b ) ; + void extend ( const sgVec3 v ) ; + + int intersects ( const sgSphere *s ) const + { + return s -> intersects ( this ) ; + } + + int intersects ( const sgBox *b ) const + { + return min[0] <= b->getMax()[0] && max[0] >= b->getMin()[0] && + min[1] <= b->getMax()[1] && max[1] >= b->getMin()[1] && + min[2] <= b->getMax()[2] && max[2] >= b->getMin()[2] ; + } + + int intersects ( const sgVec4 plane ) const ; +} ; + +#define SG_NEAR 0x10 +#define SG_FAR 0x20 +#define SG_TOP 0x30 +#define SG_BOT 0x40 +#define SG_LEFT 0x50 +#define SG_RIGHT 0x60 + +class sgFrustum +{ + /* The parameters for a glFrustum or pfMakePerspFrust */ + + SGfloat left, right, top, bot, nnear, ffar ; + + /* The A,B,C terms of the plane equations of the four sloping planes */ + + sgVec3 top_plane, bot_plane, left_plane, right_plane ; + + /* A GL/PF-style perspective matrix for this frustum */ + + sgMat4 mat ; + + /* These two are only valid for simple frusta */ + + SGfloat hfov ; /* Horizontal Field of View */ + SGfloat vfov ; /* Vertical Field of View */ + + void update (void) ; + int getOutcode ( const sgVec4 src ) const ; + +public: + + sgFrustum (void) + { + nnear = SG_ONE ; + ffar = 1000000.0f ; + hfov = SG_45 ; + vfov = SG_45 ; + update () ; + } + + void setFrustum ( const SGfloat l, const SGfloat r, + const SGfloat b, const SGfloat t, + const SGfloat n, const SGfloat f ) + { + left = l ; right = r ; + top = t ; bot = b ; + nnear = n ; ffar = f ; + hfov = vfov = SG_ZERO ; + update () ; + } + + void getMat4 ( sgMat4 dst ) { sgCopyMat4 ( dst, mat ) ; } + + SGfloat getHFOV (void) const { return hfov ; } + SGfloat getVFOV (void) const { return vfov ; } + SGfloat getNear (void) const { return nnear ; } + SGfloat getFar (void) const { return ffar ; } + SGfloat getLeft (void) const { return left ; } + SGfloat getRight(void) const { return right ; } + SGfloat getTop (void) const { return top ; } + SGfloat getBot (void) const { return bot ; } + + void getFOV ( SGfloat *h, SGfloat *v ) const + { + if ( h != (SGfloat *) 0 ) *h = hfov ; + if ( v != (SGfloat *) 0 ) *v = vfov ; + } + + void setFOV ( const SGfloat h, const SGfloat v ) + { + hfov = ( h <= 0 ) ? ( v * SG_THREE / SG_TWO ) : h ; + vfov = ( v <= 0 ) ? ( h * SG_TWO / SG_THREE ) : v ; + update () ; + } + + void getNearFar ( SGfloat *n, SGfloat *f ) const + { + if ( n != (SGfloat *) 0 ) *n = nnear ; + if ( f != (SGfloat *) 0 ) *f = ffar ; + } + + void setNearFar ( const SGfloat n, const SGfloat f ) + { + nnear = n ; + ffar = f ; + update () ; + } + + int contains ( const sgVec3 p ) const ; + int contains ( const sgSphere *s ) const ; +} ; + + +/* + Quaternion routines are Copyright (C) 1999 + Kevin B. Thompson + Modified by Sylvan W. Clebsch + Largely rewritten by "Negative0" +*/ + +/* + Quaternion structure w = real, (x, y, z) = vector + CHANGED sqQuat to float array so that syntax matches + vector and matrix routines +*/ + + +inline void sgMakeIdentQuat ( sgQuat dst ) +{ + sgSetVec4 ( dst, SG_ZERO, SG_ZERO, SG_ZERO, SG_ONE ) ; +} + + +inline void sgSetQuat ( sgQuat dst, + const SGfloat w, const SGfloat x, + const SGfloat y, const SGfloat z ) +{ + sgSetVec4 ( dst, x, y, z, w ) ; +} + +inline void sgCopyQuat ( sgQuat dst, const sgQuat src ) +{ + sgCopyVec4 ( dst, src ) ; +} + + +/* Construct a unit quaternion (length==1) */ + +inline void sgNormaliseQuat ( sgQuat dst, const sgQuat src ) +{ + SGfloat d = sgScalarProductVec4 ( src, src ) ; + + d = (d > SG_ZERO) ? (SG_ONE / sgSqrt ( d )) : SG_ONE ; + + sgScaleVec4 ( dst, src, d ) ; +} + + + +inline void sgNormaliseQuat ( sgQuat dst ) { sgNormaliseQuat ( dst, dst ) ; } + + +inline void sgInvertQuat ( sgQuat dst, const sgQuat src ) +{ + SGfloat d = sgScalarProductVec4 ( src, src ) ; + + d = ( d == SG_ZERO ) ? SG_ONE : ( SG_ONE / d ) ; + + dst[SG_W] = src[SG_W] * d ; + dst[SG_X] = -src[SG_X] * d ; + dst[SG_Y] = -src[SG_Y] * d ; + dst[SG_Z] = -src[SG_Z] * d ; +} + +inline void sgInvertQuat ( sgQuat dst ) { sgInvertQuat ( dst, dst ) ; } + + +/* Make an angle and axis of rotation from a Quaternion. */ + +void sgQuatToAngleAxis ( SGfloat *angle, sgVec3 axis, const sgQuat src ) ; +void sgQuatToAngleAxis ( SGfloat *angle, + SGfloat *x, SGfloat *y, SGfloat *z, + const sgQuat src ) ; + +/* Make a quaternion from a given angle and axis of rotation */ + +void sgAngleAxisToQuat ( sgQuat dst, const SGfloat angle, const sgVec3 axis ) ; +void sgAngleAxisToQuat ( sgQuat dst, + const SGfloat angle, + const SGfloat x, const SGfloat y, const SGfloat z ) ; + +/* Convert a matrix to/from a quat */ + +void sgMatrixToQuat ( sgQuat quat, const sgMat4 m ) ; +void sgQuatToMatrix ( sgMat4 m, const sgQuat quat ) ; + +/* Convert a set of eulers to/from a quat */ + +void sgQuatToEuler( sgVec3 hpr, const sgQuat quat ) ; +void sgEulerToQuat( sgQuat quat, const sgVec3 hpr ) ; + +inline void sgEulerToQuat( sgQuat dst, + SGfloat h, SGfloat p, SGfloat r ) +{ + sgVec3 hpr ; + + sgSetVec3 ( hpr, h, p, r ) ; + + sgEulerToQuat( dst, hpr ) ; +} + +inline void sgHPRToQuat ( sgQuat dst, SGfloat h, SGfloat p, SGfloat r ) +{ + sgVec3 hpr; + + hpr[0] = h * SG_DEGREES_TO_RADIANS ; + hpr[1] = p * SG_DEGREES_TO_RADIANS ; + hpr[2] = r * SG_DEGREES_TO_RADIANS ; + + sgEulerToQuat( dst, hpr ) ; +} + +inline void sgHPRToQuat ( sgQuat dst, const sgVec3 hpr ) +{ + sgVec3 tmp ; + + sgScaleVec3 ( tmp, hpr, SG_DEGREES_TO_RADIANS ) ; + + sgEulerToQuat ( dst, tmp ) ; +}; + +/* Multiply quaternions together (concatenate rotations) */ + +void sgMultQuat ( sgQuat dst, const sgQuat a, const sgQuat b ) ; + +inline void sgPostMultQuat ( sgQuat dst, const sgQuat q ) +{ + sgQuat r ; + + sgCopyQuat ( r, dst ) ; + sgMultQuat ( dst, r, q ) ; +} + +inline void sgPreMultQuat ( sgQuat dst, const sgQuat q ) +{ + sgQuat r ; + + sgCopyQuat ( r, dst ) ; + sgMultQuat ( dst, q, r ) ; +} + + +/* Rotate a quaternion by a given angle and axis (convenience function) */ + + +inline void sgPreRotQuat ( sgQuat dst, const SGfloat angle, const sgVec3 axis ) +{ + sgQuat q ; + sgAngleAxisToQuat ( q, angle, axis ) ; + sgPreMultQuat ( dst, q ) ; + sgNormaliseQuat ( dst ) ; +} + + +inline void sgPostRotQuat ( sgQuat dst, const SGfloat angle, const sgVec3 axis ) +{ + sgQuat q ; + sgAngleAxisToQuat ( q, angle, axis ) ; + sgPostMultQuat ( dst, q ) ; + sgNormaliseQuat ( dst ) ; +} + + +inline void sgPreRotQuat ( sgQuat dst, + const SGfloat angle, + const SGfloat x, const SGfloat y, const SGfloat z ) +{ + sgVec3 axis ; + + sgSetVec3 ( axis, x, y, z ) ; + sgPreRotQuat ( dst, angle, axis ) ; +} + +inline void sgPostRotQuat ( sgQuat dst, + const SGfloat angle, + const SGfloat x, const SGfloat y, const SGfloat z ) +{ + sgVec3 axis ; + + sgSetVec3 ( axis, x, y, z ) ; + sgPostRotQuat ( dst, angle, axis ) ; +} + + +/* more meaningful names */ +#define sgWorldRotQuat sgPostRotQuat +#define sgLocalRotQuat sgPreRotQuat + +/* for backwards compatibility */ +#define sgRotQuat sgPostRotQuat + + +/* SWC - Interpolate between to quaternions */ + +extern void sgSlerpQuat ( sgQuat dst, + const sgQuat from, const sgQuat to, + const SGfloat t ) ; + + + +/* + Intersection testing. +*/ + +int sgIsectPlanePlane ( sgVec3 point, sgVec3 dir, + sgVec4 plane1, sgVec4 plane2 ) ; +int sgIsectInfLinePlane ( sgVec3 dst, + sgVec3 l_org, sgVec3 l_vec, + sgVec4 plane ) ; +int sgIsectInfLineInfLine ( sgVec3 dst, + sgVec3 l1_org, sgVec3 l1_vec, + sgVec3 l2_org, sgVec3 l2_vec ) ; +SGfloat sgIsectLinesegPlane ( sgVec3 dst, + sgVec3 v1, sgVec3 v2, + sgVec4 plane ) ; + + + + + + +/**********************************************************************/ + +#define sgdFloat double +#define SGDfloat double + +#define SGD_ZERO 0.0 +#define SGD_HALF 0.5 +#define SGD_ONE 1.0 +#define SGD_TWO 2.0 +#define SGD_THREE 3.0 +#define SGD_45 45.0 +#define SGD_180 180.0 +#define SGD_MAX DBL_MAX + +#define SGD_X 0 +#define SGD_Y 1 +#define SGD_Z 2 +#define SGD_W 3 + +#ifndef M_PI +#define SGD_PI 3.14159265358979323846 /* From M_PI under Linux/X86 */ +#else +#define SGD_PI M_PI +#endif + +#define SGD_DEGREES_TO_RADIANS (SGD_PI/SGD_180) +#define SGD_RADIANS_TO_DEGREES (SGD_180/SGD_PI) + +/* + These are just convenient redefinitions of standard + math library functions to stop float/double warnings. +*/ + +inline SGDfloat sgdSqrt ( const SGDfloat x ) { return sqrt ( x ) ; } +inline SGDfloat sgdSquare ( const SGDfloat x ) { return x * x ; } +inline SGDfloat sgdAbs ( const SGDfloat a ) { return ( a < SGD_ZERO ) ? -a : a ; } + +inline int sgdCompareFloat ( const SGDfloat a, const SGDfloat b, const SGDfloat tol ) +{ + if ( ( a + tol ) < b ) return -1 ; + if ( ( b + tol ) < a ) return 1 ; + return 0 ; +} + + +/* + Types used in SGD. +*/ + +typedef SGDfloat sgdVec2 [ 2 ] ; +typedef SGDfloat sgdVec3 [ 3 ] ; +typedef SGDfloat sgdVec4 [ 4 ] ; + +typedef sgdVec4 sgdQuat ; + +typedef SGDfloat sgdMat3 [3][3] ; +typedef SGDfloat sgdMat4 [4][4] ; + +struct sgdCoord +{ + sgdVec3 xyz ; + sgdVec3 hpr ; +} ; + +class sgdSphere ; +class sgdBox ; +class sgdFrustum ; + +/* + Some handy constants +*/ + +#define SGD_OUTSIDE false +#define SGD_INSIDE true +#define SGD_STRADDLE 2 + +inline SGDfloat sgdHeightOfPlaneVec2 ( const sgdVec4 plane, const sgdVec2 pnt ) +{ + if ( plane[2] == SGD_ZERO ) + return SGD_ZERO ; + else + return -( plane[0] * pnt[0] + plane[1] * pnt[1] + plane[3] ) / plane[2] ; +} + +/* + Convert a direction vector into a set of euler angles, + (with zero roll) +*/ + +extern void sgdHPRfromVec3 ( sgdVec3 hpr, const sgdVec3 src ) ; + +extern void sgdMakeCoordMat4 ( sgdMat4 dst, const SGDfloat x, const SGDfloat y, const SGDfloat z, + const SGDfloat h, const SGDfloat p, const SGDfloat r ) ; + +inline void sgdMakeCoordMat4( sgdMat4 dst, const sgdVec3 xyz, const sgdVec3 hpr ) +{ + sgdMakeCoordMat4 ( dst, xyz[0], xyz[1], xyz[2], + hpr[0], hpr[1], hpr[2] ) ; +} + +inline void sgdMakeCoordMat4( sgdMat4 dst, const sgdCoord *src ) +{ + sgdMakeCoordMat4 ( dst, src->xyz, src->hpr ) ; +} + +extern void sgdMakeRotMat4 ( sgdMat4 dst, const SGDfloat angle, const sgdVec3 axis ) ; + +inline void sgdMakeRotMat4 ( sgdMat4 dst, const sgdVec3 hpr ) +{ + sgdMakeCoordMat4 ( dst, SGD_ZERO, SGD_ZERO, SGD_ZERO, hpr[0], hpr[1], hpr[2] ) ; +} + +inline void sgdMakeRotMat4 ( sgdMat4 dst, const SGDfloat h, const SGDfloat p, const SGDfloat r ) +{ + sgdMakeCoordMat4 ( dst, SGD_ZERO, SGD_ZERO, SGD_ZERO, h, p, r ) ; +} + +extern void sgdMakeTransMat4 ( sgdMat4 dst, const sgdVec3 xyz ) ; +extern void sgdMakeTransMat4 ( sgdMat4 dst, const SGDfloat x, const SGDfloat y, const SGDfloat z ) ; + + +extern void sgdSetCoord ( sgdCoord *coord, const sgdMat4 src ) ; + +extern void sgdMultMat4 ( sgdMat4 dst, const sgdMat4 a, const sgdMat4 b ) ; +extern void sgdPostMultMat4 ( sgdMat4 dst, const sgdMat4 a ) ; +extern void sgdPreMultMat4 ( sgdMat4 dst, const sgdMat4 a ) ; + +extern void sgdTransposeNegateMat4 ( sgdMat4 dst ) ; +extern void sgdTransposeNegateMat4 ( sgdMat4 dst, const sgdMat4 src ) ; + +extern void sgdInvertMat4 ( sgdMat4 dst, const sgdMat4 src ) ; +inline void sgdInvertMat4 ( sgdMat4 dst ) { sgdInvertMat4 ( dst, dst ) ; } + +extern void sgdXformVec3 ( sgdVec3 dst, const sgdVec3 src, const sgdMat4 mat ) ; +extern void sgdXformPnt3 ( sgdVec3 dst, const sgdVec3 src, const sgdMat4 mat ) ; +extern void sgdXformVec4 ( sgdVec4 dst, const sgdVec4 src, const sgdMat4 mat ) ; +extern void sgdXformPnt4 ( sgdVec4 dst, const sgdVec4 src, const sgdMat4 mat ) ; +extern void sgdFullXformPnt3 ( sgdVec3 dst, const sgdVec3 src, const sgdMat4 mat ) ; +extern void sgdFullXformPnt4 ( sgdVec4 dst, const sgdVec4 src, const sgdMat4 mat ) ; + +inline void sgdXformVec3 ( sgdVec3 dst, const sgdMat4 mat ) { sgdXformVec3 ( dst, dst, mat ) ; } +inline void sgdXformPnt3 ( sgdVec3 dst, const sgdMat4 mat ) { sgdXformPnt3 ( dst, dst, mat ) ; } +inline void sgdXformVec4 ( sgdVec4 dst, const sgdMat4 mat ) { sgdXformVec4 ( dst, dst, mat ) ; } +inline void sgdXformPnt4 ( sgdVec4 dst, const sgdMat4 mat ) { sgdXformPnt4 ( dst, dst, mat ) ; } +inline void sgdFullXformPnt3 ( sgdVec3 dst, const sgdMat4 mat ) { sgdFullXformPnt3 ( dst, dst, mat ) ; } +inline void sgdFullXformPnt4 ( sgdVec4 dst, const sgdMat4 mat ) { sgdFullXformPnt4 ( dst, dst, mat ) ; } + +/* + Basic low-level vector functions. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + For each of Vec2, Vec3 and Vec4, we provide inlines for + + Zero - set all elements to zero. + Set - set each element individually. + Add - add vectors element by element. + Sub - subtract vectors element by element. + Scale - multiply each element of a vector by a variable. + Negate - negate each element of a vector. + Compare - compare vectors element by element with optional tolerance. + (return TRUE if vectors are equal - within tolerances) + Equal - return TRUE if vectors are exactly equal. + Length - compute length of a vector. + Distance - compute distance between two points. + LengthSquared - compute the square of the length of a vector. + DistanceSquared - compute the square of the distance between two points. + ScalarProduct - scalar (dot) product. + VectorProduct - vector (cross) product (3-element vectors ONLY!). + Normalise/Normalize - make vector be one unit long. + Lerp - linear interpolation by a fraction 'f'. +*/ + +inline void sgdZeroVec2 ( sgdVec2 dst ) { dst[0]=dst[1]=SGD_ZERO ; } +inline void sgdZeroVec3 ( sgdVec3 dst ) { dst[0]=dst[1]=dst[2]=SGD_ZERO ; } +inline void sgdZeroVec4 ( sgdVec4 dst ) { dst[0]=dst[1]=dst[2]=dst[3]=SGD_ZERO ; } + + +inline void sgdSetVec2 ( sgdVec2 dst, const SGDfloat x, const SGDfloat y ) +{ + dst [ 0 ] = x ; + dst [ 1 ] = y ; +} + +inline void sgdSetVec3 ( sgdVec3 dst, const SGDfloat x, const SGDfloat y, const SGDfloat z ) +{ + dst [ 0 ] = x ; + dst [ 1 ] = y ; + dst [ 2 ] = z ; +} + +inline void sgdSetVec4 ( sgdVec4 dst, const SGDfloat x, const SGDfloat y, const SGDfloat z, const SGDfloat w ) +{ + dst [ 0 ] = x ; + dst [ 1 ] = y ; + dst [ 2 ] = z ; + dst [ 3 ] = w ; +} + + +inline void sgdCopyVec2 ( sgdVec2 dst, const sgdVec2 src ) +{ + dst [ 0 ] = src [ 0 ] ; + dst [ 1 ] = src [ 1 ] ; +} + +inline void sgdCopyVec3 ( sgdVec3 dst, const sgdVec3 src ) +{ + dst [ 0 ] = src [ 0 ] ; + dst [ 1 ] = src [ 1 ] ; + dst [ 2 ] = src [ 2 ] ; +} + +inline void sgdCopyVec4 ( sgdVec4 dst, const sgdVec4 src ) +{ + dst [ 0 ] = src [ 0 ] ; + dst [ 1 ] = src [ 1 ] ; + dst [ 2 ] = src [ 2 ] ; + dst [ 3 ] = src [ 3 ] ; +} + + +inline void sgdAddVec2 ( sgdVec2 dst, const sgdVec2 src ) +{ + dst [ 0 ] += src [ 0 ] ; + dst [ 1 ] += src [ 1 ] ; +} + +inline void sgdAddVec3 ( sgdVec3 dst, const sgdVec3 src ) +{ + dst [ 0 ] += src [ 0 ] ; + dst [ 1 ] += src [ 1 ] ; + dst [ 2 ] += src [ 2 ] ; +} + +inline void sgdAddVec4 ( sgdVec4 dst, const sgdVec4 src ) +{ + dst [ 0 ] += src [ 0 ] ; + dst [ 1 ] += src [ 1 ] ; + dst [ 2 ] += src [ 2 ] ; + dst [ 3 ] += src [ 3 ] ; +} + + +inline void sgdAddVec2 ( sgdVec2 dst, const sgdVec2 src1, const sgdVec2 src2 ) +{ + dst [ 0 ] = src1 [ 0 ] + src2 [ 0 ] ; + dst [ 1 ] = src1 [ 1 ] + src2 [ 1 ] ; +} + +inline void sgdAddVec3 ( sgdVec3 dst, const sgdVec3 src1, const sgdVec3 src2 ) +{ + dst [ 0 ] = src1 [ 0 ] + src2 [ 0 ] ; + dst [ 1 ] = src1 [ 1 ] + src2 [ 1 ] ; + dst [ 2 ] = src1 [ 2 ] + src2 [ 2 ] ; +} + +inline void sgdAddVec4 ( sgdVec4 dst, const sgdVec4 src1, const sgdVec4 src2 ) +{ + dst [ 0 ] = src1 [ 0 ] + src2 [ 0 ] ; + dst [ 1 ] = src1 [ 1 ] + src2 [ 1 ] ; + dst [ 2 ] = src1 [ 2 ] + src2 [ 2 ] ; + dst [ 3 ] = src1 [ 3 ] + src2 [ 3 ] ; +} + + +inline void sgdSubVec2 ( sgdVec2 dst, const sgdVec2 src ) +{ + dst [ 0 ] -= src [ 0 ] ; + dst [ 1 ] -= src [ 1 ] ; +} + +inline void sgdSubVec3 ( sgdVec3 dst, const sgdVec3 src ) +{ + dst [ 0 ] -= src [ 0 ] ; + dst [ 1 ] -= src [ 1 ] ; + dst [ 2 ] -= src [ 2 ] ; +} + +inline void sgdSubVec4 ( sgdVec4 dst, const sgdVec4 src ) +{ + dst [ 0 ] -= src [ 0 ] ; + dst [ 1 ] -= src [ 1 ] ; + dst [ 2 ] -= src [ 2 ] ; + dst [ 3 ] -= src [ 3 ] ; +} + +inline void sgdSubVec2 ( sgdVec2 dst, const sgdVec2 src1, const sgdVec2 src2 ) +{ + dst [ 0 ] = src1 [ 0 ] - src2 [ 0 ] ; + dst [ 1 ] = src1 [ 1 ] - src2 [ 1 ] ; +} + +inline void sgdSubVec3 ( sgdVec3 dst, const sgdVec3 src1, const sgdVec3 src2 ) +{ + dst [ 0 ] = src1 [ 0 ] - src2 [ 0 ] ; + dst [ 1 ] = src1 [ 1 ] - src2 [ 1 ] ; + dst [ 2 ] = src1 [ 2 ] - src2 [ 2 ] ; +} + +inline void sgdSubVec4 ( sgdVec4 dst, const sgdVec4 src1, const sgdVec4 src2 ) +{ + dst [ 0 ] = src1 [ 0 ] - src2 [ 0 ] ; + dst [ 1 ] = src1 [ 1 ] - src2 [ 1 ] ; + dst [ 2 ] = src1 [ 2 ] - src2 [ 2 ] ; + dst [ 3 ] = src1 [ 3 ] - src2 [ 3 ] ; +} + + +inline void sgdNegateVec2 ( sgdVec2 dst ) +{ + dst [ 0 ] = -dst [ 0 ] ; + dst [ 1 ] = -dst [ 1 ] ; +} + +inline void sgdNegateVec3 ( sgdVec3 dst ) +{ + dst [ 0 ] = -dst [ 0 ] ; + dst [ 1 ] = -dst [ 1 ] ; + dst [ 2 ] = -dst [ 2 ] ; +} + +inline void sgdNegateVec4 ( sgdVec4 dst ) +{ + dst [ 0 ] = -dst [ 0 ] ; + dst [ 1 ] = -dst [ 1 ] ; + dst [ 2 ] = -dst [ 2 ] ; + dst [ 3 ] = -dst [ 3 ] ; +} + + +inline void sgdNegateVec2 ( sgdVec2 dst, const sgdVec2 src ) +{ + dst [ 0 ] = -src [ 0 ] ; + dst [ 1 ] = -src [ 1 ] ; +} + +inline void sgdNegateVec3 ( sgdVec3 dst, const sgdVec3 src ) +{ + dst [ 0 ] = -src [ 0 ] ; + dst [ 1 ] = -src [ 1 ] ; + dst [ 2 ] = -src [ 2 ] ; +} + +inline void sgdNegateVec4 ( sgdVec4 dst, const sgdVec4 src ) +{ + dst [ 0 ] = -src [ 0 ] ; + dst [ 1 ] = -src [ 1 ] ; + dst [ 2 ] = -src [ 2 ] ; + dst [ 3 ] = -src [ 3 ] ; +} + + +inline void sgdScaleVec2 ( sgdVec2 dst, const SGDfloat s ) +{ + dst [ 0 ] *= s ; + dst [ 1 ] *= s ; +} + +inline void sgdScaleVec3 ( sgdVec3 dst, const SGDfloat s ) +{ + dst [ 0 ] *= s ; + dst [ 1 ] *= s ; + dst [ 2 ] *= s ; +} + +inline void sgdScaleVec4 ( sgdVec4 dst, const SGDfloat s ) +{ + dst [ 0 ] *= s ; + dst [ 1 ] *= s ; + dst [ 2 ] *= s ; + dst [ 3 ] *= s ; +} + +inline void sgdScaleVec2 ( sgdVec2 dst, const sgdVec2 src, const SGDfloat s ) +{ + dst [ 0 ] = src [ 0 ] * s ; + dst [ 1 ] = src [ 1 ] * s ; +} + +inline void sgdScaleVec3 ( sgdVec3 dst, const sgdVec3 src, const SGDfloat s ) +{ + dst [ 0 ] = src [ 0 ] * s ; + dst [ 1 ] = src [ 1 ] * s ; + dst [ 2 ] = src [ 2 ] * s ; +} + +inline void sgdScaleVec4 ( sgdVec4 dst, const sgdVec4 src, const SGDfloat s ) +{ + dst [ 0 ] = src [ 0 ] * s ; + dst [ 1 ] = src [ 1 ] * s ; + dst [ 2 ] = src [ 2 ] * s ; + dst [ 3 ] = src [ 3 ] * s ; +} + + +inline void sgdAddScaledVec2 ( sgdVec2 dst, const sgdVec2 src, const SGDfloat s ) +{ + dst [ 0 ] += src [ 0 ] * s ; + dst [ 1 ] += src [ 1 ] * s ; +} + +inline void sgdAddScaledVec3 ( sgdVec3 dst, const sgdVec3 src, const SGDfloat s ) +{ + dst [ 0 ] += src [ 0 ] * s ; + dst [ 1 ] += src [ 1 ] * s ; + dst [ 2 ] += src [ 2 ] * s ; +} + +inline void sgdAddScaledVec4 ( sgdVec4 dst, const sgdVec4 src, const SGDfloat s ) +{ + dst [ 0 ] += src [ 0 ] * s ; + dst [ 1 ] += src [ 1 ] * s ; + dst [ 2 ] += src [ 2 ] * s ; + dst [ 3 ] += src [ 3 ] * s ; +} + + +inline void sgdAddScaledVec2 ( sgdVec2 dst, const sgdVec2 src1, const sgdVec2 src2, const SGDfloat s ) +{ + dst [ 0 ] = src1 [ 0 ] + src2 [ 0 ] * s ; + dst [ 1 ] = src1 [ 1 ] + src2 [ 1 ] * s ; +} + +inline void sgdAddScaledVec3 ( sgdVec3 dst, const sgdVec3 src1, const sgdVec3 src2, const SGDfloat s ) +{ + dst [ 0 ] = src1 [ 0 ] + src2 [ 0 ] * s ; + dst [ 1 ] = src1 [ 1 ] + src2 [ 1 ] * s ; + dst [ 2 ] = src1 [ 2 ] + src2 [ 2 ] * s ; +} + +inline void sgdAddScaledVec4 ( sgdVec4 dst, const sgdVec4 src1, const sgdVec4 src2, const SGDfloat s ) +{ + dst [ 0 ] = src1 [ 0 ] + src2 [ 0 ] * s ; + dst [ 1 ] = src1 [ 1 ] + src2 [ 1 ] * s ; + dst [ 2 ] = src1 [ 2 ] + src2 [ 2 ] * s ; + dst [ 3 ] = src1 [ 3 ] + src2 [ 3 ] * s ; +} + + + +inline int sgdCompareVec2 ( const sgdVec2 a, const sgdVec2 b, const SGDfloat tol ) +{ + int val = 0 ; + + if ( ( val = sgdCompareFloat( a[0], b[0], tol ) ) != 0 ) return val ; + if ( ( val = sgdCompareFloat( a[1], b[1], tol ) ) != 0 ) return val ; + + return 0 ; +} + +inline int sgdCompareVec3 ( const sgdVec3 a, const sgdVec3 b, const SGDfloat tol ) +{ + int val = 0 ; + + if ( ( val = sgdCompareFloat( a[0], b[0], tol ) ) != 0 ) return val ; + if ( ( val = sgdCompareFloat( a[1], b[1], tol ) ) != 0 ) return val ; + if ( ( val = sgdCompareFloat( a[2], b[2], tol ) ) != 0 ) return val ; + + return 0 ; +} + +inline int sgdCompareVec4 ( const sgdVec4 a, const sgdVec4 b, const SGDfloat tol ) +{ + int val = 0 ; + + if ( ( val = sgdCompareFloat( a[0], b[0], tol ) ) != 0 ) return val ; + if ( ( val = sgdCompareFloat( a[1], b[1], tol ) ) != 0 ) return val ; + if ( ( val = sgdCompareFloat( a[2], b[2], tol ) ) != 0 ) return val ; + if ( ( val = sgdCompareFloat( a[3], b[3], tol ) ) != 0 ) return val ; + + return 0 ; +} + + +inline int sgdEqualVec2 ( const sgdVec2 a, const sgdVec2 b ) +{ + return a[0] == b[0] && + a[1] == b[1] ; +} + +inline int sgdEqualVec3 ( const sgdVec3 a, const sgdVec3 b ) +{ + return a[0] == b[0] && + a[1] == b[1] && + a[2] == b[2] ; +} + +inline int sgdEqualVec4 ( const sgdVec4 a, const sgdVec4 b ) +{ + return a[0] == b[0] && + a[1] == b[1] && + a[2] == b[2] && + a[3] == b[3] ; +} + + +inline SGDfloat sgdScalarProductVec2 ( const sgdVec2 a, const sgdVec2 b ) +{ + return a[0]*b[0] + a[1]*b[1] ; +} + +inline SGDfloat sgdScalarProductVec3 ( const sgdVec3 a, const sgdVec3 b ) +{ + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] ; +} + +inline SGDfloat sgdScalarProductVec4 ( const sgdVec4 a, const sgdVec4 b ) +{ + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3] ; +} + + +extern void sgdVectorProductVec3 ( sgdVec3 dst, const sgdVec3 a, const sgdVec3 b ) ; + + +inline void sgdLerpVec4 ( sgdVec4 dst, const sgdVec4 a, const sgdVec4 b, const SGDfloat f ) +{ + dst[0] = a[0] + f * ( b[0] - a[0] ) ; + dst[1] = a[1] + f * ( b[1] - a[1] ) ; + dst[2] = a[2] + f * ( b[2] - a[2] ) ; + dst[3] = a[3] + f * ( b[3] - a[3] ) ; +} + +inline void sgdLerpVec3 ( sgdVec3 dst, const sgdVec3 a, const sgdVec3 b, const SGDfloat f ) +{ + dst[0] = a[0] + f * ( b[0] - a[0] ) ; + dst[1] = a[1] + f * ( b[1] - a[1] ) ; + dst[2] = a[2] + f * ( b[2] - a[2] ) ; +} + +inline void sgdLerpVec2 ( sgdVec2 dst, const sgdVec2 a, const sgdVec2 b, const SGDfloat f ) +{ + dst[0] = a[0] + f * ( b[0] - a[0] ) ; + dst[1] = a[1] + f * ( b[1] - a[1] ) ; +} + + +inline SGDfloat sgdDistanceSquaredVec2 ( const sgdVec2 a, const sgdVec2 b ) +{ + return sgdSquare ( a[0]-b[0] ) + sgdSquare ( a[1]-b[1] ) ; +} + +inline SGDfloat sgdDistanceSquaredVec3 ( const sgdVec3 a, const sgdVec3 b ) +{ + return sgdSquare ( a[0]-b[0] ) + sgdSquare ( a[1]-b[1] ) + + sgdSquare ( a[2]-b[2] ) ; +} + +inline SGDfloat sgdDistanceSquaredVec4 ( const sgdVec4 a, const sgdVec4 b ) +{ + return sgdSquare ( a[0]-b[0] ) + sgdSquare ( a[1]-b[1] ) + + sgdSquare ( a[2]-b[2] ) + sgdSquare ( a[3]-b[3] ) ; +} + + +inline SGDfloat sgdDistanceVec2 ( const sgdVec2 a, const sgdVec2 b ) +{ + return sgdSqrt ( sgdSquare ( a[0]-b[0] ) + sgdSquare ( a[1]-b[1] ) ) ; +} + +inline SGDfloat sgdDistanceVec3 ( const sgdVec3 a, const sgdVec3 b ) +{ + return sgdSqrt ( sgdSquare ( a[0]-b[0] ) + sgdSquare ( a[1]-b[1] ) + + sgdSquare ( a[2]-b[2] ) ) ; +} + +inline SGDfloat sgdDistanceVec4 ( const sgdVec4 a, const sgdVec4 b ) +{ + return sgdSqrt ( sgdSquare ( a[0]-b[0] ) + sgdSquare ( a[1]-b[1] ) + + sgdSquare ( a[2]-b[2] ) + sgdSquare ( a[3]-b[3] ) ) ; +} + + +inline SGDfloat sgdLengthVec2 ( sgdVec2 const src ) +{ + return sgdSqrt ( sgdScalarProductVec2 ( src, src ) ) ; +} + +inline SGDfloat sgdLengthVec3 ( sgdVec3 const src ) +{ + return sgdSqrt ( sgdScalarProductVec3 ( src, src ) ) ; +} + +inline SGDfloat sgdLengthVec4 ( sgdVec4 const src ) +{ + return sgdSqrt ( sgdScalarProductVec4 ( src, src ) ) ; +} + +inline SGDfloat sgdLengthSquaredVec2 ( sgdVec2 const src ) +{ + return sgdScalarProductVec2 ( src, src ) ; +} + +inline SGDfloat sgdLengthSquaredVec3 ( sgdVec3 const src ) +{ + return sgdScalarProductVec3 ( src, src ) ; +} + +inline SGDfloat sgdLengthSquaredVec4 ( sgdVec4 const src ) +{ + return sgdScalarProductVec4 ( src, src ) ; +} + +/* Anglo-US spelling issues. */ +#define sgdNormalizeVec2 sgdNormaliseVec2 +#define sgdNormalizeVec3 sgdNormaliseVec3 +#define sgdNormalizeVec4 sgdNormaliseVec4 +#define sgdNormalizeQuat sgdNormaliseQuat + +inline void sgdNormaliseVec2 ( sgdVec2 dst ) +{ + sgdScaleVec2 ( dst, SGD_ONE / sgdLengthVec2 ( dst ) ) ; +} + +inline void sgdNormaliseVec3 ( sgdVec3 dst ) +{ + sgdScaleVec3 ( dst, SGD_ONE / sgdLengthVec3 ( dst ) ) ; +} + +inline void sgdNormaliseVec4 ( sgdVec4 dst ) +{ + sgdScaleVec4 ( dst, SGD_ONE / sgdLengthVec4 ( dst ) ) ; +} + +inline void sgdNormaliseVec2 ( sgdVec2 dst, const sgdVec2 src ) +{ + sgdScaleVec2 ( dst, src, SGD_ONE / sgdLengthVec2 ( src ) ) ; +} + +inline void sgdNormaliseVec3 ( sgdVec3 dst, const sgdVec3 src ) +{ + sgdScaleVec3 ( dst, src, SGD_ONE / sgdLengthVec3 ( src ) ) ; +} + +inline void sgdNormaliseVec4 ( sgdVec4 dst, const sgdVec4 src ) +{ + sgdScaleVec4 ( dst, src, SGD_ONE / sgdLengthVec4 ( src ) ) ; +} + + +inline void sgdZeroCoord ( sgdCoord *dst ) +{ + sgdSetVec3 ( dst->xyz, SGD_ZERO, SGD_ZERO, SGD_ZERO ) ; + sgdSetVec3 ( dst->hpr, SGD_ZERO, SGD_ZERO, SGD_ZERO ) ; +} + +inline void sgdSetCoord ( sgdCoord *dst, const SGDfloat x, const SGDfloat y, const SGDfloat z, + const SGDfloat h, const SGDfloat p, const SGDfloat r ) +{ + sgdSetVec3 ( dst->xyz, x, y, z ) ; + sgdSetVec3 ( dst->hpr, h, p, r ) ; +} + +inline void sgdSetCoord ( sgdCoord *dst, const sgdVec3 xyz, const sgdVec3 hpr ) +{ + sgdCopyVec3 ( dst->xyz, xyz ) ; + sgdCopyVec3 ( dst->hpr, hpr ) ; +} + +inline void sgdCopyCoord ( sgdCoord *dst, const sgdCoord *src ) +{ + sgdCopyVec3 ( dst->xyz, src->xyz ) ; + sgdCopyVec3 ( dst->hpr, src->hpr ) ; +} + + + +inline void sgdCopyMat4 ( sgdMat4 dst, const sgdMat4 src ) +{ + sgdCopyVec4 ( dst[ 0 ], src[ 0 ] ) ; + sgdCopyVec4 ( dst[ 1 ], src[ 1 ] ) ; + sgdCopyVec4 ( dst[ 2 ], src[ 2 ] ) ; + sgdCopyVec4 ( dst[ 3 ], src[ 3 ] ) ; +} + + +inline void sgdScaleMat4 ( sgdMat4 dst, const sgdMat4 src, const SGDfloat scale ) +{ + sgdScaleVec4 ( dst[0], src[0], scale ) ; + sgdScaleVec4 ( dst[1], src[1], scale ) ; + sgdScaleVec4 ( dst[2], src[2], scale ) ; + sgdScaleVec4 ( dst[3], src[3], scale ) ; +} + + +inline void sgdMakeIdentMat4 ( sgdMat4 dst ) +{ + sgdSetVec4 ( dst[0], SGD_ONE , SGD_ZERO, SGD_ZERO, SGD_ZERO ) ; + sgdSetVec4 ( dst[1], SGD_ZERO, SGD_ONE , SGD_ZERO, SGD_ZERO ) ; + sgdSetVec4 ( dst[2], SGD_ZERO, SGD_ZERO, SGD_ONE , SGD_ZERO ) ; + sgdSetVec4 ( dst[3], SGD_ZERO, SGD_ZERO, SGD_ZERO, SGD_ONE ) ; +} + +extern int sgdCompare3DSqdDist ( const sgdVec3 a, const sgdVec3 b, const SGDfloat sqd_dist ) ; +extern void sgdMakeTransMat4 ( sgdMat4 m, const SGDfloat x, const SGDfloat y, const SGDfloat z ) ; +extern void sgdMakeTransMat4 ( sgdMat4 m, const sgdVec3 xyz ) ; +extern void sgdMakeCoordMat4 ( sgdMat4 m, const SGDfloat x, const SGDfloat y, const SGDfloat z, + const SGDfloat h, const SGDfloat p, const SGDfloat r ) ; +extern void sgdMakeCoordMat4 ( sgdMat4 m, const sgdCoord *c ) ; + +inline SGDfloat sgdDistToLineVec2 ( const sgdVec3 line, const sgdVec2 pnt ) +{ + return sgdScalarProductVec2 ( line, pnt ) + line[2] ; +} + +inline SGDfloat sgdDistToPlaneVec3 ( const sgdVec4 plane, const sgdVec3 pnt ) +{ + return sgdScalarProductVec3 ( plane, pnt ) + plane[3] ; +} + +inline SGDfloat sgdHeightAbovePlaneVec3 ( const sgdVec4 plane, const sgdVec3 pnt ) +{ + return pnt[3] - sgdHeightOfPlaneVec2 ( plane, pnt ) ; +} + +extern void sgdReflectInPlaneVec3 ( sgdVec3 dst, const sgdVec3 src, const sgdVec4 plane ) ; + +inline void sgdReflectInPlaneVec3 ( sgdVec3 dst, const sgdVec4 plane ) +{ + sgdReflectInPlaneVec3 ( dst, dst, plane ) ; +} + +extern void sgdMakeNormal ( sgdVec3 dst, const sgdVec3 a, const sgdVec3 b, const sgdVec3 c ) ; + +inline void sgdMake2DLine ( sgdVec3 dst, const sgdVec2 a, const sgdVec2 b ) +{ + dst[0] = b[1]-a[1] ; + dst[1] = -b[0]-a[0] ; + sgdNormalizeVec2 ( dst ) ; + dst[2] = - ( dst[0]*a[0] + dst[1]*a[1] ) ; +} + +inline void sgdMakePlane ( sgdVec4 dst, const sgdVec3 normal, const sgdVec3 pnt ) +{ + sgdCopyVec3 ( dst, normal ) ; + dst [ 3 ] = - sgdScalarProductVec3 ( normal, pnt ) ; +} + +inline void sgdMakePlane ( sgdVec4 dst, const sgdVec3 a, const sgdVec3 b, const sgdVec3 c ) +{ + /* + Ax + By + Cz + D == 0 ; + D = - ( Ax + By + Cz ) + = - ( A*a[0] + B*a[1] + C*a[2] ) + = - sgdScalarProductVec3 ( normal, a ) ; + */ + + sgdMakeNormal ( dst, a, b, c ) ; + + dst [ 3 ] = - sgdScalarProductVec3 ( dst, a ) ; +} + + + + +class sgdSphere +{ + sgdVec3 center ; + SGDfloat radius ; +public: + + const SGDfloat *getCenter (void) const { return center ; } + + void setCenter ( const sgdVec3 c ) + { + sgdCopyVec3 ( center, c ) ; + } + + void setCenter ( const SGDfloat x, const SGDfloat y, const SGDfloat z ) + { + sgdSetVec3 ( center, x, y, z ) ; + } + + SGDfloat getRadius (void) const { return radius ; } + void setRadius ( const SGDfloat r ) { radius = r ; } + + int isEmpty (void) const { return radius < SGD_ZERO ; } + void empty (void) { radius = - SGD_ONE ; } + + void orthoXform ( const sgdMat4 m ) + { + sgdXformPnt3 ( center, center, m ) ; + // radius *= sgdLengthVec3 ( m[0] ) ; + } + + void extend ( const sgdSphere *s ) ; + void extend ( const sgdBox *b ) ; + void extend ( const sgdVec3 v ) ; + + int intersects ( const sgdSphere *s ) const + { + return sgdCompare3DSqdDist ( center, s->getCenter(), + sgdSquare ( radius + s->getRadius() ) ) <= 0 ; + } + + int intersects ( const sgdVec4 plane ) const + { + return sgdAbs ( sgdDistToPlaneVec3 ( plane, center ) ) <= radius ; + } + + int intersects ( const sgdBox *b ) const ; +} ; + + +class sgdBox +{ + sgdVec3 min ; + sgdVec3 max ; + +public: + + const SGDfloat *getMin (void) const { return min ; } + const SGDfloat *getMax (void) const { return max ; } + + void setMin ( const SGDfloat x, const SGDfloat y, const SGDfloat z ) + { + sgdSetVec3 ( min, x, y, z ) ; + } + + void setMin ( const sgdVec3 src ) + { + sgdCopyVec3 ( min, src ) ; + } + + void setMax ( const SGDfloat x, const SGDfloat y, const SGDfloat z ) + { + sgdSetVec3 ( max, x, y, z ) ; + } + + void setMax ( const sgdVec3 src ) + { + sgdCopyVec3 ( max, src ) ; + } + + int isEmpty(void) const + { + return ( min[0] > max[0] || + min[1] > max[1] || + min[2] > max[2] ) ; + } + + void empty (void) + { + sgdSetVec3 ( min, SGD_MAX, SGD_MAX, SGD_MAX ) ; + sgdSetVec3 ( max, -SGD_MAX, -SGD_MAX, -SGD_MAX ) ; + } + + void extend ( const sgdSphere *s ) ; + void extend ( const sgdBox *b ) ; + void extend ( const sgdVec3 v ) ; + + int intersects ( const sgdSphere *s ) const + { + return s -> intersects ( this ) ; + } + + int intersects ( const sgdBox *b ) const + { + return min[0] <= b->getMax()[0] && max[0] >= b->getMin()[0] && + min[1] <= b->getMax()[1] && max[1] >= b->getMin()[1] && + min[2] <= b->getMax()[2] && max[2] >= b->getMin()[2] ; + } + + int intersects ( const sgdVec4 plane ) const ; +} ; + +#define SGD_NEAR 0x10 +#define SGD_FAR 0x20 +#define SGD_TOP 0x30 +#define SGD_BOT 0x40 +#define SGD_LEFT 0x50 +#define SGD_RIGHT 0x60 + +class sgdFrustum +{ + /* The parameters for a glFrustum or pfMakePerspFrust */ + + SGDfloat left, right, top, bot, nnear, ffar ; + + /* The A,B,C terms of the plane equations of the four sloping planes */ + + sgdVec3 top_plane, bot_plane, left_plane, right_plane ; + + /* A GL/PF-style perspective matrix for this frustum */ + + sgdMat4 mat ; + + /* These two are only valid for simple frusta */ + + SGDfloat hfov ; /* Horizontal Field of View */ + SGDfloat vfov ; /* Vertical Field of View */ + + void update (void) ; + int getOutcode ( const sgdVec4 src ) const ; + +public: + + sgdFrustum (void) + { + nnear = SGD_ONE ; + ffar = 1000000.0f ; + hfov = SGD_45 ; + vfov = SGD_45 ; + update () ; + } + + void setFrustum ( const SGDfloat l, const SGDfloat r, + const SGDfloat b, const SGDfloat t, + const SGDfloat n, const SGDfloat f ) + { + left = l ; right = r ; + top = t ; bot = b ; + nnear = n ; ffar = f ; + hfov = vfov = SGD_ZERO ; + update () ; + } + + SGDfloat getHFOV (void) const { return hfov ; } + SGDfloat getVFOV (void) const { return vfov ; } + SGDfloat getNear (void) const { return nnear ; } + SGDfloat getFar (void) const { return ffar ; } + SGDfloat getLeft (void) const { return left ; } + SGDfloat getRight(void) const { return right ; } + SGDfloat getTop (void) const { return top ; } + SGDfloat getBot (void) const { return bot ; } + + void getFOV ( SGDfloat *h, SGDfloat *v ) const + { + if ( h != (SGDfloat *) 0 ) *h = hfov ; + if ( v != (SGDfloat *) 0 ) *v = vfov ; + } + + void setFOV ( const SGDfloat h, const SGDfloat v ) + { + hfov = ( h <= 0 ) ? ( v * SGD_THREE / SGD_TWO ) : h ; + vfov = ( v <= 0 ) ? ( h * SGD_TWO / SGD_THREE ) : v ; + update () ; + } + + void getNearFar ( SGDfloat *n, SGDfloat *f ) const + { + if ( n != (SGDfloat *) 0 ) *n = nnear ; + if ( f != (SGDfloat *) 0 ) *f = ffar ; + } + + void setNearFar ( const SGDfloat n, const SGDfloat f ) + { + nnear = n ; + ffar = f ; + update () ; + } + + int contains ( const sgdVec3 p ) const ; + int contains ( const sgdSphere *s ) const ; +} ; + + +/* + Quaternion routines are Copyright (C) 1999 + Kevin B. Thompson + Modified by Sylvan W. Clebsch + Largely rewritten by "Negative0" +*/ + +/* + Quaternion structure w = real, (x, y, z) = vector + CHANGED sqQuat to float array so that syntax matches + vector and matrix routines +*/ + + +inline void sgdMakeIdentQuat ( sgdQuat dst ) +{ + sgdSetVec4 ( dst, SGD_ZERO, SGD_ZERO, SGD_ZERO, SGD_ONE ) ; +} + + +inline void sgdSetQuat ( sgdQuat dst, + const SGDfloat w, const SGDfloat x, + const SGDfloat y, const SGDfloat z ) +{ + sgdSetVec4 ( dst, x, y, z, w ) ; +} + +inline void sgdCopyQuat ( sgdQuat dst, const sgdQuat src ) +{ + sgdCopyVec4 ( dst, src ) ; +} + + +/* Construct a unit quaternion (length==1) */ + +inline void sgdNormaliseQuat ( sgdQuat dst, const sgdQuat src ) +{ + SGDfloat d = sgdScalarProductVec4 ( src, src ) ; + + d = (d > SGD_ZERO) ? (SGD_ONE / sgdSqrt ( d )) : SGD_ONE ; + + sgdScaleVec4 ( dst, src, d ) ; +} + + + +inline void sgdNormaliseQuat ( sgdQuat dst ) { sgdNormaliseQuat ( dst, dst ) ; } + + +inline void sgdInvertQuat ( sgdQuat dst, const sgdQuat src ) +{ + SGDfloat d = sgdScalarProductVec4 ( src, src ) ; + + d = ( d == SGD_ZERO ) ? SGD_ONE : ( SGD_ONE / d ) ; + + dst[SG_W] = src[SG_W] * d ; + dst[SG_X] = -src[SG_X] * d ; + dst[SG_Y] = -src[SG_Y] * d ; + dst[SG_Z] = -src[SG_Z] * d ; +} + +inline void sgdInvertQuat ( sgdQuat dst ) { sgdInvertQuat ( dst, dst ) ; } + + +/* Make an angle and axis of rotation from a Quaternion. */ + +void sgdQuatToAngleAxis ( SGDfloat *angle, sgdVec3 axis, const sgdQuat src ) ; +void sgdQuatToAngleAxis ( SGDfloat *angle, + SGDfloat *x, SGDfloat *y, SGDfloat *z, + const sgdQuat src ) ; + +/* Make a quaternion from a given angle and axis of rotation */ + +void sgdAngleAxisToQuat ( sgdQuat dst, + const SGDfloat angle, const sgdVec3 axis ) ; +void sgdAngleAxisToQuat ( sgdQuat dst, + const SGDfloat angle, + const SGDfloat x, const SGDfloat y, const SGDfloat z ); + +/* Convert a matrix to/from a quat */ + +void sgdMatrixToQuat ( sgdQuat quat, const sgdMat4 m ) ; +void sgdQuatToMatrix ( sgdMat4 m, const sgdQuat quat ) ; + +/* Convert a set of eulers to/from a quat */ + +void sgdQuatToEuler( sgdVec3 hpr, const sgdQuat quat ) ; +void sgdEulerToQuat( sgdQuat quat, const sgdVec3 hpr ) ; + +inline void sgdEulerToQuat( sgdQuat dst, + SGDfloat h, SGDfloat p, SGDfloat r ) +{ + sgdVec3 hpr ; + + sgdSetVec3 ( hpr, h, p, r ) ; + + sgdEulerToQuat( dst, hpr ) ; +} + +inline void sgdHPRToQuat ( sgdQuat dst, SGDfloat h, SGDfloat p, SGDfloat r ) +{ + sgdVec3 hpr; + + hpr[0] = h * SGD_DEGREES_TO_RADIANS ; + hpr[1] = p * SGD_DEGREES_TO_RADIANS ; + hpr[2] = r * SGD_DEGREES_TO_RADIANS ; + + sgdEulerToQuat( dst, hpr ) ; +} + +inline void sgdHPRToQuat ( sgdQuat dst, const sgdVec3 hpr ) +{ + sgdVec3 tmp ; + + sgdScaleVec3 ( tmp, hpr, SGD_DEGREES_TO_RADIANS ) ; + + sgdEulerToQuat ( dst, tmp ) ; +}; + +/* Multiply quaternions together (concatenate rotations) */ + +void sgdMultQuat ( sgdQuat dst, const sgdQuat a, const sgdQuat b ) ; + +inline void sgdPostMultQuat ( sgdQuat dst, const sgdQuat q ) +{ + sgdQuat r ; + + sgdCopyQuat ( r, dst ) ; + sgdMultQuat ( dst, r, q ) ; +} + +inline void sgdPreMultQuat ( sgdQuat dst, const sgdQuat q ) +{ + sgdQuat r ; + + sgdCopyQuat ( r, dst ) ; + sgdMultQuat ( dst, q, r ) ; +} + + +/* Rotate a quaternion by a given angle and axis (convenience function) */ + + +inline void sgdRotQuat ( sgdQuat dst, const SGDfloat angle, const sgdVec3 axis ) +{ + sgdQuat q ; + + sgdAngleAxisToQuat ( q, angle, axis ) ; + sgdPostMultQuat ( dst, q ) ; + sgdNormaliseQuat ( dst ) ; +} + + +inline void sgdRotQuat ( sgdQuat dst, + const SGDfloat angle, + const SGDfloat x, const SGDfloat y, const SGDfloat z ) +{ + sgdVec3 axis ; + + sgdSetVec3 ( axis, x, y, z ) ; + sgdRotQuat ( dst, angle, axis ) ; +} + +/* SWC - Interpolate between to quaternions */ + +extern void sgdSlerpQuat ( sgdQuat dst, + const sgdQuat from, const sgdQuat to, + const SGDfloat t ) ; + + +/* Conversions between sg and sgd types. */ + +inline void sgSetVec2 ( sgVec2 dst, sgdVec2 src ) +{ + dst [ 0 ] = (SGfloat) src [ 0 ] ; + dst [ 1 ] = (SGfloat) src [ 1 ] ; +} + +inline void sgSetVec3 ( sgVec3 dst, sgdVec3 src ) +{ + dst [ 0 ] = (SGfloat) src [ 0 ] ; + dst [ 1 ] = (SGfloat) src [ 1 ] ; + dst [ 2 ] = (SGfloat) src [ 2 ] ; +} + +inline void sgSetVec4 ( sgVec4 dst, sgdVec4 src ) +{ + dst [ 0 ] = (SGfloat) src [ 0 ] ; + dst [ 1 ] = (SGfloat) src [ 1 ] ; + dst [ 2 ] = (SGfloat) src [ 2 ] ; + dst [ 3 ] = (SGfloat) src [ 3 ] ; +} + +inline void sgdSetVec2 ( sgdVec2 dst, sgVec2 src ) +{ + dst [ 0 ] = (SGDfloat) src [ 0 ] ; + dst [ 1 ] = (SGDfloat) src [ 1 ] ; +} + +inline void sgdSetVec3 ( sgdVec3 dst, sgVec3 src ) +{ + dst [ 0 ] = (SGDfloat) src [ 0 ] ; + dst [ 1 ] = (SGDfloat) src [ 1 ] ; + dst [ 2 ] = (SGDfloat) src [ 2 ] ; +} + +inline void sgdSetVec4 ( sgdVec4 dst, sgVec4 src ) +{ + dst [ 0 ] = (SGDfloat) src [ 0 ] ; + dst [ 1 ] = (SGDfloat) src [ 1 ] ; + dst [ 2 ] = (SGDfloat) src [ 2 ] ; + dst [ 3 ] = (SGDfloat) src [ 3 ] ; +} + + +inline void sgSetMat4 ( sgMat4 dst, sgdMat4 src ) +{ + sgSetVec4 ( dst [ 0 ], src [ 0 ] ) ; + sgSetVec4 ( dst [ 1 ], src [ 1 ] ) ; + sgSetVec4 ( dst [ 2 ], src [ 2 ] ) ; + sgSetVec4 ( dst [ 3 ], src [ 3 ] ) ; +} + + +inline void sgdSetMat4 ( sgdMat4 dst, sgMat4 src ) +{ + sgdSetVec4 ( dst [ 0 ], src [ 0 ] ) ; + sgdSetVec4 ( dst [ 1 ], src [ 1 ] ) ; + sgdSetVec4 ( dst [ 2 ], src [ 2 ] ) ; + sgdSetVec4 ( dst [ 3 ], src [ 3 ] ) ; +} + + +inline void sgSetCoord ( sgCoord *dst, sgdCoord *src ) +{ + sgSetVec3 ( dst->xyz, src->xyz ) ; + sgSetVec3 ( dst->hpr, src->hpr ) ; +} + + +inline void sgdSetCoord ( sgdCoord *dst, sgCoord *src ) +{ + sgdSetVec3 ( dst->xyz, src->xyz ) ; + sgdSetVec3 ( dst->hpr, src->hpr ) ; +} + +inline void sgSetQuat ( sgQuat dst, sgdQuat src ) +{ + sgSetVec4 ( dst, src ) ; +} + + + +inline void sgdSetQuat ( sgdQuat dst, sgQuat src ) +{ + sgdSetVec4 ( dst, src ) ; +} + + + +#endif + diff --git a/SDK/LIBS/dcinclude/dcplib/ul.h b/SDK/LIBS/dcinclude/dcplib/ul.h new file mode 100644 index 00000000..f1744e46 --- /dev/null +++ b/SDK/LIBS/dcinclude/dcplib/ul.h @@ -0,0 +1,61 @@ +/* + PLIB - A Suite of Portable Game Libraries + Copyright (C) 2001 Steve Baker + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For further information visit http://plib.sourceforge.net + + $Id: ul.h,v 1.1 2003/02/27 03:46:29 bardtx Exp $ +*/ + +// +// UL - utility library +// +// Contains: +// - necessary system includes +// - basic types +// - error message routines +// - high performance clocks +// - more to come (endian support, version ID) +// + +// emasculated to only include error message routines - all that is needed (I think) for SG and FNT. PSH + +#ifndef _INCLUDED_UL_H_ +#define _INCLUDED_UL_H_ + +/* + Error handler. +*/ + +enum ulSeverity +{ + UL_DEBUG, // Messages that can safely be ignored. + UL_WARNING, // Messages that are important. + UL_FATAL, // Errors that we cannot recover from. + UL_MAX_SEVERITY +} ; + + +typedef void (*ulErrorCallback) ( enum ulSeverity severity, char* msg ) ; + +void ulSetError ( enum ulSeverity severity, const char *fmt, ... ) ; +char* ulGetError ( void ) ; +void ulClearError ( void ) ; +ulErrorCallback ulGetErrorCallback ( void ) ; +void ulSetErrorCallback ( ulErrorCallback cb ) ; + +#endif diff --git a/SDK/LIBS/dcinclude/endian.h b/SDK/LIBS/dcinclude/endian.h new file mode 100644 index 00000000..19a6f4b4 --- /dev/null +++ b/SDK/LIBS/dcinclude/endian.h @@ -0,0 +1,123 @@ +/* + * This module was ported from the BSD 4.5 libc by Dan Potter. Please + * see "README.BSD" in "docs" for more information. + * + * $Id: endian.h,v 1.2 2003/04/24 03:18:08 bardtx Exp $ + */ + +/* + * Copyright (c) 1987, 1991 Regents of the University of California. + * 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. + * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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. + * + * from: @(#)endian.h 7.8 (Berkeley) 4/3/91 + * $FreeBSD: src/sys/i386/include/endian.h,v 1.18 1999/12/29 04:33:01 peter Exp $ + */ + +#ifndef _MACHINE_ENDIAN_H_ +#define _MACHINE_ENDIAN_H_ + +#include + +/* + * Define the order of 32-bit words in 64-bit words. + */ +#define _QUAD_HIGHWORD 1 +#define _QUAD_LOWWORD 0 + +#ifndef _POSIX_SOURCE + +/* + * Definitions for byte order, according to byte significance from low + * address to high. + */ +#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ +#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ +#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */ + +#define BYTE_ORDER LITTLE_ENDIAN + +#ifndef _KERNEL +#include +#endif + +__BEGIN_DECLS +unsigned long htonl __P((unsigned long)); +unsigned short htons __P((unsigned short)); +unsigned long ntohl __P((unsigned long)); +unsigned short ntohs __P((unsigned short)); +__END_DECLS + +#define __word_swap_long(x) \ +__extension__ ({ register u_long __X = (x); \ + __asm ("rorl $16, %1" \ + : "=r" (__X) \ + : "0" (__X)); \ + __X; }) + +#if defined(_KERNEL) && (defined(I486_CPU) || defined(I586_CPU) || defined(I686_CPU)) && !defined(I386_CPU) + +#define __byte_swap_long(x) \ +__extension__ ({ register u_long __X = (x); \ + __asm ("bswap %0" \ + : "=r" (__X) \ + : "0" (__X)); \ + __X; }) +#else + +#define __byte_swap_long(x) \ +__extension__ ({ register u_long __X = (x); \ + __asm ("xchgb %h1, %b1\n\trorl $16, %1\n\txchgb %h1, %b1" \ + : "=q" (__X) \ + : "0" (__X)); \ + __X; }) +#endif + +#define __byte_swap_word(x) \ +__extension__ ({ register u_short __X = (x); \ + __asm ("xchgb %h1, %b1" \ + : "=q" (__X) \ + : "0" (__X)); \ + __X; }) + +/* + * Macros for network/external number representation conversion. + */ +/* #ifdef __GNUC__ +#define ntohl __byte_swap_long +#define ntohs __byte_swap_word +#define htonl __byte_swap_long +#define htons __byte_swap_word +#endif */ + +#define NTOHL(x) ((x) = ntohl((u_long)(x))) +#define NTOHS(x) ((x) = ntohs((u_short)(x))) +#define HTONL(x) ((x) = htonl((u_long)(x))) +#define HTONS(x) ((x) = htons((u_short)(x))) + +#endif /* ! _POSIX_SOURCE */ + +#endif /* !_MACHINE_ENDIAN_H_ */ diff --git a/SDK/LIBS/dcinclude/errno.h b/SDK/LIBS/dcinclude/errno.h new file mode 100644 index 00000000..29690937 --- /dev/null +++ b/SDK/LIBS/dcinclude/errno.h @@ -0,0 +1,10 @@ +#ifndef __ERRNO_H +#define __ERRNO_H + +/* Temporary stand-in for now to make libm happy */ + +#define EDOM -1 +#define ERANGE -2 +extern int errno; + +#endif diff --git a/SDK/LIBS/dcinclude/imageload/imageload.h b/SDK/LIBS/dcinclude/imageload/imageload.h new file mode 100644 index 00000000..bbe82cb4 --- /dev/null +++ b/SDK/LIBS/dcinclude/imageload/imageload.h @@ -0,0 +1,81 @@ +#ifndef __IMAGELOAD_H__ +#define __IMAGELOAD_H__ + +#include +#include + +#include + +typedef enum +{ + IMG_FILE_GUESS, + IMG_FILE_JPEG, + IMG_FILE_PNG, + IMG_FILE_BMP, + IMG_FILE_PCX +} IMG_FILE; + +typedef enum +{ + IMG_ALPHA_NONE, + IMG_ALPHA_MASK, + IMG_ALPHA_KEYED, + IMG_ALPHA_FULL +} IMG_ALPHA; + +typedef enum +{ + IMG_DITHER_NONE, + IMG_DITHER_JITTER +} IMG_DITHER; + + +typedef struct +{ + IMG_FILE type; + IMG_ALPHA alpha; + uint32 key; + IMG_DITHER dither; + uint32 dither_width; + uint32 dither_height; + uint32 noise; +} IMG_INFO; + +#define IMG_INFO_DEFAULTS {IMG_FILE_GUESS,IMG_ALPHA_NONE,0,IMG_DITHER_NONE,0,0,0} + +/* At some point these functions will return success/failure */ +int img_load_data(FILE *f, IMG_INFO *info, kos_img_t *img); + +int img_load_file(const char *filename, IMG_INFO *info, kos_img_t *img); + +/* Jitter Functions */ + +/* Call to initialize jitter table at runtime + * if you run the makejitter program before you compile, you can + * create a jitter table at compile time + */ +void jitter_init(void); +uint8 jitter(uint8 c, uint8 n, uint8 shift, uint8 noise, uint16 x, uint16 y); + +/* Format specific loaders */ + +uint32 readbmp_init(FILE *infile); +uint8 *readbmp_get_image(uint32 *pChannels, uint32 *pRowbytes, + uint32 *pWidth, uint32 *pHeight); +void readbmp_cleanup(void); + +uint32 readpng_init(FILE *infile); +uint8 *readpng_get_image(uint32 *pChannels, uint32 *pRowbytes, + uint32 *pWidth, uint32 *pHeight); +void readpng_cleanup(void); + +uint32 readjpeg_init(FILE *infile); +uint8 *readjpeg_get_image(uint32 *pChannels, uint32 *pRowbytes, + uint32 *pWidth, uint32 *pHeight); +void readjpeg_cleanup(void); + +uint32 readpcx_init(FILE *infile); +uint8 *readpcx_get_image(uint32 *pChannels, uint32 *pRowbytes, + uint32 *pWidth, uint32 *pHeight); +void readpcx_cleanup(void); +#endif diff --git a/SDK/LIBS/dcinclude/imageload/jitterdefs.h b/SDK/LIBS/dcinclude/imageload/jitterdefs.h new file mode 100644 index 00000000..74c100cc --- /dev/null +++ b/SDK/LIBS/dcinclude/imageload/jitterdefs.h @@ -0,0 +1,12 @@ +#ifndef __JITTERDEFS_H__ +#define __JITTERDEFS_H__ + +#define LARGE_NUMBER 1024 +#define JITTER_TABLE_SIZE 1024 +#define JITTER_MASK (JITTER_TABLE_SIZE-1) + +extern int ijitter[]; +extern float ujitter[]; +extern float vjitter[]; + +#endif diff --git a/SDK/LIBS/dcinclude/jpeg/jpeg.h b/SDK/LIBS/dcinclude/jpeg/jpeg.h new file mode 100644 index 00000000..7a69f7f7 --- /dev/null +++ b/SDK/LIBS/dcinclude/jpeg/jpeg.h @@ -0,0 +1,30 @@ +/* KallistiOS 1.2.0 + + jpeg.h + (c)2001 Dan Potter + + $Id: jpeg.h,v 1.1 2003/02/27 03:46:29 bardtx Exp $ +*/ + +#ifndef __JPEG_JPEG_H +#define __JPEG_JPEG_H + +#include +__BEGIN_DECLS + +#include + +#ifdef _arch_dreamcast + #include + + /* Load a JPEG file into a texture; returns 0 for success, -1 for failure. */ + int jpeg_to_texture(const char * filename, pvr_ptr_t tex, int size, int scale); +#endif + +/* Load a JPEG into a KOS PIImage */ +int jpeg_to_img(const char *filename, int scale, kos_img_t *rv); + +__END_DECLS + +#endif /* __JPEG_JPEG_H */ + diff --git a/SDK/LIBS/dcinclude/kmg/kmg.h b/SDK/LIBS/dcinclude/kmg/kmg.h new file mode 100644 index 00000000..a10e9e3f --- /dev/null +++ b/SDK/LIBS/dcinclude/kmg/kmg.h @@ -0,0 +1,80 @@ +/* KallistiOS 1.2.0 + + kmg/kmg.h + Copyrigh (C)2003 Dan Potter + + $Id: kmg.h,v 1.2 2003/04/24 02:52:42 bardtx Exp $ + +*/ + +#ifndef __KMG_KMG_H +#define __KMG_KMG_H + +#ifdef _arch_dreamcast +# include + __BEGIN_DECLS + +# include +#else + +#ifdef NEED_KOS_TYPES +typedef unsigned char uint8; +typedef unsigned short uint16; +typedef unsigned long uint32; +#endif + +#endif + + +/* Header for KMG files. This isn't particularly meant to be future-proof + since generally you'll build your textures into this format and then + pair that data with an executable build. For safety though, we go ahead + and put a version number anyway. All fields are _little endian_. */ +typedef struct kmg_header { + uint32 magic; /* Magic code */ + uint32 version; /* Version code */ + uint32 platform; /* Platform specifier (major format) */ + uint32 format; /* Image (minor) format spec */ + uint32 width; /* Image width */ + uint32 height; /* Image height */ + uint32 byte_count; /* Image's data size in bytes */ + uint8 padding[36]; /* Pad to a 64-byte header (all zeros) */ +} kmg_header_t; + +/* Magic code -- every KMG will start with one of these. */ +#define KMG_MAGIC 0x00474d4b /* 'KMG\0' */ + +/* Version specifier -- for this version of the lib. A new version + means the files are incompatible. */ +#define KMG_VERSION 1 + +/* Platform specifiers */ +#define KMG_PLAT_DC 1 +#define KMG_PLAT_GBA 2 +#define KMG_PLAT_PS2 3 + +/* Format specifiers for DC */ +#define KMG_DCFMT_4BPP_PAL 0x01 /* Paletted formats */ +#define KMG_DCFMT_8BPP_PAL 0x02 +#define KMG_DCFMT_RGB565 0x03 /* True-color formats */ +#define KMG_DCFMT_ARGB4444 0x04 +#define KMG_DCFMT_ARGB1555 0x05 +#define KMG_DCFMT_YUV422 0x06 +#define KMG_DCFMT_BUMP 0x07 +#define KMG_DCFMT_MASK 0xff + +#define KMG_DCFMT_VQ 0x0100 /* VQ-encoded (incl codebook) */ +#define KMG_DCFMT_TWIDDLED 0x0200 /* Pre-twiddled */ +#define KMG_DCFMT_MIPMAP 0x0400 /* Includes mipmaps */ + +#ifdef _arch_dreamcast + + /* Call to load a KMG file from the VFS. */ + int kmg_to_img(const char * fn, kos_img_t * rv); + + + __END_DECLS +#endif + +#endif /* __KMG_KMG_H */ + diff --git a/SDK/LIBS/dcinclude/kos.h b/SDK/LIBS/dcinclude/kos.h new file mode 100644 index 00000000..3e3e61ea --- /dev/null +++ b/SDK/LIBS/dcinclude/kos.h @@ -0,0 +1,98 @@ +/* KallistiOS 1.2.0 + + kos.h + (c)2001 Dan Potter + + $Id: kos.h,v 1.25 2003/05/23 02:18:45 bardtx Exp $ +*/ + +#ifndef __KOS_H +#define __KOS_H + +/* The ultimate for the truly lazy: include and go! No more figuring out + which headers to include for your project. */ + +#include +__BEGIN_DECLS + +#include +#include +#include +#include +#include + +/* These still haven't been fully ported */ +/* #include */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef _arch_dreamcast +# include + +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +#elif _arch_gba /* _arch_dreamcast */ +# include +# include +# include +# include +# include +#elif _arch_ps2 /* _arch_gba */ +# include +# include +# include +#else /* _arch_ps2 */ +# error Invalid architecture or no architecture specified +#endif + +__END_DECLS + +#endif + diff --git a/SDK/LIBS/dcinclude/kos/bspline.h b/SDK/LIBS/dcinclude/kos/bspline.h new file mode 100644 index 00000000..a94aa332 --- /dev/null +++ b/SDK/LIBS/dcinclude/kos/bspline.h @@ -0,0 +1,41 @@ +/* KallistiOS 1.2.0 + + bspline.h + (c)2000 Dan Potter + + $Id: bspline.h,v 1.1 2002/09/05 07:31:55 bardtx Exp $ +*/ + +#ifndef __KOS_BSPLINE_H +#define __KOS_BSPLINE_H + +#include +__BEGIN_DECLS + +/** \file + This module provides utility functions to generate b-spline + curves in your program. It is used by passing in a set of + control points to bspline_coeff, and then querying for + individual points using bspline_get_point. +*/ + +#include + +/** + Pass it an array of points and it will calculate a set of B-spline + co-efficients for generating a curve. There must be at least one point + before the "current" one, and at least two after the "current" one (a + total of four points required). These values will be used in the + function below. +*/ +void bspline_coeff(const point_t *pnt); + +/** + Given a 't' (between 0.0f and 1.0f) this will generate the next point + values for the current set of coefficients. +*/ +void bspline_get_point(float t, point_t *p); + +__END_DECLS + +#endif /* __KOS_BSPLINE_H */ diff --git a/SDK/LIBS/dcinclude/kos/cond.h b/SDK/LIBS/dcinclude/kos/cond.h new file mode 100644 index 00000000..119e7cce --- /dev/null +++ b/SDK/LIBS/dcinclude/kos/cond.h @@ -0,0 +1,64 @@ +/* KallistiOS 1.2.0 + + include/kos/cond.h + (c)2001 Dan Potter + + $Id: cond.h,v 1.3 2003/02/16 05:16:40 bardtx Exp $ + +*/ + +#ifndef __KOS_COND_H +#define __KOS_COND_H + +#include +__BEGIN_DECLS + +#include +#include +#include +#include + +/* Condition structure */ +typedef struct condvar { + /* List entry for the global list of condvars */ + LIST_ENTRY(condvar) g_list; +} condvar_t; + +LIST_HEAD(condlist, condvar); + +/* Allocate a new condvar; the condvar will be assigned + to the calling process and when that process dies, the condvar + will also die. */ +condvar_t *cond_create(); + +/* Free a condvar */ +void cond_destroy(condvar_t *cv); + +/* Wait on a condvar; if there is an associated mutex to unlock + while waiting, then pass that as well. */ +void cond_wait(condvar_t *cv, mutex_t * m); + +/* Wait on a condvar; if there is an associated mutex to unlock + while waiting, then pass that as well. If more than 'timeout' + milliseconds passes and we still haven't been signaled, return + an error code (-1). Return success (0) when we are woken normally. + Note: if 'timeout' is zero, this call is equivalent to + cond_wait above. */ +int cond_wait_timed(condvar_t *cv, mutex_t * m, int timeout); + +/* Signal a single thread waiting on the condvar; you should be + holding any associated mutex before doing this! */ +void cond_signal(condvar_t *cv); + +/* Signal all threads waiting on the condvar; you should be holding + any associated mutex before doing this! */ +void cond_broadcast(condvar_t *cv); + +/* Init / shutdown */ +int cond_init(); +void cond_shutdown(); + +__END_DECLS + +#endif /* __KOS_COND_H */ + diff --git a/SDK/LIBS/dcinclude/kos/fs.h b/SDK/LIBS/dcinclude/kos/fs.h new file mode 100644 index 00000000..aa332569 --- /dev/null +++ b/SDK/LIBS/dcinclude/kos/fs.h @@ -0,0 +1,189 @@ +/* KallistiOS 1.2.0 + + kos/fs.h + (c)2000-2001 Dan Potter + + $Id: fs.h,v 1.9 2002/10/01 03:19:59 bardtx Exp $ + +*/ + +#ifndef __KOS_FS_H +#define __KOS_FS_H + +#include +__BEGIN_DECLS + +#include +#include +#include +#include + +/* Directory entry; all handlers must conform to this interface */ +typedef struct dirent { + int size; + char name[MAX_FN_LEN]; + time_t time; + uint32 attr; +} dirent_t; + +/* File status information; like dirent, this is not the same as the *nix + variation but it has similar information. */ +struct vfs_handler_str; +typedef struct stat { + struct vfs_handler_str * dev; /* The VFS handler for this file/dir */ + uint32 unique; /* A unique identifier on the VFS for this file/dir */ + uint32 type; /* File/Dir type */ + uint32 attr; /* Attributes */ + off_t size; /* Total file size, if applicable */ + time_t time; /* Last access/mod/change time (depends on VFS) */ +} stat_t; + +/* stat_t.unique */ +#define STAT_UNIQUE_NONE 0 /* Constant to use denoting the file has no unique ID */ + +/* stat_t.type */ +#define STAT_TYPE_NONE 0 /* Unknown / undefined / not relevant */ +#define STAT_TYPE_FILE 1 /* Standard file */ +#define STAT_TYPE_DIR 2 /* Standard directory */ +#define STAT_TYPE_PIPE 3 /* A virtual device of some sort (pipe, socket, etc) */ +#define STAT_TYPE_META 4 /* Meta data */ + +/* stat_t.attr */ +#define STAT_ATTR_NONE 0x00 /* No attributes */ +#define STAT_ATTR_R 0x01 /* Read-capable */ +#define STAT_ATTR_W 0x02 /* Write-capable */ +#define STAT_ATTR_RW (STAT_ATTR_R | STAT_ATTR_W) /* Read/Write capable */ + +/* File handle type */ +typedef uint32 file_t; + +/* Invalid file handle constant (for open failure, etc) */ +#define FILEHND_INVALID ((file_t)0) + +/* Pre-define list types */ +struct vfs_handler; +typedef LIST_HEAD(vfs_list, vfs_handler) vfs_list_t; + +/* List entry initializer for static structs */ +#define VFS_LIST_INIT { NULL } + +/* Handler interface; all VFS handlers must implement this interface. */ +typedef struct vfs_handler { + char prefix[MAX_FN_LEN]; /* Path prefix */ + int pid; /* Process table ID for handler (0 == static) */ + int cache; /* Allow VFS cacheing; 0=no, 1=yes */ + void * privdata; /* Pointer to private data for the handler */ + LIST_ENTRY(vfs_handler) list_ent; /* Linked list entry */ + + /* Open a file on the given VFS; return a unique identifier */ + file_t (*open)(struct vfs_handler * vfs, const char *fn, int mode); + + /* Close a previously opened file */ + void (*close)(file_t hnd); + + /* Read from a previously opened file */ + ssize_t (*read)(file_t hnd, void *buffer, size_t cnt); + + /* Write to a previously opened file */ + ssize_t (*write)(file_t hnd, const void *buffer, size_t cnt); + + /* Seek in a previously opened file */ + off_t (*seek)(file_t hnd, off_t offset, int whence); + + /* Return the current position in a previously opened file */ + off_t (*tell)(file_t hnd); + + /* Return the total size of a previously opened file */ + size_t (*total)(file_t hnd); + + /* Read the next directory entry in a directory opened with O_DIR */ + dirent_t* (*readdir)(file_t hnd); + + /* Execute a device-specific call on a previously opened file */ + int (*ioctl)(file_t hnd, void *data, size_t size); + + /* Rename/move a file on the given VFS */ + int (*rename)(struct vfs_handler * vfs, const char *fn1, const char *fn2); + + /* Delete a file from the given VFS */ + int (*unlink)(struct vfs_handler * vfs, const char *fn); + + /* "Memory map" a previously opened file */ + void* (*mmap)(file_t fd); + + /* Perform an I/O completion (async I/O) for a previously opened file */ + int (*complete)(file_t fd, ssize_t * rv); + + /* Get status information on a file on the given VFS */ + int (*stat)(struct vfs_handler * vfs, const char * fn, stat_t * rv); + + /* Make a directory on the given VFS */ + int (*mkdir)(struct vfs_handler * vfs, const char * fn); + + /* Remove a directory from the given VFS */ + int (*rmdir)(struct vfs_handler * vfs, const char * fn); +} vfs_handler_t; + + +/* Open modes */ +#define O_RDONLY 1 /* Read only */ +#define O_RDWR 2 /* Read-write */ +#define O_APPEND 3 /* Append to an existing file */ +#define O_WRONLY 4 /* Write-only */ +#define O_MODE_MASK 7 /* Mask for mode numbers */ +#define O_TRUNC 0x0100 /* Truncate */ +#define O_ASYNC 0x0200 /* Open for asynchronous I/O */ +#define O_DIR 0x1000 /* Open as directory */ +#define O_META 0x2000 /* Open as metadata */ + +/* Seek modes */ +#define SEEK_SET 0 +#define SEEK_CUR 1 +#define SEEK_END 2 + +/* Standard file functions */ +file_t fs_open(const char *fn, int mode); +void fs_close(file_t hnd); +ssize_t fs_read(file_t hnd, void *buffer, size_t cnt); +ssize_t fs_write(file_t hnd, const void *buffer, size_t cnt); +off_t fs_seek(file_t hnd, off_t offset, int whence); +off_t fs_tell(file_t hnd); +size_t fs_total(file_t hnd); +dirent_t* fs_readdir(file_t hnd); +int fs_ioctl(file_t hnd, void *data, size_t size); +int fs_rename(const char *fn1, const char *fn2); +int fs_unlink(const char *fn); +int fs_chdir(const char *fn); +void* fs_mmap(file_t hnd); +int fs_complete(file_t fd, ssize_t * rv); +int fs_stat(const char * fn, stat_t * rv); +int fs_mkdir(const char * fn); +int fs_rmdir(const char * fn); + +const char *fs_getwd(); + +/* Couple of util functions */ + +/* Copies a file from 'src' to 'dst'. The amount of the file + actually copied without error is returned. */ +ssize_t fs_copy(const char * src, const char * dst); + +/* Opens a file, allocates enough RAM to hold the whole thing, + reads it into RAM, and closes it. The caller owns the allocated + memory (and must free it). The file size is returned, or -1 + on failure; on success, out_ptr is filled with the address + of the loaded buffer, and on failure it is set to NULL. */ +ssize_t fs_load(const char * src, void ** out_ptr); + +/* Add/Remove a VFS module */ +int fs_handler_add(const char *prefix, vfs_handler_t *hnd); +int fs_handler_remove(const vfs_handler_t *hnd); + +/* VFS init */ +int fs_init(); +void fs_shutdown(); + +__END_DECLS + +#endif /* __KOS_FS_H */ + diff --git a/SDK/LIBS/dcinclude/kos/fs_builtin.h b/SDK/LIBS/dcinclude/kos/fs_builtin.h new file mode 100644 index 00000000..61998ed1 --- /dev/null +++ b/SDK/LIBS/dcinclude/kos/fs_builtin.h @@ -0,0 +1,38 @@ +/* KallistiOS 1.2.0 + + kos/fs_builtin.h + (c)2000-2001 Dan Potter + + $Id: fs_builtin.h,v 1.3 2002/08/12 18:43:53 bardtx Exp $ +*/ + +#ifndef __KOS_FS_BUILTIN_H +#define __KOS_FS_BUILTIN_H + +/* Definitions for the "built-in" file system */ + +#include +__BEGIN_DECLS + +#include +#include + +typedef struct { + char name[MAX_FN_LEN]; /* File's full path name */ + uint8 *data; /* Data for the file */ + uint32 size; /* Data size */ +} fs_builtin_ent; + + +/* Set a table */ +int fs_builtin_set_table(fs_builtin_ent *tbl, int cnt); + +/* Init func */ +int fs_builtin_init(); +int fs_builtin_shutdown(); + +__END_DECLS + +#endif /* __KOS_FS_BUILTIN_H */ + + diff --git a/SDK/LIBS/dcinclude/kos/fs_ramdisk.h b/SDK/LIBS/dcinclude/kos/fs_ramdisk.h new file mode 100644 index 00000000..0cd79bdd --- /dev/null +++ b/SDK/LIBS/dcinclude/kos/fs_ramdisk.h @@ -0,0 +1,34 @@ +/* KallistiOS 1.2.0 + + kos/fs_ramdisk.h + (c)2002 Dan Potter + + $Id: fs_ramdisk.h,v 1.2 2003/04/24 03:00:02 bardtx Exp $ +*/ + +#ifndef __KOS_FS_RAMDISK_H +#define __KOS_FS_RAMDISK_H + +#include +__BEGIN_DECLS + +#include +#include +#include + +/* Call this function to have the ramdisk fs take over a piece + of memory from you and turn it into a ramdisk file. This is handy + if you have some loaded object but need to use it as a file. + XXX Doesn't work with multiple ramdisks... do we care? */ +int fs_ramdisk_attach(const char * fn, void * obj, size_t size); + +/* Does the opposite of attach */ +int fs_ramdisk_detach(const char * fn, void ** obj, size_t * size); + +int fs_ramdisk_init(); +int fs_ramdisk_shutdown(); + +__END_DECLS + +#endif /* __KOS_FS_RAMDISK_H */ + diff --git a/SDK/LIBS/dcinclude/kos/fs_romdisk.h b/SDK/LIBS/dcinclude/kos/fs_romdisk.h new file mode 100644 index 00000000..6b6b90ae --- /dev/null +++ b/SDK/LIBS/dcinclude/kos/fs_romdisk.h @@ -0,0 +1,44 @@ +/* KallistiOS 1.2.0 + + kos/fs_romdisk.h + (c)2001 Dan Potter + + $Id: fs_romdisk.h,v 1.4 2002/08/13 04:54:22 bardtx Exp $ +*/ + +#ifndef __KOS_FS_ROMDISK_H +#define __KOS_FS_ROMDISK_H + +#include +__BEGIN_DECLS + +#include +#include +#include + +#define MAX_RD_FILES 16 + +/* Initialize the file system */ +int fs_romdisk_init(); + +/* De-init the file system; also unmounts any mounted images. */ +int fs_romdisk_shutdown(); + +/* NOTE: the mount/unmount are _not_ thread safe as regards doing multiple + mounts/unmounts in different threads at the same time, and they don't + check for open files currently either. Caveat emptor! */ + +/* Mount a romdisk image; must have called fs_romdisk_init() earlier. + Also note that we do _not_ take ownership of the image data if + own_buffer is 0, so if you malloc'd that buffer, you must + also free it after the unmount. If own_buffer is non-zero, then + we free the buffer when it is unmounted. */ +int fs_romdisk_mount(const char * mountpoint, const uint8 *img, int own_buffer); + +/* Unmount a romdisk image */ +int fs_romdisk_unmount(const char * mountpoint); + +__END_DECLS + +#endif /* __KOS_FS_ROMDISK_H */ + diff --git a/SDK/LIBS/dcinclude/kos/genwait.h b/SDK/LIBS/dcinclude/kos/genwait.h new file mode 100644 index 00000000..a8f92fd2 --- /dev/null +++ b/SDK/LIBS/dcinclude/kos/genwait.h @@ -0,0 +1,55 @@ +/* KallistiOS 1.2.0 + + include/kos/genwait.h + Copyright (c)2003 Dan Potter + + $Id: genwait.h,v 1.2 2003/02/16 04:55:24 bardtx Exp $ + +*/ + +#ifndef __KOS_GENWAIT_H +#define __KOS_GENWAIT_H + +#include +__BEGIN_DECLS + +#include +#include + +/* Sleep on the object "obj". The sleep status will be listed in any + textual displays as "mesg". If "timeout" is non-zero, then the thread + will be woken again after timeout milliseconds even if it hasn't + been signaled manually. If "callback" is non-NULL, then the given + function will be called with "obj" as its parameter if the wait + times out (but before the thread is re-scheduled). */ +int genwait_wait(void * obj, const char * mesg, int timeout, void (*callback)(void *)); + +/* Wake up N threads waiting on the given object. If cnt is <=0, then we + wake all threads. Returns the number of threads actually woken. */ +int genwait_wake_cnt(void * obj, int cnt); + +/* Wake up all threads waiting on the given object. */ +void genwait_wake_all(void * obj); + +/* Wake up one thread waiting on the given object. */ +void genwait_wake_one(void * obj); + +/* Called by the scheduler to look for timed out genwait_wait calls. + Pass the current system clock as "now". */ +void genwait_check_timeouts(uint64 now); + +/* Returns the time of the next timeout event. If there are no pending + timeout events, then we return zero. Called by the scheduler. */ +uint64 genwait_next_timeout(); + +/* Initialize the genwait system */ +int genwait_init(); + +/* Shut down the genwait system */ +void genwait_shutdown(); + + +__END_DECLS + +#endif /* __KOS_GENWAIT_H */ + diff --git a/SDK/LIBS/dcinclude/kos/img.h b/SDK/LIBS/dcinclude/kos/img.h new file mode 100644 index 00000000..5e97c328 --- /dev/null +++ b/SDK/LIBS/dcinclude/kos/img.h @@ -0,0 +1,71 @@ +/* KallistiOS 1.2.0 + + kos/img.h + (c)2002 Dan Potter + + $Id: img.h,v 1.4 2003/04/24 03:00:44 bardtx Exp $ + +*/ + +#ifndef __KOS_IMG_H +#define __KOS_IMG_H + +#include +__BEGIN_DECLS + +#include + +/* KOS Platform independent image struct; you can use this for textures or + whatever you feel it's appropriate for. "width" and "height" are as you + would expect. "format" has a lower-half which is platform independent + and used to basically describe the contained data; the upper-half is + platform dependent and can hold anything (so AND it off if you want + the bottom part). Note that in some of the more obscure formats (like + the paletted formats) the data interpretation _may_ be platform dependent. + Thus we also provide a data-length field. */ +typedef struct kos_img { + void * data; + uint32 w, h; + uint32 fmt; + uint32 byte_count; +} kos_img_t; + +/* Access to the upper and lower pieces of the format word */ +#define KOS_IMG_FMT_I(x) ((x) & 0xffff) /* Platform independent part */ +#define KOS_IMG_FMT_D(x) (((x) >> 16) & 0xffff) + +/* Macro to create a new format word */ +#define KOS_IMG_FMT(i, d) ( ((i) & 0xffff) | (((d) & 0xffff) << 16) ) + +/* Definitions for the plat independent part *************************************/ + +/* Bitmap formats */ +#define KOS_IMG_FMT_NONE 0x00 /* Undefined */ +#define KOS_IMG_FMT_RGB888 0x01 /* Interleaved r/g/b bytes (24-bit) */ +#define KOS_IMG_FMT_ARGB8888 0x02 /* Interleaved a/r/g/b bytes (32-bit) */ +#define KOS_IMG_FMT_RGB565 0x03 /* r/g/b 5/6/5 (16-bit) */ +#define KOS_IMG_FMT_ARGB4444 0x04 /* a/r/g/b 4/4/4/4 (16-bit) */ +#define KOS_IMG_FMT_ARGB1555 0x05 /* a/r/g/b 1/5/5/5 (16-bit) */ +#define KOS_IMG_FMT_PAL4BPP 0x06 /* Paletted (4-bit) */ +#define KOS_IMG_FMT_PAL8BPP 0x07 /* Paletted (8-bit) */ +#define KOS_IMG_FMT_YUV422 0x08 /* y/u/v 4/2/2 (8-bit) */ +#define KOS_IMG_FMT_BGR565 0x09 /* b/g/r 5/6/5 (16-bit) */ +#define KOS_IMG_FMT_RGBA8888 0x10 /* Interleaved r/g/b/a bytes (32-bit) */ +#define KOS_IMG_FMT_MASK 0xff + +/* Misc attributes */ +#define KOS_IMG_INVERTED_X 0x0100 /* X axis is inverted */ +#define KOS_IMG_INVERTED_Y 0x0200 /* Y axis is inverted */ +#define KOS_IMG_NOT_OWNER 0x0400 /* We don't own the buffer containing + the data (ROM or similar) */ + +/* Util functions ****************************************************************/ + +/* Free a kos_img_t which was created by an image loader; set struct_also to non-zero + if you want it to free the struct itself as well. */ +void kos_img_free(kos_img_t *img, int struct_also); + +__END_DECLS + +#endif /* __KOS_IMG_H */ + diff --git a/SDK/LIBS/dcinclude/kos/limits.h b/SDK/LIBS/dcinclude/kos/limits.h new file mode 100644 index 00000000..4480af15 --- /dev/null +++ b/SDK/LIBS/dcinclude/kos/limits.h @@ -0,0 +1,15 @@ +/* KallistiOS 1.2.0 + + kos/limits.h + (c)2000-2001 Dan Potter + + $Id: limits.h,v 1.1.1.1 2001/09/26 07:05:20 bardtx Exp $ + +*/ + +#ifndef __KOS_LIMITS_H +#define __KOS_LIMITS_H + +#define MAX_FN_LEN 256 /* Max filename length */ + +#endif /* __KOS_LIMITS_H */ diff --git a/SDK/LIBS/dcinclude/kos/msg.h b/SDK/LIBS/dcinclude/kos/msg.h new file mode 100644 index 00000000..54e16d63 --- /dev/null +++ b/SDK/LIBS/dcinclude/kos/msg.h @@ -0,0 +1,85 @@ +/* KallistiOS 1.2.0 + + include/kos/msg.h + (c)2001 Dan Potter + + $Id: msg.h,v 1.2 2002/01/05 07:23:32 bardtx Exp $ + +*/ + +#ifndef __KOS_MSG_H +#define __KOS_MSG_H + +#error This file hasn't been ported yet.. don't use it! + +#include +#include +#include + +/* Message channel handle type */ +typedef handle_t channel_t; + +#ifdef _KERNEL + +/* Allocate a new message channel; the channel will be assigned + to the calling process and when that process dies, the channel + will also die. */ +void sc_msg_chan_create(const char *name); + +/* Free a message channel */ +void sc_msg_chan_destroy(channel_t id); + +/* Open an existing message channel by name and return a handle. */ +void sc_msg_chan_open(const char *name); + +/* Close an opened message channel */ +void sc_msg_chan_close(channel_t id); + +/* Send a message on the given channel; if the channel has no + threads queued in a receive-blocked state, then the caller + will be queued in a send-blocked state. If the send + succeeds, the caller will be blocked in a reply-blocked + state. */ +void sc_msg_sendv(channel_t id, iovec_t *send, int sendcnt, + iovec_t *recv, int recvcnt); + +/* Receives a message on the given channel; if the channel has no + threads queued in a send-blocked state, then the caller + will be queued in a receive-blocked state. If the receive + succeeds, a notation will be made as to which thread to send + replies to. */ +void sc_msg_recvv(channel_t id, iovec_t *data, int iovcnt); + +/* Reply to a message on the given channel; if the channel has no + threads queued in a receive-blocked state, then an error is + returned (this should not happen normally). If the reply + succeeds, both caller and callee will be unblocked; the + code will be returned to the original sender, and optionally, + a chunk of data. */ +void sc_msg_replyv(channel_t id, int retval, iovec_t *data, int iovcnt); + +/* Free all message channels for the given process' pid */ +void msg_chan_freeall(pid_t pid); + +/* Init / Shutdown */ +int msg_init(); +void msg_shutdown(); + +#else /* _KERNEL */ + +/* Userland versions */ +channel_t msg_chan_create(const char *name); +int msg_chan_destroy(channel_t id); +channel_t msg_chan_open(const char *name); +int msg_chan_close(channel_t id); +int msg_sendv(channel_t id, iovec_t *send, int sendcnt, + iovec_t *recv, int recvcnt); +int msg_recvv(channel_t id, iovec_t *data, int iovcnt); +int msg_replyv(channel_t id, int retval, iovec_t *data, int iovcnt); + +#endif /* _KERNEL */ + +#endif /* __KOS_MSG_H */ + + + diff --git a/SDK/LIBS/dcinclude/kos/mutex.h b/SDK/LIBS/dcinclude/kos/mutex.h new file mode 100644 index 00000000..9a7fa0b8 --- /dev/null +++ b/SDK/LIBS/dcinclude/kos/mutex.h @@ -0,0 +1,45 @@ +/* KallistiOS 1.2.0 + + include/kos/mutex.h + (c)2001 Dan Potter + + $Id: mutex.h,v 1.1 2002/08/12 06:22:36 bardtx Exp $ + +*/ + +#ifndef __KOS_MUTEX_H +#define __KOS_MUTEX_H + +#include +__BEGIN_DECLS + +/* These are just wrappers around semaphores */ +#include + +typedef semaphore_t mutex_t; + +/* Create a mutex */ +mutex_t * mutex_create(); + +/* Destroy a mutex */ +void mutex_destroy(mutex_t * m); + +/* Attempt to lock the mutex; if it's busy, then block */ +void mutex_lock(mutex_t * m); + +/* Attempt to lock the mutex; if it's busy and it takes longer than the + timeout (milliseconds) then return an error. */ +int mutex_lock_timed(mutex_t * m, int timeout); + +/* Check to see whether the mutex is available; note that this is not + a threadsafe way to figure out if it _will_ be locked by the time you + get to locking it. */ +int mutex_is_locked(mutex_t * m); + +/* Unlock the mutex */ +void mutex_unlock(mutex_t * m); + +__END_DECLS + +#endif /* __KOS_MUTEX_H */ + diff --git a/SDK/LIBS/dcinclude/kos/net.h b/SDK/LIBS/dcinclude/kos/net.h new file mode 100644 index 00000000..bf47da61 --- /dev/null +++ b/SDK/LIBS/dcinclude/kos/net.h @@ -0,0 +1,202 @@ +/* KallistiOS 1.2.0 + + include/kos/net.h + (c)2002 Dan Potter + + $Id: net.h,v 1.7 2003/02/25 07:43:12 bardtx Exp $ + +*/ + +#ifndef __KOS_NET_H +#define __KOS_NET_H + +#include +__BEGIN_DECLS + +#include +#include + +/* All functions in this header return < 0 on failure, and 0 on success. */ + + + +/* Structure describing one usable network device; this is pretty ethernet + centric, though I suppose you could stuff other things into this system + like PPP. */ +typedef struct knetif { + /* Device list handle */ + LIST_ENTRY(knetif) if_list; + + /* Device name ("bba", "la", etc) */ + const char *name; + + /* Long description of the device */ + const char *descr; + + /* Unit index (starts at zero and counts upwards for multiple + network devices of the same type) */ + int index; + + /* Internal device ID (for whatever the driver wants) */ + uint32 dev_id; + + /* Interface flags */ + uint32 flags; + + /* The device's MAC address */ + uint8 mac_addr[6]; + + /* The device's IP address (if any) */ + uint8 ip_addr[4]; + + /* All of the following callback functions should return a negative + value on failure, and a zero or positive value on success. Some + functions have special values, as noted. */ + + /* Attempt to detect the device */ + int (*if_detect)(struct knetif * self); + + /* Initialize the device */ + int (*if_init)(struct knetif * self); + + /* Shutdown the device */ + int (*if_shutdown)(struct knetif * self); + + /* Start the device (after init or stop) */ + int (*if_start)(struct knetif * self); + + /* Stop (hibernate) the device */ + int (*if_stop)(struct knetif * self); + + /* Queue a packet for transmission; see special return values + below the structure */ + int (*if_tx)(struct knetif * self, const uint8 * data, int len, int blocking); + + /* Commit any queued output packets */ + int (*if_tx_commit)(struct knetif * self); + + /* Poll for queued receive packets, if neccessary */ + int (*if_rx_poll)(struct knetif * self); + + /* Set flags; you should generally manipulate flags through here so that + the driver gets a chance to act on the info. */ + int (*if_set_flags)(struct knetif * self, uint32 flags_and, uint32 flags_or); +} netif_t; + +/* Flags for netif_t */ +#define NETIF_NO_FLAGS 0x00000000 +#define NETIF_REGISTERED 0x00000001 /* Is it registered? */ +#define NETIF_DETECTED 0x00000002 /* Is it detected? */ +#define NETIF_INITIALIZED 0x00000004 /* Has it been initialized? */ +#define NETIF_RUNNING 0x00000008 /* Has start() been called? */ +#define NETIF_PROMISC 0x00010000 /* Promiscuous mode */ +#define NETIF_NEEDSPOLL 0x01000000 /* Needs to be polled for input */ + +/* Return types for if_tx */ +#define NETIF_TX_OK 0 +#define NETIF_TX_ERROR -1 +#define NETIF_TX_AGAIN -2 + +/* Blocking types */ +#define NETIF_NOBLOCK 0 +#define NETIF_BLOCK 1 + + +/* Define the list type */ +LIST_HEAD(netif_list, knetif); + + +/* Structure describing an ARP entry; each entry contains a MAC address, + an IP address, and a timestamp from 'jiffies'. The timestamp allows + aging and eventual removal. */ +typedef struct netarp { + /* ARP cache list handle */ + LIST_ENTRY(netarp) ac_list; + + /* Mac address */ + uint8 mac[6]; + + /* Associated IP address */ + uint8 ip[4]; + + /* Cache entry time; if zero, this entry won't expire */ + uint32 timestamp; +} netarp_t; + +/* Define the list type */ +LIST_HEAD(netarp_list, netarp); + +/***** net_arp.c **********************************************************/ + +/* ARP cache */ +extern struct netarp_list net_arp_cache; + + +/* Init */ +int net_arp_init(); + +/* Shutdown */ +void net_arp_shutdown(); + +/* Garbage collect timed out entries */ +int net_arp_gc(); + +/* Add an entry to the ARP cache manually */ +int net_arp_insert(netif_t *nif, uint8 mac[6], uint8 ip[4], uint32 timestamp); + +/* Look up an entry from the ARP cache; if no entry is found, then an ARP + query will be sent and an error will be returned. Thus your packet send + should also fail. Later when the transmit retries, hopefully the answer + will have arrived. */ +int net_arp_lookup(netif_t *nif, uint8 ip_in[4], uint8 mac_out[6]); + +/* Do a reverse ARP lookup: look for an IP for a given mac address; note + that if this fails, you have no recourse. */ +int net_arp_revlookup(netif_t *nif, uint8 ip_out[4], uint8 mac_in[6]); + +/* Receive an ARP packet and process it (called by net_input) */ +int net_arp_input(netif_t *nif, const uint8 *pkt, int len); + +/* Generate an ARP who-has query on the given device */ +int net_arp_query(netif_t *nif, uint8 ip[4]); + + +/***** net_input.c *********************************************************/ + +/* Type of net input callback */ +typedef int (*net_input_func)(netif_t *, const uint8 *, int); + +/* Where will input packets be routed? */ +extern net_input_func net_input_target; + +/* Device drivers should call this function to submit packets received + in the background; this function may or may not return immidiately + but it won't take an infinitely long time (so it's safe to call inside + interrupt handlers, etc) */ +int net_input(netif_t *device, const uint8 *data, int len); + +/* Setup an input target; returns the old target */ +net_input_func net_input_set_target(net_input_func t); + +/***** net_core.c *********************************************************/ + +/* Interface list; note: do not manipulate directly */ +extern struct netif_list net_if_list; + +/* Register a network device */ +int net_reg_device(netif_t *device); + +/* Unregister a network device */ +int net_unreg_device(netif_t *device); + + +/* Init */ +int net_init(); + +/* Shutdown */ +void net_shutdown(); + +__END_DECLS + +#endif /* __KOS_NET_H */ + diff --git a/SDK/LIBS/dcinclude/kos/pcx.h b/SDK/LIBS/dcinclude/kos/pcx.h new file mode 100644 index 00000000..98fa76cc --- /dev/null +++ b/SDK/LIBS/dcinclude/kos/pcx.h @@ -0,0 +1,38 @@ +/* KallistiOS 1.2.0 + + kos/pcx.h + (c)2000-2001 Dan Potter + + $Id: pcx.h,v 1.2 2002/01/05 07:23:32 bardtx Exp $ + +*/ + +#ifndef __KOS_PCX_H +#define __KOS_PCX_H + +#include +__BEGIN_DECLS + +#include + +/* These first two versions are mainly for use with the GBA, and they are + defined in the "pcx_small" file. They can be used on any architecture of + course. */ + +/* Flat 15-bit BGR load of the PCX data into whatever buffer -- assumes the + buffer is the same width as the PCX */ +int pcx_load_flat(const char *fn, int *w_out, int *h_out, void *pic_out); + +/* Palettized load of the PCX data -- the picture data will go into the + picture output buffer, and the palette will go into pal_out as + 15-bit BGR data. */ +int pcx_load_palette(const char *fn, int *w_out, int *h_out, void *pic_out, void *pal_out); + + +/* This last version is the larger memory version (for use on DC, etc) */ +/* XXX insert definition */ + +__END_DECLS + +#endif /* __KOS_PCX_H */ + diff --git a/SDK/LIBS/dcinclude/kos/sem.h b/SDK/LIBS/dcinclude/kos/sem.h new file mode 100644 index 00000000..14f9a171 --- /dev/null +++ b/SDK/LIBS/dcinclude/kos/sem.h @@ -0,0 +1,72 @@ +/* KallistiOS 1.2.0 + + include/kos/sem.h + (c)2001 Dan Potter + + $Id: sem.h,v 1.5 2003/02/14 08:08:55 bardtx Exp $ + +*/ + +#ifndef __KOS_SEM_H +#define __KOS_SEM_H + +#include +__BEGIN_DECLS + +#include +#include +#include +#include + +/* Semaphore structure definition */ +typedef struct semaphore { + /* List entry for the global list of semaphores */ + LIST_ENTRY(semaphore) g_list; + + /* Basic semaphore info */ + tid_t owner; /* Process that owns this semaphore */ + int count; /* The semaphore count */ +} semaphore_t; + +LIST_HEAD(semlist, semaphore); + +/* Allocate a new semaphore; the semaphore will be assigned + to the calling process and when that process dies, the semaphore + will also die (in theory...). */ +semaphore_t *sem_create(int value); + +/* Free a semaphore */ +void sem_destroy(semaphore_t *sem); + +/* Wait on a semaphore */ +void sem_wait(semaphore_t *sem); + +/* Wait on a semaphore, with timeout (in milliseconds); returns -1 + on failure, otherwise 0. */ +int sem_wait_timed(semaphore_t *sem, int timeout); + +/* Attempt to wait on a semaphore. If the semaphore would block, + then return an error instead of actually blocking. */ +int sem_trywait(semaphore_t *sem); + +/* Signal a semaphore */ +void sem_signal(semaphore_t *sem); + +/* Return the semaphore count */ +int sem_count(semaphore_t *sem); + +/* Free all semaphores for the given process' pid */ +void sem_freeall(int tid); + +/* Called by the periodic thread interrupt to look for timed out + sem_wait_timed calls */ +void sem_check_timeouts(); + +/* Init / shutdown */ +int sem_init(); +void sem_shutdown(); + +__END_DECLS + +#endif /* __KOS_SEM_H */ + diff --git a/SDK/LIBS/dcinclude/kos/thread.h b/SDK/LIBS/dcinclude/kos/thread.h new file mode 100644 index 00000000..937dbfbb --- /dev/null +++ b/SDK/LIBS/dcinclude/kos/thread.h @@ -0,0 +1,203 @@ +/* KallistiOS 1.2.0 + + include/kos/thread.h + Copyright (C)2000,2001,2002,2003 Dan Potter + + $Id: thread.h,v 1.11 2003/04/24 03:01:20 bardtx Exp $ + +*/ + +#ifndef __KOS_THREAD_H +#define __KOS_THREAD_H + +#include +__BEGIN_DECLS + +#include +#include +#include +#include +#include + +/* Priority values */ +#define PRIO_MAX 4096 +#define PRIO_DEFAULT 10 + +/* Pre-define list/queue types */ +struct kthread; +TAILQ_HEAD(ktqueue, kthread); +LIST_HEAD(ktlist, kthread); + +/* Structure describing one running thread */ +typedef struct kthread { + /* Thread list handle */ + LIST_ENTRY(kthread) t_list; + + /* Run/Wait queue handle */ + TAILQ_ENTRY(kthread) thdq; + + /* Timer queue handle (if applicable) */ + TAILQ_ENTRY(kthread) timerq; + + /* Kernel thread id */ + tid_t tid; + + /* Static priority: 0..PRIO_MAX (higher means lower priority) */ + prio_t prio; + + /* Flags */ + uint32 flags; + + /* Process state */ + int state; + + /* Generic wait target and message, if applicable */ + void * wait_obj; + const char * wait_msg; + + /* Wait timeout callback: if the genwait times out, this function + will be called. This allows hooks for things like fixing up + semaphore count values, etc. */ + void (*wait_callback)(void * obj); + + /* Next scheduled time; used for sleep and timed block + operations. This value is in milliseconds since the start of + timer_ms_gettime(). This should be enough for something like + 2 million years of wait time ;) */ + uint64 wait_timeout; + + /* Thread label; used when printing out a user-readable + process listing. */ + /* XXX: Move to TLS */ + char label[256]; + + /* Current file system path */ + /* XXX: Move to TLS */ + char pwd[256]; + + /* Register store; used to save thread context */ + irq_context_t context; + + /* Thread private stack; this should be a pointer to the base + of a stack page. */ + uint32 *stack; + uint32 stack_size; +} kthread_t; + +/* Thread flag values */ +#define THD_DEFAULTS 0 /* Defaults: no flags */ +#define THD_USER 1 /* Thread runs in user mode */ +#define THD_QUEUED 2 /* Thread is in the run queue */ + +/* Thread state values */ +#define STATE_ZOMBIE 0x0000 /* Waiting to die */ +#define STATE_RUNNING 0x0001 /* Process is "current" */ +#define STATE_READY 0x0002 /* Ready to be scheduled */ +#define STATE_WAIT 0x0003 /* Blocked on a genwait */ + +/* Are threads cooperative or pre-emptive? */ +extern int thd_mode; +#define THD_MODE_COOP 0 +#define THD_MODE_PREEMPT 1 + +/* Thread list; note: do not manipulate directly */ +extern struct ktlist thd_list; + +/* Run queue; note: do not manipulate directly */ +extern struct ktqueue run_queue; + +/* The currently executing thread */ +extern kthread_t *thd_current; + +/* "Jiffy" count; just counts context switches */ +/* XXX: Deprecated! */ +extern vuint32 jiffies; + +/* Blocks the calling thread and performs a reschedule as if a context + switch timer had been executed. This is useful for, e.g., blocking + on sync primitives. The param 'mycxt' should point to the calling + thread's context block. This is implemented in arch-specific code. + The meaningfulness of the return value depends on whether the + unblocker set a return value or not. */ +int thd_block_now(irq_context_t * mycxt); + +/* This function looks at the state of the system and returns a new + thread context to swap in. This is called from thd_block_now() and + from the pre-emptive context switcher. Note that thd_current might + be NULL on entering this function, if the caller blocked itself. + It is assumed that by the time this returns, the irq_srt_addr and + thd_current will be updated.*/ +irq_context_t * thd_choose_new(); + +/* Given a thread ID, locates the thread structure */ +kthread_t *thd_by_tid(tid_t tid); + +/* Enqueue a process in the runnable queue; adds it right after the + process group of the same priority if front_of_line is zero, + otherwise queues it at the front of its priority group. */ +void thd_add_to_runnable(kthread_t *t, int front_of_line); + +/* Removes a thread from the runnable queue, if it's there. */ +int thd_remove_from_runnable(kthread_t *thd); + +/* New thread function; given a routine address, it will create a + new kernel thread with a default stack. When the routine + returns, the thread will exit. Returns the new thread id. */ +kthread_t *thd_create(void (*routine)(void *param), void *param); + +/* Given a thread id, this function removes the thread from + the execution chain. */ +int thd_destroy(kthread_t *thd); + +/* Thread exit syscall (for use in user-mode processes, but can be used + anywhere). */ +void thd_exit(); + +/* Force a re-schedule; for most cases, you'll want to set front_of_line + to zero, but read the comments in kernel/thread/thread.c for more + info, especially if you need to guarantee low latencies. This just + updates irq_srt_addr and thd_current. Set 'now' to non-zero if you want + thd_schedule() to use a particular system time for checking timeouts. */ +void thd_schedule(int front_of_line, uint64 now); + +/* Force a given thread to the front of the queue */ +void thd_schedule_next(kthread_t *thd); + +/* Throw away the curren thread's timeslice */ +void thd_pass(); + +/* Sleep for a given number of milliseconds */ +void thd_sleep(int ms); + +/* Set a thread's priority value; if it is scheduled already, it will be + rescheduled with the new priority value. */ +int thd_set_prio(kthread_t *thd, prio_t prio); + +/* Return the current thread's kthread struct */ +kthread_t *thd_get_current(); + +/* Retrive / set thread label */ +const char *thd_get_label(kthread_t *thd); +void thd_set_label(kthread_t *thd, const char *label); + +/* Retrieve / set thread pwd */ +const char *thd_get_pwd(kthread_t *thd); +void thd_set_pwd(kthread_t *thd, const char *pwd); + +/* Change threading modes */ +int thd_set_mode(int mode); + +/* Wait for a thread to exit */ +int thd_wait(kthread_t * thd); + + +/* Init */ +int thd_init(int mode); + +/* Shutdown */ +void thd_shutdown(); + +__END_DECLS + +#endif /* __KOS_THREAD_H */ + diff --git a/SDK/LIBS/dcinclude/kos/vector.h b/SDK/LIBS/dcinclude/kos/vector.h new file mode 100644 index 00000000..1b6602f0 --- /dev/null +++ b/SDK/LIBS/dcinclude/kos/vector.h @@ -0,0 +1,34 @@ +/* KallistiOS 1.2.0 + + kos/vector.h + (c)2002 Dan Potter + + $Id: vector.h,v 1.1 2002/09/05 07:31:55 bardtx Exp $ + +*/ + +#ifndef __KOS_VECTOR_H +#define __KOS_VECTOR_H + +#include +__BEGIN_DECLS + +#include + +/** + KOS Platform independent 4-part vector data types. These are used by + the matrix routines in the DC, and by bsplines in misc. */ + +/* Matrix definition (4x4) */ +typedef float matrix_t[4][4]; + +/* Vector definition */ +typedef struct vector { float x, y, z, w; } vector_t; + +/* Points are just vectors */ +typedef vector_t point_t; + +__END_DECLS + +#endif /* __KOS_VECTOR_H */ + diff --git a/SDK/LIBS/dcinclude/kosh/kosh.h b/SDK/LIBS/dcinclude/kosh/kosh.h new file mode 100644 index 00000000..512e16ac --- /dev/null +++ b/SDK/LIBS/dcinclude/kosh/kosh.h @@ -0,0 +1,26 @@ +/* Libkosh for KallistiOS 1.2.0 + + kosh.h + (c)2002 Dan Potter + + $Id: kosh.h,v 1.1 2003/02/27 03:46:29 bardtx Exp $ + +*/ + +#ifndef __KOSH_KOSH_H +#define __KOSH_KOSH_H + +#include +__BEGIN_DECLS + +/** Call to begin a KOSH thread on the currently open conio. Assumes + that you've already initiated the libconio system. */ +int kosh_init(); + +/** Call to terminate the KOSH thread on the currently open conio. */ +void kosh_shutdown(); + +__END_DECLS + +#endif /* __KOSH_KOSH_H */ + diff --git a/SDK/LIBS/dcinclude/lua/lua.h b/SDK/LIBS/dcinclude/lua/lua.h new file mode 100644 index 00000000..20cacd7a --- /dev/null +++ b/SDK/LIBS/dcinclude/lua/lua.h @@ -0,0 +1,28 @@ +/* KallistiOS 1.2.0 + + lua.h + (c)2002 Dan Potter + + $Id: lua.h,v 1.1 2003/02/27 03:46:29 bardtx Exp $ +*/ + +#ifndef __LUA_LUA_H +#define __LUA_LUA_H + +#include +__BEGIN_DECLS + +/* Just include the stuff from the Lua tree */ +#include "../../addons/lua/include/lua.h" +#include "../../addons/lua/include/lauxlib.h" +#include "../../addons/lua/include/luadebug.h" +#include "../../addons/lua/include/lualib.h" + +/* And our fputs shim */ +void luaB_set_fputs(void (* fputs_target)(const char *)); + +__END_DECLS + +#endif /* __LUA_LUA_H */ + + diff --git a/SDK/LIBS/dcinclude/lwip/lwip.h b/SDK/LIBS/dcinclude/lwip/lwip.h new file mode 100644 index 00000000..773ea27d --- /dev/null +++ b/SDK/LIBS/dcinclude/lwip/lwip.h @@ -0,0 +1,46 @@ +/* KallistiOS 1.2.0 + + lwip/lwip.h + (c)2002 Dan Potter + + $Id: lwip.h,v 1.1 2003/02/27 03:46:30 bardtx Exp $ + + Note that for this to work properly, you will need to add the lwIP + include paths to your CFLAGS; see addons/lwip/Makefile. + +*/ + +#ifndef __LWIP_LWIP_H +#define __LWIP_LWIP_H + +#include +__BEGIN_DECLS + +#include "lwip/debug.h" +#include +#include "lwip/opt.h" +#include "lwip/mem.h" +#include "lwip/memp.h" +#include "lwip/sys.h" +#include "lwip/stats.h" +#include "lwip/tcpip.h" +#include "netif/kosnetdev.h" +#include "netif/loopif.h" +#include "lwip/ip_addr.h" +#include "arch/perf.h" +#include "lwip/dhcp.h" +// #include "dcload/dcload-lwip.h" + +/* Initialize lwIP using static IP address info */ +int lwip_init_static(struct ip_addr * i_ipaddr, struct ip_addr * i_netmask, struct ip_addr * i_gw); + +/* Initialize lwIP using DHCP */ +int lwip_init_dhcp(); + +/* Shut down lwIP */ +void lwip_shutdown(); + +__END_DECLS + +#endif /* __LWIP_LWIP_H */ + diff --git a/SDK/LIBS/dcinclude/malloc.h b/SDK/LIBS/dcinclude/malloc.h new file mode 100644 index 00000000..c244a720 --- /dev/null +++ b/SDK/LIBS/dcinclude/malloc.h @@ -0,0 +1,1419 @@ +/* KallistiOS 1.2.0 + + malloc.h + (c)2001 Dan Potter + + $Id: malloc.h,v 1.5 2002/11/06 07:35:06 bardtx Exp $ + + Imported from the public domain source by Doug Lea. + + */ + +#ifndef __MALLOC_H +#define __MALLOC_H + +#include +__BEGIN_DECLS + +/* KOS specific calls */ +int malloc_irq_safe(); + +/* Only available with KM_DBG */ +int mem_check_block(void *p); +int mem_check_all(); + +/* + This is a version (aka dlmalloc) of malloc/free/realloc written by + Doug Lea and released to the public domain. Use, modify, and + redistribute this code without permission or acknowledgement in any + way you wish. Send questions, comments, complaints, performance + data, etc to dl@cs.oswego.edu + +* VERSION 2.7.0 Sun Mar 11 14:14:06 2001 Doug Lea (dl at gee) + + Note: There may be an updated version of this malloc obtainable at + ftp://gee.cs.oswego.edu/pub/misc/malloc.c + Check before installing! + +* Quickstart + + This library is all in one file to simplify the most common usage: + ftp it, compile it (-O), and link it into another program. All + of the compile-time options default to reasonable values for use on + most unix platforms. Compile -DWIN32 for reasonable defaults on windows. + You might later want to step through various compile-time and dynamic + tuning options. + + For convenience, an include file for code using this malloc is at: + ftp://gee.cs.oswego.edu/pub/misc/malloc-2.7.0.h + You don't really need this .h file unless you call functions not + defined in your system include files. The .h file contains only the + excerpts from this file needed for using this malloc on ANSI C/C++ + systems, so long as you haven't changed compile-time options about + naming and tuning parameters. If you do, then you can create your + own malloc.h that does include all settings by cutting at the point + indicated below. + +* Why use this malloc? + + This is not the fastest, most space-conserving, most portable, or + most tunable malloc ever written. However it is among the fastest + while also being among the most space-conserving, portable and tunable. + Consistent balance across these factors results in a good general-purpose + allocator for malloc-intensive programs. + + The main properties of the algorithms are: + * For large (>= 512 bytes) requests, it is a pure best-fit allocator, + with ties normally decided via FIFO (i.e. least recently used). + * For small (<= 64 bytes by default) requests, it is a caching + allocator, that maintains pools of quickly recycled chunks. + * In between, and for combinations of large and small requests, it does + the best it can trying to meet both goals at once. + * For very large requests (>= 128KB by default), it relies on system + memory mapping facilities, if supported. + + For a longer but slightly out of date high-level description, see + http://gee.cs.oswego.edu/dl/html/malloc.html + + You may already by default be using a C library containing a malloc + that is based on some version of this malloc (for example in + linux). You might still want to use the one in this file in order to + customize settings or to avoid overheads associated with library + versions. + +* Contents, described in more detail in "description of public routines" below. + + Standard (ANSI/SVID/...) functions: + malloc(size_t n); + calloc(size_t n_elements, size_t element_size); + free(Void_t* p); + realloc(Void_t* p, size_t n); + memalign(size_t alignment, size_t n); + valloc(size_t n); + mallinfo() + mallopt(int parameter_number, int parameter_value) + + Additional functions: + independent_calloc(size_t n_elements, size_t size, Void_t* chunks[]); + independent_comalloc(size_t n_elements, size_t sizes[], Void_t* chunks[]); + pvalloc(size_t n); + cfree(Void_t* p); + malloc_trim(size_t pad); + malloc_usable_size(Void_t* p); + malloc_stats(); + +* Vital statistics: + + Supported pointer representation: 4 or 8 bytes + Supported size_t representation: 4 or 8 bytes + Note that size_t is allowed to be 4 bytes even if pointers are 8. + You can adjust this by defining INTERNAL_SIZE_T + + Alignment: 2 * sizeof(size_t) (default) + (i.e., 8 byte alignment with 4byte size_t). This suffices for + nearly all current machines and C compilers. However, you can + define MALLOC_ALIGNMENT to be wider than this if necessary. + + Minimum overhead per allocated chunk: 4 or 8 bytes + Each malloced chunk has a hidden word of overhead holding size + and status information. + + Minimum allocated size: 4-byte ptrs: 16 bytes (including 4 overhead) + 8-byte ptrs: 24/32 bytes (including, 4/8 overhead) + + When a chunk is freed, 12 (for 4byte ptrs) or 20 (for 8 byte + ptrs but 4 byte size) or 24 (for 8/8) additional bytes are + needed; 4 (8) for a trailing size field and 8 (16) bytes for + free list pointers. Thus, the minimum allocatable size is + 16/24/32 bytes. + + Even a request for zero bytes (i.e., malloc(0)) returns a + pointer to something of the minimum allocatable size. + + The maximum overhead wastage (i.e., number of extra bytes + allocated than were requested in malloc) is less than or equal + to the minimum size, except for requests >= mmap_threshold that + are serviced via mmap(), where the worst case wastage is 2 * + sizeof(size_t) bytes plus the remainder from a system page (the + minimal mmap unit); typically 4096 or 8192 bytes. + + Maximum allocated size: 4-byte size_t: 2^32 minus about two pages + 8-byte size_t: 2^64 minus about two pages + + It is assumed that (possibly signed) size_t values suffice to + represent chunk sizes. `Possibly signed' is due to the fact + that `size_t' may be defined on a system as either a signed or + an unsigned type. The ISO C standard says that it must be + unsigned, but a few systems are known not to adhere to this. + Additionally, even when size_t is unsigned, sbrk (which is by + default used to obtain memory from system) accepts signed + arguments, and may not be able to handle size_t-wide arguments + with negative sign bit. Generally, values that would + appear as negative after accounting for overhead and alignment + are supported only via mmap(), which does not have this + limitation. + + Requests for sizes outside the allowed range will perform an optional + failure action and then return null. (Requests may also + also fail because a system is out of memory.) + + Thread-safety: NOT thread-safe unless USE_MALLOC_LOCK defined + + When USE_MALLOC_LOCK is defined, wrappers are created to + surround every public call with either a pthread mutex or + a win32 spinlock (depending on WIN32). This is not + especially fast, and can be a major bottleneck. + It is designed only to provide minimal protection + in concurrent environments, and to provide a basis for + extensions. If you are using malloc in a concurrent program, + you would be far better off obtaining ptmalloc, which is + derived from a version of this malloc, and is well-tuned for + concurrent programs. (See http://www.malloc.de) + + Compliance: I believe it is compliant with the 1997 Single Unix Specification + (See http://www.opennc.org). Also SVID/XPG, ANSI C, and probably + others as well. + +* Synopsis of compile-time options: + + People have reported using previous versions of this malloc on all + versions of Unix, sometimes by tweaking some of the defines + below. It has been tested most extensively on Solaris and + Linux. It is also reported to work on WIN32 platforms. + People also report using it in stand-alone embedded systems. + + The implementation is in straight, hand-tuned ANSI C. It is not + at all modular. (Sorry!) It uses a lot of macros. To be at all + usable, this code should be compiled using an optimizing compiler + (for example gcc -O3) that can simplify expressions and control + paths. (FAQ: some macros import variables as arguments rather than + declare locals because people reported that some debuggers + otherwise get confused.) + + OPTION DEFAULT VALUE + + Compilation Environment options: + + __STD_C derived from C compiler defines + WIN32 NOT defined + HAVE_MEMCPY defined + USE_MEMCPY 1 if HAVE_MEMCPY is defined + HAVE_MMAP defined as 1 + MMAP_CLEARS 1 + HAVE_MREMAP 0 unless linux defined + malloc_getpagesize derived from system #includes, or 4096 if not + HAVE_USR_INCLUDE_MALLOC_H NOT defined + LACKS_UNISTD_H NOT defined unless WIN32 + LACKS_SYS_PARAM_H NOT defined unless WIN32 + LACKS_SYS_MMAN_H NOT defined unless WIN32 + + Changing default word sizes: + + INTERNAL_SIZE_T size_t + MALLOC_ALIGNMENT 2 * sizeof(INTERNAL_SIZE_T) + + Configuration and functionality options: + + USE_DL_PREFIX NOT defined + USE_PUBLIC_MALLOC_WRAPPERS NOT defined + USE_MALLOC_LOCK NOT defined + DEBUG NOT defined + REALLOC_ZERO_BYTES_FREES NOT defined + MALLOC_FAILURE_ACTION errno = ENOMEM, if __STD_C defined, else no-op + TRIM_FASTBINS 0 + + Options for customizing MORECORE: + + MORECORE sbrk + MORECORE_CONTIGUOUS 1 + MORECORE_CANNOT_TRIM NOT defined + MMAP_AS_MORECORE_SIZE (1024 * 1024) + + Tuning options that are also dynamically changeable via mallopt: + + DEFAULT_MXFAST 64 + DEFAULT_TRIM_THRESHOLD 128 * 1024 + DEFAULT_TOP_PAD 0 + DEFAULT_MMAP_THRESHOLD 128 * 1024 + DEFAULT_MMAP_MAX 65536 + + There are several other #defined constants and macros that you + probably don't want to touch unless you are extending or adapting malloc. +*/ + +/* + Void_t* is the pointer type that malloc should say it returns +*/ + +#define __STD_C 1 + +#ifndef Void_t +#if (__STD_C || defined(WIN32)) +#define Void_t void +#else +#define Void_t char +#endif +#endif /*Void_t*/ + +#include /* for size_t */ + +#include + +/* define LACKS_SYS_PARAM_H if your system does not have a . */ + +#define LACKS_SYS_PARAM_H + + +#include /* needed for malloc_stats */ + + +/* + Debugging: + + Because freed chunks may be overwritten with bookkeeping fields, this + malloc will often die when freed memory is overwritten by user + programs. This can be very effective (albeit in an annoying way) + in helping track down dangling pointers. + + If you compile with -DDEBUG, a number of assertion checks are + enabled that will catch more memory errors. You probably won't be + able to make much sense of the actual assertion errors, but they + should help you locate incorrectly overwritten memory. The + checking is fairly extensive, and will slow down execution + noticeably. Calling malloc_stats or mallinfo with DEBUG set will + attempt to check every non-mmapped allocated and free chunk in the + course of computing the summmaries. (By nature, mmapped regions + cannot be checked very much automatically.) + + Setting DEBUG may also be helpful if you are trying to modify + this code. The assertions in the check routines spell out in more + detail the assumptions and invariants underlying the algorithms. + + Setting DEBUG does NOT provide an automated mechanism for checking + that all accesses to malloced memory stay within their + bounds. However, there are several add-ons and adaptations of this + or other mallocs available that do this. +*/ + +#include + +/* + INTERNAL_SIZE_T is the word-size used for internal bookkeeping + of chunk sizes. + + The default version is the same as size_t. + + While not strictly necessary, it is best to define this as an + unsigned type, even if size_t is a signed type. This may avoid some + artificial size limitations on some systems. + + On a 64-bit machine, you may be able to reduce malloc overhead by + defining INTERNAL_SIZE_T to be a 32 bit `unsigned int' at the + expense of not being able to handle more than 2^32 of malloced + space. If this limitation is acceptable, you are encouraged to set + this unless you are on a platform requiring 16byte alignments. In + this case the alignment requirements turn out to negate any + potential advantages of decreasing size_t word size. + + Implementors: Beware of the possible combinations of: + - INTERNAL_SIZE_T might be signed or unsigned, might be 32 or 64 bits, + and might be the same width as int or as long + - size_t might have different width and signedness as INTERNAL_SIZE_T + - int and long might be 32 or 64 bits, and might be the same width + To deal with this, most comparisons and difference computations + among INTERNAL_SIZE_Ts should cast them to unsigned long, being + aware of the fact that casting an unsigned int to a wider long does + not sign-extend. (This also makes checking for negative numbers + awkward.) Some of these casts result in harmless compiler warnings + on some systems. +*/ + +#ifndef INTERNAL_SIZE_T +#define INTERNAL_SIZE_T size_t +#endif + +/* The corresponding word size */ +#define SIZE_SZ (sizeof(INTERNAL_SIZE_T)) + + +/* + MALLOC_ALIGNMENT is the minimum alignment for malloc'ed chunks. + It must be a power of two at least 2 * SIZE_SZ, even on machines + for which smaller alignments would suffice. It may be defined as + larger than this though. Note however that code and data structures + are optimized for the case of 8-byte alignment. +*/ + +#ifdef _arch_ps2 +# ifndef MALLOC_ALIGNMENT +# define MALLOC_ALIGNMENT 16 +# endif +#else +# ifndef MALLOC_ALIGNMENT +# define MALLOC_ALIGNMENT (2 * SIZE_SZ) +# endif +#endif + +/* The corresponding bit mask value */ +#define MALLOC_ALIGN_MASK (MALLOC_ALIGNMENT - 1) + + + +/* + REALLOC_ZERO_BYTES_FREES should be set if a call to + realloc with zero bytes should be the same as a call to free. + Some people think it should. Otherwise, since this malloc + returns a unique pointer for malloc(0), so does realloc(p, 0). +*/ + +/* #define REALLOC_ZERO_BYTES_FREES */ + +/* + TRIM_FASTBINS controls whether free() of a very small chunk can + immediately lead to trimming. Setting to true (1) can reduce memory + footprint, but will almost always slow down programs that use a lot + of small chunks. + + Define this only if you are willing to give up some speed to more + aggressively reduce system-level memory footprint when releasing + memory in programs that use many small chunks. You can get + essentially the same effect by setting MXFAST to 0, but this can + lead to even greater slowdowns in programs using many small chunks. + TRIM_FASTBINS is an in-between compile-time option, that disables + only those chunks bordering topmost memory from being placed in + fastbins. +*/ + +#ifdef _arch_gba +# ifndef TRIM_FASTBINS +# define TRIM_FASTBINS 1 +# endif +#else +# ifndef TRIM_FASTBINS +# define TRIM_FASTBINS 0 +# endif +#endif + + +/* + USE_DL_PREFIX will prefix all public routines with the string 'dl'. + This is necessary when you only want to use this malloc in one part + of a program, using your regular system malloc elsewhere. +*/ + +/* #define USE_DL_PREFIX */ + + +/* + USE_MALLOC_LOCK causes wrapper functions to surround each + callable routine with pthread mutex lock/unlock. + + USE_MALLOC_LOCK forces USE_PUBLIC_MALLOC_WRAPPERS to be defined +*/ + + +#define USE_MALLOC_LOCK + + +/* + If USE_PUBLIC_MALLOC_WRAPPERS is defined, every public routine is + actually a wrapper function that first calls MALLOC_PREACTION, then + calls the internal routine, and follows it with + MALLOC_POSTACTION. This is needed for locking, but you can also use + this, without USE_MALLOC_LOCK, for purposes of interception, + instrumentation, etc. It is a sad fact that using wrappers often + noticeably degrades performance of malloc-intensive programs. +*/ + +#ifdef USE_MALLOC_LOCK +#define USE_PUBLIC_MALLOC_WRAPPERS +#else +/* #define USE_PUBLIC_MALLOC_WRAPPERS */ +#endif + + +/* + Two-phase name translation. + All of the actual routines are given mangled names. + When wrappers are used, they become the public callable versions. + When DL_PREFIX is used, the callable names are prefixed. +*/ + +#ifndef USE_PUBLIC_MALLOC_WRAPPERS +#define cALLOc public_cALLOc +#define fREe public_fREe +#define cFREe public_cFREe +#define mALLOc public_mALLOc +#define mEMALIGn public_mEMALIGn +#define rEALLOc public_rEALLOc +#define vALLOc public_vALLOc +#define pVALLOc public_pVALLOc +#define mALLINFo public_mALLINFo +#define mALLOPt public_mALLOPt +#define mTRIm public_mTRIm +#define mSTATs public_mSTATs +#define mUSABLe public_mUSABLe +#define iCALLOc public_iCALLOc +#define iCOMALLOc public_iCOMALLOc +#endif + +#ifdef USE_DL_PREFIX +#define public_cALLOc dlcalloc +#define public_fREe dlfree +#define public_cFREe dlcfree +#define public_mALLOc dlmalloc +#define public_mEMALIGn dlmemalign +#define public_rEALLOc dlrealloc +#define public_vALLOc dlvalloc +#define public_pVALLOc dlpvalloc +#define public_mALLINFo dlmallinfo +#define public_mALLOPt dlmallopt +#define public_mTRIm dlmalloc_trim +#define public_mSTATs dlmalloc_stats +#define public_mUSABLe dlmalloc_usable_size +#define public_iCALLOc dlindependent_calloc +#define public_iCOMALLOc dlindependent_comalloc +#else /* USE_DL_PREFIX */ +#define public_cALLOc calloc +#define public_fREe free +#define public_cFREe cfree +#define public_mALLOc malloc +#define public_mEMALIGn memalign +#define public_rEALLOc realloc +#define public_vALLOc valloc +#define public_pVALLOc pvalloc +#define public_mALLINFo mallinfo +#define public_mALLOPt mallopt +#define public_mTRIm malloc_trim +#define public_mSTATs malloc_stats +#define public_mUSABLe malloc_usable_size +#define public_iCALLOc independent_calloc +#define public_iCOMALLOc independent_comalloc +#endif /* USE_DL_PREFIX */ + + +/* + HAVE_MEMCPY should be defined if you are not otherwise using + ANSI STD C, but still have memcpy and memset in your C library + and want to use them in calloc and realloc. Otherwise simple + macro versions are defined below. + + USE_MEMCPY should be defined as 1 if you actually want to + have memset and memcpy called. People report that the macro + versions are faster than libc versions on some systems. + + Even if USE_MEMCPY is set to 1, loops to copy/clear small chunks + (of <= 36 bytes) are manually unrolled in realloc and calloc. +*/ + +#define HAVE_MEMCPY + +#ifndef USE_MEMCPY +#ifdef HAVE_MEMCPY +#define USE_MEMCPY 1 +#else +#define USE_MEMCPY 0 +#endif +#endif + + +#if (__STD_C || defined(HAVE_MEMCPY)) + +#include + +#ifdef WIN32 +/* On Win32 memset and memcpy are already declared in windows.h */ +#else +/* #if __STD_C +void* memset(void*, int, size_t); +void* memcpy(void*, const void*, size_t); +#else +Void_t* memset(); +Void_t* memcpy(); +#endif */ +#endif +#endif + +/* + MALLOC_FAILURE_ACTION is the action to take before "return 0" when + malloc fails to be able to return memory, either because memory is + exhausted or because of illegal arguments. + + By default, sets errno if running on STD_C platform, else does nothing. +*/ + +/* #ifndef MALLOC_FAILURE_ACTION +#if __STD_C +#define MALLOC_FAILURE_ACTION \ + errno = ENOMEM; + +#else +#define MALLOC_FAILURE_ACTION +#endif +#endif */ + +#define MALLOC_FAILURE_ACTION \ + dbglog(DBG_DEAD, "malloc: core exhausted\n"); \ + arch_exit(); + +/* + MORECORE-related declarations. By default, rely on sbrk +*/ + + +#ifdef LACKS_UNISTD_H +#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) +#if __STD_C +extern Void_t* sbrk(ptrdiff_t); +#else +extern Void_t* sbrk(); +#endif +#endif +#endif + +/* + MORECORE is the name of the routine to call to obtain more memory + from the system. See below for general guidance on writing + alternative MORECORE functions, as well as a version for WIN32 and a + sample version for pre-OSX macos. +*/ + +#ifndef MORECORE +#define MORECORE sbrk +#endif + +/* + MORECORE_FAILURE is the value returned upon failure of MORECORE + as well as mmap. Since it cannot be an otherwise valid memory address, + and must reflect values of standard sys calls, you probably ought not + try to redefine it. +*/ + +#ifndef MORECORE_FAILURE +#define MORECORE_FAILURE (-1) +#endif + +/* + If MORECORE_CONTIGUOUS is true, take advantage of fact that + consecutive calls to MORECORE with positive arguments always return + contiguous increasing addresses. This is true of unix sbrk. Even + if not defined, when regions happen to be contiguous, malloc will + permit allocations spanning regions obtained from different + calls. But defining this when applicable enables some stronger + consistency checks and space efficiencies. +*/ + +#ifndef MORECORE_CONTIGUOUS +#define MORECORE_CONTIGUOUS 1 +#endif + +/* + Define MORECORE_CANNOT_TRIM if your version of MORECORE + cannot release space back to the system when given negative + arguments. This is generally necessary only if you are using + a hand-crafted MORECORE function that cannot handle negative arguments. +*/ + +/* #define MORECORE_CANNOT_TRIM */ + + +/* + Define HAVE_MMAP as true to optionally make malloc() use mmap() to + allocate very large blocks. These will be returned to the + operating system immediately after a free(). Also, if mmap + is available, it is used as a backup strategy in cases where + MORECORE fails to provide space from system. + + This malloc is best tuned to work with mmap for large requests. + If you do not have mmap, operations involving very large chunks (1MB + or so) may be slower than you'd like. +*/ + +#define HAVE_MMAP 0 + +#ifndef HAVE_MMAP +#define HAVE_MMAP 1 + +/* + Standard unix mmap using /dev/zero clears memory so calloc doesn't + need to. +*/ + +#ifndef MMAP_CLEARS +#define MMAP_CLEARS 1 +#endif + +#else /* no mmap */ +#ifndef MMAP_CLEARS +#define MMAP_CLEARS 0 +#endif +#endif + + +/* + MMAP_AS_MORECORE_SIZE is the minimum mmap size argument to use if + sbrk fails, and mmap is used as a backup (which is done only if + HAVE_MMAP). The value must be a multiple of page size. This + backup strategy generally applies only when systems have "holes" in + address space, so sbrk cannot perform contiguous expansion, but + there is still space available on system. On systems for which + this is known to be useful (i.e. most linux kernels), this occurs + only when programs allocate huge amounts of memory. Between this, + and the fact that mmap regions tend to be limited, the size should + be large, to avoid too many mmap calls and thus avoid running out + of kernel resources. +*/ + +#ifndef MMAP_AS_MORECORE_SIZE +#define MMAP_AS_MORECORE_SIZE (1024 * 1024) +#endif + +/* + Define HAVE_MREMAP to make realloc() use mremap() to re-allocate + large blocks. This is currently only possible on Linux with + kernel versions newer than 1.3.77. +*/ + +#ifndef HAVE_MREMAP +#ifdef linux +#define HAVE_MREMAP 1 +#else +#define HAVE_MREMAP 0 +#endif + +#endif /* HAVE_MMAP */ + + +/* + The system page size. To the extent possible, this malloc manages + memory from the system in page-size units. Note that this value is + cached during initialization into a field of malloc_state. So even + if malloc_getpagesize is a function, it is only called once. + + The following mechanics for getpagesize were adapted from bsd/gnu + getpagesize.h. If none of the system-probes here apply, a value of + 4096 is used, which should be OK: If they don't apply, then using + the actual value probably doesn't impact performance. +*/ + +#define malloc_getpagesize 4096 /* XXX: Should we make this 16384 + for cache considerations? */ + +#ifndef malloc_getpagesize + +#ifndef LACKS_UNISTD_H +# include +#endif + +# ifdef _SC_PAGESIZE /* some SVR4 systems omit an underscore */ +# ifndef _SC_PAGE_SIZE +# define _SC_PAGE_SIZE _SC_PAGESIZE +# endif +# endif + +# ifdef _SC_PAGE_SIZE +# define malloc_getpagesize sysconf(_SC_PAGE_SIZE) +# else +# if defined(BSD) || defined(DGUX) || defined(HAVE_GETPAGESIZE) + extern size_t getpagesize(); +# define malloc_getpagesize getpagesize() +# else +# ifdef WIN32 /* use supplied emulation of getpagesize */ +# define malloc_getpagesize getpagesize() +# else +# ifndef LACKS_SYS_PARAM_H +# include +# endif +# ifdef EXEC_PAGESIZE +# define malloc_getpagesize EXEC_PAGESIZE +# else +# ifdef NBPG +# ifndef CLSIZE +# define malloc_getpagesize NBPG +# else +# define malloc_getpagesize (NBPG * CLSIZE) +# endif +# else +# ifdef NBPC +# define malloc_getpagesize NBPC +# else +# ifdef PAGESIZE +# define malloc_getpagesize PAGESIZE +# else /* just guess */ +# define malloc_getpagesize (4096) +# endif +# endif +# endif +# endif +# endif +# endif +# endif +#endif + +/* + This version of malloc supports the standard SVID/XPG mallinfo + routine that returns a struct containing usage properties and + statistics. It should work on any SVID/XPG compliant system that has + a /usr/include/malloc.h defining struct mallinfo. (If you'd like to + install such a thing yourself, cut out the preliminary declarations + as described above and below and save them in a malloc.h file. But + there's no compelling reason to bother to do this.) + + The main declaration needed is the mallinfo struct that is returned + (by-copy) by mallinfo(). The SVID/XPG malloinfo struct contains a + bunch of field that are not even meaningful in this version of + malloc. These fields are are instead filled by mallinfo() with + other numbers that might be of interest. + + HAVE_USR_INCLUDE_MALLOC_H should be set if you have a + /usr/include/malloc.h file that includes a declaration of struct + mallinfo. If so, it is included; else an SVID2/XPG2 compliant + version is declared below. These must be precisely the same for + mallinfo() to work. The original SVID version of this struct, + defined on most systems with mallinfo, declares all fields as + ints. But some others define as unsigned long. If your system + defines the fields using a type of different width than listed here, + you must #include your system version and #define + HAVE_USR_INCLUDE_MALLOC_H. +*/ + +#undef HAVE_USR_INCLUDE_MALLOC_H + +#ifdef HAVE_USR_INCLUDE_MALLOC_H +#include "/usr/include/malloc.h" +#else + +/* SVID2/XPG mallinfo structure */ + +struct mallinfo { + int arena; /* non-mmapped space allocated from system */ + int ordblks; /* number of free chunks */ + int smblks; /* number of fastbin blocks */ + int hblks; /* number of mmapped regions */ + int hblkhd; /* space in mmapped regions */ + int usmblks; /* maximum total allocated space */ + int fsmblks; /* space available in freed fastbin blocks */ + int uordblks; /* total allocated space */ + int fordblks; /* total free space */ + int keepcost; /* top-most, releasable (via malloc_trim) space */ +}; + +/* + SVID/XPG defines four standard parameter numbers for mallopt, + normally defined in malloc.h. Only one of these (M_MXFAST) is used + in this malloc. The others (M_NLBLKS, M_GRAIN, M_KEEP) don't apply, + so setting them has no effect. But this malloc also supports other + options in mallopt described below. +*/ +#endif + + +/* ---------- description of public routines ------------ */ + +/* + malloc(size_t n) + Returns a pointer to a newly allocated chunk of at least n bytes, or null + if no space is available. Additionally, on failure, errno is + set to ENOMEM on ANSI C systems. + + If n is zero, malloc returns a minumum-sized chunk. (The minimum + size is 16 bytes on most 32bit systems, and 24 or 32 bytes on 64bit + systems.) On most systems, size_t is an unsigned type, so calls + with negative arguments are interpreted as requests for huge amounts + of space, which will often fail. The maximum supported value of n + differs across systems, but is in all cases less than the maximum + representable value of a size_t. +*/ +#if __STD_C +Void_t* public_mALLOc(size_t); +#else +Void_t* public_mALLOc(); +#endif + +/* + free(Void_t* p) + Releases the chunk of memory pointed to by p, that had been previously + allocated using malloc or a related routine such as realloc. + It has no effect if p is null. It can have arbitrary (i.e., bad!) + effects if p has already been freed. + + Unless disabled (using mallopt), freeing very large spaces will + when possible, automatically trigger operations that give + back unused memory to the system, thus reducing program footprint. +*/ +#if __STD_C +void public_fREe(Void_t*); +#else +void public_fREe(); +#endif + +/* + calloc(size_t n_elements, size_t element_size); + Returns a pointer to n_elements * element_size bytes, with all locations + set to zero. +*/ +#if __STD_C +Void_t* public_cALLOc(size_t, size_t); +#else +Void_t* public_cALLOc(); +#endif + +/* + realloc(Void_t* p, size_t n) + Returns a pointer to a chunk of size n that contains the same data + as does chunk p up to the minimum of (n, p's size) bytes, or null + if no space is available. + + The returned pointer may or may not be the same as p. The algorithm + prefers extending p when possible, otherwise it employs the + equivalent of a malloc-copy-free sequence. + + If p is null, realloc is equivalent to malloc. + + If space is not available, realloc returns null, errno is set (if on + ANSI) and p is NOT freed. + + if n is for fewer bytes than already held by p, the newly unused + space is lopped off and freed if possible. Unless the #define + REALLOC_ZERO_BYTES_FREES is set, realloc with a size argument of + zero (re)allocates a minimum-sized chunk. + + Large chunks that were internally obtained via mmap will always + be reallocated using malloc-copy-free sequences unless + the system supports MREMAP (currently only linux). + + The old unix realloc convention of allowing the last-free'd chunk + to be used as an argument to realloc is not supported. +*/ +#if __STD_C +Void_t* public_rEALLOc(Void_t*, size_t); +#else +Void_t* public_rEALLOc(); +#endif + +/* + memalign(size_t alignment, size_t n); + Returns a pointer to a newly allocated chunk of n bytes, aligned + in accord with the alignment argument. + + The alignment argument should be a power of two. If the argument is + not a power of two, the nearest greater power is used. + 8-byte alignment is guaranteed by normal malloc calls, so don't + bother calling memalign with an argument of 8 or less. + + Overreliance on memalign is a sure way to fragment space. +*/ +#if __STD_C +Void_t* public_mEMALIGn(size_t, size_t); +#else +Void_t* public_mEMALIGn(); +#endif + +/* + valloc(size_t n); + Equivalent to memalign(pagesize, n), where pagesize is the page + size of the system. If the pagesize is unknown, 4096 is used. +*/ +#if __STD_C +Void_t* public_vALLOc(size_t); +#else +Void_t* public_vALLOc(); +#endif + + + +/* + mallopt(int parameter_number, int parameter_value) + Sets tunable parameters The format is to provide a + (parameter-number, parameter-value) pair. mallopt then sets the + corresponding parameter to the argument value if it can (i.e., so + long as the value is meaningful), and returns 1 if successful else + 0. SVID/XPG/ANSI defines four standard param numbers for mallopt, + normally defined in malloc.h. Only one of these (M_MXFAST) is used + in this malloc. The others (M_NLBLKS, M_GRAIN, M_KEEP) don't apply, + so setting them has no effect. But this malloc also supports four + other options in mallopt. See below for details. Briefly, supported + parameters are as follows (listed defaults are for "typical" + configurations). + + Symbol param # default allowed param values + M_MXFAST 1 64 0-80 (0 disables fastbins) + M_TRIM_THRESHOLD -1 128*1024 any (-1U disables trimming) + M_TOP_PAD -2 0 any + M_MMAP_THRESHOLD -3 128*1024 any (or 0 if no MMAP support) + M_MMAP_MAX -4 65536 any (0 disables use of mmap) +*/ +#if __STD_C +int public_mALLOPt(int, int); +#else +int public_mALLOPt(); +#endif + + +/* + mallinfo() + Returns (by copy) a struct containing various summary statistics: + + arena: current total non-mmapped bytes allocated from system + ordblks: the number of free chunks + smblks: the number of fastbin blocks (i.e., small chunks that + have been freed but not use resused or consolidated) + hblks: current number of mmapped regions + hblkhd: total bytes held in mmapped regions + usmblks: the maximum total allocated space. This will be greater + than current total if trimming has occurred. + fsmblks: total bytes held in fastbin blocks + uordblks: current total allocated space (normal or mmapped) + fordblks: total free space + keepcost: the maximum number of bytes that could ideally be released + back to system via malloc_trim. ("ideally" means that + it ignores page restrictions etc.) + + Because these fields are ints, but internal bookkeeping may + be kept as longs, the reported values may wrap around zero and + thus be inaccurate. +*/ +#if __STD_C +struct mallinfo public_mALLINFo(void); +#else +struct mallinfo public_mALLINFo(); +#endif + +/* + independent_calloc(size_t n_elements, size_t element_size, Void_t* chunks[]); + + independent_calloc is similar to calloc, but instead of returning a + single cleared space, it returns an array of pointers to n_elements + independent elements that can hold contents of size elem_size, each + of which starts out cleared, and can be independently freed, + realloc'ed etc. The elements are guaranteed to be adjacently + allocated (this is not guaranteed to occur with multiple callocs or + mallocs), which may also improve cache locality in some + applications. + + The "chunks" argument is optional (i.e., may be null, which is + probably the most typical usage). If it is null, the returned array + is itself dynamically allocated and should also be freed when it is + no longer needed. Otherwise, the chunks array must be of at least + n_elements in length. It is filled in with the pointers to the + chunks. + + In either case, independent_calloc returns this pointer array, or + null if the allocation failed. If n_elements is zero and "chunks" + is null, it returns a chunk representing an array with zero elements + (which should be freed if not wanted). + + Each element must be individually freed when it is no longer + needed. If you'd like to instead be able to free all at once, you + should instead use regular calloc and assign pointers into this + space to represent elements. (In this case though, you cannot + independently free elements.) + + independent_calloc simplifies and speeds up implementations of many + kinds of pools. It may also be useful when constructing large data + structures that initially have a fixed number of fixed-sized nodes, + but the number is not known at compile time, and some of the nodes + may later need to be freed. For example: + + struct Node { int item; struct Node* next; }; + + struct Node* build_list() { + struct Node** pool; + int n = read_number_of_nodes_needed(); + if (n <= 0) return 0; + pool = (struct Node**)(independent_calloc(n, sizeof(struct Node), 0); + if (pool == 0) die(); + // organize into a linked list... + struct Node* first = pool[0]; + for (i = 0; i < n-1; ++i) + pool[i]->next = pool[i+1]; + free(pool); // Can now free the array (or not, if it is needed later) + return first; + } +*/ +#if __STD_C +Void_t** public_iCALLOc(size_t, size_t, Void_t**); +#else +Void_t** public_iCALLOc(); +#endif + +/* + independent_comalloc(size_t n_elements, size_t sizes[], Void_t* chunks[]); + + independent_comalloc allocates, all at once, a set of n_elements + chunks with sizes indicated in the "sizes" array. It returns + an array of pointers to these elements, each of which can be + independently freed, realloc'ed etc. The elements are guaranteed to + be adjacently allocated (this is not guaranteed to occur with + multiple callocs or mallocs), which may also improve cache locality + in some applications. + + The "chunks" argument is optional (i.e., may be null). If it is null + the returned array is itself dynamically allocated and should also + be freed when it is no longer needed. Otherwise, the chunks array + must be of at least n_elements in length. It is filled in with the + pointers to the chunks. + + In either case, independent_comalloc returns this pointer array, or + null if the allocation failed. If n_elements is zero and chunks is + null, it returns a chunk representing an array with zero elements + (which should be freed if not wanted). + + Each element must be individually freed when it is no longer + needed. If you'd like to instead be able to free all at once, you + should instead use a single regular malloc, and assign pointers at + particular offsets in the aggregate space. (In this case though, you + cannot independently free elements.) + + independent_comallac differs from independent_calloc in that each + element may have a different size, and also that it does not + automatically clear elements. + + independent_comalloc can be used to speed up allocation in cases + where several structs or objects must always be allocated at the + same time. For example: + + struct Head { ... } + struct Foot { ... } + + void send_message(char* msg) { + int msglen = strlen(msg); + size_t sizes[3] = { sizeof(struct Head), msglen, sizeof(struct Foot) }; + void* chunks[3]; + if (independent_comalloc(3, sizes, chunks) == 0) + die(); + struct Head* head = (struct Head*)(chunks[0]); + char* body = (char*)(chunks[1]); + struct Foot* foot = (struct Foot*)(chunks[2]); + // ... + } + + In general though, independent_comalloc is worth using only for + larger values of n_elements. For small values, you probably won't + detect enough difference from series of malloc calls to bother. + + Overuse of independent_comalloc can increase overall memory usage, + since it cannot reuse existing noncontiguous small chunks that + might be available for some of the elements. +*/ +#if __STD_C +Void_t** public_iCOMALLOc(size_t, size_t*, Void_t**); +#else +Void_t** public_iCOMALLOc(); +#endif + + +/* + pvalloc(size_t n); + Equivalent to valloc(minimum-page-that-holds(n)), that is, + round up n to nearest pagesize. + */ +#if __STD_C +Void_t* public_pVALLOc(size_t); +#else +Void_t* public_pVALLOc(); +#endif + +/* + cfree(Void_t* p); + Equivalent to free(p). + + cfree is needed/defined on some systems that pair it with calloc, + for odd historical reasons (such as: cfree is used in example + code in the first edition of K&R). +*/ +#if __STD_C +void public_cFREe(Void_t*); +#else +void public_cFREe(); +#endif + +/* + malloc_trim(size_t pad); + + If possible, gives memory back to the system (via negative + arguments to sbrk) if there is unused memory at the `high' end of + the malloc pool. You can call this after freeing large blocks of + memory to potentially reduce the system-level memory requirements + of a program. However, it cannot guarantee to reduce memory. Under + some allocation patterns, some large free blocks of memory will be + locked between two used chunks, so they cannot be given back to + the system. + + The `pad' argument to malloc_trim represents the amount of free + trailing space to leave untrimmed. If this argument is zero, + only the minimum amount of memory to maintain internal data + structures will be left (one page or less). Non-zero arguments + can be supplied to maintain enough trailing space to service + future expected allocations without having to re-obtain memory + from the system. + + Malloc_trim returns 1 if it actually released any memory, else 0. + On systems that do not support "negative sbrks", it will always + rreturn 0. +*/ +#if __STD_C +int public_mTRIm(size_t); +#else +int public_mTRIm(); +#endif + +/* + malloc_usable_size(Void_t* p); + + Returns the number of bytes you can actually use in + an allocated chunk, which may be more than you requested (although + often not) due to alignment and minimum size constraints. + You can use this many bytes without worrying about + overwriting other allocated objects. This is not a particularly great + programming practice. malloc_usable_size can be more useful in + debugging and assertions, for example: + + p = malloc(n); + assert(malloc_usable_size(p) >= 256); + +*/ +#if __STD_C +size_t public_mUSABLe(Void_t*); +#else +size_t public_mUSABLe(); +#endif + +/* + malloc_stats(); + Prints on stderr the amount of space obtained from the system (both + via sbrk and mmap), the maximum amount (which may be more than + current if malloc_trim and/or munmap got called), and the current + number of bytes allocated via malloc (or realloc, etc) but not yet + freed. Note that this is the number of bytes allocated, not the + number requested. It will be larger than the number requested + because of alignment and bookkeeping overhead. Because it includes + alignment wastage as being in use, this figure may be greater than + zero even when no user-level chunks are allocated. + + The reported current and maximum system memory can be inaccurate if + a program makes other calls to system memory allocation functions + (normally sbrk) outside of malloc. + + malloc_stats prints only the most commonly interesting statistics. + More information can be obtained by calling mallinfo. + +*/ +#if __STD_C +void public_mSTATs(); +#else +void public_mSTATs(); +#endif + +/* mallopt tuning options */ + +/* + M_MXFAST is the maximum request size used for "fastbins", special bins + that hold returned chunks without consolidating their spaces. This + enables future requests for chunks of the same size to be handled + very quickly, but can increase fragmentation, and thus increase the + overall memory footprint of a program. + + This malloc manages fastbins very conservatively yet still + efficiently, so fragmentation is rarely a problem for values less + than or equal to the default. The maximum supported value of MXFAST + is 80. You wouldn't want it any higher than this anyway. Fastbins + are designed especially for use with many small structs, objects or + strings -- the default handles structs/objects/arrays with sizes up + to 8 4byte fields, or small strings representing words, tokens, + etc. Using fastbins for larger objects normally worsens + fragmentation without improving speed. + + M_MXFAST is set in REQUEST size units. It is internally used in + chunksize units, which adds padding and alignment. You can reduce + M_MXFAST to 0 to disable all use of fastbins. This causes the malloc + algorithm to be a closer approximation of fifo-best-fit in all cases, + not just for larger requests, but will generally cause it to be + slower. +*/ + + +/* M_MXFAST is a standard SVID/XPG tuning option, usually listed in malloc.h */ +#ifndef M_MXFAST +#define M_MXFAST 1 +#endif + +#ifndef DEFAULT_MXFAST +#define DEFAULT_MXFAST 64 +#endif + + +/* + M_TRIM_THRESHOLD is the maximum amount of unused top-most memory + to keep before releasing via malloc_trim in free(). + + Automatic trimming is mainly useful in long-lived programs. + Because trimming via sbrk can be slow on some systems, and can + sometimes be wasteful (in cases where programs immediately + afterward allocate more large chunks) the value should be high + enough so that your overall system performance would improve by + releasing this much memory. + + The trim threshold and the mmap control parameters (see below) + can be traded off with one another. Trimming and mmapping are + two different ways of releasing unused memory back to the + system. Between these two, it is often possible to keep + system-level demands of a long-lived program down to a bare + minimum. For example, in one test suite of sessions measuring + the XF86 X server on Linux, using a trim threshold of 128K and a + mmap threshold of 192K led to near-minimal long term resource + consumption. + + If you are using this malloc in a long-lived program, it should + pay to experiment with these values. As a rough guide, you + might set to a value close to the average size of a process + (program) running on your system. Releasing this much memory + would allow such a process to run in memory. Generally, it's + worth it to tune for trimming rather tham memory mapping when a + program undergoes phases where several large chunks are + allocated and released in ways that can reuse each other's + storage, perhaps mixed with phases where there are no such + chunks at all. And in well-behaved long-lived programs, + controlling release of large blocks via trimming versus mapping + is usually faster. + + However, in most programs, these parameters serve mainly as + protection against the system-level effects of carrying around + massive amounts of unneeded memory. Since frequent calls to + sbrk, mmap, and munmap otherwise degrade performance, the default + parameters are set to relatively high values that serve only as + safeguards. + + The trim value It must be greater than page size to have any useful + effect. To disable trimming completely, you can set to + (unsigned long)(-1) + + Trim settings interact with fastbin (MXFAST) settings: Unless + TRIM_FASTBINS is defined, automatic trimming never takes place upon + freeing a chunk with size less than or equal to MXFAST. Trimming is + instead delayed until subsequent freeing of larger chunks. However, + you can still force an attempted trim by calling malloc_trim. + + Also, trimming is not generally possible in cases where + the main arena is obtained via mmap. + + Note that the trick some people use of mallocing a huge space and + then freeing it at program startup, in an attempt to reserve system + memory, doesn't have the intended effect under automatic trimming, + since that memory will immediately be returned to the system. +*/ + +#define M_TRIM_THRESHOLD -1 + +#ifndef DEFAULT_TRIM_THRESHOLD +#define DEFAULT_TRIM_THRESHOLD (128 * 1024) +#endif + +/* + M_TOP_PAD is the amount of extra `padding' space to allocate or + retain whenever sbrk is called. It is used in two ways internally: + + * When sbrk is called to extend the top of the arena to satisfy + a new malloc request, this much padding is added to the sbrk + request. + + * When malloc_trim is called automatically from free(), + it is used as the `pad' argument. + + In both cases, the actual amount of padding is rounded + so that the end of the arena is always a system page boundary. + + The main reason for using padding is to avoid calling sbrk so + often. Having even a small pad greatly reduces the likelihood + that nearly every malloc request during program start-up (or + after trimming) will invoke sbrk, which needlessly wastes + time. + + Automatic rounding-up to page-size units is normally sufficient + to avoid measurable overhead, so the default is 0. However, in + systems where sbrk is relatively slow, it can pay to increase + this value, at the expense of carrying around more memory than + the program needs. +*/ + +#define M_TOP_PAD -2 + +#ifndef DEFAULT_TOP_PAD +#define DEFAULT_TOP_PAD (0) +#endif + +/* + M_MMAP_THRESHOLD is the request size threshold for using mmap() + to service a request. Requests of at least this size that cannot + be allocated using already-existing space will be serviced via mmap. + (If enough normal freed space already exists it is used instead.) + + Using mmap segregates relatively large chunks of memory so that + they can be individually obtained and released from the host + system. A request serviced through mmap is never reused by any + other request (at least not directly; the system may just so + happen to remap successive requests to the same locations). + + Segregating space in this way has the benefits that: + + 1. Mmapped space can ALWAYS be individually released back + to the system, which helps keep the system level memory + demands of a long-lived program low. + 2. Mapped memory can never become `locked' between + other chunks, as can happen with normally allocated chunks, which + means that even trimming via malloc_trim would not release them. + 3. On some systems with "holes" in address spaces, mmap can obtain + memory that sbrk cannot. + + However, it has the disadvantages that: + + 1. The space cannot be reclaimed, consolidated, and then + used to service later requests, as happens with normal chunks. + 2. It can lead to more wastage because of mmap page alignment + requirements + 3. It causes malloc performance to be more dependent on host + system memory management support routines which may vary in + implementation quality and may impose arbitrary + limitations. Generally, servicing a request via normal + malloc steps is faster than going through a system's mmap. + + The advantages of mmap nearly always outweigh disadvantages for + "large" chunks, but the value of "large" varies across systems. The + default is an empirically derived value that works well in most + systems. +*/ + +#define M_MMAP_THRESHOLD -3 + +#ifndef DEFAULT_MMAP_THRESHOLD +#define DEFAULT_MMAP_THRESHOLD (128 * 1024) +#endif + +/* + M_MMAP_MAX is the maximum number of requests to simultaneously + service using mmap. This parameter exists because +. Some systems have a limited number of internal tables for + use by mmap, and using more than a few of them may degrade + performance. + + The default is set to a value that serves only as a safeguard. + Setting to 0 disables use of mmap for servicing large requests. If + HAVE_MMAP is not set, the default value is 0, and attempts to set it + to non-zero values in mallopt will fail. +*/ + +#define M_MMAP_MAX -4 + +#ifndef DEFAULT_MMAP_MAX +#if HAVE_MMAP +#define DEFAULT_MMAP_MAX (65536) +#else +#define DEFAULT_MMAP_MAX (0) +#endif +#endif + +__END_DECLS + +#endif /* __MALLOC_H */ + + diff --git a/SDK/LIBS/dcinclude/math.h b/SDK/LIBS/dcinclude/math.h new file mode 100644 index 00000000..b342f6ea --- /dev/null +++ b/SDK/LIBS/dcinclude/math.h @@ -0,0 +1,29 @@ +/* KallistiOS 1.2.0 + + math.h + (c)2001 Dan Potter + + $Id: math.h,v 1.6 2002/10/26 07:56:58 bardtx Exp $ +*/ + +#ifndef __KOS_MATH_H +#define __KOS_MATH_H + +#include +__BEGIN_DECLS + +/* Just pull in the Newlib math routines for the right platform */ +#ifdef _arch_dreamcast +#include +#elif _arch_gba +#include +#elif _arch_ps2 +#include /* XXX Not correct yet */ +#else +#error Invalid architecture or no architecture specified +#endif + +__END_DECLS + +#endif /* __KOS_MATH_H */ + diff --git a/SDK/LIBS/dcinclude/modplug/modplug.h b/SDK/LIBS/dcinclude/modplug/modplug.h new file mode 100644 index 00000000..fd8ec02f --- /dev/null +++ b/SDK/LIBS/dcinclude/modplug/modplug.h @@ -0,0 +1,92 @@ +/* + * This source code is public domain. + * + * Authors: Kenton Varda (C interface wrapper) + */ + +#ifndef MODPLUG_H__INCLUDED +#define MODPLUG_H__INCLUDED + +#ifdef __cplusplus +extern "C" { +#endif + +struct _ModPlugFile; +typedef struct _ModPlugFile ModPlugFile; + +/* Load a mod file. [data] should point to a block of memory containing the complete + * file, and [size] should be the size of that block. + * Return the loaded mod file on success, or NULL on failure. */ +ModPlugFile* ModPlug_Load(const void* data, int size); +/* Unload a mod file. */ +void ModPlug_Unload(ModPlugFile* file); + +/* Read sample data into the buffer. Returns the number of bytes read. If the end + * of the mod has been reached, zero is returned. */ +int ModPlug_Read(ModPlugFile* file, void* buffer, int size); + +/* Get the name of the mod. The returned buffer is stored within the ModPlugFile + * structure and will remain valid until you unload the file. */ +const char* ModPlug_GetName(ModPlugFile* file); + +/* Get the length of the mod, in milliseconds. Note that this result is not always + * accurate, especially in the case of mods with loops. */ +int ModPlug_GetLength(ModPlugFile* file); + +/* Seek to a particular position in the song. Note that seeking and MODs don't mix very + * well. Some mods will be missing instruments for a short time after a seek, as ModPlug + * does not scan the sequence backwards to find out which instruments were supposed to be + * playing at that time. (Doing so would be difficult and not very reliable.) Also, + * note that seeking is not very exact in some mods -- especially those for which + * ModPlug_GetLength() does not report the full length. */ +void ModPlug_Seek(ModPlugFile* file, int millisecond); + +enum _ModPlug_Flags +{ + MODPLUG_ENABLE_OVERSAMPLING = 1 << 0, /* Enable oversampling (*highly* recommended) */ + MODPLUG_ENABLE_NOISE_REDUCTION = 1 << 1, /* Enable noise reduction */ + MODPLUG_ENABLE_REVERB = 1 << 2, /* Enable reverb */ + MODPLUG_ENABLE_MEGABASS = 1 << 3, /* Enable megabass */ + MODPLUG_ENABLE_SURROUND = 1 << 4 /* Enable surround sound. */ +}; + +enum _ModPlug_ResamplingMode +{ + MODPLUG_RESAMPLE_NEAREST = 0, /* No interpolation (very fast, extremely bad sound quality) */ + MODPLUG_RESAMPLE_LINEAR = 1, /* Linear interpolation (fast, good quality) */ + MODPLUG_RESAMPLE_SPLINE = 2, /* Cubic spline interpolation (high quality) */ + MODPLUG_RESAMPLE_FIR = 3 /* 8-tap fir filter (extremely high quality) */ +}; + +typedef struct _ModPlug_Settings +{ + int mFlags; /* One or more of the MODPLUG_ENABLE_* flags above, bitwise-OR'ed */ + + /* Note that ModPlug always decodes sound at 44100kHz, 32 bit, stereo and then + * down-mixes to the settings you choose. */ + int mChannels; /* Number of channels - 1 for mono or 2 for stereo */ + int mBits; /* Bits per sample - 8, 16, or 32 */ + int mFrequency; /* Sampling rate - 11025, 22050, or 44100 */ + int mResamplingMode; /* One of MODPLUG_RESAMPLE_*, above */ + + int mReverbDepth; /* Reverb level 0(quiet)-100(loud) */ + int mReverbDelay; /* Reverb delay in ms, usually 40-200ms */ + int mBassAmount; /* XBass level 0(quiet)-100(loud) */ + int mBassRange; /* XBass cutoff in Hz 10-100 */ + int mSurroundDepth; /* Surround level 0(quiet)-100(heavy) */ + int mSurroundDelay; /* Surround delay in ms, usually 5-40ms */ + int mLoopCount; /* Number of times to loop. Zero prevents looping. + -1 loops forever. */ +} ModPlug_Settings; + +/* Get and set the mod decoder settings. All options, except for channels, bits-per-sample, + * sampling rate, and loop count, will take effect immediately. Those options which don't + * take effect immediately will take effect the next time you load a mod. */ +void ModPlug_GetSettings(ModPlug_Settings* settings); +void ModPlug_SetSettings(const ModPlug_Settings* settings); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/SDK/LIBS/dcinclude/modplug/sndfile.h b/SDK/LIBS/dcinclude/modplug/sndfile.h new file mode 100644 index 00000000..e6720dc0 --- /dev/null +++ b/SDK/LIBS/dcinclude/modplug/sndfile.h @@ -0,0 +1,982 @@ +/* + * This source code is public domain. + * + * Authors: Olivier Lapicque , + * Adam Goode (endian and char fixes for PPC) +*/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifndef __SNDFILE_H +#define __SNDFILE_H + +#ifndef LPCBYTE +typedef const BYTE * LPCBYTE; +#endif + +#define MOD_AMIGAC2 0x1AB +#define MAX_SAMPLE_LENGTH 16000000 +#define MAX_SAMPLE_RATE 50000 +#define MAX_ORDERS 256 +#define MAX_PATTERNS 240 +#define MAX_SAMPLES 240 +#define MAX_INSTRUMENTS MAX_SAMPLES +#ifdef FASTSOUNDLIB +#define MAX_CHANNELS 80 +#else +#define MAX_CHANNELS 128 +#endif +#define MAX_BASECHANNELS 64 +#define MAX_ENVPOINTS 32 +#define MIN_PERIOD 0x0020 +#define MAX_PERIOD 0xFFFF +#define MAX_PATTERNNAME 32 +#define MAX_CHANNELNAME 20 +#define MAX_INFONAME 80 +#define MAX_EQ_BANDS 6 +#define MAX_MIXPLUGINS 8 + + +#define MOD_TYPE_NONE 0x00 +#define MOD_TYPE_MOD 0x01 +#define MOD_TYPE_S3M 0x02 +#define MOD_TYPE_XM 0x04 +#define MOD_TYPE_MED 0x08 +#define MOD_TYPE_MTM 0x10 +#define MOD_TYPE_IT 0x20 +#define MOD_TYPE_669 0x40 +#define MOD_TYPE_ULT 0x80 +#define MOD_TYPE_STM 0x100 +#define MOD_TYPE_FAR 0x200 +#define MOD_TYPE_WAV 0x400 +#define MOD_TYPE_AMF 0x800 +#define MOD_TYPE_AMS 0x1000 +#define MOD_TYPE_DSM 0x2000 +#define MOD_TYPE_MDL 0x4000 +#define MOD_TYPE_OKT 0x8000 +#define MOD_TYPE_MID 0x10000 +#define MOD_TYPE_DMF 0x20000 +#define MOD_TYPE_PTM 0x40000 +#define MOD_TYPE_DBM 0x80000 +#define MOD_TYPE_MT2 0x100000 +#define MOD_TYPE_AMF0 0x200000 +#define MOD_TYPE_PSM 0x400000 +#define MOD_TYPE_J2B 0x800000 +#define MOD_TYPE_UMX 0x80000000 // Fake type +#define MAX_MODTYPE 23 + + + +// Channel flags: +// Bits 0-7: Sample Flags +#define CHN_16BIT 0x01 +#define CHN_LOOP 0x02 +#define CHN_PINGPONGLOOP 0x04 +#define CHN_SUSTAINLOOP 0x08 +#define CHN_PINGPONGSUSTAIN 0x10 +#define CHN_PANNING 0x20 +#define CHN_STEREO 0x40 +#define CHN_PINGPONGFLAG 0x80 +// Bits 8-31: Channel Flags +#define CHN_MUTE 0x100 +#define CHN_KEYOFF 0x200 +#define CHN_NOTEFADE 0x400 +#define CHN_SURROUND 0x800 +#define CHN_NOIDO 0x1000 +#define CHN_HQSRC 0x2000 +#define CHN_FILTER 0x4000 +#define CHN_VOLUMERAMP 0x8000 +#define CHN_VIBRATO 0x10000 +#define CHN_TREMOLO 0x20000 +#define CHN_PANBRELLO 0x40000 +#define CHN_PORTAMENTO 0x80000 +#define CHN_GLISSANDO 0x100000 +#define CHN_VOLENV 0x200000 +#define CHN_PANENV 0x400000 +#define CHN_PITCHENV 0x800000 +#define CHN_FASTVOLRAMP 0x1000000 +#define CHN_EXTRALOUD 0x2000000 +#define CHN_REVERB 0x4000000 +#define CHN_NOREVERB 0x8000000 + + +#define ENV_VOLUME 0x0001 +#define ENV_VOLSUSTAIN 0x0002 +#define ENV_VOLLOOP 0x0004 +#define ENV_PANNING 0x0008 +#define ENV_PANSUSTAIN 0x0010 +#define ENV_PANLOOP 0x0020 +#define ENV_PITCH 0x0040 +#define ENV_PITCHSUSTAIN 0x0080 +#define ENV_PITCHLOOP 0x0100 +#define ENV_SETPANNING 0x0200 +#define ENV_FILTER 0x0400 +#define ENV_VOLCARRY 0x0800 +#define ENV_PANCARRY 0x1000 +#define ENV_PITCHCARRY 0x2000 + +#define CMD_NONE 0 +#define CMD_ARPEGGIO 1 +#define CMD_PORTAMENTOUP 2 +#define CMD_PORTAMENTODOWN 3 +#define CMD_TONEPORTAMENTO 4 +#define CMD_VIBRATO 5 +#define CMD_TONEPORTAVOL 6 +#define CMD_VIBRATOVOL 7 +#define CMD_TREMOLO 8 +#define CMD_PANNING8 9 +#define CMD_OFFSET 10 +#define CMD_VOLUMESLIDE 11 +#define CMD_POSITIONJUMP 12 +#define CMD_VOLUME 13 +#define CMD_PATTERNBREAK 14 +#define CMD_RETRIG 15 +#define CMD_SPEED 16 +#define CMD_TEMPO 17 +#define CMD_TREMOR 18 +#define CMD_MODCMDEX 19 +#define CMD_S3MCMDEX 20 +#define CMD_CHANNELVOLUME 21 +#define CMD_CHANNELVOLSLIDE 22 +#define CMD_GLOBALVOLUME 23 +#define CMD_GLOBALVOLSLIDE 24 +#define CMD_KEYOFF 25 +#define CMD_FINEVIBRATO 26 +#define CMD_PANBRELLO 27 +#define CMD_XFINEPORTAUPDOWN 28 +#define CMD_PANNINGSLIDE 29 +#define CMD_SETENVPOSITION 30 +#define CMD_MIDI 31 + + +// Volume Column commands +#define VOLCMD_VOLUME 1 +#define VOLCMD_PANNING 2 +#define VOLCMD_VOLSLIDEUP 3 +#define VOLCMD_VOLSLIDEDOWN 4 +#define VOLCMD_FINEVOLUP 5 +#define VOLCMD_FINEVOLDOWN 6 +#define VOLCMD_VIBRATOSPEED 7 +#define VOLCMD_VIBRATO 8 +#define VOLCMD_PANSLIDELEFT 9 +#define VOLCMD_PANSLIDERIGHT 10 +#define VOLCMD_TONEPORTAMENTO 11 +#define VOLCMD_PORTAUP 12 +#define VOLCMD_PORTADOWN 13 + +#define RSF_16BIT 0x04 +#define RSF_STEREO 0x08 + +#define RS_PCM8S 0 // 8-bit signed +#define RS_PCM8U 1 // 8-bit unsigned +#define RS_PCM8D 2 // 8-bit delta values +#define RS_ADPCM4 3 // 4-bit ADPCM-packed +#define RS_PCM16D 4 // 16-bit delta values +#define RS_PCM16S 5 // 16-bit signed +#define RS_PCM16U 6 // 16-bit unsigned +#define RS_PCM16M 7 // 16-bit motorola order +#define RS_STPCM8S (RS_PCM8S|RSF_STEREO) // stereo 8-bit signed +#define RS_STPCM8U (RS_PCM8U|RSF_STEREO) // stereo 8-bit unsigned +#define RS_STPCM8D (RS_PCM8D|RSF_STEREO) // stereo 8-bit delta values +#define RS_STPCM16S (RS_PCM16S|RSF_STEREO) // stereo 16-bit signed +#define RS_STPCM16U (RS_PCM16U|RSF_STEREO) // stereo 16-bit unsigned +#define RS_STPCM16D (RS_PCM16D|RSF_STEREO) // stereo 16-bit delta values +#define RS_STPCM16M (RS_PCM16M|RSF_STEREO) // stereo 16-bit signed big endian +// IT 2.14 compressed samples +#define RS_IT2148 0x10 +#define RS_IT21416 0x14 +#define RS_IT2158 0x12 +#define RS_IT21516 0x16 +// AMS Packed Samples +#define RS_AMS8 0x11 +#define RS_AMS16 0x15 +// DMF Huffman compression +#define RS_DMF8 0x13 +#define RS_DMF16 0x17 +// MDL Huffman compression +#define RS_MDL8 0x20 +#define RS_MDL16 0x24 +#define RS_PTM8DTO16 0x25 +// Stereo Interleaved Samples +#define RS_STIPCM8S (RS_PCM8S|0x40|RSF_STEREO) // stereo 8-bit signed +#define RS_STIPCM8U (RS_PCM8U|0x40|RSF_STEREO) // stereo 8-bit unsigned +#define RS_STIPCM16S (RS_PCM16S|0x40|RSF_STEREO) // stereo 16-bit signed +#define RS_STIPCM16U (RS_PCM16U|0x40|RSF_STEREO) // stereo 16-bit unsigned +#define RS_STIPCM16M (RS_PCM16M|0x40|RSF_STEREO) // stereo 16-bit signed big endian +// 24-bit signed +#define RS_PCM24S (RS_PCM16S|0x80) // mono 24-bit signed +#define RS_STIPCM24S (RS_PCM16S|0x80|RSF_STEREO) // stereo 24-bit signed +#define RS_PCM32S (RS_PCM16S|0xC0) // mono 24-bit signed +#define RS_STIPCM32S (RS_PCM16S|0xC0|RSF_STEREO) // stereo 24-bit signed + +// NNA types +#define NNA_NOTECUT 0 +#define NNA_CONTINUE 1 +#define NNA_NOTEOFF 2 +#define NNA_NOTEFADE 3 + +// DCT types +#define DCT_NONE 0 +#define DCT_NOTE 1 +#define DCT_SAMPLE 2 +#define DCT_INSTRUMENT 3 + +// DNA types +#define DNA_NOTECUT 0 +#define DNA_NOTEOFF 1 +#define DNA_NOTEFADE 2 + +// Mixer Hardware-Dependent features +#define SYSMIX_ENABLEMMX 0x01 +#define SYSMIX_WINDOWSNT 0x02 +#define SYSMIX_SLOWCPU 0x04 +#define SYSMIX_FASTCPU 0x08 + +// Module flags +#define SONG_EMBEDMIDICFG 0x0001 +#define SONG_FASTVOLSLIDES 0x0002 +#define SONG_ITOLDEFFECTS 0x0004 +#define SONG_ITCOMPATMODE 0x0008 +#define SONG_LINEARSLIDES 0x0010 +#define SONG_PATTERNLOOP 0x0020 +#define SONG_STEP 0x0040 +#define SONG_PAUSED 0x0080 +#define SONG_FADINGSONG 0x0100 +#define SONG_ENDREACHED 0x0200 +#define SONG_GLOBALFADE 0x0400 +#define SONG_CPUVERYHIGH 0x0800 +#define SONG_FIRSTTICK 0x1000 +#define SONG_MPTFILTERMODE 0x2000 +#define SONG_SURROUNDPAN 0x4000 +#define SONG_EXFILTERRANGE 0x8000 +#define SONG_AMIGALIMITS 0x10000 + +// Global Options (Renderer) +#define SNDMIX_REVERSESTEREO 0x0001 +#define SNDMIX_NOISEREDUCTION 0x0002 +#define SNDMIX_AGC 0x0004 +#define SNDMIX_NORESAMPLING 0x0008 +#define SNDMIX_HQRESAMPLER 0x0010 +#define SNDMIX_MEGABASS 0x0020 +#define SNDMIX_SURROUND 0x0040 +#define SNDMIX_REVERB 0x0080 +#define SNDMIX_EQ 0x0100 +#define SNDMIX_SOFTPANNING 0x0200 +#define SNDMIX_ULTRAHQSRCMODE 0x0400 +// Misc Flags (can safely be turned on or off) +#define SNDMIX_DIRECTTODISK 0x10000 +#define SNDMIX_ENABLEMMX 0x20000 +#define SNDMIX_NOBACKWARDJUMPS 0x40000 +#define SNDMIX_MAXDEFAULTPAN 0x80000 // Used by the MOD loader + + +// Reverb Types (GM2 Presets) +enum { + REVERBTYPE_SMALLROOM, + REVERBTYPE_MEDIUMROOM, + REVERBTYPE_LARGEROOM, + REVERBTYPE_SMALLHALL, + REVERBTYPE_MEDIUMHALL, + REVERBTYPE_LARGEHALL, + NUM_REVERBTYPES +}; + + +enum { + SRCMODE_NEAREST, + SRCMODE_LINEAR, + SRCMODE_SPLINE, + SRCMODE_POLYPHASE, + NUM_SRC_MODES +}; + + +// Sample Struct +typedef struct _MODINSTRUMENT +{ + UINT nLength,nLoopStart,nLoopEnd; + UINT nSustainStart, nSustainEnd; + signed char *pSample; + UINT nC4Speed; + WORD nPan; + WORD nVolume; + WORD nGlobalVol; + WORD uFlags; + signed char RelativeTone; + signed char nFineTune; + BYTE nVibType; + BYTE nVibSweep; + BYTE nVibDepth; + BYTE nVibRate; + CHAR name[22]; +} MODINSTRUMENT; + + +// Instrument Struct +typedef struct _INSTRUMENTHEADER +{ + UINT nFadeOut; + DWORD dwFlags; + WORD nGlobalVol; + WORD nPan; + WORD VolPoints[MAX_ENVPOINTS]; + WORD PanPoints[MAX_ENVPOINTS]; + WORD PitchPoints[MAX_ENVPOINTS]; + BYTE VolEnv[MAX_ENVPOINTS]; + BYTE PanEnv[MAX_ENVPOINTS]; + BYTE PitchEnv[MAX_ENVPOINTS]; + BYTE Keyboard[128]; + BYTE NoteMap[128]; + + BYTE nVolEnv; + BYTE nPanEnv; + BYTE nPitchEnv; + BYTE nVolLoopStart; + BYTE nVolLoopEnd; + BYTE nVolSustainBegin; + BYTE nVolSustainEnd; + BYTE nPanLoopStart; + BYTE nPanLoopEnd; + BYTE nPanSustainBegin; + BYTE nPanSustainEnd; + BYTE nPitchLoopStart; + BYTE nPitchLoopEnd; + BYTE nPitchSustainBegin; + BYTE nPitchSustainEnd; + BYTE nNNA; + BYTE nDCT; + BYTE nDNA; + BYTE nPanSwing; + BYTE nVolSwing; + BYTE nIFC; + BYTE nIFR; + WORD wMidiBank; + BYTE nMidiProgram; + BYTE nMidiChannel; + BYTE nMidiDrumKey; + signed char nPPS; + unsigned char nPPC; + CHAR name[32]; + CHAR filename[12]; +} INSTRUMENTHEADER; + + +// Channel Struct +typedef struct _MODCHANNEL +{ + // First 32-bytes: Most used mixing information: don't change it + signed char * pCurrentSample; + DWORD nPos; + DWORD nPosLo; // actually 16-bit + LONG nInc; // 16.16 + LONG nRightVol; + LONG nLeftVol; + LONG nRightRamp; + LONG nLeftRamp; + // 2nd cache line + DWORD nLength; + DWORD dwFlags; + DWORD nLoopStart; + DWORD nLoopEnd; + LONG nRampRightVol; + LONG nRampLeftVol; + LONG nFilter_Y1, nFilter_Y2, nFilter_Y3, nFilter_Y4; + LONG nFilter_A0, nFilter_B0, nFilter_B1; + LONG nROfs, nLOfs; + LONG nRampLength; + // Information not used in the mixer + signed char * pSample; + LONG nNewRightVol, nNewLeftVol; + LONG nRealVolume, nRealPan; + LONG nVolume, nPan, nFadeOutVol; + LONG nPeriod, nC4Speed, nPortamentoDest; + INSTRUMENTHEADER *pHeader; + MODINSTRUMENT *pInstrument; + DWORD nVolEnvPosition, nPanEnvPosition, nPitchEnvPosition; + DWORD nMasterChn, nVUMeter; + LONG nGlobalVol, nInsVol; + LONG nFineTune, nTranspose; + LONG nPortamentoSlide, nAutoVibDepth; + UINT nAutoVibPos, nVibratoPos, nTremoloPos, nPanbrelloPos; + // 16-bit members + signed short nVolSwing, nPanSwing; + // 8-bit members + BYTE nNote, nNNA; + BYTE nNewNote, nNewIns, nCommand, nArpeggio; + BYTE nOldVolumeSlide, nOldFineVolUpDown; + BYTE nOldPortaUpDown, nOldFinePortaUpDown; + BYTE nOldPanSlide, nOldChnVolSlide; + BYTE nVibratoType, nVibratoSpeed, nVibratoDepth; + BYTE nTremoloType, nTremoloSpeed, nTremoloDepth; + BYTE nPanbrelloType, nPanbrelloSpeed, nPanbrelloDepth; + BYTE nOldCmdEx, nOldVolParam, nOldTempo; + BYTE nOldOffset, nOldHiOffset; + BYTE nCutOff, nResonance; + BYTE nRetrigCount, nRetrigParam; + BYTE nTremorCount, nTremorParam; + BYTE nPatternLoop, nPatternLoopCount; + BYTE nRowNote, nRowInstr; + BYTE nRowVolCmd, nRowVolume; + BYTE nRowCommand, nRowParam; + BYTE nLeftVU, nRightVU; + BYTE nActiveMacro, nPadding; +} MODCHANNEL; + + +typedef struct _MODCHANNELSETTINGS +{ + UINT nPan; + UINT nVolume; + DWORD dwFlags; + UINT nMixPlugin; + char szName[MAX_CHANNELNAME]; // changed from CHAR +} MODCHANNELSETTINGS; + + +typedef struct _MODCOMMAND +{ + BYTE note; + BYTE instr; + BYTE volcmd; + BYTE command; + BYTE vol; + BYTE param; +} MODCOMMAND, *LPMODCOMMAND; + +//////////////////////////////////////////////////////////////////// +// Mix Plugins +#define MIXPLUG_MIXREADY 0x01 // Set when cleared + +class IMixPlugin +{ +public: + virtual int AddRef() = 0; + virtual int Release() = 0; + virtual void SaveAllParameters() = 0; + virtual void RestoreAllParameters() = 0; + virtual void Process(float *pOutL, float *pOutR, unsigned long nSamples) = 0; + virtual void Init(unsigned long nFreq, int bReset) = 0; + virtual void MidiSend(DWORD dwMidiCode) = 0; + virtual void MidiCommand(UINT nMidiCh, UINT nMidiProg, UINT note, UINT vol) = 0; +}; + + +#define MIXPLUG_INPUTF_MASTEREFFECT 0x01 // Apply to master mix +#define MIXPLUG_INPUTF_BYPASS 0x02 // Bypass effect +#define MIXPLUG_INPUTF_WETMIX 0x04 // Wet Mix (dry added) + +typedef struct _SNDMIXPLUGINSTATE +{ + DWORD dwFlags; // MIXPLUG_XXXX + LONG nVolDecayL, nVolDecayR; // Buffer click removal + int *pMixBuffer; // Stereo effect send buffer + float *pOutBufferL; // Temp storage for int -> float conversion + float *pOutBufferR; +} SNDMIXPLUGINSTATE, *PSNDMIXPLUGINSTATE; + +typedef struct _SNDMIXPLUGININFO +{ + DWORD dwPluginId1; + DWORD dwPluginId2; + DWORD dwInputRouting; // MIXPLUG_INPUTF_XXXX + DWORD dwOutputRouting; // 0=mix 0x80+=fx + DWORD dwReserved[4]; // Reserved for routing info + CHAR szName[32]; + CHAR szLibraryName[64]; // original DLL name +} SNDMIXPLUGININFO, *PSNDMIXPLUGININFO; // Size should be 128 + +typedef struct _SNDMIXPLUGIN +{ + IMixPlugin *pMixPlugin; + PSNDMIXPLUGINSTATE pMixState; + ULONG nPluginDataSize; + PVOID pPluginData; + SNDMIXPLUGININFO Info; +} SNDMIXPLUGIN, *PSNDMIXPLUGIN; + +typedef BOOL (*PMIXPLUGINCREATEPROC)(PSNDMIXPLUGIN); + +//////////////////////////////////////////////////////////////////// + +enum { + MIDIOUT_START=0, + MIDIOUT_STOP, + MIDIOUT_TICK, + MIDIOUT_NOTEON, + MIDIOUT_NOTEOFF, + MIDIOUT_VOLUME, + MIDIOUT_PAN, + MIDIOUT_BANKSEL, + MIDIOUT_PROGRAM, +}; + + +typedef struct MODMIDICFG +{ + char szMidiGlb[9*32]; // changed from CHAR + char szMidiSFXExt[16*32]; // changed from CHAR + char szMidiZXXExt[128*32]; // changed from CHAR +} MODMIDICFG, *LPMODMIDICFG; + + +typedef VOID (* LPSNDMIXHOOKPROC)(int *, unsigned long, unsigned long); // buffer, samples, channels + + + +//============== +class CSoundFile +//============== +{ +public: // Static Members + static UINT m_nXBassDepth, m_nXBassRange; + static UINT m_nReverbDepth, m_nReverbDelay, gnReverbType; + static UINT m_nProLogicDepth, m_nProLogicDelay; + static UINT m_nStereoSeparation; + static UINT m_nMaxMixChannels; + static LONG m_nStreamVolume; + static DWORD gdwSysInfo, gdwSoundSetup, gdwMixingFreq, gnBitsPerSample, gnChannels; + static UINT gnAGC, gnVolumeRampSamples, gnVUMeter, gnCPUUsage; + static LPSNDMIXHOOKPROC gpSndMixHook; + static PMIXPLUGINCREATEPROC gpMixPluginCreateProc; + +public: // for Editing + MODCHANNEL Chn[MAX_CHANNELS]; // Channels + UINT ChnMix[MAX_CHANNELS]; // Channels to be mixed + MODINSTRUMENT Ins[MAX_SAMPLES]; // Instruments + INSTRUMENTHEADER *Headers[MAX_INSTRUMENTS]; // Instrument Headers + MODCHANNELSETTINGS ChnSettings[MAX_BASECHANNELS]; // Channels settings + MODCOMMAND *Patterns[MAX_PATTERNS]; // Patterns + WORD PatternSize[MAX_PATTERNS]; // Patterns Lengths + BYTE Order[MAX_ORDERS]; // Pattern Orders + MODMIDICFG m_MidiCfg; // Midi macro config table + SNDMIXPLUGIN m_MixPlugins[MAX_MIXPLUGINS]; // Mix plugins + UINT m_nDefaultSpeed, m_nDefaultTempo, m_nDefaultGlobalVolume; + DWORD m_dwSongFlags; // Song flags SONG_XXXX + UINT m_nChannels, m_nMixChannels, m_nMixStat, m_nBufferCount; + UINT m_nType, m_nSamples, m_nInstruments; + UINT m_nTickCount, m_nTotalCount, m_nPatternDelay, m_nFrameDelay; + UINT m_nMusicSpeed, m_nMusicTempo; + UINT m_nNextRow, m_nRow; + UINT m_nPattern,m_nCurrentPattern,m_nNextPattern,m_nRestartPos; + UINT m_nMasterVolume, m_nGlobalVolume, m_nSongPreAmp; + UINT m_nFreqFactor, m_nTempoFactor, m_nOldGlbVolSlide; + LONG m_nMinPeriod, m_nMaxPeriod, m_nRepeatCount, m_nInitialRepeatCount; + DWORD m_nGlobalFadeSamples, m_nGlobalFadeMaxSamples; + UINT m_nMaxOrderPosition; + UINT m_nPatternNames; + LPSTR m_lpszSongComments, m_lpszPatternNames; + char m_szNames[MAX_INSTRUMENTS][32]; // changed from CHAR + CHAR CompressionTable[16]; + +public: + CSoundFile(); + ~CSoundFile(); + +public: + BOOL Create(LPCBYTE lpStream, DWORD dwMemLength=0); + BOOL Destroy(); + UINT GetType() const { return m_nType; } + UINT GetNumChannels() const; + UINT GetLogicalChannels() const { return m_nChannels; } + BOOL SetMasterVolume(UINT vol, BOOL bAdjustAGC=FALSE); + UINT GetMasterVolume() const { return m_nMasterVolume; } + UINT GetNumPatterns() const; + UINT GetNumInstruments() const; + UINT GetNumSamples() const { return m_nSamples; } + UINT GetCurrentPos() const; + UINT GetCurrentPattern() const { return m_nPattern; } + UINT GetCurrentOrder() const { return m_nCurrentPattern; } + UINT GetSongComments(LPSTR s, UINT cbsize, UINT linesize=32); + UINT GetRawSongComments(LPSTR s, UINT cbsize, UINT linesize=32); + UINT GetMaxPosition() const; + void SetCurrentPos(UINT nPos); + void SetCurrentOrder(UINT nOrder); + void GetTitle(LPSTR s) const { lstrcpyn(s,m_szNames[0],32); } + LPCSTR GetTitle() const { return m_szNames[0]; } + UINT GetSampleName(UINT nSample,LPSTR s=NULL) const; + UINT GetInstrumentName(UINT nInstr,LPSTR s=NULL) const; + UINT GetMusicSpeed() const { return m_nMusicSpeed; } + UINT GetMusicTempo() const { return m_nMusicTempo; } + DWORD GetLength(BOOL bAdjust, BOOL bTotal=FALSE); + DWORD GetSongTime() { return GetLength(FALSE, TRUE); } + void SetRepeatCount(int n) { m_nRepeatCount = n; m_nInitialRepeatCount = n; } + int GetRepeatCount() const { return m_nRepeatCount; } + BOOL IsPaused() const { return (m_dwSongFlags & SONG_PAUSED) ? TRUE : FALSE; } + void LoopPattern(int nPat, int nRow=0); + void CheckCPUUsage(UINT nCPU); + BOOL SetPatternName(UINT nPat, LPCSTR lpszName); + BOOL GetPatternName(UINT nPat, LPSTR lpszName, UINT cbSize=MAX_PATTERNNAME) const; + // Module Loaders + BOOL ReadXM(LPCBYTE lpStream, DWORD dwMemLength); + BOOL ReadS3M(LPCBYTE lpStream, DWORD dwMemLength); + BOOL ReadMod(LPCBYTE lpStream, DWORD dwMemLength); + BOOL ReadMed(LPCBYTE lpStream, DWORD dwMemLength); + BOOL ReadMTM(LPCBYTE lpStream, DWORD dwMemLength); + BOOL ReadSTM(LPCBYTE lpStream, DWORD dwMemLength); + BOOL ReadIT(LPCBYTE lpStream, DWORD dwMemLength); + BOOL Read669(LPCBYTE lpStream, DWORD dwMemLength); + BOOL ReadUlt(LPCBYTE lpStream, DWORD dwMemLength); + BOOL ReadWav(LPCBYTE lpStream, DWORD dwMemLength); + BOOL ReadDSM(LPCBYTE lpStream, DWORD dwMemLength); + BOOL ReadFAR(LPCBYTE lpStream, DWORD dwMemLength); + BOOL ReadAMS(LPCBYTE lpStream, DWORD dwMemLength); + BOOL ReadAMS2(LPCBYTE lpStream, DWORD dwMemLength); + BOOL ReadMDL(LPCBYTE lpStream, DWORD dwMemLength); + BOOL ReadOKT(LPCBYTE lpStream, DWORD dwMemLength); + BOOL ReadDMF(LPCBYTE lpStream, DWORD dwMemLength); + BOOL ReadPTM(LPCBYTE lpStream, DWORD dwMemLength); + BOOL ReadDBM(LPCBYTE lpStream, DWORD dwMemLength); + BOOL ReadAMF(LPCBYTE lpStream, DWORD dwMemLength); + BOOL ReadMT2(LPCBYTE lpStream, DWORD dwMemLength); + BOOL ReadPSM(LPCBYTE lpStream, DWORD dwMemLength); + BOOL ReadJ2B(LPCBYTE lpStream, DWORD dwMemLength); + BOOL ReadUMX(LPCBYTE lpStream, DWORD dwMemLength); + // Save Functions +#ifndef MODPLUG_NO_FILESAVE + UINT WriteSample(FILE *f, MODINSTRUMENT *pins, UINT nFlags, UINT nMaxLen=0); + BOOL SaveXM(LPCSTR lpszFileName, UINT nPacking=0); + BOOL SaveS3M(LPCSTR lpszFileName, UINT nPacking=0); + BOOL SaveMod(LPCSTR lpszFileName, UINT nPacking=0); + BOOL SaveIT(LPCSTR lpszFileName, UINT nPacking=0); +#endif // MODPLUG_NO_FILESAVE + // MOD Convert function + UINT GetBestSaveFormat() const; + UINT GetSaveFormats() const; + void ConvertModCommand(MODCOMMAND *) const; + void S3MConvert(MODCOMMAND *m, BOOL bIT) const; + void S3MSaveConvert(UINT *pcmd, UINT *pprm, BOOL bIT) const; + WORD ModSaveCommand(const MODCOMMAND *m, BOOL bXM) const; + +public: + // Real-time sound functions + VOID ResetChannels(); + + UINT Read(LPVOID lpBuffer, UINT cbBuffer); + UINT CreateStereoMix(int count); + BOOL FadeSong(UINT msec); + BOOL GlobalFadeSong(UINT msec); + UINT GetTotalTickCount() const { return m_nTotalCount; } + VOID ResetTotalTickCount() { m_nTotalCount = 0; } + +public: + // Mixer Config + static BOOL InitPlayer(BOOL bReset=FALSE); + static BOOL SetWaveConfig(UINT nRate,UINT nBits,UINT nChannels,BOOL bMMX=FALSE); + static BOOL SetResamplingMode(UINT nMode); // SRCMODE_XXXX + static BOOL IsStereo() { return (gnChannels > 1) ? TRUE : FALSE; } + static DWORD GetSampleRate() { return gdwMixingFreq; } + static DWORD GetBitsPerSample() { return gnBitsPerSample; } + static DWORD InitSysInfo(); + static DWORD GetSysInfo() { return gdwSysInfo; } + // AGC + static BOOL GetAGC() { return (gdwSoundSetup & SNDMIX_AGC) ? TRUE : FALSE; } + static void SetAGC(BOOL b); + static void ResetAGC(); + static void ProcessAGC(int count); + + //GCCFIX -- added these functions back in! + static BOOL SetWaveConfigEx(BOOL bSurround,BOOL bNoOverSampling,BOOL bReverb,BOOL hqido,BOOL bMegaBass,BOOL bNR,BOOL bEQ); + // DSP Effects + static void InitializeDSP(BOOL bReset); + static void ProcessStereoDSP(int count); + static void ProcessMonoDSP(int count); + // [Reverb level 0(quiet)-100(loud)], [delay in ms, usually 40-200ms] + static BOOL SetReverbParameters(UINT nDepth, UINT nDelay); + // [XBass level 0(quiet)-100(loud)], [cutoff in Hz 10-100] + static BOOL SetXBassParameters(UINT nDepth, UINT nRange); + // [Surround level 0(quiet)-100(heavy)] [delay in ms, usually 5-40ms] + static BOOL SetSurroundParameters(UINT nDepth, UINT nDelay); +public: + BOOL ReadNote(); + BOOL ProcessRow(); + BOOL ProcessEffects(); + UINT GetNNAChannel(UINT nChn) const; + void CheckNNA(UINT nChn, UINT instr, int note, BOOL bForceCut); + void NoteChange(UINT nChn, int note, BOOL bPorta=FALSE, BOOL bResetEnv=TRUE); + void InstrumentChange(MODCHANNEL *pChn, UINT instr, BOOL bPorta=FALSE,BOOL bUpdVol=TRUE,BOOL bResetEnv=TRUE); + // Channel Effects + void PortamentoUp(MODCHANNEL *pChn, UINT param); + void PortamentoDown(MODCHANNEL *pChn, UINT param); + void FinePortamentoUp(MODCHANNEL *pChn, UINT param); + void FinePortamentoDown(MODCHANNEL *pChn, UINT param); + void ExtraFinePortamentoUp(MODCHANNEL *pChn, UINT param); + void ExtraFinePortamentoDown(MODCHANNEL *pChn, UINT param); + void TonePortamento(MODCHANNEL *pChn, UINT param); + void Vibrato(MODCHANNEL *pChn, UINT param); + void FineVibrato(MODCHANNEL *pChn, UINT param); + void VolumeSlide(MODCHANNEL *pChn, UINT param); + void PanningSlide(MODCHANNEL *pChn, UINT param); + void ChannelVolSlide(MODCHANNEL *pChn, UINT param); + void FineVolumeUp(MODCHANNEL *pChn, UINT param); + void FineVolumeDown(MODCHANNEL *pChn, UINT param); + void Tremolo(MODCHANNEL *pChn, UINT param); + void Panbrello(MODCHANNEL *pChn, UINT param); + void RetrigNote(UINT nChn, UINT param); + void NoteCut(UINT nChn, UINT nTick); + void KeyOff(UINT nChn); + int PatternLoop(MODCHANNEL *, UINT param); + void ExtendedMODCommands(UINT nChn, UINT param); + void ExtendedS3MCommands(UINT nChn, UINT param); + void ExtendedChannelEffect(MODCHANNEL *, UINT param); + void ProcessMidiMacro(UINT nChn, LPCSTR pszMidiMacro, UINT param=0); + void SetupChannelFilter(MODCHANNEL *pChn, BOOL bReset, int flt_modifier=256) const; + // Low-Level effect processing + void DoFreqSlide(MODCHANNEL *pChn, LONG nFreqSlide); + // Global Effects + void SetTempo(UINT param); + void SetSpeed(UINT param); + void GlobalVolSlide(UINT param); + DWORD IsSongFinished(UINT nOrder, UINT nRow) const; + BOOL IsValidBackwardJump(UINT nStartOrder, UINT nStartRow, UINT nJumpOrder, UINT nJumpRow) const; + // Read/Write sample functions + signed char GetDeltaValue(signed char prev, UINT n) const { return (signed char)(prev + CompressionTable[n & 0x0F]); } + UINT PackSample(int &sample, int next); + BOOL CanPackSample(LPSTR pSample, UINT nLen, UINT nPacking, BYTE *result=NULL); + UINT ReadSample(MODINSTRUMENT *pIns, UINT nFlags, LPCSTR pMemFile, DWORD dwMemLength); + BOOL DestroySample(UINT nSample); + BOOL DestroyInstrument(UINT nInstr); + BOOL IsSampleUsed(UINT nSample); + BOOL IsInstrumentUsed(UINT nInstr); + BOOL RemoveInstrumentSamples(UINT nInstr); + UINT DetectUnusedSamples(BOOL *); + BOOL RemoveSelectedSamples(BOOL *); + void AdjustSampleLoop(MODINSTRUMENT *pIns); + // I/O from another sound file + BOOL ReadInstrumentFromSong(UINT nInstr, CSoundFile *, UINT nSrcInstrument); + BOOL ReadSampleFromSong(UINT nSample, CSoundFile *, UINT nSrcSample); + // Period/Note functions + UINT GetNoteFromPeriod(UINT period) const; + UINT GetPeriodFromNote(UINT note, int nFineTune, UINT nC4Speed) const; + UINT GetFreqFromPeriod(UINT period, UINT nC4Speed, int nPeriodFrac=0) const; + // Misc functions + MODINSTRUMENT *GetSample(UINT n) { return Ins+n; } + void ResetMidiCfg(); + UINT MapMidiInstrument(DWORD dwProgram, UINT nChannel, UINT nNote); + BOOL ITInstrToMPT(const void *p, INSTRUMENTHEADER *penv, UINT trkvers); + UINT SaveMixPlugins(FILE *f=NULL, BOOL bUpdate=TRUE); + UINT LoadMixPlugins(const void *pData, UINT nLen); +#ifndef NO_FILTER + DWORD CutOffToFrequency(UINT nCutOff, int flt_modifier=256) const; // [0-255] => [1-10KHz] +#endif + + // Static helper functions +public: + static DWORD TransposeToFrequency(int transp, int ftune=0); + static int FrequencyToTranspose(DWORD freq); + static void FrequencyToTranspose(MODINSTRUMENT *psmp); + + // System-Dependant functions +public: + static MODCOMMAND *AllocatePattern(UINT rows, UINT nchns); + static signed char* AllocateSample(UINT nbytes); + static void FreePattern(LPVOID pat); + static void FreeSample(LPVOID p); + static UINT Normalize24BitBuffer(LPBYTE pbuffer, UINT cbsizebytes, DWORD lmax24, DWORD dwByteInc); +}; + + +// inline DWORD BigEndian(DWORD x) { return ((x & 0xFF) << 24) | ((x & 0xFF00) << 8) | ((x & 0xFF0000) >> 8) | ((x & 0xFF000000) >> 24); } +// inline WORD BigEndianW(WORD x) { return (WORD)(((x >> 8) & 0xFF) | ((x << 8) & 0xFF00)); } + + +////////////////////////////////////////////////////////// +// WAVE format information + +#pragma pack(1) + +// Standard IFF chunks IDs +#define IFFID_FORM 0x4d524f46 +#define IFFID_RIFF 0x46464952 +#define IFFID_WAVE 0x45564157 +#define IFFID_LIST 0x5453494C +#define IFFID_INFO 0x4F464E49 + +// IFF Info fields +#define IFFID_ICOP 0x504F4349 +#define IFFID_IART 0x54524149 +#define IFFID_IPRD 0x44525049 +#define IFFID_INAM 0x4D414E49 +#define IFFID_ICMT 0x544D4349 +#define IFFID_IENG 0x474E4549 +#define IFFID_ISFT 0x54465349 +#define IFFID_ISBJ 0x4A425349 +#define IFFID_IGNR 0x524E4749 +#define IFFID_ICRD 0x44524349 + +// Wave IFF chunks IDs +#define IFFID_wave 0x65766177 +#define IFFID_fmt 0x20746D66 +#define IFFID_wsmp 0x706D7377 +#define IFFID_pcm 0x206d6370 +#define IFFID_data 0x61746164 +#define IFFID_smpl 0x6C706D73 +#define IFFID_xtra 0x61727478 + +typedef struct WAVEFILEHEADER +{ + DWORD id_RIFF; // "RIFF" + DWORD filesize; // file length-8 + DWORD id_WAVE; +} WAVEFILEHEADER; + + +typedef struct WAVEFORMATHEADER +{ + DWORD id_fmt; // "fmt " + DWORD hdrlen; // 16 + WORD format; // 1 + WORD channels; // 1:mono, 2:stereo + DWORD freqHz; // sampling freq + DWORD bytessec; // bytes/sec=freqHz*samplesize + WORD samplesize; // sizeof(sample) + WORD bitspersample; // bits per sample (8/16) +} WAVEFORMATHEADER; + + +typedef struct WAVEDATAHEADER +{ + DWORD id_data; // "data" + DWORD length; // length of data +} WAVEDATAHEADER; + + +typedef struct WAVESMPLHEADER +{ + // SMPL + DWORD smpl_id; // "smpl" -> 0x6C706D73 + DWORD smpl_len; // length of smpl: 3Ch (54h with sustain loop) + DWORD dwManufacturer; + DWORD dwProduct; + DWORD dwSamplePeriod; // 1000000000/freqHz + DWORD dwBaseNote; // 3Ch = C-4 -> 60 + RelativeTone + DWORD dwPitchFraction; + DWORD dwSMPTEFormat; + DWORD dwSMPTEOffset; + DWORD dwSampleLoops; // number of loops + DWORD cbSamplerData; +} WAVESMPLHEADER; + + +typedef struct SAMPLELOOPSTRUCT +{ + DWORD dwIdentifier; + DWORD dwLoopType; // 0=normal, 1=bidi + DWORD dwLoopStart; + DWORD dwLoopEnd; // Byte offset ? + DWORD dwFraction; + DWORD dwPlayCount; // Loop Count, 0=infinite +} SAMPLELOOPSTRUCT; + + +typedef struct WAVESAMPLERINFO +{ + WAVESMPLHEADER wsiHdr; + SAMPLELOOPSTRUCT wsiLoops[2]; +} WAVESAMPLERINFO; + + +typedef struct WAVELISTHEADER +{ + DWORD list_id; // "LIST" -> 0x5453494C + DWORD list_len; + DWORD info; // "INFO" +} WAVELISTHEADER; + + +typedef struct WAVEEXTRAHEADER +{ + DWORD xtra_id; // "xtra" -> 0x61727478 + DWORD xtra_len; + DWORD dwFlags; + WORD wPan; + WORD wVolume; + WORD wGlobalVol; + WORD wReserved; + BYTE nVibType; + BYTE nVibSweep; + BYTE nVibDepth; + BYTE nVibRate; +} WAVEEXTRAHEADER; + +#pragma pack() + +/////////////////////////////////////////////////////////// +// Low-level Mixing functions + +#define MIXBUFFERSIZE 512 +#define MIXING_ATTENUATION 4 +#define MIXING_CLIPMIN (-0x08000000) +#define MIXING_CLIPMAX (0x07FFFFFF) +#define VOLUMERAMPPRECISION 12 +#define FADESONGDELAY 100 +#define EQ_BUFFERSIZE (MIXBUFFERSIZE) +#define AGC_PRECISION 9 +#define AGC_UNITY (1 << AGC_PRECISION) + +// Calling conventions +#ifdef MSC_VER +#define MPPASMCALL __cdecl +#define MPPFASTCALL __fastcall +#else +#define MPPASMCALL +#define MPPFASTCALL +#endif + +#define MOD2XMFineTune(k) ((int)( (signed char)((k)<<4) )) +#define XM2MODFineTune(k) ((int)( (k>>4)&0x0f )) + +int _muldiv(long a, long b, long c); +int _muldivr(long a, long b, long c); + + +// Byte swapping functions from the GNU C Library and libsdl + +/* Swap bytes in 16 bit value. */ +#ifdef __GNUC__ +# define bswap_16(x) \ + (__extension__ \ + ({ unsigned short int __bsx = (x); \ + ((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8)); })) +#else +static __inline unsigned short int +bswap_16 (unsigned short int __bsx) +{ + return ((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8)); +} +#endif + +/* Swap bytes in 32 bit value. */ +#ifdef __GNUC__ +# define bswap_32(x) \ + (__extension__ \ + ({ unsigned int __bsx = (x); \ + ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >> 8) | \ + (((__bsx) & 0x0000ff00) << 8) | (((__bsx) & 0x000000ff) << 24)); })) +#else +static __inline unsigned int +bswap_32 (unsigned int __bsx) +{ + return ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >> 8) | + (((__bsx) & 0x0000ff00) << 8) | (((__bsx) & 0x000000ff) << 24)); +} +#endif + + +// From libsdl +#undef WORDS_BIGENDIAN +#ifdef WORDS_BIGENDIAN +#define bswapLE16(X) bswap_16(X) +#define bswapLE32(X) bswap_32(X) +#define bswapBE16(X) (X) +#define bswapBE32(X) (X) +#else +#define bswapLE16(X) (X) +#define bswapLE32(X) (X) +#define bswapBE16(X) bswap_16(X) +#define bswapBE32(X) bswap_32(X) +#endif + + +#endif diff --git a/SDK/LIBS/dcinclude/modplug/stdafx.h b/SDK/LIBS/dcinclude/modplug/stdafx.h new file mode 100644 index 00000000..b60cce78 --- /dev/null +++ b/SDK/LIBS/dcinclude/modplug/stdafx.h @@ -0,0 +1,98 @@ +/* + * This source code is public domain. + * + * Authors: Rani Assaf , + * Olivier Lapicque , + * Adam Goode (endian and char fixes for PPC) +*/ + +#ifndef _STDAFX_H_ +#define _STDAFX_H_ + + +#ifdef MSC_VER + +#pragma warning (disable:4201) +#pragma warning (disable:4514) +#include +#include +#include +#include + +inline void ProcessPlugins(int n) {} + +#else + +#include +#include +#include + +typedef signed char CHAR; +typedef unsigned char UCHAR; +typedef unsigned char* PUCHAR; +typedef unsigned short USHORT; +typedef unsigned long ULONG; +typedef unsigned long UINT; +typedef unsigned long DWORD; +typedef long LONG; +typedef unsigned short WORD; +typedef unsigned char BYTE; +typedef unsigned char * LPBYTE; +typedef bool BOOL; +typedef char * LPSTR; +typedef void * LPVOID; +typedef long * LPLONG; +typedef unsigned long * LPDWORD; +typedef unsigned short * LPWORD; +typedef const char * LPCSTR; +typedef long long LONGLONG; +typedef void * PVOID; +typedef void VOID; + + +inline LONG MulDiv (long a, long b, long c) +{ + // if (!c) return 0; + return ((unsigned long long) a * (unsigned long long) b ) / c; +} + +#define MODPLUG_NO_FILESAVE +#define NO_AGC +#define LPCTSTR LPCSTR +#define lstrcpyn strncpy +#define lstrcpy strcpy +#define lstrcmp strcmp +#define WAVE_FORMAT_PCM 1 +//#define ENABLE_EQ + +#define GHND 0 + +inline signed char * GlobalAllocPtr(unsigned int, size_t size) +{ + signed char * p = (signed char *) malloc(size); + + if (p != NULL) memset(p, 0, size); + return p; +} + +inline void ProcessPlugins(int n) {} + +#define GlobalFreePtr(p) free((void *)(p)) + +#define strnicmp(a,b,c) strncasecmp(a,b,c) +#define wsprintf sprintf + +#ifndef FALSE +#define FALSE false +#endif + +#ifndef TRUE +#define TRUE true +#endif + +#endif // MSC_VER + +#endif + + + diff --git a/SDK/LIBS/dcinclude/mp3/sfxmgr.h b/SDK/LIBS/dcinclude/mp3/sfxmgr.h new file mode 100644 index 00000000..51e113c8 --- /dev/null +++ b/SDK/LIBS/dcinclude/mp3/sfxmgr.h @@ -0,0 +1,23 @@ +/* KallistiOS 1.2.0 + + sfxmgr.h + (c)2000 Dan Potter + + $Id: sfxmgr.h,v 1.1 2003/02/27 03:46:30 bardtx Exp $ + +*/ + +#ifndef __SFXMGR_H +#define __SFXMGR_H + +#include +__BEGIN_DECLS + +int sfx_load(const char *fn); +void sfx_play(int idx, int vol, int pan); +void sfx_unload_all(); + +__END_DECLS + +#endif /* __SFXMGR_H */ + diff --git a/SDK/LIBS/dcinclude/mp3/sndmp3.h b/SDK/LIBS/dcinclude/mp3/sndmp3.h new file mode 100644 index 00000000..a63107dd --- /dev/null +++ b/SDK/LIBS/dcinclude/mp3/sndmp3.h @@ -0,0 +1,28 @@ +/* KallistiOS 1.2.0 + + sndmp3.h + (c)2000 Dan Potter + + $Id: sndmp3.h,v 1.1 2003/02/27 03:46:30 bardtx Exp $ + +*/ + +#ifndef __SNDMP3_H +#define __SNDMP3_H + +#include +__BEGIN_DECLS + +int sndmp3_init(const char *fn, int loop); + +/* Initialize the MP3 driver; takes an input filename and starts the + decoding process. */ +int sndmp3_start(const char *fn, int loop); + +/* Shut everything down */ +void sndmp3_shutdown(); + +__END_DECLS + +#endif /* __SNDMP3_H */ + diff --git a/SDK/LIBS/dcinclude/mp3/sndserver.h b/SDK/LIBS/dcinclude/mp3/sndserver.h new file mode 100644 index 00000000..27924360 --- /dev/null +++ b/SDK/LIBS/dcinclude/mp3/sndserver.h @@ -0,0 +1,34 @@ +/* KallistiOS 1.2.0 + + sndserver.h + (c)2000 Dan Potter + + $Id: sndserver.h,v 1.1 2003/02/27 03:46:30 bardtx Exp $ + +*/ + +#ifndef __SNDSERVER_H +#define __SNDSERVER_H + +#include +__BEGIN_DECLS + +#include +#include + +/* Starts the MP3 server thread */ +int mp3_init(); + +/* Starts a song playing */ +int mp3_start(const char *fn, int loop); + +/* Stops the playing song */ +int mp3_stop(); + +/* Shuts down the MP3 server thread */ +int mp3_quit(); + +__END_DECLS + +#endif /* __SNDSERVER_H */ + diff --git a/SDK/LIBS/dcinclude/navi/flash.h b/SDK/LIBS/dcinclude/navi/flash.h new file mode 100644 index 00000000..a7cbbb3e --- /dev/null +++ b/SDK/LIBS/dcinclude/navi/flash.h @@ -0,0 +1,28 @@ +/* KallistiOS 1.2.0 + + navi/flash.h + (c)2002 Dan Potter + + $Id: flash.h,v 1.1 2002/05/05 22:17:51 bardtx Exp $ +*/ + +#ifndef __NAVI_FLASH_H +#define __NAVI_FLASH_H + +#include + +/* Return 0 if we successfully detect a compatible device */ +int nvflash_detect(); + +/* Erase a block of flash */ +int nvflash_erase_block(uint32 addr); + +/* Write a block of data */ +int nvflash_write_block(uint32 addr, void * data, uint32 len); + +/* Erase the whole flash chip */ +int nvflash_erase_all(); + + +#endif /* __NAVI_FLASH_H */ + diff --git a/SDK/LIBS/dcinclude/navi/ide.h b/SDK/LIBS/dcinclude/navi/ide.h new file mode 100644 index 00000000..66b55f1f --- /dev/null +++ b/SDK/LIBS/dcinclude/navi/ide.h @@ -0,0 +1,29 @@ +/* KallistiOS 1.2.0 + + navi/ide.h + (c)2002 Dan Potter + + $Id: ide.h,v 1.1 2002/05/05 22:17:51 bardtx Exp $ +*/ + +#ifndef __NAVI_IDE_H +#define __NAVI_IDE_H + +#include + +/* Read n sectors from the hard disk using PIO mode */ +int ide_read(uint32 linear,uint32 numsects, void *bufptr); + +/* Write n sectors to the hard disk using PIO mode */ +int ide_write(uint32 linear,uint32 numsects, void *bufptr); + +/* Get the available space */ +uint32 ide_num_sectors(); + +/* Init/Shutdown the device */ +int ide_init(); +void ide_shutdown(); + + +#endif /* __NAVI_IDE_H */ + diff --git a/SDK/LIBS/dcinclude/newlib-libm-arm/_ansi.h b/SDK/LIBS/dcinclude/newlib-libm-arm/_ansi.h new file mode 100644 index 00000000..5daad478 --- /dev/null +++ b/SDK/LIBS/dcinclude/newlib-libm-arm/_ansi.h @@ -0,0 +1,77 @@ +/* Provide support for both ANSI and non-ANSI environments. */ + +/* Some ANSI environments are "broken" in the sense that __STDC__ cannot be + relied upon to have it's intended meaning. Therefore we must use our own + concoction: _HAVE_STDC. Always use _HAVE_STDC instead of __STDC__ in newlib + sources! + + To get a strict ANSI C environment, define macro __STRICT_ANSI__. This will + "comment out" the non-ANSI parts of the ANSI header files (non-ANSI header + files aren't affected). */ + +#ifndef _ANSIDECL_H_ +#define _ANSIDECL_H_ + +#include + +/* First try to figure out whether we really are in an ANSI C environment. */ +/* FIXME: This probably needs some work. Perhaps sys/config.h can be + prevailed upon to give us a clue. */ + +#ifdef __STDC__ +#define _HAVE_STDC +#endif + +#ifdef _HAVE_STDC +#define _PTR void * +#define _AND , +#define _NOARGS void +#define _CONST const +#define _VOLATILE volatile +#define _SIGNED signed +#define _DOTS , ... +#define _VOID void +#ifdef __CYGWIN__ +#define _EXFUN(name, proto) __cdecl name proto +#define _EXPARM(name, proto) (* __cdecl name) proto +#else +#define _EXFUN(name, proto) name proto +#define _EXPARM(name, proto) (* name) proto +#endif +#define _DEFUN(name, arglist, args) name(args) +#define _DEFUN_VOID(name) name(_NOARGS) +#define _CAST_VOID (void) +#ifndef _LONG_DOUBLE +#define _LONG_DOUBLE long double +#endif +#ifndef _PARAMS +#define _PARAMS(paramlist) paramlist +#endif +#else +#define _PTR char * +#define _AND ; +#define _NOARGS +#define _CONST +#define _VOLATILE +#define _SIGNED +#define _DOTS +#define _VOID void +#define _EXFUN(name, proto) name() +#define _DEFUN(name, arglist, args) name arglist args; +#define _DEFUN_VOID(name) name() +#define _CAST_VOID +#define _LONG_DOUBLE double +#ifndef _PARAMS +#define _PARAMS(paramlist) () +#endif +#endif + +/* Support gcc's __attribute__ facility. */ + +#ifdef __GNUC__ +#define _ATTRIBUTE(attrs) __attribute__ (attrs) +#else +#define _ATTRIBUTE(attrs) +#endif + +#endif /* _ANSIDECL_H_ */ diff --git a/SDK/LIBS/dcinclude/newlib-libm-arm/ieeefp.h b/SDK/LIBS/dcinclude/newlib-libm-arm/ieeefp.h new file mode 100644 index 00000000..78bb5bf6 --- /dev/null +++ b/SDK/LIBS/dcinclude/newlib-libm-arm/ieeefp.h @@ -0,0 +1,241 @@ +#ifndef _IEEE_FP_H_ +#define _IEEE_FP_H_ + +#include "_ansi.h" + +#include + +/* FIXME FIXME FIXME: + Neither of __ieee_{float,double}_shape_tape seem to be used anywhere + except in libm/test. If that is the case, please delete these from here. + If that is not the case, please insert documentation here describing why + they're needed. */ + +#ifdef __IEEE_BIG_ENDIAN + +typedef union +{ + double value; + struct + { + unsigned int sign : 1; + unsigned int exponent: 11; + unsigned int fraction0:4; + unsigned int fraction1:16; + unsigned int fraction2:16; + unsigned int fraction3:16; + + } number; + struct + { + unsigned int sign : 1; + unsigned int exponent: 11; + unsigned int quiet:1; + unsigned int function0:3; + unsigned int function1:16; + unsigned int function2:16; + unsigned int function3:16; + } nan; + struct + { + unsigned long msw; + unsigned long lsw; + } parts; + long aslong[2]; +} __ieee_double_shape_type; + +#endif + +#ifdef __IEEE_LITTLE_ENDIAN + +typedef union +{ + double value; + struct + { +#ifdef __SMALL_BITFIELDS + unsigned int fraction3:16; + unsigned int fraction2:16; + unsigned int fraction1:16; + unsigned int fraction0: 4; +#else + unsigned int fraction1:32; + unsigned int fraction0:20; +#endif + unsigned int exponent :11; + unsigned int sign : 1; + } number; + struct + { +#ifdef __SMALL_BITFIELDS + unsigned int function3:16; + unsigned int function2:16; + unsigned int function1:16; + unsigned int function0:3; +#else + unsigned int function1:32; + unsigned int function0:19; +#endif + unsigned int quiet:1; + unsigned int exponent: 11; + unsigned int sign : 1; + } nan; + struct + { + unsigned long lsw; + unsigned long msw; + } parts; + + long aslong[2]; + +} __ieee_double_shape_type; + +#endif + +#ifdef __IEEE_BIG_ENDIAN + +typedef union +{ + float value; + struct + { + unsigned int sign : 1; + unsigned int exponent: 8; + unsigned int fraction0: 7; + unsigned int fraction1: 16; + } number; + struct + { + unsigned int sign:1; + unsigned int exponent:8; + unsigned int quiet:1; + unsigned int function0:6; + unsigned int function1:16; + } nan; + long p1; + +} __ieee_float_shape_type; + +#endif + +#ifdef __IEEE_LITTLE_ENDIAN + +typedef union +{ + float value; + struct + { + unsigned int fraction0: 7; + unsigned int fraction1: 16; + unsigned int exponent: 8; + unsigned int sign : 1; + } number; + struct + { + unsigned int function1:16; + unsigned int function0:6; + unsigned int quiet:1; + unsigned int exponent:8; + unsigned int sign:1; + } nan; + long p1; + +} __ieee_float_shape_type; + +#endif + + + + + +/* FLOATING ROUNDING */ + +typedef int fp_rnd; +#define FP_RN 0 /* Round to nearest */ +#define FP_RM 1 /* Round down */ +#define FP_RP 2 /* Round up */ +#define FP_RZ 3 /* Round to zero (trunate) */ + +fp_rnd _EXFUN(fpgetround,(void)); +fp_rnd _EXFUN(fpsetround, (fp_rnd)); + +/* EXCEPTIONS */ + +typedef int fp_except; +#define FP_X_INV 0x10 /* Invalid operation */ +#define FP_X_DX 0x80 /* Divide by zero */ +#define FP_X_OFL 0x04 /* Overflow exception */ +#define FP_X_UFL 0x02 /* Underflow exception */ +#define FP_X_IMP 0x01 /* imprecise exception */ + +fp_except _EXFUN(fpgetmask,(void)); +fp_except _EXFUN(fpsetmask,(fp_except)); +fp_except _EXFUN(fpgetsticky,(void)); +fp_except _EXFUN(fpsetsticky, (fp_except)); + +/* INTEGER ROUNDING */ + +typedef int fp_rdi; +#define FP_RDI_TOZ 0 /* Round to Zero */ +#define FP_RDI_RD 1 /* Follow float mode */ + +fp_rdi _EXFUN(fpgetroundtoi,(void)); +fp_rdi _EXFUN(fpsetroundtoi,(fp_rdi)); + +int _EXFUN(isnan, (double)); +int _EXFUN(isinf, (double)); +int _EXFUN(finite, (double)); + + + +int _EXFUN(isnanf, (float)); +int _EXFUN(isinff, (float)); +int _EXFUN(finitef, (float)); + +#define __IEEE_DBL_EXPBIAS 1023 +#define __IEEE_FLT_EXPBIAS 127 + +#define __IEEE_DBL_EXPLEN 11 +#define __IEEE_FLT_EXPLEN 8 + + +#define __IEEE_DBL_FRACLEN (64 - (__IEEE_DBL_EXPLEN + 1)) +#define __IEEE_FLT_FRACLEN (32 - (__IEEE_FLT_EXPLEN + 1)) + +#define __IEEE_DBL_MAXPOWTWO ((double)(1L << 32 - 2) * (1L << (32-11) - 32 + 1)) +#define __IEEE_FLT_MAXPOWTWO ((float)(1L << (32-8) - 1)) + +#define __IEEE_DBL_NAN_EXP 0x7ff +#define __IEEE_FLT_NAN_EXP 0xff + + +#define isnanf(x) (((*(long *)&(x) & 0x7f800000L)==0x7f800000L) && \ + ((*(long *)&(x) & 0x007fffffL)!=0000000000L)) + +#define isinff(x) (((*(long *)&(x) & 0x7f800000L)==0x7f800000L) && \ + ((*(long *)&(x) & 0x007fffffL)==0000000000L)) + +#define finitef(x) (((*(long *)&(x) & 0x7f800000L)!=0x7f800000L)) + +#ifdef _DOUBLE_IS_32BITS +#undef __IEEE_DBL_EXPBIAS +#define __IEEE_DBL_EXPBIAS __IEEE_FLT_EXPBIAS + +#undef __IEEE_DBL_EXPLEN +#define __IEEE_DBL_EXPLEN __IEEE_FLT_EXPLEN + +#undef __IEEE_DBL_FRACLEN +#define __IEEE_DBL_FRACLEN __IEEE_FLT_FRACLEN + +#undef __IEEE_DBL_MAXPOWTWO +#define __IEEE_DBL_MAXPOWTWO __IEEE_FLT_MAXPOWTWO + +#undef __IEEE_DBL_NAN_EXP +#define __IEEE_DBL_NAN_EXP __IEEE_FLT_NAN_EXP + +#undef __ieee_double_shape_type +#define __ieee_double_shape_type __ieee_float_shape_type + +#endif /* _DOUBLE_IS_32BITS */ + +#endif /* _IEEE_FP_H_ */ diff --git a/SDK/LIBS/dcinclude/newlib-libm-arm/machine/ieeefp.h b/SDK/LIBS/dcinclude/newlib-libm-arm/machine/ieeefp.h new file mode 100644 index 00000000..570db14e --- /dev/null +++ b/SDK/LIBS/dcinclude/newlib-libm-arm/machine/ieeefp.h @@ -0,0 +1,174 @@ +#ifndef __IEEE_BIG_ENDIAN +#ifndef __IEEE_LITTLE_ENDIAN + +#if defined(__arm__) || defined(__thumb__) +/* ARM always has big-endian words. Within those words the byte ordering + appears to be big or little endian. Newlib doesn't seem to care about + the byte ordering within words. */ +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef __hppa__ +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef __sparc__ +#ifdef __LITTLE_ENDIAN_DATA__ +#define __IEEE_LITTLE_ENDIAN +#else +#define __IEEE_BIG_ENDIAN +#endif +#endif + +#if defined(__m68k__) || defined(__mc68000__) +#define __IEEE_BIG_ENDIAN +#endif + +#if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__) +#define __IEEE_BIG_ENDIAN +#define __SMALL_BITFIELDS +#define _DOUBLE_IS_32BITS +#endif + +#ifdef __H8500__ +#define __IEEE_BIG_ENDIAN +#define __SMALL_BITFIELDS +#define _DOUBLE_IS_32BITS +#endif + +#ifdef __sh__ +#ifdef __LITTLE_ENDIAN__ +#define __IEEE_LITTLE_ENDIAN +#else +#define __IEEE_BIG_ENDIAN +#endif +#if defined(__SH3E__) || defined(__SH4_SINGLE_ONLY__) +#define _DOUBLE_IS_32BITS +#endif +#endif + +#ifdef _AM29K +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef _WIN32 +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __i386__ +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __i960__ +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __M32R__ +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef __TIC80__ +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __MIPSEL__ +#define __IEEE_LITTLE_ENDIAN +#endif +#ifdef __MIPSEB__ +#define __IEEE_BIG_ENDIAN +#endif + +/* necv70 was __IEEE_LITTLE_ENDIAN. */ + +#ifdef __W65__ +#define __IEEE_LITTLE_ENDIAN +#define __SMALL_BITFIELDS +#define _DOUBLE_IS_32BITS +#endif + +#if defined(__Z8001__) || defined(__Z8002__) +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef __m88k__ +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef __mn10300__ +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __mn10200__ +#define __IEEE_LITTLE_ENDIAN +#define __SMALL_BITFIELDS +#define _DOUBLE_IS_32BITS +#endif + +#ifdef __v800 +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __v850 +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __D10V__ +#define __IEEE_BIG_ENDIAN +#define _DOUBLE_IS_32BITS +#define __SMALL_BITFIELDS +#endif + +#ifdef __PPC__ +#if (defined(_BIG_ENDIAN) && _BIG_ENDIAN) || (defined(_AIX) && _AIX) +#define __IEEE_BIG_ENDIAN +#else +#if (defined(_LITTLE_ENDIAN) && _LITTLE_ENDIAN) || (defined(__sun__) && __sun__) || (defined(_WIN32) && _WIN32) +#define __IEEE_LITTLE_ENDIAN +#endif +#endif +#endif + +#ifdef __arc__ +#ifdef __big_endian__ +#define __IEEE_BIG_ENDIAN +#else +#define __IEEE_LITTLE_ENDIAN +#endif +#endif + +#ifdef __fr30__ +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef __mcore__ +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef __ia64__ +#ifdef __BIG_ENDIAN__ +#define __IEEE_BIG_ENDIAN +#else +#define __IEEE_LITTLE_ENDIAN +#endif +#endif + +#ifdef __AVR__ +#define __IEEE_LITTLE_ENDIAN +#define __SMALL_BITFIELDS +#define _DOUBLE_IS_32BITS +#endif + +#if defined(__or32__) || defined(__or1k__) || defined(__or16__) +#define __IEEE_BIG_ENDIAN +#endif + + +#ifndef __IEEE_BIG_ENDIAN +#ifndef __IEEE_LITTLE_ENDIAN +#error Endianess not declared!! +#endif /* not __IEEE_LITTLE_ENDIAN */ +#endif /* not __IEEE_BIG_ENDIAN */ + +#endif /* not __IEEE_LITTLE_ENDIAN */ +#endif /* not __IEEE_BIG_ENDIAN */ + diff --git a/SDK/LIBS/dcinclude/newlib-libm-arm/math.h b/SDK/LIBS/dcinclude/newlib-libm-arm/math.h new file mode 100644 index 00000000..998fba51 --- /dev/null +++ b/SDK/LIBS/dcinclude/newlib-libm-arm/math.h @@ -0,0 +1,276 @@ +/* math.h -- Definitions for the math floating point package. */ + +#ifndef _MATH_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _MATH_H_ + +#include +#include +#include + +#ifndef HUGE_VAL + +/* Define HUGE_VAL as infinity, unless HUGE_VAL is already defined + (which might have been done by something like math-68881.h). */ + +union __dmath +{ + __uint32_t i[2]; + double d; +}; + +/* Declare this as an array without bounds so that no matter what small data + support a port and/or library has, this reference will be via the general + method for accessing globals. */ +extern __IMPORT const union __dmath __infinity[]; + +#define HUGE_VAL (__infinity[0].d) + +#endif /* ! defined (HUGE_VAL) */ + +/* Reentrant ANSI C functions. */ + +#ifndef __math_68881 +extern double atan _PARAMS((double)); +extern double cos _PARAMS((double)); +extern double sin _PARAMS((double)); +extern double tan _PARAMS((double)); +extern double tanh _PARAMS((double)); +extern double frexp _PARAMS((double, int *)); +extern double modf _PARAMS((double, double *)); +extern double ceil _PARAMS((double)); +extern double fabs _PARAMS((double)); +extern double floor _PARAMS((double)); +#endif /* ! defined (__math_68881) */ + +/* Non reentrant ANSI C functions. */ + +#ifndef _REENT_ONLY +#ifndef __math_6881 +extern double acos _PARAMS((double)); +extern double asin _PARAMS((double)); +extern double atan2 _PARAMS((double, double)); +extern double cosh _PARAMS((double)); +extern double sinh _PARAMS((double)); +extern double exp _PARAMS((double)); +extern double ldexp _PARAMS((double, int)); +extern double log _PARAMS((double)); +extern double log10 _PARAMS((double)); +extern double pow _PARAMS((double, double)); +extern double sqrt _PARAMS((double)); +extern double fmod _PARAMS((double, double)); +#endif /* ! defined (__math_68881) */ +#endif /* ! defined (_REENT_ONLY) */ + +#ifndef __STRICT_ANSI__ + +/* Non ANSI double precision functions. */ + +extern double infinity _PARAMS((void)); +extern double nan _PARAMS((void)); +extern int isnan _PARAMS((double)); +extern int isinf _PARAMS((double)); +extern int finite _PARAMS((double)); +extern double copysign _PARAMS((double, double)); +extern int ilogb _PARAMS((double)); + +extern double asinh _PARAMS((double)); +extern double cbrt _PARAMS((double)); +extern double nextafter _PARAMS((double, double)); +extern double rint _PARAMS((double)); +extern double scalbn _PARAMS((double, int)); + +#ifndef __math_68881 +extern double log1p _PARAMS((double)); +extern double expm1 _PARAMS((double)); +#endif /* ! defined (__math_68881) */ + +#ifndef _REENT_ONLY +extern double acosh _PARAMS((double)); +extern double atanh _PARAMS((double)); +extern double remainder _PARAMS((double, double)); +extern double gamma _PARAMS((double)); +extern double gamma_r _PARAMS((double, int *)); +extern double lgamma _PARAMS((double)); +extern double lgamma_r _PARAMS((double, int *)); +extern double erf _PARAMS((double)); +extern double erfc _PARAMS((double)); +extern double y0 _PARAMS((double)); +extern double y1 _PARAMS((double)); +extern double yn _PARAMS((int, double)); +extern double j0 _PARAMS((double)); +extern double j1 _PARAMS((double)); +extern double jn _PARAMS((int, double)); +#define log2(x) (log (x) / M_LOG2_E) + +#ifndef __math_68881 +extern double hypot _PARAMS((double, double)); +#endif + +extern double cabs(); +extern double drem _PARAMS((double, double)); + +#endif /* ! defined (_REENT_ONLY) */ + +/* Single precision versions of ANSI functions. */ + +extern float atanf _PARAMS((float)); +extern float cosf _PARAMS((float)); +extern float sinf _PARAMS((float)); +extern float tanf _PARAMS((float)); +extern float tanhf _PARAMS((float)); +extern float frexpf _PARAMS((float, int *)); +extern float modff _PARAMS((float, float *)); +extern float ceilf _PARAMS((float)); +extern float fabsf _PARAMS((float)); +extern float floorf _PARAMS((float)); + +#ifndef _REENT_ONLY +extern float acosf _PARAMS((float)); +extern float asinf _PARAMS((float)); +extern float atan2f _PARAMS((float, float)); +extern float coshf _PARAMS((float)); +extern float sinhf _PARAMS((float)); +extern float expf _PARAMS((float)); +extern float ldexpf _PARAMS((float, int)); +extern float logf _PARAMS((float)); +extern float log10f _PARAMS((float)); +extern float powf _PARAMS((float, float)); +extern float sqrtf _PARAMS((float)); +extern float fmodf _PARAMS((float, float)); +#endif /* ! defined (_REENT_ONLY) */ + +/* Other single precision functions. */ + +extern float infinityf _PARAMS((void)); +extern float nanf _PARAMS((void)); +extern int isnanf _PARAMS((float)); +extern int isinff _PARAMS((float)); +extern int finitef _PARAMS((float)); +extern float copysignf _PARAMS((float, float)); +extern int ilogbf _PARAMS((float)); + +extern float asinhf _PARAMS((float)); +extern float cbrtf _PARAMS((float)); +extern float nextafterf _PARAMS((float, float)); +extern float rintf _PARAMS((float)); +extern float scalbnf _PARAMS((float, int)); +extern float log1pf _PARAMS((float)); +extern float expm1f _PARAMS((float)); + +#ifndef _REENT_ONLY +extern float acoshf _PARAMS((float)); +extern float atanhf _PARAMS((float)); +extern float remainderf _PARAMS((float, float)); +extern float gammaf _PARAMS((float)); +extern float gammaf_r _PARAMS((float, int *)); +extern float lgammaf _PARAMS((float)); +extern float lgammaf_r _PARAMS((float, int *)); +extern float erff _PARAMS((float)); +extern float erfcf _PARAMS((float)); +extern float y0f _PARAMS((float)); +extern float y1f _PARAMS((float)); +extern float ynf _PARAMS((int, float)); +extern float j0f _PARAMS((float)); +extern float j1f _PARAMS((float)); +extern float jnf _PARAMS((int, float)); +#define log2f(x) (logf (x) / (float) M_LOG2_E) +extern float hypotf _PARAMS((float, float)); + +extern float cabsf(); +extern float dremf _PARAMS((float, float)); + +#endif /* ! defined (_REENT_ONLY) */ + +/* The gamma functions use a global variable, signgam. */ + +extern __IMPORT int signgam; + +/* The exception structure passed to the matherr routine. */ + +#ifdef __cplusplus +struct __exception +#else +struct exception +#endif +{ + int type; + char *name; + double arg1; + double arg2; + double retval; + int err; +}; + +#ifdef __cplusplus +extern int matherr _PARAMS((struct __exception *e)); +#else +extern int matherr _PARAMS((struct exception *e)); +#endif + +/* Values for the type field of struct exception. */ + +#define DOMAIN 1 +#define SING 2 +#define OVERFLOW 3 +#define UNDERFLOW 4 +#define TLOSS 5 +#define PLOSS 6 + +/* Useful constants. */ + +#define M_E 2.7182818284590452354 +#define M_LOG2E 1.4426950408889634074 +#define M_LOG10E 0.43429448190325182765 +#define M_LN2 0.69314718055994530942 +#define M_LN10 2.30258509299404568402 +#define M_PI 3.14159265358979323846 +#define M_TWOPI (M_PI * 2.0) +#define M_PI_2 1.57079632679489661923 +#define M_PI_4 0.78539816339744830962 +#define M_3PI_4 2.3561944901923448370E0 +#define M_SQRTPI 1.77245385090551602792981 +#define M_1_PI 0.31830988618379067154 +#define M_2_PI 0.63661977236758134308 +#define M_2_SQRTPI 1.12837916709551257390 +#define M_SQRT2 1.41421356237309504880 +#define M_SQRT1_2 0.70710678118654752440 +#define M_LN2LO 1.9082149292705877000E-10 +#define M_LN2HI 6.9314718036912381649E-1 +#define M_SQRT3 1.73205080756887719000 +#define M_IVLN10 0.43429448190325182765 /* 1 / log(10) */ +#define M_LOG2_E 0.693147180559945309417 +#define M_INVLN2 1.4426950408889633870E0 /* 1 / log(2) */ + +/* Global control over fdlibm error handling. */ + +enum __fdlibm_version +{ + __fdlibm_ieee = -1, + __fdlibm_svid, + __fdlibm_xopen, + __fdlibm_posix +}; + +#define _LIB_VERSION_TYPE enum __fdlibm_version +#define _LIB_VERSION __fdlib_version + +extern __IMPORT _CONST _LIB_VERSION_TYPE _LIB_VERSION; + +#define _IEEE_ __fdlibm_ieee +#define _SVID_ __fdlibm_svid +#define _XOPEN_ __fdlibm_xopen +#define _POSIX_ __fdlibm_posix + +#endif /* ! defined (__STRICT_ANSI__) */ + +#ifdef __FAST_MATH__ +#include +#endif + +#ifdef __cplusplus +} +#endif +#endif /* _MATH_H_ */ diff --git a/SDK/LIBS/dcinclude/newlib-libm-arm/sys/config.h b/SDK/LIBS/dcinclude/newlib-libm-arm/sys/config.h new file mode 100644 index 00000000..f8bd8cdb --- /dev/null +++ b/SDK/LIBS/dcinclude/newlib-libm-arm/sys/config.h @@ -0,0 +1,142 @@ +#ifndef __SYS_CONFIG_H__ +#define __SYS_CONFIG_H__ + +/* exceptions first */ +/* ??? Why is much of this stuff duplicated with machine/ieeefp.h? */ +#if defined(__H8300__) || defined(__H8500__) || defined (__H8300H__) || defined(__W65__) || defined (__H8300S__) +#define _FLOAT_ARG float +#define __SMALL_BITFIELDS +#define _DOUBLE_IS_32BITS +#define __IEEE_BIG_ENDIAN +/* ??? This conditional is true for the h8500 and the w65, defining H8300 + in those cases probably isn't the right thing to do. */ +#define H8300 1 +#endif + +#ifdef __W65__ +#define _DOUBLE_IS_32BITS +#define __SMALL_BITFIELDS +#define __IEEE_BIG_ENDIAN +#undef INT_MAX +#undef UINT_MAX +#define INT_MAX 32767 +#define UINT_MAX 65535 + +#endif + +/* 16 bit integer machines */ +#if defined(__Z8001__) || defined(__Z8002__) || defined(__H8300__) || defined(__H8500__) || defined(__W65__) || defined (__H8300H__) || defined (__H8300S__) || defined (__mn10200__) || defined (__AVR__) + +#undef INT_MAX +#undef UINT_MAX +#define INT_MAX 32767 +#define UINT_MAX 65535 +#endif + +#if defined(__D10V__) +#undef INT_MAX +#undef UINT_MAX +#define INT_MAX __INT_MAX__ +#define UINT_MAX (__INT_MAX__ * 2U + 1) +#define _DOUBLE_IS_32BITS +#define _POINTER_INT short +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef ___AM29K__ +#define _FLOAT_RET double +#endif + +#ifdef __i386__ +#ifndef __unix__ +/* in other words, go32 */ +#define _FLOAT_RET double +#endif +#endif + +#ifdef __M32R__ +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef __m68k__ +/* This is defined in machine/ieeefp.h; need to check is it redundant here? */ +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef __mn10300__ +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __mn10200__ +#define _DOUBLE_IS_32BITS +#define __SMALL_BITFIELDS +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __AVR__ +#define _DOUBLE_IS_32BITS +#define __SMALL_BITFIELDS +#define __IEEE_LITTLE_ENDIAN +#define _POINTER_INT short +#endif + +#ifdef __TIC80__ +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __v850 +#define __IEEE_LITTLE_ENDIAN +#define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__sda__)) +#endif + +#ifdef __D30V__ +#define __IEEE_BIG_ENDIAN +#endif + +/* For the PowerPC eabi, force the _impure_ptr to be in .sdata */ +#if defined(__PPC__) && defined(_CALL_SYSV) +#define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__section__(".sdata"))) +#endif + +#ifdef __sparc__ +#ifdef __LITTLE_ENDIAN_DATA__ +#define __IEEE_LITTLE_ENDIAN +#else +#define __IEEE_BIG_ENDIAN +#endif +#endif + +#if INT_MAX == 32767 +typedef long int __int32_t; +typedef unsigned long int __uint32_t; +#else +typedef int __int32_t; +typedef unsigned int __uint32_t; +#endif + +#ifndef _POINTER_INT +#define _POINTER_INT long +#endif + +#undef __RAND_MAX +#if INT_MAX == 32767 +#define __RAND_MAX 32767 +#else +#define __RAND_MAX 0x7fffffff +#endif + + +#if defined(__CYGWIN32__) || defined(__CYGWIN__) +#if defined(__INSIDE_CYGWIN__) || defined(_COMPILING_NEWLIB) +#define __IMPORT +#else +#define __IMPORT __declspec(dllimport) +#endif +#endif + +#ifndef __IMPORT +#define __IMPORT +#endif + + +#endif /* __SYS_CONFIG_H__ */ diff --git a/SDK/LIBS/dcinclude/newlib-libm-arm/sys/reent.h b/SDK/LIBS/dcinclude/newlib-libm-arm/sys/reent.h new file mode 100644 index 00000000..5a07f84d --- /dev/null +++ b/SDK/LIBS/dcinclude/newlib-libm-arm/sys/reent.h @@ -0,0 +1,240 @@ +/* This header file provides the reentrancy. */ + +/* WARNING: All identifiers here must begin with an underscore. This file is + included by stdio.h and others and we therefore must only use identifiers + in the namespace allotted to us. */ + +#ifndef _SYS_REENT_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _SYS_REENT_H_ + +#include +#include + +#ifndef __Long +#if __LONG_MAX__ == 2147483647L +#define __Long long +typedef unsigned __Long __ULong; +#elif __INT_MAX__ == 2147483647 +#define __Long int +typedef unsigned __Long __ULong; +#endif +#endif + +#ifndef __Long +#define __Long __int32_t +typedef __uint32_t __ULong; +#endif + +struct _glue +{ + struct _glue *_next; + int _niobs; + struct __sFILE *_iobs; +}; + +struct _Bigint +{ + struct _Bigint *_next; + int _k, _maxwds, _sign, _wds; + __ULong _x[1]; +}; + +/* + * atexit() support + */ + +#define _ATEXIT_SIZE 32 /* must be at least 32 to guarantee ANSI conformance */ + +struct _atexit { + struct _atexit *_next; /* next in list */ + int _ind; /* next index in this table */ + void (*_fns[_ATEXIT_SIZE])(void); /* the table itself */ +}; + +/* + * Stdio buffers. + * + * This and __sFILE are defined here because we need them for struct _reent, + * but we don't want stdio.h included when stdlib.h is. + */ + +struct __sbuf { + unsigned char *_base; + int _size; +}; + +/* + * We need fpos_t for the following, but it doesn't have a leading "_", + * so we use _fpos_t instead. + */ + +typedef long _fpos_t; /* XXX must match off_t in */ + /* (and must be `long' for now) */ + +/* + * Stdio state variables. + * + * The following always hold: + * + * if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR), + * _lbfsize is -_bf._size, else _lbfsize is 0 + * if _flags&__SRD, _w is 0 + * if _flags&__SWR, _r is 0 + * + * This ensures that the getc and putc macros (or inline functions) never + * try to write or read from a file that is in `read' or `write' mode. + * (Moreover, they can, and do, automatically switch from read mode to + * write mode, and back, on "r+" and "w+" files.) + * + * _lbfsize is used only to make the inline line-buffered output stream + * code as compact as possible. + * + * _ub, _up, and _ur are used when ungetc() pushes back more characters + * than fit in the current _bf, or when ungetc() pushes back a character + * that does not match the previous one in _bf. When this happens, + * _ub._base becomes non-nil (i.e., a stream has ungetc() data iff + * _ub._base!=NULL) and _up and _ur save the current values of _p and _r. + */ + +struct __sFILE { + unsigned char *_p; /* current position in (some) buffer */ + int _r; /* read space left for getc() */ + int _w; /* write space left for putc() */ + short _flags; /* flags, below; this FILE is free if 0 */ + short _file; /* fileno, if Unix descriptor, else -1 */ + struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */ + int _lbfsize; /* 0 or -_bf._size, for inline putc */ + + /* operations */ + _PTR _cookie; /* cookie passed to io functions */ + + int _EXFUN((*_read),(_PTR _cookie, char *_buf, int _n)); + int _EXFUN((*_write),(_PTR _cookie, const char *_buf, int _n)); + _fpos_t _EXFUN((*_seek),(_PTR _cookie, _fpos_t _offset, int _whence)); + int _EXFUN((*_close),(_PTR _cookie)); + + /* separate buffer for long sequences of ungetc() */ + struct __sbuf _ub; /* ungetc buffer */ + unsigned char *_up; /* saved _p when _p is doing ungetc data */ + int _ur; /* saved _r when _r is counting ungetc data */ + + /* tricks to meet minimum requirements even when malloc() fails */ + unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */ + unsigned char _nbuf[1]; /* guarantee a getc() buffer */ + + /* separate buffer for fgetline() when line crosses buffer boundary */ + struct __sbuf _lb; /* buffer for fgetline() */ + + /* Unix stdio files get aligned to block boundaries on fseek() */ + int _blksize; /* stat.st_blksize (may be != _bf._size) */ + int _offset; /* current lseek offset */ + + struct _reent *_data; +}; + +/* + * struct _reent + * + * This structure contains *all* globals needed by the library. + * It's raison d'etre is to facilitate threads by making all library routines + * reentrant. IE: All state information is contained here. + */ + +struct _reent +{ + /* local copy of errno */ + int _errno; + + /* FILE is a big struct and may change over time. To try to achieve binary + compatibility with future versions, put stdin,stdout,stderr here. + These are pointers into member __sf defined below. */ + struct __sFILE *_stdin, *_stdout, *_stderr; + + int _inc; /* used by tmpnam */ + char _emergency[25]; + + int _current_category; /* used by setlocale */ + _CONST char *_current_locale; + + int __sdidinit; /* 1 means stdio has been init'd */ + + void _EXFUN((*__cleanup),(struct _reent *)); + + /* used by mprec routines */ + struct _Bigint *_result; + int _result_k; + struct _Bigint *_p5s; + struct _Bigint **_freelist; + + /* used by some fp conversion routines */ + int _cvtlen; /* should be size_t */ + char *_cvtbuf; + + union + { + struct + { + unsigned int _unused_rand; + char * _strtok_last; + char _asctime_buf[26]; + struct tm _localtime_buf; + int _gamma_signgam; + __extension__ unsigned long long _rand_next; + + } _reent; + /* Two next two fields were once used by malloc. They are no longer + used. They are used to preserve the space used before so as to + allow addition of new reent fields and keep binary compatibility. */ + struct + { +#define _N_LISTS 30 + unsigned char * _nextf[_N_LISTS]; + unsigned int _nmalloc[_N_LISTS]; + } _unused; + } _new; + + /* atexit stuff */ + struct _atexit *_atexit; /* points to head of LIFO stack */ + struct _atexit _atexit0; /* one guaranteed table, required by ANSI */ + + /* signal info */ + void (**(_sig_func))(int); + + /* These are here last so that __sFILE can grow without changing the offsets + of the above members (on the off chance that future binary compatibility + would be broken otherwise). */ + struct _glue __sglue; /* root of glue chain */ + struct __sFILE __sf[3]; /* first three file descriptors */ +}; + +#define _REENT_INIT(var) \ + { 0, &var.__sf[0], &var.__sf[1], &var.__sf[2], 0, "", 0, "C", \ + 0, NULL, NULL, 0, NULL, NULL, 0, NULL, { {0, NULL, "", \ + { 0,0,0,0,0,0,0,0}, 0, 1} } } + +/* + * All references to struct _reent are via this pointer. + * Internally, newlib routines that need to reference it should use _REENT. + */ + +#ifndef __ATTRIBUTE_IMPURE_PTR__ +#define __ATTRIBUTE_IMPURE_PTR__ +#endif + +extern struct _reent *_impure_ptr __ATTRIBUTE_IMPURE_PTR__; + +void _reclaim_reent _PARAMS ((struct _reent *)); + +/* #define _REENT_ONLY define this to get only reentrant routines */ + +#ifndef _REENT_ONLY +#define _REENT _impure_ptr +#endif + +#ifdef __cplusplus +} +#endif +#endif /* _SYS_REENT_H_ */ diff --git a/SDK/LIBS/dcinclude/newlib-libm-sh4/_ansi.h b/SDK/LIBS/dcinclude/newlib-libm-sh4/_ansi.h new file mode 100644 index 00000000..3d3f2695 --- /dev/null +++ b/SDK/LIBS/dcinclude/newlib-libm-sh4/_ansi.h @@ -0,0 +1,71 @@ +/* Provide support for both ANSI and non-ANSI environments. */ + +/* Some ANSI environments are "broken" in the sense that __STDC__ cannot be + relied upon to have it's intended meaning. Therefore we must use our own + concoction: _HAVE_STDC. Always use _HAVE_STDC instead of __STDC__ in newlib + sources! + + To get a strict ANSI C environment, define macro __STRICT_ANSI__. This will + "comment out" the non-ANSI parts of the ANSI header files (non-ANSI header + files aren't affected). */ + +#ifndef _ANSIDECL_H_ +#define _ANSIDECL_H_ + +#include + +/* First try to figure out whether we really are in an ANSI C environment. */ +/* FIXME: This probably needs some work. Perhaps sys/config.h can be + prevailed upon to give us a clue. */ + +#ifdef __STDC__ +#define _HAVE_STDC +#endif + +#ifdef _HAVE_STDC +#define _PTR void * +#define _AND , +#define _NOARGS void +#define _CONST const +#define _VOLATILE volatile +#define _SIGNED signed +#define _DOTS , ... +#define _VOID void +#define _EXFUN(name, proto) name proto +#define _DEFUN(name, arglist, args) name(args) +#define _DEFUN_VOID(name) name(_NOARGS) +#define _CAST_VOID (void) +#ifndef _LONG_DOUBLE +#define _LONG_DOUBLE long double +#endif +#ifndef _PARAMS +#define _PARAMS(paramlist) paramlist +#endif +#else +#define _PTR char * +#define _AND ; +#define _NOARGS +#define _CONST +#define _VOLATILE +#define _SIGNED +#define _DOTS +#define _VOID void +#define _EXFUN(name, proto) name() +#define _DEFUN(name, arglist, args) name arglist args; +#define _DEFUN_VOID(name) name() +#define _CAST_VOID +#define _LONG_DOUBLE double +#ifndef _PARAMS +#define _PARAMS(paramlist) () +#endif +#endif + +/* Support gcc's __attribute__ facility. */ + +#ifdef __GNUC__ +#define _ATTRIBUTE(attrs) __attribute__ (attrs) +#else +#define _ATTRIBUTE(attrs) +#endif + +#endif /* _ANSIDECL_H_ */ diff --git a/SDK/LIBS/dcinclude/newlib-libm-sh4/fastmath.h b/SDK/LIBS/dcinclude/newlib-libm-sh4/fastmath.h new file mode 100644 index 00000000..b41f00ac --- /dev/null +++ b/SDK/LIBS/dcinclude/newlib-libm-sh4/fastmath.h @@ -0,0 +1,13 @@ +#ifndef _FASTMATH_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _FASTMATH_H_ + +#include +#include + +#ifdef __cplusplus +} +#endif +#endif /* _FASTMATH_H_ */ diff --git a/SDK/LIBS/dcinclude/newlib-libm-sh4/ieeefp.h b/SDK/LIBS/dcinclude/newlib-libm-sh4/ieeefp.h new file mode 100644 index 00000000..6b70dffd --- /dev/null +++ b/SDK/LIBS/dcinclude/newlib-libm-sh4/ieeefp.h @@ -0,0 +1,241 @@ +#ifndef _IEEE_FP_H_ +#define _IEEE_FP_H_ + +#include + +#include + +/* FIXME FIXME FIXME: + Neither of __ieee_{float,double}_shape_tape seem to be used anywhere + except in libm/test. If that is the case, please delete these from here. + If that is not the case, please insert documentation here describing why + they're needed. */ + +#ifdef __IEEE_BIG_ENDIAN + +typedef union +{ + double value; + struct + { + unsigned int sign : 1; + unsigned int exponent: 11; + unsigned int fraction0:4; + unsigned int fraction1:16; + unsigned int fraction2:16; + unsigned int fraction3:16; + + } number; + struct + { + unsigned int sign : 1; + unsigned int exponent: 11; + unsigned int quiet:1; + unsigned int function0:3; + unsigned int function1:16; + unsigned int function2:16; + unsigned int function3:16; + } nan; + struct + { + unsigned long msw; + unsigned long lsw; + } parts; + long aslong[2]; +} __ieee_double_shape_type; + +#endif + +#ifdef __IEEE_LITTLE_ENDIAN + +typedef union +{ + double value; + struct + { +#ifdef __SMALL_BITFIELDS + unsigned int fraction3:16; + unsigned int fraction2:16; + unsigned int fraction1:16; + unsigned int fraction0: 4; +#else + unsigned int fraction1:32; + unsigned int fraction0:20; +#endif + unsigned int exponent :11; + unsigned int sign : 1; + } number; + struct + { +#ifdef __SMALL_BITFIELDS + unsigned int function3:16; + unsigned int function2:16; + unsigned int function1:16; + unsigned int function0:3; +#else + unsigned int function1:32; + unsigned int function0:19; +#endif + unsigned int quiet:1; + unsigned int exponent: 11; + unsigned int sign : 1; + } nan; + struct + { + unsigned long lsw; + unsigned long msw; + } parts; + + long aslong[2]; + +} __ieee_double_shape_type; + +#endif + +#ifdef __IEEE_BIG_ENDIAN + +typedef union +{ + float value; + struct + { + unsigned int sign : 1; + unsigned int exponent: 8; + unsigned int fraction0: 7; + unsigned int fraction1: 16; + } number; + struct + { + unsigned int sign:1; + unsigned int exponent:8; + unsigned int quiet:1; + unsigned int function0:6; + unsigned int function1:16; + } nan; + long p1; + +} __ieee_float_shape_type; + +#endif + +#ifdef __IEEE_LITTLE_ENDIAN + +typedef union +{ + float value; + struct + { + unsigned int fraction0: 7; + unsigned int fraction1: 16; + unsigned int exponent: 8; + unsigned int sign : 1; + } number; + struct + { + unsigned int function1:16; + unsigned int function0:6; + unsigned int quiet:1; + unsigned int exponent:8; + unsigned int sign:1; + } nan; + long p1; + +} __ieee_float_shape_type; + +#endif + + + + + +/* FLOATING ROUNDING */ + +typedef int fp_rnd; +#define FP_RN 0 /* Round to nearest */ +#define FP_RM 1 /* Round down */ +#define FP_RP 2 /* Round up */ +#define FP_RZ 3 /* Round to zero (trunate) */ + +fp_rnd _EXFUN(fpgetround,(void)); +fp_rnd _EXFUN(fpsetround, (fp_rnd)); + +/* EXCEPTIONS */ + +typedef int fp_except; +#define FP_X_INV 0x10 /* Invalid operation */ +#define FP_X_DX 0x80 /* Divide by zero */ +#define FP_X_OFL 0x04 /* Overflow exception */ +#define FP_X_UFL 0x02 /* Underflow exception */ +#define FP_X_IMP 0x01 /* imprecise exception */ + +fp_except _EXFUN(fpgetmask,(void)); +fp_except _EXFUN(fpsetmask,(fp_except)); +fp_except _EXFUN(fpgetsticky,(void)); +fp_except _EXFUN(fpsetsticky, (fp_except)); + +/* INTEGER ROUNDING */ + +typedef int fp_rdi; +#define FP_RDI_TOZ 0 /* Round to Zero */ +#define FP_RDI_RD 1 /* Follow float mode */ + +fp_rdi _EXFUN(fpgetroundtoi,(void)); +fp_rdi _EXFUN(fpsetroundtoi,(fp_rdi)); + +int _EXFUN(isnan, (double)); +int _EXFUN(isinf, (double)); +int _EXFUN(finite, (double)); + + + +int _EXFUN(isnanf, (float)); +int _EXFUN(isinff, (float)); +int _EXFUN(finitef, (float)); + +#define __IEEE_DBL_EXPBIAS 1023 +#define __IEEE_FLT_EXPBIAS 127 + +#define __IEEE_DBL_EXPLEN 11 +#define __IEEE_FLT_EXPLEN 8 + + +#define __IEEE_DBL_FRACLEN (64 - (__IEEE_DBL_EXPLEN + 1)) +#define __IEEE_FLT_FRACLEN (32 - (__IEEE_FLT_EXPLEN + 1)) + +#define __IEEE_DBL_MAXPOWTWO ((double)(1L << 32 - 2) * (1L << (32-11) - 32 + 1)) +#define __IEEE_FLT_MAXPOWTWO ((float)(1L << (32-8) - 1)) + +#define __IEEE_DBL_NAN_EXP 0x7ff +#define __IEEE_FLT_NAN_EXP 0xff + + +#define isnanf(x) (((*(long *)&(x) & 0x7f800000L)==0x7f800000L) && \ + ((*(long *)&(x) & 0x007fffffL)!=0000000000L)) + +#define isinff(x) (((*(long *)&(x) & 0x7f800000L)==0x7f800000L) && \ + ((*(long *)&(x) & 0x007fffffL)==0000000000L)) + +#define finitef(x) (((*(long *)&(x) & 0x7f800000L)!=0x7f800000L)) + +#ifdef _DOUBLE_IS_32BITS +#undef __IEEE_DBL_EXPBIAS +#define __IEEE_DBL_EXPBIAS __IEEE_FLT_EXPBIAS + +#undef __IEEE_DBL_EXPLEN +#define __IEEE_DBL_EXPLEN __IEEE_FLT_EXPLEN + +#undef __IEEE_DBL_FRACLEN +#define __IEEE_DBL_FRACLEN __IEEE_FLT_FRACLEN + +#undef __IEEE_DBL_MAXPOWTWO +#define __IEEE_DBL_MAXPOWTWO __IEEE_FLT_MAXPOWTWO + +#undef __IEEE_DBL_NAN_EXP +#define __IEEE_DBL_NAN_EXP __IEEE_FLT_NAN_EXP + +#undef __ieee_double_shape_type +#define __ieee_double_shape_type __ieee_float_shape_type + +#endif /* _DOUBLE_IS_32BITS */ + +#endif /* _IEEE_FP_H_ */ diff --git a/SDK/LIBS/dcinclude/newlib-libm-sh4/machine/fastmath.h b/SDK/LIBS/dcinclude/newlib-libm-sh4/machine/fastmath.h new file mode 100644 index 00000000..b13befa2 --- /dev/null +++ b/SDK/LIBS/dcinclude/newlib-libm-sh4/machine/fastmath.h @@ -0,0 +1,100 @@ +#ifdef __sysvnecv70_target +double EXFUN(fast_sin,(double)); +double EXFUN(fast_cos,(double)); +double EXFUN(fast_tan,(double)); + +double EXFUN(fast_asin,(double)); +double EXFUN(fast_acos,(double)); +double EXFUN(fast_atan,(double)); + +double EXFUN(fast_sinh,(double)); +double EXFUN(fast_cosh,(double)); +double EXFUN(fast_tanh,(double)); + +double EXFUN(fast_asinh,(double)); +double EXFUN(fast_acosh,(double)); +double EXFUN(fast_atanh,(double)); + +double EXFUN(fast_abs,(double)); +double EXFUN(fast_sqrt,(double)); +double EXFUN(fast_exp2,(double)); +double EXFUN(fast_exp10,(double)); +double EXFUN(fast_expe,(double)); +double EXFUN(fast_log10,(double)); +double EXFUN(fast_log2,(double)); +double EXFUN(fast_loge,(double)); + + +#define sin(x) fast_sin(x) +#define cos(x) fast_cos(x) +#define tan(x) fast_tan(x) +#define asin(x) fast_asin(x) +#define acos(x) fast_acos(x) +#define atan(x) fast_atan(x) +#define sinh(x) fast_sinh(x) +#define cosh(x) fast_cosh(x) +#define tanh(x) fast_tanh(x) +#define asinh(x) fast_asinh(x) +#define acosh(x) fast_acosh(x) +#define atanh(x) fast_atanh(x) +#define abs(x) fast_abs(x) +#define sqrt(x) fast_sqrt(x) +#define exp2(x) fast_exp2(x) +#define exp10(x) fast_exp10(x) +#define expe(x) fast_expe(x) +#define log10(x) fast_log10(x) +#define log2(x) fast_log2(x) +#define loge(x) fast_loge(x) + +#ifdef _HAVE_STDC +/* These functions are in assembler, they really do take floats. This + can only be used with a real ANSI compiler */ + +float EXFUN(fast_sinf,(float)); +float EXFUN(fast_cosf,(float)); +float EXFUN(fast_tanf,(float)); + +float EXFUN(fast_asinf,(float)); +float EXFUN(fast_acosf,(float)); +float EXFUN(fast_atanf,(float)); + +float EXFUN(fast_sinhf,(float)); +float EXFUN(fast_coshf,(float)); +float EXFUN(fast_tanhf,(float)); + +float EXFUN(fast_asinhf,(float)); +float EXFUN(fast_acoshf,(float)); +float EXFUN(fast_atanhf,(float)); + +float EXFUN(fast_absf,(float)); +float EXFUN(fast_sqrtf,(float)); +float EXFUN(fast_exp2f,(float)); +float EXFUN(fast_exp10f,(float)); +float EXFUN(fast_expef,(float)); +float EXFUN(fast_log10f,(float)); +float EXFUN(fast_log2f,(float)); +float EXFUN(fast_logef,(float)); +#define sinf(x) fast_sinf(x) +#define cosf(x) fast_cosf(x) +#define tanf(x) fast_tanf(x) +#define asinf(x) fast_asinf(x) +#define acosf(x) fast_acosf(x) +#define atanf(x) fast_atanf(x) +#define sinhf(x) fast_sinhf(x) +#define coshf(x) fast_coshf(x) +#define tanhf(x) fast_tanhf(x) +#define asinhf(x) fast_asinhf(x) +#define acoshf(x) fast_acoshf(x) +#define atanhf(x) fast_atanhf(x) +#define absf(x) fast_absf(x) +#define sqrtf(x) fast_sqrtf(x) +#define exp2f(x) fast_exp2f(x) +#define exp10f(x) fast_exp10f(x) +#define expef(x) fast_expef(x) +#define log10f(x) fast_log10f(x) +#define log2f(x) fast_log2f(x) +#define logef(x) fast_logef(x) +#endif +/* Override the functions defined in math.h */ +#endif /* __sysvnecv70_target */ + diff --git a/SDK/LIBS/dcinclude/newlib-libm-sh4/machine/ieeefp.h b/SDK/LIBS/dcinclude/newlib-libm-sh4/machine/ieeefp.h new file mode 100644 index 00000000..ce8f0ffc --- /dev/null +++ b/SDK/LIBS/dcinclude/newlib-libm-sh4/machine/ieeefp.h @@ -0,0 +1,157 @@ +#ifndef __IEEE_BIG_ENDIAN +#ifndef __IEEE_LITTLE_ENDIAN + +#if defined(__arm__) || defined(__thumb__) +/* ARM always has big-endian words. Within those words the byte ordering + appears to be big or little endian. Newlib doesn't seem to care about + the byte ordering within words. */ +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef __hppa__ +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef __sparc__ +#ifdef __LITTLE_ENDIAN_DATA__ +#define __IEEE_LITTLE_ENDIAN +#else +#define __IEEE_BIG_ENDIAN +#endif +#endif + +#if defined(__m68k__) || defined(__mc68000__) +#define __IEEE_BIG_ENDIAN +#endif + +#if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__) +#define __IEEE_BIG_ENDIAN +#define __SMALL_BITFIELDS +#define _DOUBLE_IS_32BITS +#endif + +#ifdef __H8500__ +#define __IEEE_BIG_ENDIAN +#define __SMALL_BITFIELDS +#define _DOUBLE_IS_32BITS +#endif + +#ifdef __sh__ +#ifdef __LITTLE_ENDIAN__ +#define __IEEE_LITTLE_ENDIAN +#else +#define __IEEE_BIG_ENDIAN +#endif +#if defined(__SH3E__) || defined(__SH4_SINGLE_ONLY__) +#define _DOUBLE_IS_32BITS +#endif +#endif + +#ifdef _AM29K +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef _WIN32 +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __i386__ +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __i960__ +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __M32R__ +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef __TIC80__ +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __MIPSEL__ +#define __IEEE_LITTLE_ENDIAN +#endif +#ifdef __MIPSEB__ +#define __IEEE_BIG_ENDIAN +#endif + +/* necv70 was __IEEE_LITTLE_ENDIAN. */ + +#ifdef __W65__ +#define __IEEE_LITTLE_ENDIAN +#define __SMALL_BITFIELDS +#define _DOUBLE_IS_32BITS +#endif + +#if defined(__Z8001__) || defined(__Z8002__) +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef __m88k__ +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef __mn10300__ +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __mn10200__ +#define __IEEE_LITTLE_ENDIAN +#define __SMALL_BITFIELDS +#define _DOUBLE_IS_32BITS +#endif + +#ifdef __v800 +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __v850 +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __D10V__ +#define __IEEE_BIG_ENDIAN +#define _DOUBLE_IS_32BITS +#define __SMALL_BITFIELDS +#endif + +#ifdef __PPC__ +#if (defined(_BIG_ENDIAN) && _BIG_ENDIAN) || (defined(_AIX) && _AIX) +#define __IEEE_BIG_ENDIAN +#else +#if (defined(_LITTLE_ENDIAN) && _LITTLE_ENDIAN) || (defined(__sun__) && __sun__) || (defined(_WIN32) && _WIN32) +#define __IEEE_LITTLE_ENDIAN +#endif +#endif +#endif + +#ifdef __arc__ +#ifdef __big_endian__ +#define __IEEE_BIG_ENDIAN +#else +#define __IEEE_LITTLE_ENDIAN +#endif +#endif + +#ifdef __fr30__ +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef __mcore__ +#define __IEEE_BIG_ENDIAN +#endif + + + +#ifndef __IEEE_BIG_ENDIAN +#ifndef __IEEE_LITTLE_ENDIAN +#error Endianess not declared!! +#endif /* not __IEEE_LITTLE_ENDIAN */ +#endif /* not __IEEE_BIG_ENDIAN */ + +#endif /* not __IEEE_LITTLE_ENDIAN */ +#endif /* not __IEEE_BIG_ENDIAN */ + diff --git a/SDK/LIBS/dcinclude/newlib-libm-sh4/machine/time.h b/SDK/LIBS/dcinclude/newlib-libm-sh4/machine/time.h new file mode 100644 index 00000000..13857bfd --- /dev/null +++ b/SDK/LIBS/dcinclude/newlib-libm-sh4/machine/time.h @@ -0,0 +1,10 @@ +#ifndef _MACHTIME_H_ +#define _MACHTIME_H_ + +#if defined(__arm__) || defined(__thumb__) +#define _CLOCKS_PER_SEC_ 100 +#endif + +#endif /* _MACHTIME_H_ */ + + diff --git a/SDK/LIBS/dcinclude/newlib-libm-sh4/machine/types.h b/SDK/LIBS/dcinclude/newlib-libm-sh4/machine/types.h new file mode 100644 index 00000000..b71a67f5 --- /dev/null +++ b/SDK/LIBS/dcinclude/newlib-libm-sh4/machine/types.h @@ -0,0 +1,9 @@ +#ifndef _MACHTYPES_H_ +#define _MACHTYPES_H_ + +#define _CLOCK_T_ unsigned long /* clock() */ +#define _TIME_T_ long /* time() */ + +#endif /* _MACHTYPES_H_ */ + + diff --git a/SDK/LIBS/dcinclude/newlib-libm-sh4/math.h b/SDK/LIBS/dcinclude/newlib-libm-sh4/math.h new file mode 100644 index 00000000..059b4d15 --- /dev/null +++ b/SDK/LIBS/dcinclude/newlib-libm-sh4/math.h @@ -0,0 +1,273 @@ +/* math.h -- Definitions for the math floating point package. */ + +#ifndef _MATH_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _MATH_H_ + +#include +#include +#include + +#ifndef HUGE_VAL + +/* Define HUGE_VAL as infinity, unless HUGE_VAL is already defined + (which might have been done by something like math-68881.h). */ + +union __dmath +{ + __uint32_t i[2]; + double d; +}; + +extern const union __dmath __infinity; + +#define HUGE_VAL (__infinity.d) + +#endif /* ! defined (HUGE_VAL) */ + +/* Reentrant ANSI C functions. */ + +#ifndef __math_68881 +extern double atan _PARAMS((double)); +extern double cos _PARAMS((double)); +extern double sin _PARAMS((double)); +extern double tan _PARAMS((double)); +extern double tanh _PARAMS((double)); +extern double frexp _PARAMS((double, int *)); +extern double modf _PARAMS((double, double *)); +extern double ceil _PARAMS((double)); +extern double fabs _PARAMS((double)); +extern double floor _PARAMS((double)); +#endif /* ! defined (__math_68881) */ + +/* Non reentrant ANSI C functions. */ + +#ifndef _REENT_ONLY +#ifndef __math_6881 +extern double acos _PARAMS((double)); +extern double asin _PARAMS((double)); +extern double atan2 _PARAMS((double, double)); +extern double cosh _PARAMS((double)); +extern double sinh _PARAMS((double)); +extern double exp _PARAMS((double)); +extern double ldexp _PARAMS((double, int)); +extern double log _PARAMS((double)); +extern double log10 _PARAMS((double)); +extern double pow _PARAMS((double, double)); +extern double sqrt _PARAMS((double)); +extern double fmod _PARAMS((double, double)); +#endif /* ! defined (__math_68881) */ +#endif /* ! defined (_REENT_ONLY) */ + +#ifndef __STRICT_ANSI__ + +/* Non ANSI double precision functions. */ + +extern double infinity _PARAMS((void)); +extern double nan _PARAMS((void)); +extern int isnan _PARAMS((double)); +extern int isinf _PARAMS((double)); +extern int finite _PARAMS((double)); +extern double copysign _PARAMS((double, double)); +extern int ilogb _PARAMS((double)); + +extern double asinh _PARAMS((double)); +extern double cbrt _PARAMS((double)); +extern double nextafter _PARAMS((double, double)); +extern double rint _PARAMS((double)); +extern double scalbn _PARAMS((double, int)); + +#ifndef __math_68881 +extern double log1p _PARAMS((double)); +extern double expm1 _PARAMS((double)); +#endif /* ! defined (__math_68881) */ + +#ifndef _REENT_ONLY +extern double acosh _PARAMS((double)); +extern double atanh _PARAMS((double)); +extern double remainder _PARAMS((double, double)); +extern double gamma _PARAMS((double)); +extern double gamma_r _PARAMS((double, int *)); +extern double lgamma _PARAMS((double)); +extern double lgamma_r _PARAMS((double, int *)); +extern double erf _PARAMS((double)); +extern double erfc _PARAMS((double)); +extern double y0 _PARAMS((double)); +extern double y1 _PARAMS((double)); +extern double yn _PARAMS((int, double)); +extern double j0 _PARAMS((double)); +extern double j1 _PARAMS((double)); +extern double jn _PARAMS((int, double)); +#define log2(x) (log (x) / M_LOG2_E) + +#ifndef __math_68881 +extern double hypot _PARAMS((double, double)); +#endif + +extern double cabs(); +extern double drem _PARAMS((double, double)); + +#endif /* ! defined (_REENT_ONLY) */ + +/* Single precision versions of ANSI functions. */ + +extern float atanf _PARAMS((float)); +extern float cosf _PARAMS((float)); +extern float sinf _PARAMS((float)); +extern float tanf _PARAMS((float)); +extern float tanhf _PARAMS((float)); +extern float frexpf _PARAMS((float, int *)); +extern float modff _PARAMS((float, float *)); +extern float ceilf _PARAMS((float)); +extern float fabsf _PARAMS((float)); +extern float floorf _PARAMS((float)); + +#ifndef _REENT_ONLY +extern float acosf _PARAMS((float)); +extern float asinf _PARAMS((float)); +extern float atan2f _PARAMS((float, float)); +extern float coshf _PARAMS((float)); +extern float sinhf _PARAMS((float)); +extern float expf _PARAMS((float)); +extern float ldexpf _PARAMS((float, int)); +extern float logf _PARAMS((float)); +extern float log10f _PARAMS((float)); +extern float powf _PARAMS((float, float)); +extern float sqrtf _PARAMS((float)); +extern float fmodf _PARAMS((float, float)); +#endif /* ! defined (_REENT_ONLY) */ + +/* Other single precision functions. */ + +extern float infinityf _PARAMS((void)); +extern float nanf _PARAMS((void)); +extern int isnanf _PARAMS((float)); +extern int isinff _PARAMS((float)); +extern int finitef _PARAMS((float)); +extern float copysignf _PARAMS((float, float)); +extern int ilogbf _PARAMS((float)); + +extern float asinhf _PARAMS((float)); +extern float cbrtf _PARAMS((float)); +extern float nextafterf _PARAMS((float, float)); +extern float rintf _PARAMS((float)); +extern float scalbnf _PARAMS((float, int)); +extern float log1pf _PARAMS((float)); +extern float expm1f _PARAMS((float)); + +#ifndef _REENT_ONLY +extern float acoshf _PARAMS((float)); +extern float atanhf _PARAMS((float)); +extern float remainderf _PARAMS((float, float)); +extern float gammaf _PARAMS((float)); +extern float gammaf_r _PARAMS((float, int *)); +extern float lgammaf _PARAMS((float)); +extern float lgammaf_r _PARAMS((float, int *)); +extern float erff _PARAMS((float)); +extern float erfcf _PARAMS((float)); +extern float y0f _PARAMS((float)); +extern float y1f _PARAMS((float)); +extern float ynf _PARAMS((int, float)); +extern float j0f _PARAMS((float)); +extern float j1f _PARAMS((float)); +extern float jnf _PARAMS((int, float)); +#define log2f(x) (logf (x) / (float) M_LOG2_E) +extern float hypotf _PARAMS((float, float)); + +extern float cabsf(); +extern float dremf _PARAMS((float, float)); + +#endif /* ! defined (_REENT_ONLY) */ + +/* The gamma functions use a global variable, signgam. */ + +extern int signgam; + +/* The exception structure passed to the matherr routine. */ + +#ifdef __cplusplus +struct __exception +#else +struct exception +#endif +{ + int type; + char *name; + double arg1; + double arg2; + double retval; + int err; +}; + +#ifdef __cplusplus +extern int matherr _PARAMS((struct __exception *e)); +#else +extern int matherr _PARAMS((struct exception *e)); +#endif + +/* Values for the type field of struct exception. */ + +#define DOMAIN 1 +#define SING 2 +#define OVERFLOW 3 +#define UNDERFLOW 4 +#define TLOSS 5 +#define PLOSS 6 + +/* Useful constants. */ + +#define M_E 2.7182818284590452354 +#define M_LOG2E 1.4426950408889634074 +#define M_LOG10E 0.43429448190325182765 +#define M_LN2 0.69314718055994530942 +#define M_LN10 2.30258509299404568402 +#define M_PI 3.14159265358979323846 +#define M_TWOPI (M_PI * 2.0) +#define M_PI_2 1.57079632679489661923 +#define M_PI_4 0.78539816339744830962 +#define M_3PI_4 2.3561944901923448370E0 +#define M_SQRTPI 1.77245385090551602792981 +#define M_1_PI 0.31830988618379067154 +#define M_2_PI 0.63661977236758134308 +#define M_2_SQRTPI 1.12837916709551257390 +#define M_SQRT2 1.41421356237309504880 +#define M_SQRT1_2 0.70710678118654752440 +#define M_LN2LO 1.9082149292705877000E-10 +#define M_LN2HI 6.9314718036912381649E-1 +#define M_SQRT3 1.73205080756887719000 +#define M_IVLN10 0.43429448190325182765 /* 1 / log(10) */ +#define M_LOG2_E 0.693147180559945309417 +#define M_INVLN2 1.4426950408889633870E0 /* 1 / log(2) */ + +/* Global control over fdlibm error handling. */ + +enum __fdlibm_version +{ + __fdlibm_ieee = -1, + __fdlibm_svid, + __fdlibm_xopen, + __fdlibm_posix +}; + +#define _LIB_VERSION_TYPE enum __fdlibm_version +#define _LIB_VERSION __fdlib_version + +extern _CONST _LIB_VERSION_TYPE _LIB_VERSION; + +#define _IEEE_ __fdlibm_ieee +#define _SVID_ __fdlibm_svid +#define _XOPEN_ __fdlibm_xopen +#define _POSIX_ __fdlibm_posix + +#endif /* ! defined (__STRICT_ANSI__) */ + +#ifdef __FAST_MATH__ +#include +#endif + +#ifdef __cplusplus +} +#endif +#endif /* _MATH_H_ */ diff --git a/SDK/LIBS/dcinclude/newlib-libm-sh4/reent.h b/SDK/LIBS/dcinclude/newlib-libm-sh4/reent.h new file mode 100644 index 00000000..56fae91a --- /dev/null +++ b/SDK/LIBS/dcinclude/newlib-libm-sh4/reent.h @@ -0,0 +1,87 @@ +/* This header file provides the reentrancy. */ + +/* The reentrant system calls here serve two purposes: + + 1) Provide reentrant versions of the system calls the ANSI C library + requires. + 2) Provide these system calls in a namespace clean way. + + It is intended that *all* system calls that the ANSI C library needs + be declared here. It documents them all in one place. All library access + to the system is via some form of these functions. + + There are three ways a target may provide the needed syscalls. + + 1) Define the reentrant versions of the syscalls directly. + (eg: _open_r, _close_r, etc.). Please keep the namespace clean. + When you do this, set "syscall_dir" to "syscalls" in configure.in, + and add -DREENTRANT_SYSCALLS_PROVIDED to target_cflags in configure.in. + + 2) Define namespace clean versions of the system calls by prefixing + them with '_' (eg: _open, _close, etc.). Technically, there won't be + true reentrancy at the syscall level, but the library will be namespace + clean. + When you do this, set "syscall_dir" to "syscalls" in configure.in. + + 3) Define or otherwise provide the regular versions of the syscalls + (eg: open, close, etc.). The library won't be reentrant nor namespace + clean, but at least it will work. + When you do this, add -DMISSING_SYSCALL_NAMES to target_cflags in + configure.in. + + Stubs of the reentrant versions of the syscalls exist in the libc/reent + source directory and are used if REENTRANT_SYSCALLS_PROVIDED isn't defined. + They use the native system calls: _open, _close, etc. if they're available + (MISSING_SYSCALL_NAMES is *not* defined), otherwise open, close, etc. + (MISSING_SYSCALL_NAMES *is* defined). */ + +/* WARNING: All identifiers here must begin with an underscore. This file is + included by stdio.h and others and we therefore must only use identifiers + in the namespace allotted to us. */ + +#ifndef _REENT_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _REENT_H_ + +#include +#include +#include + +#define __need_size_t +#include + +/* FIXME: not namespace clean */ +struct stat; +struct tms; +struct timeval; +struct timezone; + +/* Reentrant versions of system calls. */ + +extern int _close_r _PARAMS ((struct _reent *, int)); +extern int _execve_r _PARAMS ((struct _reent *, char *, char **, char **)); +extern int _fcntl_r _PARAMS ((struct _reent *, int, int, int)); +extern int _fork_r _PARAMS ((struct _reent *)); +extern int _fstat_r _PARAMS ((struct _reent *, int, struct stat *)); +extern int _getpid_r _PARAMS ((struct _reent *)); +extern int _kill_r _PARAMS ((struct _reent *, int, int)); +extern int _link_r _PARAMS ((struct _reent *, const char *, const char *)); +extern _off_t _lseek_r _PARAMS ((struct _reent *, int, _off_t, int)); +extern int _open_r _PARAMS ((struct _reent *, const char *, int, int)); +extern _ssize_t _read_r _PARAMS ((struct _reent *, int, void *, size_t)); +extern void *_sbrk_r _PARAMS ((struct _reent *, size_t)); +extern int _stat_r _PARAMS ((struct _reent *, const char *, struct stat *)); +extern _CLOCK_T_ _times_r _PARAMS ((struct _reent *, struct tms *)); +extern int _unlink_r _PARAMS ((struct _reent *, const char *)); +extern int _wait_r _PARAMS ((struct _reent *, int *)); +extern _ssize_t _write_r _PARAMS ((struct _reent *, int, const void *, size_t)); + +/* This one is not guaranteed to be available on all targets. */ +extern int _gettimeofday_r _PARAMS ((struct _reent *, struct timeval *tp, struct timezone *tzp)); + +#ifdef __cplusplus +} +#endif +#endif /* _REENT_H_ */ diff --git a/SDK/LIBS/dcinclude/newlib-libm-sh4/sys/_types.h b/SDK/LIBS/dcinclude/newlib-libm-sh4/sys/_types.h new file mode 100644 index 00000000..8186f2d9 --- /dev/null +++ b/SDK/LIBS/dcinclude/newlib-libm-sh4/sys/_types.h @@ -0,0 +1,15 @@ +/* ANSI C namespace clean utility typedefs */ + +/* This file defines various typedefs needed by the system calls that support + the C library. Basically, they're just the POSIX versions with an '_' + prepended. This file lives in the `sys' directory so targets can provide + their own if desired (or they can put target dependant conditionals here). +*/ + +#ifndef _SYS__TYPES_H +#define _SYS__TYPES_H + +typedef long _off_t; +typedef long _ssize_t; + +#endif /* _SYS__TYPES_H */ diff --git a/SDK/LIBS/dcinclude/newlib-libm-sh4/sys/config.h b/SDK/LIBS/dcinclude/newlib-libm-sh4/sys/config.h new file mode 100644 index 00000000..e274119b --- /dev/null +++ b/SDK/LIBS/dcinclude/newlib-libm-sh4/sys/config.h @@ -0,0 +1,115 @@ +#ifndef __SYS_CONFIG_H__ +#define __SYS_CONFIG_H__ + +/* exceptions first */ +/* ??? Why is much of this stuff duplicated with machine/ieeefp.h? */ +#if defined(__H8300__) || defined(__H8500__) || defined (__H8300H__) || defined(__W65__) || defined (__H8300S__) +#define _FLOAT_ARG float +#define __SMALL_BITFIELDS +#define _DOUBLE_IS_32BITS +#define __IEEE_BIG_ENDIAN +/* ??? This conditional is true for the h8500 and the w65, defining H8300 + in those cases probably isn't the right thing to do. */ +#define H8300 1 +#endif + +#ifdef __W65__ +#define _DOUBLE_IS_32BITS +#define __SMALL_BITFIELDS +#define __IEEE_BIG_ENDIAN +#undef INT_MAX +#undef UINT_MAX +#define INT_MAX 32767 +#define UINT_MAX 65535 + +#endif + +/* 16 bit integer machines */ +#if defined(__Z8001__) || defined(__Z8002__) || defined(__H8300__) || defined(__H8500__) || defined(__W65__) || defined (__H8300H__) || defined (__H8300S__) || defined (__mn10200__) + +#undef INT_MAX +#undef UINT_MAX +#define INT_MAX 32767 +#define UINT_MAX 65535 +#endif + +#if defined(__D10V__) +#undef INT_MAX +#undef UINT_MAX +#define INT_MAX __INT_MAX__ +#define UINT_MAX (__INT_MAX__ * 2U + 1) +#define _DOUBLE_IS_32BITS +#define _POINTER_INT short +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef ___AM29K__ +#define _FLOAT_RET double +#endif + +#ifdef __i386__ +#ifndef __unix__ +/* in other words, go32 */ +#define _FLOAT_RET double +#endif +#endif + +#ifdef __M32R__ +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef __m68k__ +/* This is defined in machine/ieeefp.h; need to check is it redundant here? */ +#define __IEEE_BIG_ENDIAN +#endif + +#ifdef __mn10300__ +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __mn10200__ +#define _DOUBLE_IS_32BITS +#define __SMALL_BITFIELDS +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __TIC80__ +#define __IEEE_LITTLE_ENDIAN +#endif + +#ifdef __v850 +#define __IEEE_LITTLE_ENDIAN +#define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__sda__)) +#endif + +#ifdef __D30V__ +#define __IEEE_BIG_ENDIAN +#endif + +/* For the PowerPC eabi, force the _impure_ptr to be in .sdata */ +#if defined(__PPC__) && defined(_CALL_SYSV) +#define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__section__(".sdata"))) +#endif + +#ifdef __sparc__ +#ifdef __LITTLE_ENDIAN_DATA__ +#define __IEEE_LITTLE_ENDIAN +#else +#define __IEEE_BIG_ENDIAN +#endif +#endif + +#if INT_MAX == 32767 +typedef long int __int32_t; +typedef unsigned long int __uint32_t; +#else +typedef int __int32_t; +typedef unsigned int __uint32_t; +#endif + +#ifndef _POINTER_INT +#define _POINTER_INT long +#endif + + +#endif /* __SYS_CONFIG_H__ */ diff --git a/SDK/LIBS/dcinclude/newlib-libm-sh4/sys/reent.h b/SDK/LIBS/dcinclude/newlib-libm-sh4/sys/reent.h new file mode 100644 index 00000000..30a2b040 --- /dev/null +++ b/SDK/LIBS/dcinclude/newlib-libm-sh4/sys/reent.h @@ -0,0 +1,238 @@ +/* This header file provides the reentrancy. */ + +/* WARNING: All identifiers here must begin with an underscore. This file is + included by stdio.h and others and we therefore must only use identifiers + in the namespace allotted to us. */ + +#ifndef _SYS_REENT_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _SYS_REENT_H_ + +#include +#include + +#ifndef __Long +#if __LONG_MAX__ == 2147483647L +#define __Long long +typedef unsigned __Long __ULong; +#elif __INT_MAX__ == 2147483647 +#define __Long int +typedef unsigned __Long __ULong; +#endif +#endif + +#ifndef __Long +#define __Long __int32_t +typedef __uint32_t __ULong; +#endif + +struct _glue +{ + struct _glue *_next; + int _niobs; + struct __sFILE *_iobs; +}; + +struct _Bigint +{ + struct _Bigint *_next; + int _k, _maxwds, _sign, _wds; + __ULong _x[1]; +}; + +/* + * atexit() support + */ + +#define _ATEXIT_SIZE 32 /* must be at least 32 to guarantee ANSI conformance */ + +struct _atexit { + struct _atexit *_next; /* next in list */ + int _ind; /* next index in this table */ + void (*_fns[_ATEXIT_SIZE])(void); /* the table itself */ +}; + +/* + * Stdio buffers. + * + * This and __sFILE are defined here because we need them for struct _reent, + * but we don't want stdio.h included when stdlib.h is. + */ + +struct __sbuf { + unsigned char *_base; + int _size; +}; + +/* + * We need fpos_t for the following, but it doesn't have a leading "_", + * so we use _fpos_t instead. + */ + +typedef long _fpos_t; /* XXX must match off_t in */ + /* (and must be `long' for now) */ + +/* + * Stdio state variables. + * + * The following always hold: + * + * if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR), + * _lbfsize is -_bf._size, else _lbfsize is 0 + * if _flags&__SRD, _w is 0 + * if _flags&__SWR, _r is 0 + * + * This ensures that the getc and putc macros (or inline functions) never + * try to write or read from a file that is in `read' or `write' mode. + * (Moreover, they can, and do, automatically switch from read mode to + * write mode, and back, on "r+" and "w+" files.) + * + * _lbfsize is used only to make the inline line-buffered output stream + * code as compact as possible. + * + * _ub, _up, and _ur are used when ungetc() pushes back more characters + * than fit in the current _bf, or when ungetc() pushes back a character + * that does not match the previous one in _bf. When this happens, + * _ub._base becomes non-nil (i.e., a stream has ungetc() data iff + * _ub._base!=NULL) and _up and _ur save the current values of _p and _r. + */ + +struct __sFILE { + unsigned char *_p; /* current position in (some) buffer */ + int _r; /* read space left for getc() */ + int _w; /* write space left for putc() */ + short _flags; /* flags, below; this FILE is free if 0 */ + short _file; /* fileno, if Unix descriptor, else -1 */ + struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */ + int _lbfsize; /* 0 or -_bf._size, for inline putc */ + + /* operations */ + _PTR _cookie; /* cookie passed to io functions */ + + int _EXFUN((*_read),(_PTR _cookie, char *_buf, int _n)); + int _EXFUN((*_write),(_PTR _cookie, const char *_buf, int _n)); + _fpos_t _EXFUN((*_seek),(_PTR _cookie, _fpos_t _offset, int _whence)); + int _EXFUN((*_close),(_PTR _cookie)); + + /* separate buffer for long sequences of ungetc() */ + struct __sbuf _ub; /* ungetc buffer */ + unsigned char *_up; /* saved _p when _p is doing ungetc data */ + int _ur; /* saved _r when _r is counting ungetc data */ + + /* tricks to meet minimum requirements even when malloc() fails */ + unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */ + unsigned char _nbuf[1]; /* guarantee a getc() buffer */ + + /* separate buffer for fgetline() when line crosses buffer boundary */ + struct __sbuf _lb; /* buffer for fgetline() */ + + /* Unix stdio files get aligned to block boundaries on fseek() */ + int _blksize; /* stat.st_blksize (may be != _bf._size) */ + int _offset; /* current lseek offset */ + + struct _reent *_data; +}; + +/* + * struct _reent + * + * This structure contains *all* globals needed by the library. + * It's raison d'etre is to facilitate threads by making all library routines + * reentrant. IE: All state information is contained here. + */ + +struct _reent +{ + /* local copy of errno */ + int _errno; + + /* FILE is a big struct and may change over time. To try to achieve binary + compatibility with future versions, put stdin,stdout,stderr here. + These are pointers into member __sf defined below. */ + struct __sFILE *_stdin, *_stdout, *_stderr; + + int _inc; /* used by tmpnam */ + char _emergency[25]; + + int _current_category; /* used by setlocale */ + _CONST char *_current_locale; + + int __sdidinit; /* 1 means stdio has been init'd */ + + void _EXFUN((*__cleanup),(struct _reent *)); + + /* used by mprec routines */ + struct _Bigint *_result; + int _result_k; + struct _Bigint *_p5s; + struct _Bigint **_freelist; + + /* used by some fp conversion routines */ + int _cvtlen; /* should be size_t */ + char *_cvtbuf; + + union + { + struct + { + unsigned int _rand_next; + char * _strtok_last; + char _asctime_buf[26]; + struct tm _localtime_buf; + int _gamma_signgam; + } _reent; + /* Two next two fields were once used by malloc. They are no longer + used. They are used to preserve the space used before so as to + allow addition of new reent fields and keep binary compatibility. */ + struct + { +#define _N_LISTS 30 + unsigned char * _nextf[_N_LISTS]; + unsigned int _nmalloc[_N_LISTS]; + } _unused; + } _new; + + /* atexit stuff */ + struct _atexit *_atexit; /* points to head of LIFO stack */ + struct _atexit _atexit0; /* one guaranteed table, required by ANSI */ + + /* signal info */ + void (**(_sig_func))(int); + + /* These are here last so that __sFILE can grow without changing the offsets + of the above members (on the off chance that future binary compatibility + would be broken otherwise). */ + struct _glue __sglue; /* root of glue chain */ + struct __sFILE __sf[3]; /* first three file descriptors */ +}; + +#define _REENT_INIT(var) \ + { 0, &var.__sf[0], &var.__sf[1], &var.__sf[2], 0, "", 0, "C", \ + 0, NULL, NULL, 0, NULL, NULL, 0, NULL, { {1, NULL, "", \ + { 0,0,0,0,0,0,0,0}, 0 } } } + +/* + * All references to struct _reent are via this pointer. + * Internally, newlib routines that need to reference it should use _REENT. + */ + +#ifndef __ATTRIBUTE_IMPURE_PTR__ +#define __ATTRIBUTE_IMPURE_PTR__ +#endif + +extern struct _reent *_impure_ptr __ATTRIBUTE_IMPURE_PTR__; + +void _reclaim_reent _PARAMS ((struct _reent *)); + +/* #define _REENT_ONLY define this to get only reentrant routines */ + +#ifndef _REENT_ONLY +#define _REENT _impure_ptr +#endif + +#ifdef __cplusplus +} +#endif +#endif /* _SYS_REENT_H_ */ diff --git a/SDK/LIBS/dcinclude/newlib-libm-sh4/sys/types.h b/SDK/LIBS/dcinclude/newlib-libm-sh4/sys/types.h new file mode 100644 index 00000000..7d2e5246 --- /dev/null +++ b/SDK/LIBS/dcinclude/newlib-libm-sh4/sys/types.h @@ -0,0 +1,174 @@ +/* unified sys/types.h: + start with sef's sysvi386 version. + merge go32 version -- a few ifdefs. + h8300hms, h8300xray, and sysvnecv70 disagree on the following types: + + typedef int gid_t; + typedef int uid_t; + typedef int dev_t; + typedef int ino_t; + typedef int mode_t; + typedef int caddr_t; + + however, these aren't "reasonable" values, the sysvi386 ones make far + more sense, and should work sufficiently well (in particular, h8300 + doesn't have a stat, and the necv70 doesn't matter.) -- eichin + */ + +#ifndef _SYS_TYPES_H +#define _SYS_TYPES_H + +#if defined (_WIN32) || defined (__CYGWIN__) +#define __MS_types__ +#endif + +#ifdef __i386__ +#if defined (GO32) || defined (__MSDOS__) +#define __MS_types__ +#endif +#endif + +# include +# include + +/* To ensure the stat struct's layout doesn't change when sizeof(int), etc. + changes, we assume sizeof short and long never change and have all types + used to define struct stat use them and not int where possible. + Where not possible, _ST_INTxx are used. It would be preferable to not have + such assumptions, but until the extra fluff is necessary, it's avoided. + No 64 bit targets use stat yet. What to do about them is postponed + until necessary. */ +#ifdef __GNUC__ +#define _ST_INT32 __attribute__ ((__mode__ (__SI__))) +#else +#define _ST_INT32 +#endif + +# ifndef _POSIX_SOURCE + +# define physadr physadr_t +# define quad quad_t + +#ifndef _WINSOCK_H +typedef unsigned char u_char; +typedef unsigned short u_short; +typedef unsigned int u_int; +typedef unsigned long u_long; +#endif + +typedef unsigned short ushort; /* System V compatibility */ +typedef unsigned int uint; /* System V compatibility */ +# endif /*!_POSIX_SOURCE */ + +#ifndef __time_t_defined +typedef _TIME_T_ time_t; +#define __time_t_defined +#endif + +typedef long daddr_t; +typedef char * caddr_t; + +#ifdef __MS_types__ +typedef unsigned long ino_t; +#else +#ifdef __sparc__ +typedef unsigned long ino_t; +#else +typedef unsigned short ino_t; +#endif +#endif + +#ifdef __MS_types__ +typedef unsigned long vm_offset_t; +typedef unsigned long vm_size_t; + +#define __BIT_TYPES_DEFINED__ + +typedef char int8_t; +typedef unsigned char u_int8_t; +typedef short int16_t; +typedef unsigned short u_int16_t; +typedef int int32_t; +typedef unsigned int u_int32_t; +typedef long long int64_t; +typedef unsigned long long u_int64_t; +typedef int32_t register_t; +#endif /* __MS_types__ */ + +/* + * All these should be machine specific - right now they are all broken. + * However, for all of Cygnus' embedded targets, we want them to all be + * the same. Otherwise things like sizeof (struct stat) might depend on + * how the file was compiled (e.g. -mint16 vs -mint32, etc.). + */ + +typedef short dev_t; + +typedef long off_t; + +typedef unsigned short uid_t; +typedef unsigned short gid_t; +typedef int pid_t; +typedef long key_t; +typedef long ssize_t; + +#ifdef __MS_types__ +typedef char * addr_t; +typedef int mode_t; +#else +#if defined (__sparc__) && !defined (__sparc_v9__) +#ifdef __svr4__ +typedef unsigned long mode_t; +#else +typedef unsigned short mode_t; +#endif +#else +typedef unsigned int mode_t _ST_INT32; +#endif +#endif /* ! __MS_types__ */ + +typedef unsigned short nlink_t; + +/* We don't define fd_set and friends if we are compiling POSIX + source, or if we have included the Windows Sockets.h header (which + defines Windows versions of them). Note that a program which + includes the Windows sockets.h header must know what it is doing; + it must not call the cygwin32 select function. */ +# if ! defined (_POSIX_SOURCE) && ! defined (_WINSOCK_H) + +# define NBBY 8 /* number of bits in a byte */ +/* + * Select uses bit masks of file descriptors in longs. + * These macros manipulate such bit fields (the filesystem macros use chars). + * FD_SETSIZE may be defined by the user, but the default here + * should be >= NOFILE (param.h). + */ +# ifndef FD_SETSIZE +# define FD_SETSIZE 64 +# endif + +typedef long fd_mask; +# define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */ +# ifndef howmany +# define howmany(x,y) (((x)+((y)-1))/(y)) +# endif + +/* We use a macro for fd_set so that including Sockets.h afterwards + can work. */ +typedef struct _types_fd_set { + fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; +} _types_fd_set; + +#define fd_set _types_fd_set + +# define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1L << ((n) % NFDBITS))) +# define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1L << ((n) % NFDBITS))) +# define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1L << ((n) % NFDBITS))) +# define FD_ZERO(p) bzero((caddr_t)(p), sizeof (*(p))) + +# endif /* ! defined (_POSIX_SOURCE) && ! defined (_WINSOCK_H) */ + +#undef __MS_types__ +#undef _ST_INT32 + +#endif /* _SYS_TYPES_H */ diff --git a/SDK/LIBS/dcinclude/ogg/config_types.h b/SDK/LIBS/dcinclude/ogg/config_types.h new file mode 100644 index 00000000..0270e771 --- /dev/null +++ b/SDK/LIBS/dcinclude/ogg/config_types.h @@ -0,0 +1,10 @@ +#ifndef __CONFIG_TYPES_H__ +#define __CONFIG_TYPES_H__ + +/* these are filled in by configure */ +typedef int16 ogg_int16_t; +typedef int32 ogg_int32_t; +typedef uint32 ogg_uint32_t; +typedef int64 ogg_int64_t; + +#endif diff --git a/SDK/LIBS/dcinclude/ogg/ogg.h b/SDK/LIBS/dcinclude/ogg/ogg.h new file mode 100644 index 00000000..bcfa603e --- /dev/null +++ b/SDK/LIBS/dcinclude/ogg/ogg.h @@ -0,0 +1,184 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the Xiph.Org Foundation http://www.xiph.org/ * + * * + ******************************************************************** + + function: toplevel libogg include + last mod: $Id: ogg.h,v 1.1 2003/02/27 03:46:30 bardtx Exp $ + + ********************************************************************/ +#ifndef _OGG_H +#define _OGG_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +typedef struct { + long endbyte; + int endbit; + + unsigned char *buffer; + unsigned char *ptr; + long storage; +} oggpack_buffer; + +/* ogg_page is used to encapsulate the data in one Ogg bitstream page *****/ + +typedef struct { + unsigned char *header; + long header_len; + unsigned char *body; + long body_len; +} ogg_page; + +/* ogg_stream_state contains the current encode/decode state of a logical + Ogg bitstream **********************************************************/ + +typedef struct { + unsigned char *body_data; /* bytes from packet bodies */ + long body_storage; /* storage elements allocated */ + long body_fill; /* elements stored; fill mark */ + long body_returned; /* elements of fill returned */ + + + int *lacing_vals; /* The values that will go to the segment table */ + ogg_int64_t *granule_vals; /* granulepos values for headers. Not compact + this way, but it is simple coupled to the + lacing fifo */ + long lacing_storage; + long lacing_fill; + long lacing_packet; + long lacing_returned; + + unsigned char header[282]; /* working space for header encode */ + int header_fill; + + int e_o_s; /* set when we have buffered the last packet in the + logical bitstream */ + int b_o_s; /* set after we've written the initial page + of a logical bitstream */ + long serialno; + long pageno; + ogg_int64_t packetno; /* sequence number for decode; the framing + knows where there's a hole in the data, + but we need coupling so that the codec + (which is in a seperate abstraction + layer) also knows about the gap */ + ogg_int64_t granulepos; + +} ogg_stream_state; + +/* ogg_packet is used to encapsulate the data and metadata belonging + to a single raw Ogg/Vorbis packet *************************************/ + +typedef struct { + unsigned char *packet; + long bytes; + long b_o_s; + long e_o_s; + + ogg_int64_t granulepos; + + ogg_int64_t packetno; /* sequence number for decode; the framing + knows where there's a hole in the data, + but we need coupling so that the codec + (which is in a seperate abstraction + layer) also knows about the gap */ +} ogg_packet; + +typedef struct { + unsigned char *data; + int storage; + int fill; + int returned; + + int unsynced; + int headerbytes; + int bodybytes; +} ogg_sync_state; + +/* Ogg BITSTREAM PRIMITIVES: bitstream ************************/ + +extern void oggpack_writeinit(oggpack_buffer *b); +extern void oggpack_writetrunc(oggpack_buffer *b,long bits); +extern void oggpack_writealign(oggpack_buffer *b); +extern void oggpack_writecopy(oggpack_buffer *b,void *source,long bits); +extern void oggpack_reset(oggpack_buffer *b); +extern void oggpack_writeclear(oggpack_buffer *b); +extern void oggpack_readinit(oggpack_buffer *b,unsigned char *buf,int bytes); +extern void oggpack_write(oggpack_buffer *b,unsigned long value,int bits); +extern long oggpack_look(oggpack_buffer *b,int bits); +extern long oggpack_look1(oggpack_buffer *b); +extern void oggpack_adv(oggpack_buffer *b,int bits); +extern void oggpack_adv1(oggpack_buffer *b); +extern long oggpack_read(oggpack_buffer *b,int bits); +extern long oggpack_read1(oggpack_buffer *b); +extern long oggpack_bytes(oggpack_buffer *b); +extern long oggpack_bits(oggpack_buffer *b); +extern unsigned char *oggpack_get_buffer(oggpack_buffer *b); + +/* Ogg BITSTREAM PRIMITIVES: encoding **************************/ + +extern int ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op); +extern int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og); +extern int ogg_stream_flush(ogg_stream_state *os, ogg_page *og); + +/* Ogg BITSTREAM PRIMITIVES: decoding **************************/ + +extern int ogg_sync_init(ogg_sync_state *oy); +extern int ogg_sync_clear(ogg_sync_state *oy); +extern int ogg_sync_reset(ogg_sync_state *oy); +extern int ogg_sync_destroy(ogg_sync_state *oy); + +extern char *ogg_sync_buffer(ogg_sync_state *oy, long size); +extern int ogg_sync_wrote(ogg_sync_state *oy, long bytes); +extern long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og); +extern int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og); +extern int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og); +extern int ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op); +extern int ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op); + +/* Ogg BITSTREAM PRIMITIVES: general ***************************/ + +extern int ogg_stream_init(ogg_stream_state *os,int serialno); +extern int ogg_stream_clear(ogg_stream_state *os); +extern int ogg_stream_reset(ogg_stream_state *os); +extern int ogg_stream_reset_serialno(ogg_stream_state *os,int serialno); +extern int ogg_stream_destroy(ogg_stream_state *os); +extern int ogg_stream_eos(ogg_stream_state *os); + +extern void ogg_page_checksum_set(ogg_page *og); + +extern int ogg_page_version(ogg_page *og); +extern int ogg_page_continued(ogg_page *og); +extern int ogg_page_bos(ogg_page *og); +extern int ogg_page_eos(ogg_page *og); +extern ogg_int64_t ogg_page_granulepos(ogg_page *og); +extern int ogg_page_serialno(ogg_page *og); +extern long ogg_page_pageno(ogg_page *og); +extern int ogg_page_packets(ogg_page *og); + +extern void ogg_packet_clear(ogg_packet *op); + + +#ifdef __cplusplus +} +#endif + +#endif /* _OGG_H */ + + + + + + diff --git a/SDK/LIBS/dcinclude/ogg/os_types.h b/SDK/LIBS/dcinclude/ogg/os_types.h new file mode 100644 index 00000000..3079baf2 --- /dev/null +++ b/SDK/LIBS/dcinclude/ogg/os_types.h @@ -0,0 +1,81 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: #ifdef jail to whip a few platforms into the UNIX ideal. + last mod: $Id: os_types.h,v 1.1 2003/02/27 03:46:30 bardtx Exp $ + + ********************************************************************/ +#ifndef _OS_TYPES_H +#define _OS_TYPES_H + +/* make it easy on the folks that want to compile the libs with a + different malloc than stdlib */ +#define _ogg_malloc malloc +#define _ogg_calloc calloc +#define _ogg_realloc realloc +#define _ogg_free free + +#ifdef _WIN32 + +# ifndef __GNUC__ + /* MSVC/Borland */ + typedef __int64 ogg_int64_t; + typedef __int32 ogg_int32_t; + typedef unsigned __int32 ogg_uint32_t; + typedef __int16 ogg_int16_t; +# else + /* Cygwin */ + #include <_G_config.h> + typedef _G_int64_t ogg_int64_t; + typedef _G_int32_t ogg_int32_t; + typedef _G_uint32_t ogg_uint32_t; + typedef _G_int16_t ogg_int16_t; +# endif + +#elif defined(__MACOS__) + +# include + typedef SInt16 ogg_int16_t; + typedef SInt32 ogg_int32_t; + typedef UInt32 ogg_uint32_t; + typedef SInt64 ogg_int64_t; + +#elif defined(__MACOSX__) /* MacOS X Framework build */ + +# include + typedef int16_t ogg_int16_t; + typedef int32_t ogg_int32_t; + typedef u_int32_t ogg_uint32_t; + typedef int64_t ogg_int64_t; + +#elif defined(__BEOS__) + + /* Be */ +# include + +#elif defined (__EMX__) + + /* OS/2 GCC */ + typedef short ogg_int16_t; + typedef int ogg_int32_t; + typedef unsigned int ogg_uint32_t; + typedef long long ogg_int64_t; + +#else + +//# include +# include +# include + +#endif + +#endif /* _OS_TYPES_H */ diff --git a/SDK/LIBS/dcinclude/oggvorbis/sndoggvorbis.h b/SDK/LIBS/dcinclude/oggvorbis/sndoggvorbis.h new file mode 100644 index 00000000..15d0e3fd --- /dev/null +++ b/SDK/LIBS/dcinclude/oggvorbis/sndoggvorbis.h @@ -0,0 +1,56 @@ +/* KallistiOS 1.2.0 + + sndoggvorbis.h + (c)2001 Thorsten Titze + + An Ogg/Vorbis player library using sndstream and the official Xiphophorus + libogg and libvorbis libraries. + + $Id: sndoggvorbis.h,v 1.2 2003/04/24 02:53:30 bardtx Exp $ + +*/ + +#ifndef __SNDOGGVORBIS_H +#define __SNDOGGVORBIS_H + +#include +__BEGIN_DECLS + +#include + +int sndoggvorbis_init(); +int sndoggvorbis_start(const char *filename,int loop); +int sndoggvorbis_start_fd(FILE *f, int loop); +void sndoggvorbis_stop(); +void sndoggvorbis_shutdown(); + +int sndoggvorbis_isplaying(); + +void sndoggvorbis_volume(int vol); + +void sndoggvorbis_mainloop(); +void sndoggvorbis_wait_start(); + +void sndoggvorbis_setbitrateinterval(int interval); +long sndoggvorbis_getbitrate(); +long sndoggvorbis_getposition(); + +char *sndoggvorbis_getcommentbyname(const char *commentfield); +char *sndoggvorbis_getartist(); +char *sndoggvorbis_gettitle(); +char *sndoggvorbis_getgenre(); + +/* Enable/disable queued waiting */ +void sndoggvorbis_queue_enable(); +void sndoggvorbis_queue_disable(); + +/* Wait for the song to be queued */ +void sndoggvorbis_queue_wait(); + +/* Queue the song to start if it's in QUEUED */ +void sndoggvorbis_queue_go(); + +__END_DECLS + +#endif /* __SNDOGGVORBIS_H */ + diff --git a/SDK/LIBS/dcinclude/os/abi/fs.h b/SDK/LIBS/dcinclude/os/abi/fs.h new file mode 100644 index 00000000..0be33317 --- /dev/null +++ b/SDK/LIBS/dcinclude/os/abi/fs.h @@ -0,0 +1,44 @@ +/* KallistiOS 1.2.0 + + os/abi/fs.h + (c)2000 Dan Potter + + $Id: fs.h,v 1.1 2003/02/27 03:46:31 bardtx Exp $ +*/ + +#ifndef __OS_ABI_FS_H +#define __OS_ABI_FS_H + +#include +__BEGIN_DECLS + +#include +#include + +typedef struct { + service_abi_t hdr; /* Header info */ + + file_t (*open)(const char *fn, int mode); + void (*close)(file_t hnd); + ssize_t (*read)(file_t hnd, void *buffer, size_t cnt); + ssize_t (*write)(file_t hnd, const void *buffer, size_t cnt); + off_t (*seek)(file_t hnd, off_t offset, int whence); + off_t (*tell)(file_t hnd); + size_t (*total)(file_t hnd); + dirent_t* (*readdir)(file_t hnd); + int (*ioctl)(file_t hnd, void *data, size_t size); + int (*rename)(const char *fn1, const char *fn2); + int (*unlink)(const char *fn); + int (*chdir)(const char *fn); + void * (*mmap)(file_t fd); + const char * (*getwd)(); + uint32 padding0[32 - 13]; + + int (*handler_add)(const char *prefix, vfs_handler *hnd); + int (*handler_remove)(const vfs_handler *hnd); +} abi_fs_t; + +__END_DECLS + +#endif /* __OS_ABI_FS_H */ + diff --git a/SDK/LIBS/dcinclude/os/abi/fundamental.h b/SDK/LIBS/dcinclude/os/abi/fundamental.h new file mode 100644 index 00000000..53b5d375 --- /dev/null +++ b/SDK/LIBS/dcinclude/os/abi/fundamental.h @@ -0,0 +1,36 @@ +/* KallistiOS 1.2.0 + + os/abi/fundamental.h + (c)2000-2001 Dan Potter + + $Id: fundamental.h,v 1.1 2003/02/27 03:46:31 bardtx Exp $ + +*/ + +#ifndef __OS_ABI_FUNDAMENTAL_H +#define __OS_ABI_FUNDAMENTAL_H + +#include +__BEGIN_DECLS + +#include + +typedef struct { + service_abi_t hdr; /* Header info */ + + int (*printf)(const char *fmt, ...); /* printf */ + uint32 padding1[16-1]; + + void* (*malloc)(size_t size); /* malloc */ + void (*free)(void *ptr); + void* (*memalign)(size_t size, size_t align); + uint32 padding2[16-3]; + + /* Internal OS Debug Usage ONLY */ + int (*debug)(int i); /* misc debug function */ +} abi_fundamental_t; + +__END_DECLS + +#endif /* __OS_ABI_FUNDAMENTAL_H */ + diff --git a/SDK/LIBS/dcinclude/os/abi/libk.h b/SDK/LIBS/dcinclude/os/abi/libk.h new file mode 100644 index 00000000..dfa9b8df --- /dev/null +++ b/SDK/LIBS/dcinclude/os/abi/libk.h @@ -0,0 +1,39 @@ +/* KallistiOS 1.2.0 + + os/abi/libk.h + (c)2000-2001 Dan Potter + + $Id: libk.h,v 1.1 2003/02/27 03:46:31 bardtx Exp $ + +*/ + +#ifndef __LIBK_H +#define __LIBK_H + +#include +__BEGIN_DECLS + +/* Kernel get-service call */ +extern void* (*ko_get_svc)(char *name); + +/* Provide a nicer looking alternative */ +#define lib_open ko_get_svc + +/* For now this does nothing (bad!) */ +#define lib_close(lib) + +/* Convienence macros for opening and closing libs */ +#ifndef __cplusplus +#define OPEN_LIB(var, ident) \ + var = lib_open(ident); \ + if (!var) { printf("can't open '%s' abi\r\n", ident); return -1; } +#else +#define OPEN_LIB(var, type, ident) \ + var = (type)lib_open(ident); \ + if (!var) { printf("can't open '%s' abi\r\n", ident); return -1; } +#endif + +__END_DECLS + +#endif /* __LIBK_H */ + diff --git a/SDK/LIBS/dcinclude/os/abi/maple.h b/SDK/LIBS/dcinclude/os/abi/maple.h new file mode 100644 index 00000000..bbcda212 --- /dev/null +++ b/SDK/LIBS/dcinclude/os/abi/maple.h @@ -0,0 +1,63 @@ +/* KallistiOS 1.2.0 + + os/abi/maple.h + (c)2000-2001 Dan Potter + + $Id: maple.h,v 1.1 2003/02/27 03:46:31 bardtx Exp $ + +*/ + +#ifndef __OS_ABI_MAPLE_H +#define __OS_ABI_MAPLE_H + +#include +__BEGIN_DECLS + +#include +#include + +/* Specific maple devices */ +#include +#include +#include +#include + +typedef struct { + service_abi_t hdr; /* Header info */ + + uint8 (*create_addr)(uint8 port, uint8 unit); + int (*docmd_block)(int8 cmd, uint8 addr, + uint8 datalen, void *data, + maple_frame_t *retframe); + int (*rescan_bus)(int quiet); + uint32 (*device_func)(int port, int unit); + uint8 (*first_device)(int code); + uint8 (*first_controller)(); + uint8 (*first_mouse)(); + uint8 (*first_kb)(); + uint8 (*first_lcd)(); + uint8 (*first_vmu)(); + uint32 padding0[32 - 10]; + + int (*cont_get_cond)(uint8 addr, cont_cond_t *cond); + uint32 padding1[8 - 1]; + + int (*kbd_get_cond)(uint8 addr, kbd_cond_t *cond); + void (*kbd_set_queue)(int active); + int (*kbd_enqueue)(uint8 keyboard); + int (*kbd_get_key)(); + int (*kbd_poll)(uint8 addr); + uint32 padding2[8 - 5]; + + int (*mouse_get_cond)(uint8 addr, mouse_cond_t *cond); + uint32 padding3[8 - 1]; + + int (*vmu_draw_lcd)(uint8 addr, void *bitmap); + int (*vmu_block_read)(uint8 addr, uint16 blocknum, uint8 *buffer); + int (*vmu_block_write)(uint8 addr, uint16 blocknum, uint8 *buffer); +} abi_maple_t; + +__END_DECLS + +#endif /* __OS_ABI_MAPLE_H */ + diff --git a/SDK/LIBS/dcinclude/os/abi/process.h b/SDK/LIBS/dcinclude/os/abi/process.h new file mode 100644 index 00000000..3083225b --- /dev/null +++ b/SDK/LIBS/dcinclude/os/abi/process.h @@ -0,0 +1,30 @@ +/* KallistiOS 1.2.0 + + os/abi/process.h + (c)2000-2001 Jordan DeLong + + $Id: process.h,v 1.1 2003/02/27 03:46:31 bardtx Exp $ + +*/ + +#ifndef __OS_ABI_PROCESS_H +#define __OS_ABI_PROCESS_H + +#include +__BEGIN_DECLS + +#include +#include + +typedef struct { + service_abi_t hdr; /* header info */ + + elf_prog_t* (*load)(const char *fn); + int (*load_and_exec)(const char *fn, int argc, char **argv); + kthread_t* (*load_and_fork)(const char *fn, int argc, char **argv); +} abi_process_t; + +__END_DECLS + +#endif /* __OS_ABI_PROCESS_H */ + diff --git a/SDK/LIBS/dcinclude/os/abi/serial.h b/SDK/LIBS/dcinclude/os/abi/serial.h new file mode 100644 index 00000000..0f25ff32 --- /dev/null +++ b/SDK/LIBS/dcinclude/os/abi/serial.h @@ -0,0 +1,29 @@ +/* KallistiOS 0.80 + + os/abi/serial.h + (c)2001 Dan Potter + + $Id: serial.h,v 1.1 2003/02/27 03:46:31 bardtx Exp $ +*/ + +#ifndef __OS_ABI_SERIAL_H +#define __OS_ABI_SERIAL_H + +#include +__BEGIN_DECLS + +#include +#include + +typedef struct { + service_abi_t hdr; /* Header info */ + + void (*write)(uint8 *data, int len); + void (*read)(uint8 *data, int len); + void (*flush)(); +} abi_serial_t; + +__END_DECLS + +#endif /* __OS_ABI_SERIAL_H */ + diff --git a/SDK/LIBS/dcinclude/os/abi/spu.h b/SDK/LIBS/dcinclude/os/abi/spu.h new file mode 100644 index 00000000..fbb3d355 --- /dev/null +++ b/SDK/LIBS/dcinclude/os/abi/spu.h @@ -0,0 +1,32 @@ +/* KallistiOS 1.2.0 + + os/abi/spu.h + (c)2000-2001 Dan Potter + + $Id: spu.h,v 1.1 2003/02/27 03:46:31 bardtx Exp $ + +*/ + +#ifndef __OS_ABI_SPU_H +#define __OS_ABI_SPU_H + +#include +__BEGIN_DECLS + +#include +#include + +typedef struct { + service_abi_t hdr; /* Header info */ + + void (*write_wait)(); + void (*memload)(uint32 to, uint8* from, int length); + void (*memset)(uint32 to, uint32 what, int length); + void (*enable)(); + void (*disable)(); +} abi_spu_t; + +__END_DECLS + +#endif /* __OS_ABI_SPU_H */ + diff --git a/SDK/LIBS/dcinclude/os/abi/svcmpx.h b/SDK/LIBS/dcinclude/os/abi/svcmpx.h new file mode 100644 index 00000000..f43e0893 --- /dev/null +++ b/SDK/LIBS/dcinclude/os/abi/svcmpx.h @@ -0,0 +1,29 @@ +/* KallistiOS 1.2.0 + + os/abi/svcmpx.h - adding/removing services + (C) 2000-2001 Jordan DeLong + + $Id: svcmpx.h,v 1.1 2003/02/27 03:46:31 bardtx Exp $ + + */ + +#ifndef __OS_ABI_SVCMPX_H +#define __OS_ABI_SVCMPX_H + +#include +__BEGIN_DECLS + +#include + +typedef struct { + service_abi_t hdr; /* header info */ + + void * (*get_handler)(const char *svcname); /* here for completeness: progs use lib_open */ + int (*add_handler)(const char *name, void *svc_struct); + int (*remove_handler)(const char *name); +} abi_svcmpx_t; + +__END_DECLS + +#endif /* __OS_ABI_SVCMPX_H */ + diff --git a/SDK/LIBS/dcinclude/os/abi/ta.h b/SDK/LIBS/dcinclude/os/abi/ta.h new file mode 100644 index 00000000..3d610373 --- /dev/null +++ b/SDK/LIBS/dcinclude/os/abi/ta.h @@ -0,0 +1,60 @@ +/* KallistiOS 1.2.0 + + os/abi/ta.h + (c)2000-2001 Dan Potter + + $Id: ta.h,v 1.1 2003/02/27 03:46:31 bardtx Exp $ + +*/ + +#ifndef __OS_ABI_TA_H +#define __OS_ABI_TA_H + +#include +__BEGIN_DECLS + +#include + +#if 0 /* Broken for now */ + +#include + +typedef struct { + service_abi_t hdr; /* Header info */ + + /* KOS 0.7 */ + void (*hw_init)(); + void (*hw_shutdown)(); + void (*send_queue)(void *sql, int size); + void (*begin_render)(); + void (*commit_poly_hdr)(void *polyhdr); + void (*commit_vertex)(void *vertex, int size); + void (*commit_eol)(); + void (*finish_frame)(); + void (*poly_hdr_col)(poly_hdr_t *target, int translucent); + void (*poly_hdr_txr)(poly_hdr_t *target, int translucent, + int textureformat, int tw, int th, uint32 textureaddr, + int filtering); + + /* KOS 0.8 */ + void (*set_buffer_config)(uint32 listmask, + uint32 buffersize, uint32 vertsize); + void (*txr_release_all)(); + uint32 (*txr_allocate)(uint32 size); + void (*txr_load)(uint32 dest, void *src, int size); + void * (*txr_map)(uint32 loc); + + /* KOS 1.0 */ + void (*begin_texture)(uint32 txr, uint32 *rx, uint32 *ry); + uint32 padding0[32 - 16]; + + /* Warning: this is likely to change at any given time */ + ta_bkg_poly *bkg; +} abi_ta_t; + +#endif + +__END_DECLS + +#endif /* __OS_ABI_TA_H */ + diff --git a/SDK/LIBS/dcinclude/os/abi/thread.h b/SDK/LIBS/dcinclude/os/abi/thread.h new file mode 100644 index 00000000..2f26f9c7 --- /dev/null +++ b/SDK/LIBS/dcinclude/os/abi/thread.h @@ -0,0 +1,53 @@ +/* KallistiOS 1.2.0 + + os/abi/thread.h + (c)2000-2001 Dan Potter + + $Id: thread.h,v 1.1 2003/02/27 03:46:31 bardtx Exp $ + +*/ + +#ifndef __OS_ABI_THREAD_H +#define __OS_ABI_THREAD_H + +#include +__BEGIN_DECLS + +#include +#include + +typedef struct { + service_abi_t hdr; /* Header info */ + + kthread_t * (*create)(void (*routine)(void *param), void *param); + int (*destroy)(kthread_t *thd); + void (*exit)(); + void (*pass)(); + void (*sleep_jiffies)(int jif); + void (*sleep)(int ms); + uint32 (*jiffies)(); + /* void (*event_reset)(volatile thd_event_t *event); + void (*event_set)(volatile thd_event_t *event); + void (*event_wait)(volatile thd_event_t *event); + int (*set_prio)(tid_t tid, prio_t prio); + tid_t (*get_tid)(); + uint32 blank0[32-14]; + + sem_t (*sem_alloc)(int count); + int (*sem_free)(sem_t sem); + int (*sem_wait)(sem_t sem); + int (*sem_signal)(sem_t sem); + int (*sem_count)(sem_t sem); + uint32 blank1[8-5]; + + mbox_t (*mbox_alloc)(); + int (*mbox_free)(mbox_t mbox); + int (*mbox_post)(mbox_t mb, int len, void *data); + int (*mbox_fetch)(mbox_t mb, int *len, void **data); + int (*mbox_count)(mbox_t mb); */ +} abi_thread_t; + +__END_DECLS + +#endif /* __OS_ABI_THREAD_H */ + diff --git a/SDK/LIBS/dcinclude/os/abi/video.h b/SDK/LIBS/dcinclude/os/abi/video.h new file mode 100644 index 00000000..4436bc3d --- /dev/null +++ b/SDK/LIBS/dcinclude/os/abi/video.h @@ -0,0 +1,44 @@ +/* KallistiOS 1.2.0 + + os/abi/video.h + (c)2000-2001 Dan Potter + + $Id: video.h,v 1.1 2003/02/27 03:46:31 bardtx Exp $ + +*/ + +#ifndef __OS_ABI_VIDEO_H +#define __OS_ABI_VIDEO_H + +#include +__BEGIN_DECLS + +#include +#include +#include + +typedef struct { + service_abi_t hdr; /* Header info */ + + int (*check_cable)(); + void (*set_mode)(int ct, int vid_mode, int pixel_mode); + void (*set_start)(uint32 start); + void (*border_color)(int r, int g, int b); + void (*clear)(int r, int g, int b); + void (*empty)(); + void (*waitvbl)(); + uint32 padding0[16-7]; + + uint32 *vram_l; + uint16 *vram_s; + uint32 padding1[16-2]; + + void* (*bfont_find_char)(int ch); + void (*bfont_draw)(uint16 *buffer, int bufwidth, int opaque, int c); + void (*bfont_draw_str)(uint16 *buffer, int width, int opaque, char *str); +} abi_video_t; + +__END_DECLS + +#endif /* __OS_ABI_VIDEO_H */ + diff --git a/SDK/LIBS/dcinclude/os/elf.h b/SDK/LIBS/dcinclude/os/elf.h new file mode 100644 index 00000000..70e3f765 --- /dev/null +++ b/SDK/LIBS/dcinclude/os/elf.h @@ -0,0 +1,149 @@ +/* KallistiOS 1.2.0 + + os/elf.h + (c)2000-2001 Dan Potter + + $Id: elf.h,v 1.1 2003/02/27 03:46:31 bardtx Exp $ + +*/ + +#ifndef __OS_ELF_H +#define __OS_ELF_H + +#include +__BEGIN_DECLS + +#include +#include + +/* ELF file header */ +struct elf_hdr_t { + unsigned char ident[16]; /* For elf32-shl, 0x7f+"ELF"+1+1 */ + uint16 type; /* 0x02 for ET_EXEC */ + uint16 machine; /* 0x2a for elf32-shl */ + uint32 version; + uint32 entry; /* Entry point */ + uint32 phoff; /* Program header offset */ + uint32 shoff; /* Section header offset */ + uint32 flags; /* Processor flags */ + uint16 ehsize; /* ELF header size in bytes */ + uint16 phentsize; /* Program header entry size */ + uint16 phnum; /* Program header entry count */ + uint16 shentsize; /* Section header entry size */ + uint16 shnum; /* Section header entry count */ + uint16 shstrndx; /* String table section index */ +}; + +/* Section header types */ +#define SHT_NULL 0 /* Inactive */ +#define SHT_PROGBITS 1 /* Program code/data */ +#define SHT_SYMTAB 2 /* Full symbol table */ +#define SHT_STRTAB 3 /* String table */ +#define SHT_RELA 4 /* Relocation table */ +#define SHT_HASH 5 /* Sym tab hashtable */ +#define SHT_DYNAMIC 6 /* Dynamic linking info */ +#define SHT_NOTE 7 /* Notes */ +#define SHT_NOBITS 8 /* Occupies no space in the file */ +#define SHT_REL 9 /* Relocation table */ +#define SHT_SHLIB 10 /* Invalid.. hehe */ +#define SHT_DYNSYM 11 /* Dynamic-only sym tab */ +#define SHT_LOPROC 0x70000000 /* Processor specific */ +#define SHT_HIPROC 0x7fffffff +#define SHT_LOUSER 0x80000000 /* Program specific */ +#define SHT_HIUSER 0xffffffff + +/* Section header flags */ +#define SHF_WRITE 1 /* Writable data */ +#define SHF_ALLOC 2 /* Resident */ +#define SHF_EXECINSTR 4 /* Executable instructions */ +#define SHF_MASKPROC 0xf0000000 /* Processor specific */ + + +/* Section header */ +struct elf_shdr_t { + uint32 name; /* Index into string table */ + uint32 type; /* See constants above */ + uint32 flags; + uint32 addr; /* In-memory offset */ + uint32 offset; /* On-disk offset */ + uint32 size; /* Size (if SHT_NOBITS, zero file len */ + uint32 link; /* See below */ + uint32 info; /* See below */ + uint32 addralign; /* Alignment constraints */ + uint32 entsize; /* Fixed-size table entry sizes */ +}; +/* Link and info fields: + +switch (sh_type) { + case SHT_DYNAMIC: + link = section header index of the string table used by + the entries in this section + info = 0 + case SHT_HASH: + ilnk = section header index of the string table to which + this info applies + info = 0 + case SHT_REL, SHT_RELA: + link = section header index of associated symbol table + info = section header index of section to which reloc applies + case SHT_SYMTAB, SHT_DYNSYM: + link = section header index of associated string table + info = one greater than the symbol table index of the last + local symbol (binding STB_LOCAL) +} + +*/ + +/* Symbol table entry */ +#define STN_UNDEF 0 +#define STT_NOTYPE 0 +#define STT_OBJECT 1 +#define STT_FUNC 2 +#define STT_SECTION 3 +#define STT_FILE 4 +struct elf_sym_t { + uint32 name; /* Index into stringtab */ + uint32 value; + uint32 size; + uint8 info; /* type == info & 0x0f */ + uint8 other; + uint16 shndx; /* Section index */ +}; + +/* Relocation-A Entries */ +#define R_SH_DIR32 1 +struct elf_rela_t { + uint32 offset; /* Offset within section */ + uint32 info; /* Symbol and type */ + int32 addend; /* "A" constant */ +}; +#define ELF32_R_SYM(i) ((i) >> 8) +#define ELF32_R_TYPE(i) ((uint8)(i)) + + +/* Kernel-specific definition of a loaded ELF binary */ +typedef struct elf_prog { + void *data; /* Data block containing the program */ + uint32 size; /* Memory image size */ + int argc; /* Arguments */ + char **argv; + int (*ko_main)(int argc, char **argv); /* Program entry point */ + int (*ko_notify)(uint32 event); /* Event notification */ + char fn[256]; /* Program filename */ + + LIST_ENTRY(elf_prog) pslist; +} elf_prog_t; + +/* For use only for debugging */ +extern LIST_HEAD(pslist, elf_prog) ps_list; + +/* Load an ELF binary and return the relevant data in an elf_prog_t structure. */ +elf_prog_t *elf_load(uint32 fd); + +/* Free a loaded ELF program */ +void elf_free(elf_prog_t *prog); + +__END_DECLS + +#endif /* __OS_ELF_H */ + diff --git a/SDK/LIBS/dcinclude/os/process.h b/SDK/LIBS/dcinclude/os/process.h new file mode 100644 index 00000000..74fc235c --- /dev/null +++ b/SDK/LIBS/dcinclude/os/process.h @@ -0,0 +1,77 @@ +/* KallistiOS 1.2.0 + + os/process.h + (c)2000-2001 Dan Potter + + $Id: process.h,v 1.1 2003/02/27 03:46:31 bardtx Exp $ + +*/ + +#ifndef __OS_PROCESS_H +#define __OS_PROCESS_H + +#include +__BEGIN_DECLS + +#include +#include + +/* Maximum size of a service name */ +#define MAX_SVC_LEN 64 + +/* All service ABIs should include one of these as their first member; + all "padding" array elements should _always_ be set to zero. */ +typedef struct { + uint32 version; /* Lower three bytes are Major.Minor.Micro */ + uint32 padding[16-1]; /* Future expansion */ +} service_abi_t; + +/* Macros for accessing/creating version codes */ +#define ABI_VER_MAJOR(v) ((v >> 16) & 0xff) +#define ABI_VER_MINOR(v) ((v >> 8) & 0xff) +#define ABI_VER_MICRO(v) ((v >> 0) & 0xff) +#define ABI_MAKE_VER(MAJOR, MINOR, MICRO) \ + ( (((MAJOR) & 0xff) << 16) \ + | (((MINOR) & 0xff) << 8) \ + | (((MICRO) & 0xff) << 0) ) + + +/* All these functions are located in process.c */ +extern void* (*ps_multiplexer)(const char *svc); + +/* Default multiplexer function */ +void* psm_default(const char *svc); + +/* Loads and relocates an ELF binary from a VFS file. */ +elf_prog_t *ps_load(const char *fn); + +/* Loads an ELF binary from a VFS file and execution of the current + thread pauses until the binary finishes. If it does not finish, + execution never returns. */ +int ps_load_and_exec(const char *fn, int argc, char **argv); + +/* Loads an ELF binary and execution of the program begins in a new + kernel thread. */ +kthread_t *ps_load_and_fork(const char *fn, int argc, char **argv); + +/* Sets a multiplexer function target (i.e., what programs will + receive for their ko_get_svc pointer) */ +int ps_set_multiplexer(void* (*func)(const char *)); + +/* Sets a kernel console function target (determines where kernel + output will go from a printf() call). Defaults to serial output. Set + to NULL to disable all kernel output. */ +void * ps_set_printk(void (*print)(const char *str)); + +/* Wrapper for printk: call this to send data to the console output + device (whatever that might be) */ +void ps_printk(const char *str); + +/* initialization and shutdown */ +int ps_init(); +int ps_shutdown(); + +__END_DECLS + +#endif /* __KALLISTI_PROCESS_H */ + diff --git a/SDK/LIBS/dcinclude/os/svcmpx.h b/SDK/LIBS/dcinclude/os/svcmpx.h new file mode 100644 index 00000000..e9a2a69c --- /dev/null +++ b/SDK/LIBS/dcinclude/os/svcmpx.h @@ -0,0 +1,34 @@ +/* KallistiOS 1.2.0 + + os/svcmpx.h + (c)2000-2001 Dan Potter + + $Id: svcmpx.h,v 1.1 2003/02/27 03:46:31 bardtx Exp $ + +*/ + +#ifndef __OS_SVCMPX_H +#define __OS_SVCMPX_H + +#include +__BEGIN_DECLS + +/* Gets a current handler */ +void *svcmpx_get_handler(const char *name); + +/* Adds a new service handler (replacing any previous handler) */ +int svcmpx_add_handler(const char *name, void *svc_struct); + +/* Removes the handler of the given name (if any) */ +int svcmpx_remove_handler(const char *name); + +/* Returns 1 if the svcmpx module is active */ +int svcmpx_enabled(); + +int svcmpx_init(); +void svcmpx_shutdown(); + +__END_DECLS + +#endif /* __OS_SVCMPX_H */ + diff --git a/SDK/LIBS/dcinclude/pcx/pcx.h b/SDK/LIBS/dcinclude/pcx/pcx.h new file mode 100644 index 00000000..9eff0f3b --- /dev/null +++ b/SDK/LIBS/dcinclude/pcx/pcx.h @@ -0,0 +1,31 @@ +/* KallistiOS 1.2.0 + + pcx.h + (c)2000-2002 Dan Potter + + $Id: pcx.h,v 1.1 2003/02/27 03:46:31 bardtx Exp $ + +*/ + +#ifndef __PCX_PCX_H +#define __PCX_PCX_H + +#include +__BEGIN_DECLS + +#include + +/* Loads a PCX file into a kos_img_t struct */ +int pcx_to_img(const char *fn, kos_img_t *rv); + +#ifdef _arch_dreamcast + /* Loads a PCX file into texture RAM, potentially twiddling it and/or + converting it to an alpha mask. */ + int pcx_load_texture(const char *fn, int twiddle, int alpha, + uint32 *txr, int *w, int *h); +#endif + +__END_DECLS + +#endif /* __PCX_H */ + diff --git a/SDK/LIBS/dcinclude/plx/color.h b/SDK/LIBS/dcinclude/plx/color.h new file mode 100644 index 00000000..b959fca8 --- /dev/null +++ b/SDK/LIBS/dcinclude/plx/color.h @@ -0,0 +1,3 @@ +/* Wrapper for Parallax color.h */ + +#include "../../addons/libparallax/include/color.h" diff --git a/SDK/LIBS/dcinclude/plx/context.h b/SDK/LIBS/dcinclude/plx/context.h new file mode 100644 index 00000000..71ff2830 --- /dev/null +++ b/SDK/LIBS/dcinclude/plx/context.h @@ -0,0 +1,3 @@ +/* Wrapper for Parallax context.h */ + +#include "../../addons/libparallax/include/context.h" diff --git a/SDK/LIBS/dcinclude/plx/dr.h b/SDK/LIBS/dcinclude/plx/dr.h new file mode 100644 index 00000000..d4845032 --- /dev/null +++ b/SDK/LIBS/dcinclude/plx/dr.h @@ -0,0 +1,3 @@ +/* Wrapper for Parallax dr.h */ + +#include "../../addons/libparallax/include/dr.h" diff --git a/SDK/LIBS/dcinclude/plx/font.h b/SDK/LIBS/dcinclude/plx/font.h new file mode 100644 index 00000000..9fb8656e --- /dev/null +++ b/SDK/LIBS/dcinclude/plx/font.h @@ -0,0 +1,3 @@ +/* Wrapper for Parallax font.h */ + +#include "../../addons/libparallax/include/font.h" diff --git a/SDK/LIBS/dcinclude/plx/list.h b/SDK/LIBS/dcinclude/plx/list.h new file mode 100644 index 00000000..9a6cf9b0 --- /dev/null +++ b/SDK/LIBS/dcinclude/plx/list.h @@ -0,0 +1,3 @@ +/* Wrapper for Parallax list.h */ + +#include "../../addons/libparallax/include/list.h" diff --git a/SDK/LIBS/dcinclude/plx/matrix.h b/SDK/LIBS/dcinclude/plx/matrix.h new file mode 100644 index 00000000..003f87f6 --- /dev/null +++ b/SDK/LIBS/dcinclude/plx/matrix.h @@ -0,0 +1,3 @@ +/* Wrapper for Parallax matrix.h */ + +#include "../../addons/libparallax/include/matrix.h" diff --git a/SDK/LIBS/dcinclude/plx/prim.h b/SDK/LIBS/dcinclude/plx/prim.h new file mode 100644 index 00000000..5dad8437 --- /dev/null +++ b/SDK/LIBS/dcinclude/plx/prim.h @@ -0,0 +1,3 @@ +/* Wrapper for Parallax prim.h */ + +#include "../../addons/libparallax/include/prim.h" diff --git a/SDK/LIBS/dcinclude/plx/sprite.h b/SDK/LIBS/dcinclude/plx/sprite.h new file mode 100644 index 00000000..8be5b9b0 --- /dev/null +++ b/SDK/LIBS/dcinclude/plx/sprite.h @@ -0,0 +1,3 @@ +/* Wrapper for Parallax sprite.h */ + +#include "../../addons/libparallax/include/sprite.h" diff --git a/SDK/LIBS/dcinclude/plx/texture.h b/SDK/LIBS/dcinclude/plx/texture.h new file mode 100644 index 00000000..98fa0580 --- /dev/null +++ b/SDK/LIBS/dcinclude/plx/texture.h @@ -0,0 +1,3 @@ +/* Wrapper for Parallax texture.h */ + +#include "../../addons/libparallax/include/texture.h" diff --git a/SDK/LIBS/dcinclude/png/png.h b/SDK/LIBS/dcinclude/png/png.h new file mode 100644 index 00000000..a02d579a --- /dev/null +++ b/SDK/LIBS/dcinclude/png/png.h @@ -0,0 +1,42 @@ +/* KallistiOS 1.2.0 + + png.h + (c)2002 Jeffrey McBeth + + $Id: png.h,v 1.1 2003/02/27 03:46:31 bardtx Exp $ +*/ + +#ifndef __PNG_PNG_H +#define __PNG_PNG_H + +#include +__BEGIN_DECLS + +#include + +/* PNG_MASK_ALPHA currently doesn't work, I don't know why */ +#define PNG_NO_ALPHA 0 +#define PNG_MASK_ALPHA 1 +#define PNG_FULL_ALPHA 2 + +#ifdef _arch_dreamcast + #include + + /* Load a PNG file, allocating a texture, and returning the size of the file */ + int png_load_texture(const char *filename, pvr_ptr_t *tex, uint32 alpha, uint32 *w, uint32 *h); + + /* Load a PNG file into a texture; returns 0 for success, -1 for failure. */ + int png_to_texture(const char * filename, pvr_ptr_t tex, uint32 alpha); +#endif + +/* Load a PNG to a KOS Platform Independent Image */ +int png_to_img(const char * filename, uint32 mask, kos_img_t *rv); + +/* Write out a PNG file */ +int png_write_data(const char *filename, uint8 *data, uint32 width, uint32 height); + +__END_DECLS + +#endif /* __PNG_PNG_H */ + + diff --git a/SDK/LIBS/dcinclude/stdio.h b/SDK/LIBS/dcinclude/stdio.h new file mode 100644 index 00000000..42e42638 --- /dev/null +++ b/SDK/LIBS/dcinclude/stdio.h @@ -0,0 +1,118 @@ +/* KallistiOS 1.2.0 + + stdio.h + (c)2000-2002 Dan Potter + + $Id: stdio.h,v 1.2 2002/03/15 06:45:42 bardtx Exp $ + +*/ + +#ifndef __STDIO_H +#define __STDIO_H + +#include +__BEGIN_DECLS + +#include +#include +#include + +/* ANSI style wrappers for some of the fileio functions */ + +/* BUFSIZ for ANSI compliance; note that we actually don't have any + sort of buffering */ +#ifndef BUFSIZ +#define BUFSIZ 1024 +#endif + +#ifndef EOF +#define EOF (-1) +#endif + +typedef struct _FILE_t FILE; +typedef off_t fpos_t; + +/* For ANSI compatability */ +#define stdin ( (FILE *)1 ) +#define stdout ( (FILE *)2 ) +#define stderr ( (FILE *)2 ) + +void clearerr(FILE *); +int fclose(FILE *); +FILE *fdopen(int, const char *); +int feof(FILE *); +int ferror(FILE *); +int fflush(FILE *); +int fgetc(FILE *); +int fgetpos(FILE *, fpos_t *); +char *fgets(char *, int, FILE *); +int fileno(FILE *); +FILE *fopen(const char *, const char *); +int fprintf(FILE *, const char *, ...); +int fputc(int, FILE *); +int fputs(const char *, FILE *); +size_t fread(void *, size_t, size_t, FILE *); +FILE *freopen(const char *, const char *, FILE *); +int fscanf(FILE *, const char *, ...); +int fseek(FILE *, long int, int); +int fseeko(FILE *, off_t, int); +int fsetpos(FILE *, const fpos_t *); +long int ftell(FILE *); +off_t ftello(FILE *); +size_t fwrite(const void *, size_t, size_t, FILE *); +int getc(FILE *); +int getchar(void); +char *gets(char *); +int getw(FILE *); +int pclose(FILE *); +void perror(const char *); +FILE *popen(const char *, const char *); +int printf(const char *, ...); +int putc(int, FILE *); +int putchar(int); +int puts(const char *); +int putw(int, FILE *); +int remove(const char *); +int rename(const char *, const char *); +void rewind(FILE *); +int scanf(const char *, ...); +void setbuf(FILE *, char *); +int setvbuf(FILE *, char *, int, size_t); +int snprintf(char *, size_t, const char *, ...); +int sprintf(char *, const char *, ...); +int sscanf(const char *, const char *, ...); +char *tempnam(const char *, const char *); +FILE *tmpfile(void); +char *tmpnam(char *); +int ungetc(int, FILE *); +int vfprintf(FILE *, const char *, va_list); +int vprintf(const char *, va_list); +int vsnprintf(char *, size_t, const char *, va_list); +int vsprintf(char *, const char *, va_list); + +/* To make porting programs a bit easier.. WARNING: only works on GCC */ +#define fprintf(BLAGH, ARGS...) printf(ARGS) + +/* Kernel debugging printf; all output sent to this is filtered through + a kernel log level check before actually being printed. This way, you + can set the level of debug info you want to see (or want your users + to see). */ +void dbglog(int level, const char *fmt, ...) __printflike(2, 3); + +/* Log levels for the above */ +#define DBG_DEAD 0 /* The system is dead */ +#define DBG_CRITICAL 1 /* A critical error message */ +#define DBG_ERROR 2 /* A normal error message */ +#define DBG_WARNING 3 /* Potential problem */ +#define DBG_NOTICE 4 /* Normal but significant */ +#define DBG_INFO 5 /* Informational messages */ +#define DBG_DEBUG 6 /* User debug messages */ +#define DBG_KDEBUG 7 /* Kernel debug messages */ + +/* Set debug level */ +void dbglog_set_level(int level); + +__END_DECLS + +#endif /* __STDIO_H */ + diff --git a/SDK/LIBS/dcinclude/stdlib.h b/SDK/LIBS/dcinclude/stdlib.h new file mode 100644 index 00000000..d08c35ac --- /dev/null +++ b/SDK/LIBS/dcinclude/stdlib.h @@ -0,0 +1,85 @@ +/* KallistiOS 1.2.0 + + stdlib.h + (c)2001-2002 Dan Potter + + $Id: stdlib.h,v 1.4 2002/09/05 07:51:03 bardtx Exp $ + +*/ + +#ifndef __STDLIB_H +#define __STDLIB_H + +#include +__BEGIN_DECLS + +#include + +/* To be compatible with newer ANSI C */ +#include + +/* To make future porting efforts simpler */ +#define __P(x) x + +#include +/* From BSD */ +/* #define offsetof(type, field) ((size_t)(&((type *)0)->field)) */ + +/* random number functions */ +#define RAND_MAX 0x7fffffff + +#define EXIT_FAILURE 1 /* Failing exit status. */ +#define EXIT_SUCCESS 0 /* Successful exit status. */ + +typedef struct +{ + int quot; /* quotient */ + int rem; /* remainder */ +} div_t; + +typedef struct +{ + long quot; /* quotient */ + long rem; /* remainder */ +} ldiv_t; + +void abort(void) __noreturn; +int abs(int); +int atexit(void (*)(void)); +double atof(const char *); +int atoi(const char *); +long atol(const char *); +void *bsearch(const void *, const void *, size_t, size_t, + int (*)(const void *, const void *)); +void *calloc(size_t, size_t); +div_t div(int, int); +void exit(int) __noreturn; +char *getenv(const char *); +long labs(long); +ldiv_t ldiv(long, long); +int mblen(const char *, size_t); +size_t mbstowcs(wchar_t *, const char *, size_t); +int mbtowc(wchar_t *, const char *, size_t); +char *mktemp(char *); +int mkstemp(char *); +int putenv(char *); +void qsort(void *, size_t, size_t, int (*)(const void *, + const void *)); +int rand(void); +int rand_r(unsigned int *); +long random(void); +int randnum(int limit); /* Not ANSI C */ +void *realloc(void *, size_t); +char *realpath(const char *, char *); +void srand(unsigned int); +double strtod(const char *, char **); +long strtol(const char *, char **, int); +unsigned long strtoul(const char *, char **, int); +int system(const char *); +size_t wcstombs(char *, const wchar_t *, size_t); +int wctomb(char *, wchar_t); + +__END_DECLS + +#endif /* __STDLIB_H */ + diff --git a/SDK/LIBS/dcinclude/string.h b/SDK/LIBS/dcinclude/string.h new file mode 100644 index 00000000..1df0b4a6 --- /dev/null +++ b/SDK/LIBS/dcinclude/string.h @@ -0,0 +1,64 @@ +/* KallistiOS 1.2.0 + + string.h + (c)2000 Dan Potter + + $Id: string.h,v 1.3 2002/07/27 00:52:08 bardtx Exp $ + +*/ + +#ifndef __STRING_H +#define __STRING_H + +#include +__BEGIN_DECLS + +#include + +void bcopy(const void * src, void * dest, size_t count); +void bzero(void *s, size_t n); +char * index(const char *p, int ch); +void * memchr(const void *s, uint8 c, size_t n); +int memcmp(const void * cs,const void * ct,size_t count); +void * memcpy(void * dest,const void *src,size_t count); +void * memmove(void * dest,const void *src,size_t count); +void * memset(void * s,int c,size_t count); +void * memscan(void * addr, int c, size_t size); +char * rindex(const char *p, int ch); +char * strcat(char * dest, const char * src); +char * strchr(const char * s, int c); +int strcmp(const char * cs,const char * ct); +int strcoll(const char *s1, const char *s2); +char * strcpy(char * dest,const char *src); +size_t strcspn(const char *s1, const char *s2); +char * strdup(const char * src); +char * strerror(int errnum); +int stricmp(const char *cs, const char *ct); +size_t strlen(const char * s); +char * strncat(char *dest, const char *src, size_t count); +char * strncpy(char * dest,const char *src, size_t count); +int strnicmp(const char *cs, const char *ct, int cnt); +int strncmp(const char * cs,const char * ct,size_t count); +size_t strnlen(const char * s, size_t count); +char * strpbrk(const char * cs,const char * ct); +char * strrchr(const char * s, int c); +char * strsep(char **stringp, const char *delim); +size_t strspn(const char *s, const char *accept); +char * strstr(const char * s1,const char * s2); +char * strtok(char * s,const char * ct); +size_t strxfrm(char *s1, const char *s2, size_t n); +long strtol(const char * nptr, char ** endptr, int base); +char * _strupr(char * string); + +void * memcpy4(void * dest,const void *src,size_t count); +void * memset4(void * s,unsigned long c,size_t count); +void * memcpy2(void * dest,const void *src,size_t count); +void * memset2(void * s,unsigned short c,size_t count); +int strncasecmp(const char *s1, const char *s2, int n); + + +__END_DECLS + +#endif /* __STRING_H */ + + diff --git a/SDK/LIBS/dcinclude/sys/cdefs.h b/SDK/LIBS/dcinclude/sys/cdefs.h new file mode 100644 index 00000000..9d6a632e --- /dev/null +++ b/SDK/LIBS/dcinclude/sys/cdefs.h @@ -0,0 +1,68 @@ +/* KallistiOS 1.2.0 + + sys/cdefs.h + (c)2002 Dan Potter + + $Id: cdefs.h,v 1.2 2002/10/26 08:01:34 bardtx Exp $ + + Based loosely around some stuff in BSD's sys/cdefs.h +*/ + +#ifndef __SYS_CDEFS_H +#define __SYS_CDEFS_H + +/* Check GCC version */ +#ifndef _arch_ps2 +# if __GNUC__ < 2 +# warning Your GCC is too old. This will probably not work right. +# endif + +# if __GNUC__ == 2 && __GNUC_MINOR__ < 97 +# warning Your GCC is too old. This will probably not work right. +# endif +#endif /* _arch_ps2 */ + +/* Special function/variable attributes */ +#define __noreturn __attribute__((__noreturn__)) +#define __pure __attribute__((__const__)) +#define __unused __attribute__((__unused__)) + +#define __dead2 __noreturn /* BSD compat */ +#define __pure2 __pure /* ditto */ + +/* Printf/Scanf-like declaration */ +#define __printflike(fmtarg, firstvararg) \ + __attribute__((__format__ (__printf__, fmtarg, firstvararg))) + +#define __scanflike(fmtarg, firstvararg) \ + __attribute__((__format__ (__printf__, fmtarg, firstvararg))) + +/* C++ compatability support */ +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS +# define __END_DECLS +#endif + +/* GCC macros for special cases */ +/* #if __GNUC__ == */ + +/* Optional CVS ID tags, without warnings */ +#if defined(__GNUC__) && defined(__ELF__) +# define __IDSTRING(name, string) __asm__(".ident\t\"" string "\"") +#else +# define __IDSTRING(name, string) static const char name[] __unused = string; +#endif + +#ifndef NO_CVS_ID +# define IDSTRING(name, s) __IDSTRING(name, s) +# define CVSID(s) __IDSTRING(cvsid, "KOS " s) +#else +# define IDSTRING(s) +#endif + +#endif /* __SYS_CDEFS_H */ + + diff --git a/SDK/LIBS/dcinclude/sys/iovec.h b/SDK/LIBS/dcinclude/sys/iovec.h new file mode 100644 index 00000000..abe053cf --- /dev/null +++ b/SDK/LIBS/dcinclude/sys/iovec.h @@ -0,0 +1,26 @@ +/* KallistiOS 1.2.0 + + sys/iovec.h + (c)2001 Dan Potter + + $Id: iovec.h,v 1.1 2002/02/09 06:15:42 bardtx Exp $ + +*/ + +#ifndef __SYS_IOVEC_H +#define __SYS_IOVEC_H + +#include +__BEGIN_DECLS + +#include + +typedef struct iovec { + char *iov_base; /* Base address */ + size_t iov_len; /* Length */ +} iovec_t; + +__END_DECLS + +#endif /* __SYS_IOVEC_H */ + diff --git a/SDK/LIBS/dcinclude/sys/queue.h b/SDK/LIBS/dcinclude/sys/queue.h new file mode 100644 index 00000000..4a40d35e --- /dev/null +++ b/SDK/LIBS/dcinclude/sys/queue.h @@ -0,0 +1,555 @@ +/* + * This module was ported from the FreeBSD 4.2 kernel by Dan Potter. Please + * see "README.BSD" in "docs" for more information. + * + * $Id: queue.h,v 1.1 2002/02/09 06:15:42 bardtx Exp $ + */ + +/* + * Copyright (c) 1991, 1993 + * The Regents of the University of California. 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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. + * + * @(#)queue.h 8.5 (Berkeley) 8/20/94 + * $FreeBSD: src/sys/sys/queue.h,v 1.32.2.2 2000/05/05 01:40:02 archie Exp $ + */ + +#ifndef __BSD_QUEUE_H +#define __BSD_QUEUE_H + +#include +__BEGIN_DECLS + +#ifndef _KERNEL +#define _KERNEL +#endif + +/* + * This file defines five types of data structures: singly-linked lists, + * singly-linked tail queues, lists, tail queues, and circular queues. + * + * A singly-linked list is headed by a single forward pointer. The elements + * are singly linked for minimum space and pointer manipulation overhead at + * the expense of O(n) removal for arbitrary elements. New elements can be + * added to the list after an existing element or at the head of the list. + * Elements being removed from the head of the list should use the explicit + * macro for this purpose for optimum efficiency. A singly-linked list may + * only be traversed in the forward direction. Singly-linked lists are ideal + * for applications with large datasets and few or no removals or for + * implementing a LIFO queue. + * + * A singly-linked tail queue is headed by a pair of pointers, one to the + * head of the list and the other to the tail of the list. The elements are + * singly linked for minimum space and pointer manipulation overhead at the + * expense of O(n) removal for arbitrary elements. New elements can be added + * to the list after an existing element, at the head of the list, or at the + * end of the list. Elements being removed from the head of the tail queue + * should use the explicit macro for this purpose for optimum efficiency. + * A singly-linked tail queue may only be traversed in the forward direction. + * Singly-linked tail queues are ideal for applications with large datasets + * and few or no removals or for implementing a FIFO queue. + * + * A list is headed by a single forward pointer (or an array of forward + * pointers for a hash table header). The elements are doubly linked + * so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before + * or after an existing element or at the head of the list. A list + * may only be traversed in the forward direction. + * + * A tail queue is headed by a pair of pointers, one to the head of the + * list and the other to the tail of the list. The elements are doubly + * linked so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before or + * after an existing element, at the head of the list, or at the end of + * the list. A tail queue may be traversed in either direction. + * + * A circle queue is headed by a pair of pointers, one to the head of the + * list and the other to the tail of the list. The elements are doubly + * linked so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before or after + * an existing element, at the head of the list, or at the end of the list. + * A circle queue may be traversed in either direction, but has a more + * complex end of list detection. + * + * For details on the use of these macros, see the queue(3) manual page. + * + * + * SLIST LIST STAILQ TAILQ CIRCLEQ + * _HEAD + + + + + + * _ENTRY + + + + + + * _INIT + + + + + + * _EMPTY + + + + + + * _FIRST + + + + + + * _NEXT + + + + + + * _PREV - - - + + + * _LAST - - + + + + * _FOREACH + + + + + + * _FOREACH_REVERSE - - - + + + * _INSERT_HEAD + + + + + + * _INSERT_BEFORE - + - + + + * _INSERT_AFTER + + + + + + * _INSERT_TAIL - - + + + + * _REMOVE_HEAD + - + - - + * _REMOVE + + + + + + * + */ + +/* + * Singly-linked List definitions. + */ +#define SLIST_HEAD(name, type) \ +struct name { \ + struct type *slh_first; /* first element */ \ +} + +#define SLIST_HEAD_INITIALIZER(head) \ + { NULL } + +#define SLIST_ENTRY(type) \ +struct { \ + struct type *sle_next; /* next element */ \ +} + +/* + * Singly-linked List functions. + */ +#define SLIST_EMPTY(head) ((head)->slh_first == NULL) + +#define SLIST_FIRST(head) ((head)->slh_first) + +#define SLIST_FOREACH(var, head, field) \ + for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next) + +#define SLIST_INIT(head) { \ + (head)->slh_first = NULL; \ +} + +#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ + (elm)->field.sle_next = (slistelm)->field.sle_next; \ + (slistelm)->field.sle_next = (elm); \ +} while (0) + +#define SLIST_INSERT_HEAD(head, elm, field) do { \ + (elm)->field.sle_next = (head)->slh_first; \ + (head)->slh_first = (elm); \ +} while (0) + +#define SLIST_NEXT(elm, field) ((elm)->field.sle_next) + +#define SLIST_REMOVE_HEAD(head, field) do { \ + (head)->slh_first = (head)->slh_first->field.sle_next; \ +} while (0) + +#define SLIST_REMOVE(head, elm, type, field) do { \ + if ((head)->slh_first == (elm)) { \ + SLIST_REMOVE_HEAD((head), field); \ + } \ + else { \ + struct type *curelm = (head)->slh_first; \ + while( curelm->field.sle_next != (elm) ) \ + curelm = curelm->field.sle_next; \ + curelm->field.sle_next = \ + curelm->field.sle_next->field.sle_next; \ + } \ +} while (0) + +/* + * Singly-linked Tail queue definitions. + */ +#define STAILQ_HEAD(name, type) \ +struct name { \ + struct type *stqh_first;/* first element */ \ + struct type **stqh_last;/* addr of last next element */ \ +} + +#define STAILQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).stqh_first } + +#define STAILQ_ENTRY(type) \ +struct { \ + struct type *stqe_next; /* next element */ \ +} + +/* + * Singly-linked Tail queue functions. + */ +#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL) + +#define STAILQ_INIT(head) do { \ + (head)->stqh_first = NULL; \ + (head)->stqh_last = &(head)->stqh_first; \ +} while (0) + +#define STAILQ_FIRST(head) ((head)->stqh_first) +#define STAILQ_LAST(head) (*(head)->stqh_last) + +#define STAILQ_FOREACH(var, head, field) \ + for((var) = (head)->stqh_first; (var); (var) = (var)->field.stqe_next) + +#define STAILQ_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.stqe_next = (head)->stqh_first) == NULL) \ + (head)->stqh_last = &(elm)->field.stqe_next; \ + (head)->stqh_first = (elm); \ +} while (0) + +#define STAILQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.stqe_next = NULL; \ + *(head)->stqh_last = (elm); \ + (head)->stqh_last = &(elm)->field.stqe_next; \ +} while (0) + +#define STAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \ + if (((elm)->field.stqe_next = (tqelm)->field.stqe_next) == NULL)\ + (head)->stqh_last = &(elm)->field.stqe_next; \ + (tqelm)->field.stqe_next = (elm); \ +} while (0) + +#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) + +#define STAILQ_REMOVE_HEAD(head, field) do { \ + if (((head)->stqh_first = \ + (head)->stqh_first->field.stqe_next) == NULL) \ + (head)->stqh_last = &(head)->stqh_first; \ +} while (0) + +#define STAILQ_REMOVE_HEAD_UNTIL(head, elm, field) do { \ + if (((head)->stqh_first = (elm)->field.stqe_next) == NULL) \ + (head)->stqh_last = &(head)->stqh_first; \ +} while (0) + +#define STAILQ_REMOVE(head, elm, type, field) do { \ + if ((head)->stqh_first == (elm)) { \ + STAILQ_REMOVE_HEAD(head, field); \ + } \ + else { \ + struct type *curelm = (head)->stqh_first; \ + while( curelm->field.stqe_next != (elm) ) \ + curelm = curelm->field.stqe_next; \ + if((curelm->field.stqe_next = \ + curelm->field.stqe_next->field.stqe_next) == NULL) \ + (head)->stqh_last = &(curelm)->field.stqe_next; \ + } \ +} while (0) + +/* + * List definitions. + */ +#define LIST_HEAD(name, type) \ +struct name { \ + struct type *lh_first; /* first element */ \ +} + +#define LIST_HEAD_INITIALIZER(head) \ + { NULL } + +#define LIST_ENTRY(type) \ +struct { \ + struct type *le_next; /* next element */ \ + struct type **le_prev; /* address of previous next element */ \ +} + +/* + * List functions. + */ + +#define LIST_EMPTY(head) ((head)->lh_first == NULL) + +#define LIST_FIRST(head) ((head)->lh_first) + +#define LIST_FOREACH(var, head, field) \ + for((var) = (head)->lh_first; (var); (var) = (var)->field.le_next) + +#define LIST_INIT(head) do { \ + (head)->lh_first = NULL; \ +} while (0) + +#define LIST_INSERT_AFTER(listelm, elm, field) do { \ + if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \ + (listelm)->field.le_next->field.le_prev = \ + &(elm)->field.le_next; \ + (listelm)->field.le_next = (elm); \ + (elm)->field.le_prev = &(listelm)->field.le_next; \ +} while (0) + +#define LIST_INSERT_BEFORE(listelm, elm, field) do { \ + (elm)->field.le_prev = (listelm)->field.le_prev; \ + (elm)->field.le_next = (listelm); \ + *(listelm)->field.le_prev = (elm); \ + (listelm)->field.le_prev = &(elm)->field.le_next; \ +} while (0) + +#define LIST_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.le_next = (head)->lh_first) != NULL) \ + (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ + (head)->lh_first = (elm); \ + (elm)->field.le_prev = &(head)->lh_first; \ +} while (0) + +#define LIST_NEXT(elm, field) ((elm)->field.le_next) + +#define LIST_REMOVE(elm, field) do { \ + if ((elm)->field.le_next != NULL) \ + (elm)->field.le_next->field.le_prev = \ + (elm)->field.le_prev; \ + *(elm)->field.le_prev = (elm)->field.le_next; \ +} while (0) + +/* + * Tail queue definitions. + */ +#define TAILQ_HEAD(name, type) \ +struct name { \ + struct type *tqh_first; /* first element */ \ + struct type **tqh_last; /* addr of last next element */ \ +} + +#define TAILQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).tqh_first } + +#define TAILQ_ENTRY(type) \ +struct { \ + struct type *tqe_next; /* next element */ \ + struct type **tqe_prev; /* address of previous next element */ \ +} + +/* + * Tail queue functions. + */ +#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) + +#define TAILQ_FOREACH(var, head, field) \ + for (var = TAILQ_FIRST(head); var; var = TAILQ_NEXT(var, field)) + +#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ + for ((var) = TAILQ_LAST((head), headname); \ + (var); \ + (var) = TAILQ_PREV((var), headname, field)) + +#define TAILQ_FIRST(head) ((head)->tqh_first) + +#define TAILQ_LAST(head, headname) \ + (*(((struct headname *)((head)->tqh_last))->tqh_last)) + +#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) + +#define TAILQ_PREV(elm, headname, field) \ + (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) + +#define TAILQ_INIT(head) do { \ + (head)->tqh_first = NULL; \ + (head)->tqh_last = &(head)->tqh_first; \ +} while (0) + +#define TAILQ_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ + (head)->tqh_first->field.tqe_prev = \ + &(elm)->field.tqe_next; \ + else \ + (head)->tqh_last = &(elm)->field.tqe_next; \ + (head)->tqh_first = (elm); \ + (elm)->field.tqe_prev = &(head)->tqh_first; \ +} while (0) + +#define TAILQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.tqe_next = NULL; \ + (elm)->field.tqe_prev = (head)->tqh_last; \ + *(head)->tqh_last = (elm); \ + (head)->tqh_last = &(elm)->field.tqe_next; \ +} while (0) + +#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ + if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ + (elm)->field.tqe_next->field.tqe_prev = \ + &(elm)->field.tqe_next; \ + else \ + (head)->tqh_last = &(elm)->field.tqe_next; \ + (listelm)->field.tqe_next = (elm); \ + (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ +} while (0) + +#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ + (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ + (elm)->field.tqe_next = (listelm); \ + *(listelm)->field.tqe_prev = (elm); \ + (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ +} while (0) + +#define TAILQ_REMOVE(head, elm, field) do { \ + if (((elm)->field.tqe_next) != NULL) \ + (elm)->field.tqe_next->field.tqe_prev = \ + (elm)->field.tqe_prev; \ + else \ + (head)->tqh_last = (elm)->field.tqe_prev; \ + *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ +} while (0) + +/* + * Circular queue definitions. + */ +#define CIRCLEQ_HEAD(name, type) \ +struct name { \ + struct type *cqh_first; /* first element */ \ + struct type *cqh_last; /* last element */ \ +} + +#define CIRCLEQ_ENTRY(type) \ +struct { \ + struct type *cqe_next; /* next element */ \ + struct type *cqe_prev; /* previous element */ \ +} + +/* + * Circular queue functions. + */ +#define CIRCLEQ_EMPTY(head) ((head)->cqh_first == (void *)(head)) + +#define CIRCLEQ_FIRST(head) ((head)->cqh_first) + +#define CIRCLEQ_FOREACH(var, head, field) \ + for((var) = (head)->cqh_first; \ + (var) != (void *)(head); \ + (var) = (var)->field.cqe_next) + +#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \ + for((var) = (head)->cqh_last; \ + (var) != (void *)(head); \ + (var) = (var)->field.cqe_prev) + +#define CIRCLEQ_INIT(head) do { \ + (head)->cqh_first = (void *)(head); \ + (head)->cqh_last = (void *)(head); \ +} while (0) + +#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ + (elm)->field.cqe_next = (listelm)->field.cqe_next; \ + (elm)->field.cqe_prev = (listelm); \ + if ((listelm)->field.cqe_next == (void *)(head)) \ + (head)->cqh_last = (elm); \ + else \ + (listelm)->field.cqe_next->field.cqe_prev = (elm); \ + (listelm)->field.cqe_next = (elm); \ +} while (0) + +#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ + (elm)->field.cqe_next = (listelm); \ + (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \ + if ((listelm)->field.cqe_prev == (void *)(head)) \ + (head)->cqh_first = (elm); \ + else \ + (listelm)->field.cqe_prev->field.cqe_next = (elm); \ + (listelm)->field.cqe_prev = (elm); \ +} while (0) + +#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ + (elm)->field.cqe_next = (head)->cqh_first; \ + (elm)->field.cqe_prev = (void *)(head); \ + if ((head)->cqh_last == (void *)(head)) \ + (head)->cqh_last = (elm); \ + else \ + (head)->cqh_first->field.cqe_prev = (elm); \ + (head)->cqh_first = (elm); \ +} while (0) + +#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.cqe_next = (void *)(head); \ + (elm)->field.cqe_prev = (head)->cqh_last; \ + if ((head)->cqh_first == (void *)(head)) \ + (head)->cqh_first = (elm); \ + else \ + (head)->cqh_last->field.cqe_next = (elm); \ + (head)->cqh_last = (elm); \ +} while (0) + +#define CIRCLEQ_LAST(head) ((head)->cqh_last) + +#define CIRCLEQ_NEXT(elm,field) ((elm)->field.cqe_next) + +#define CIRCLEQ_PREV(elm,field) ((elm)->field.cqe_prev) + +#define CIRCLEQ_REMOVE(head, elm, field) do { \ + if ((elm)->field.cqe_next == (void *)(head)) \ + (head)->cqh_last = (elm)->field.cqe_prev; \ + else \ + (elm)->field.cqe_next->field.cqe_prev = \ + (elm)->field.cqe_prev; \ + if ((elm)->field.cqe_prev == (void *)(head)) \ + (head)->cqh_first = (elm)->field.cqe_next; \ + else \ + (elm)->field.cqe_prev->field.cqe_next = \ + (elm)->field.cqe_next; \ +} while (0) + +#ifdef _KERNEL + +/* + * XXX insque() and remque() are an old way of handling certain queues. + * They bogusly assumes that all queue heads look alike. + */ + +struct quehead { + struct quehead *qh_link; + struct quehead *qh_rlink; +}; + +#ifdef __GNUC__ + +static __inline void +insque(void *a, void *b) +{ + struct quehead *element = (struct quehead*)a, *head = (struct quehead*)b; + + element->qh_link = head->qh_link; + element->qh_rlink = head; + head->qh_link = element; + element->qh_link->qh_rlink = element; +} + +static __inline void +remque(void *a) +{ + struct quehead *element = (struct quehead *)a; + + element->qh_link->qh_rlink = element->qh_rlink; + element->qh_rlink->qh_link = element->qh_link; + element->qh_rlink = 0; +} + +#else /* !__GNUC__ */ + +void insque __P((void *a, void *b)); +void remque __P((void *a)); + +#endif /* __GNUC__ */ + +#endif /* _KERNEL */ + +__END_DECLS + +#endif /* !__BSD_QUEUE_H */ diff --git a/SDK/LIBS/dcinclude/sys/types.h b/SDK/LIBS/dcinclude/sys/types.h new file mode 100644 index 00000000..d22634fa --- /dev/null +++ b/SDK/LIBS/dcinclude/sys/types.h @@ -0,0 +1,21 @@ +/* KallistiOS 1.2.0 + + sys/types.h + (c)2002 Dan Potter + + $Id: types.h,v 1.1 2002/04/20 22:08:43 bardtx Exp $ + +*/ + +#ifndef __SYS_TYPES_H +#define __SYS_TYPES_H + +#include +__BEGIN_DECLS + +#include + +__END_DECLS + +#endif /* __SYS_TYPES_H */ + diff --git a/SDK/LIBS/dcinclude/tga/tga.h b/SDK/LIBS/dcinclude/tga/tga.h new file mode 100644 index 00000000..31ffba15 --- /dev/null +++ b/SDK/LIBS/dcinclude/tga/tga.h @@ -0,0 +1,31 @@ +/* KallistiOS ##version + + tga.h + (c)2000-2001 Benoit Miller + + $Id: tga.h,v 1.1 2003/02/27 03:46:32 bardtx Exp $ + +*/ + +#ifndef __TGA_TGA_H +#define __TGA_TGA_H + +#include +__BEGIN_DECLS + +#include + +/* Loads a TGA file into a kos_img_t struct */ +int tga_to_img(const char *fn, kos_img_t *rv); + +#ifdef _arch_dreamcast + /* Loads a TGA file into texture RAM, potentially twiddling it. + TGA files include an alpha channel. */ + int tga_load_texture(const char *fn, int twiddle, uint32 *txr, + int *w, int *h); +#endif + +__END_DECLS + +#endif /* __TGA_TGA_H */ + diff --git a/SDK/LIBS/dcinclude/time.h b/SDK/LIBS/dcinclude/time.h new file mode 100644 index 00000000..8f5e1435 --- /dev/null +++ b/SDK/LIBS/dcinclude/time.h @@ -0,0 +1,67 @@ +/* KallistiOS 1.2.0 + + time.h + (c)2000 Dan Potter + + $Id: time.h,v 1.3 2002/03/15 06:45:42 bardtx Exp $ + +*/ + +#ifndef __TIME_H +#define __TIME_H + +#include +__BEGIN_DECLS + +#include + +typedef uint32 time_t; +typedef uint32 clock_t; + +/* POSIX states that CLOCKS_PER_SEC must be 1000000 */ +#ifndef CLOCKS_PER_SEC +# define CLOCKS_PER_SEC 1000000 +#endif + +time_t time(time_t *t); +clock_t clock(void); +double difftime(time_t time1, time_t time0); + +/* Time value */ +struct timeval { + long tv_sec; /* Seconds */ + long tv_usec; /* Microseconds */ +}; + +/* We don't support time zones, but put it here for compatability */ +struct timezone { + int tz_minuteswest; + int tz_dsttime; +}; + +/* Return the number of seconds and microseconds since 1970 */ +int gettimeofday(struct timeval *tv, struct timezone *tz); + +/* Time struct */ +struct tm { + int tm_sec; /* seconds */ + int tm_min; /* minutes */ + int tm_hour; /* hours */ + int tm_mday; /* day of the month */ + int tm_mon; /* month (0 - 11) */ + int tm_year; /* year */ + int tm_wday; /* day of the week */ + int tm_yday; /* day of the year */ + int tm_isdst; /* daylight savings time */ +}; + +/* Convert a struct tm into a time_t */ +time_t mktime(struct tm *timeptr); + +/* Convert a time_t into a struct tm (thread-safe) */ +struct tm *localtime_r(const time_t *timep, struct tm * dst); + +__END_DECLS + +#endif /* __TIME_H */ + diff --git a/SDK/LIBS/dcinclude/tsu/animation.h b/SDK/LIBS/dcinclude/tsu/animation.h new file mode 100644 index 00000000..27bba45b --- /dev/null +++ b/SDK/LIBS/dcinclude/tsu/animation.h @@ -0,0 +1,3 @@ +/* Wrapper for Tsunami animation.h */ + +#include "../../addons/libtsunami/include/animation.h" diff --git a/SDK/LIBS/dcinclude/tsu/anims/alphafader.h b/SDK/LIBS/dcinclude/tsu/anims/alphafader.h new file mode 100644 index 00000000..03a1aebd --- /dev/null +++ b/SDK/LIBS/dcinclude/tsu/anims/alphafader.h @@ -0,0 +1,3 @@ +/* Wrapper for Tsunami anims/alphafader.h */ + +#include "../../addons/libtsunami/include/anims/alphafader.h" diff --git a/SDK/LIBS/dcinclude/tsu/anims/expxymover.h b/SDK/LIBS/dcinclude/tsu/anims/expxymover.h new file mode 100644 index 00000000..a0164faa --- /dev/null +++ b/SDK/LIBS/dcinclude/tsu/anims/expxymover.h @@ -0,0 +1,3 @@ +/* Wrapper for Tsunami anims/expxymover.h */ + +#include "../../addons/libtsunami/include/anims/expxymover.h" diff --git a/SDK/LIBS/dcinclude/tsu/anims/logxymover.h b/SDK/LIBS/dcinclude/tsu/anims/logxymover.h new file mode 100644 index 00000000..ec1212d1 --- /dev/null +++ b/SDK/LIBS/dcinclude/tsu/anims/logxymover.h @@ -0,0 +1,3 @@ +/* Wrapper for Tsunami anims/logxymover.h */ + +#include "../../addons/libtsunami/include/anims/logxymover.h" diff --git a/SDK/LIBS/dcinclude/tsu/anims/tintfader.h b/SDK/LIBS/dcinclude/tsu/anims/tintfader.h new file mode 100644 index 00000000..ff89ed16 --- /dev/null +++ b/SDK/LIBS/dcinclude/tsu/anims/tintfader.h @@ -0,0 +1,3 @@ +/* Wrapper for Tsunami anims/tintfader.h */ + +#include "../../addons/libtsunami/include/anims/tintfader.h" diff --git a/SDK/LIBS/dcinclude/tsu/color.h b/SDK/LIBS/dcinclude/tsu/color.h new file mode 100644 index 00000000..b25842b6 --- /dev/null +++ b/SDK/LIBS/dcinclude/tsu/color.h @@ -0,0 +1,3 @@ +/* Wrapper for Tsunami color.h */ + +#include "../../addons/libtsunami/include/color.h" diff --git a/SDK/LIBS/dcinclude/tsu/drawable.h b/SDK/LIBS/dcinclude/tsu/drawable.h new file mode 100644 index 00000000..dbdc4761 --- /dev/null +++ b/SDK/LIBS/dcinclude/tsu/drawable.h @@ -0,0 +1,3 @@ +/* Wrapper for Tsunami drawable.h */ + +#include "../../addons/libtsunami/include/drawable.h" diff --git a/SDK/LIBS/dcinclude/tsu/drawables/banner.h b/SDK/LIBS/dcinclude/tsu/drawables/banner.h new file mode 100644 index 00000000..bf55a790 --- /dev/null +++ b/SDK/LIBS/dcinclude/tsu/drawables/banner.h @@ -0,0 +1,3 @@ +/* Wrapper for Tsunami drawables/banner.h */ + +#include "../../addons/libtsunami/include/drawables/banner.h" diff --git a/SDK/LIBS/dcinclude/tsu/drawables/label.h b/SDK/LIBS/dcinclude/tsu/drawables/label.h new file mode 100644 index 00000000..773410e2 --- /dev/null +++ b/SDK/LIBS/dcinclude/tsu/drawables/label.h @@ -0,0 +1,3 @@ +/* Wrapper for Tsunami drawables/label.h */ + +#include "../../addons/libtsunami/include/drawables/label.h" diff --git a/SDK/LIBS/dcinclude/tsu/drawables/scene.h b/SDK/LIBS/dcinclude/tsu/drawables/scene.h new file mode 100644 index 00000000..df8e7353 --- /dev/null +++ b/SDK/LIBS/dcinclude/tsu/drawables/scene.h @@ -0,0 +1,3 @@ +/* Wrapper for Tsunami drawables/scene.h */ + +#include "../../addons/libtsunami/include/drawables/scene.h" diff --git a/SDK/LIBS/dcinclude/tsu/font.h b/SDK/LIBS/dcinclude/tsu/font.h new file mode 100644 index 00000000..40966c7a --- /dev/null +++ b/SDK/LIBS/dcinclude/tsu/font.h @@ -0,0 +1,3 @@ +/* Wrapper for Tsunami font.h */ + +#include "../../addons/libtsunami/include/font.h" diff --git a/SDK/LIBS/dcinclude/tsu/refcnt.h b/SDK/LIBS/dcinclude/tsu/refcnt.h new file mode 100644 index 00000000..0e97ca73 --- /dev/null +++ b/SDK/LIBS/dcinclude/tsu/refcnt.h @@ -0,0 +1,3 @@ +/* Wrapper for Tsunami refcnt.h */ + +#include "../../addons/libtsunami/include/refcnt.h" diff --git a/SDK/LIBS/dcinclude/tsu/sound.h b/SDK/LIBS/dcinclude/tsu/sound.h new file mode 100644 index 00000000..05995d31 --- /dev/null +++ b/SDK/LIBS/dcinclude/tsu/sound.h @@ -0,0 +1,3 @@ +/* Wrapper for Tsunami sound.h */ + +#include "../../addons/libtsunami/include/sound.h" diff --git a/SDK/LIBS/dcinclude/tsu/texture.h b/SDK/LIBS/dcinclude/tsu/texture.h new file mode 100644 index 00000000..52830397 --- /dev/null +++ b/SDK/LIBS/dcinclude/tsu/texture.h @@ -0,0 +1,3 @@ +/* Wrapper for Tsunami texture.h */ + +#include "../../addons/libtsunami/include/texture.h" diff --git a/SDK/LIBS/dcinclude/tsu/trigger.h b/SDK/LIBS/dcinclude/tsu/trigger.h new file mode 100644 index 00000000..b156c36f --- /dev/null +++ b/SDK/LIBS/dcinclude/tsu/trigger.h @@ -0,0 +1,3 @@ +/* Wrapper for Tsunami trigger.h */ + +#include "../../addons/libtsunami/include/trigger.h" diff --git a/SDK/LIBS/dcinclude/tsu/triggers/chainanim.h b/SDK/LIBS/dcinclude/tsu/triggers/chainanim.h new file mode 100644 index 00000000..61028c36 --- /dev/null +++ b/SDK/LIBS/dcinclude/tsu/triggers/chainanim.h @@ -0,0 +1,3 @@ +/* Wrapper for Tsunami chainanim.h */ + +#include "../../addons/libtsunami/include/triggers/chainanim.h" diff --git a/SDK/LIBS/dcinclude/tsu/triggers/death.h b/SDK/LIBS/dcinclude/tsu/triggers/death.h new file mode 100644 index 00000000..2103ce4b --- /dev/null +++ b/SDK/LIBS/dcinclude/tsu/triggers/death.h @@ -0,0 +1,3 @@ +/* Wrapper for Tsunami death.h */ + +#include "../../addons/libtsunami/include/triggers/death.h" diff --git a/SDK/LIBS/dcinclude/tsu/vector.h b/SDK/LIBS/dcinclude/tsu/vector.h new file mode 100644 index 00000000..e39aee7a --- /dev/null +++ b/SDK/LIBS/dcinclude/tsu/vector.h @@ -0,0 +1,3 @@ +/* Wrapper for Tsunami vector.h */ + +#include "../../addons/libtsunami/include/vector.h" diff --git a/SDK/LIBS/dcinclude/unistd.h b/SDK/LIBS/dcinclude/unistd.h new file mode 100644 index 00000000..0f6e4449 --- /dev/null +++ b/SDK/LIBS/dcinclude/unistd.h @@ -0,0 +1,27 @@ +/* KallistiOS 1.2.0 + + unistd.h + (c)2000-2001 Dan Potter + + $Id: unistd.h,v 1.1 2002/02/09 06:15:42 bardtx Exp $ + +*/ + +#ifndef __UNISTD_H +#define __UNISTD_H + +#include +__BEGIN_DECLS + +#include +#include + +#define true (1) +#define false (0) + +void usleep(unsigned long usec); + +__END_DECLS + +#endif /* __UNISTD_H */ + diff --git a/SDK/LIBS/dcinclude/vorbis/codec.h b/SDK/LIBS/dcinclude/vorbis/codec.h new file mode 100644 index 00000000..7b844a14 --- /dev/null +++ b/SDK/LIBS/dcinclude/vorbis/codec.h @@ -0,0 +1,233 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + + ******************************************************************** + + function: libvorbis codec headers + last mod: $Id: codec.h,v 1.1 2003/02/27 03:46:32 bardtx Exp $ + + ********************************************************************/ + +#ifndef _vorbis_codec_h_ +#define _vorbis_codec_h_ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#include + +typedef struct vorbis_info{ + int version; + int channels; + long rate; + + /* The below bitrate declarations are *hints*. + Combinations of the three values carry the following implications: + + all three set to the same value: + implies a fixed rate bitstream + only nominal set: + implies a VBR stream that averages the nominal bitrate. No hard + upper/lower limit + upper and or lower set: + implies a VBR bitstream that obeys the bitrate limits. nominal + may also be set to give a nominal rate. + none set: + the coder does not care to speculate. + */ + + long bitrate_upper; + long bitrate_nominal; + long bitrate_lower; + long bitrate_window; + + void *codec_setup; +} vorbis_info; + +/* vorbis_dsp_state buffers the current vorbis audio + analysis/synthesis state. The DSP state belongs to a specific + logical bitstream ****************************************************/ +typedef struct vorbis_dsp_state{ + int analysisp; + vorbis_info *vi; + + float **pcm; + float **pcmret; + int pcm_storage; + int pcm_current; + int pcm_returned; + + int preextrapolate; + int eofflag; + + long lW; + long W; + long nW; + long centerW; + + ogg_int64_t granulepos; + ogg_int64_t sequence; + + ogg_int64_t glue_bits; + ogg_int64_t time_bits; + ogg_int64_t floor_bits; + ogg_int64_t res_bits; + + void *backend_state; +} vorbis_dsp_state; + +typedef struct vorbis_block{ + /* necessary stream state for linking to the framing abstraction */ + float **pcm; /* this is a pointer into local storage */ + oggpack_buffer opb; + + long lW; + long W; + long nW; + int pcmend; + int mode; + + int eofflag; + ogg_int64_t granulepos; + ogg_int64_t sequence; + vorbis_dsp_state *vd; /* For read-only access of configuration */ + + /* local storage to avoid remallocing; it's up to the mapping to + structure it */ + void *localstore; + long localtop; + long localalloc; + long totaluse; + struct alloc_chain *reap; + + /* bitmetrics for the frame */ + long glue_bits; + long time_bits; + long floor_bits; + long res_bits; + + void *internal; + +} vorbis_block; + +/* vorbis_block is a single block of data to be processed as part of +the analysis/synthesis stream; it belongs to a specific logical +bitstream, but is independant from other vorbis_blocks belonging to +that logical bitstream. *************************************************/ + +struct alloc_chain{ + void *ptr; + struct alloc_chain *next; +}; + +/* vorbis_info contains all the setup information specific to the + specific compression/decompression mode in progress (eg, + psychoacoustic settings, channel setup, options, codebook + etc). vorbis_info and substructures are in backends.h. +*********************************************************************/ + +/* the comments are not part of vorbis_info so that vorbis_info can be + static storage */ +typedef struct vorbis_comment{ + /* unlimited user comment fields. libvorbis writes 'libvorbis' + whatever vendor is set to in encode */ + char **user_comments; + int *comment_lengths; + int comments; + char *vendor; + +} vorbis_comment; + + +/* libvorbis encodes in two abstraction layers; first we perform DSP + and produce a packet (see docs/analysis.txt). The packet is then + coded into a framed OggSquish bitstream by the second layer (see + docs/framing.txt). Decode is the reverse process; we sync/frame + the bitstream and extract individual packets, then decode the + packet back into PCM audio. + + The extra framing/packetizing is used in streaming formats, such as + files. Over the net (such as with UDP), the framing and + packetization aren't necessary as they're provided by the transport + and the streaming layer is not used */ + +/* Vorbis PRIMITIVES: general ***************************************/ + +extern void vorbis_info_init(vorbis_info *vi); +extern void vorbis_info_clear(vorbis_info *vi); +extern int vorbis_info_blocksize(vorbis_info *vi,int zo); +extern void vorbis_comment_init(vorbis_comment *vc); +extern void vorbis_comment_add(vorbis_comment *vc, char *comment); +extern void vorbis_comment_add_tag(vorbis_comment *vc, + char *tag, char *contents); +extern char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count); +extern int vorbis_comment_query_count(vorbis_comment *vc, char *tag); +extern void vorbis_comment_clear(vorbis_comment *vc); + +extern int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb); +extern int vorbis_block_clear(vorbis_block *vb); +extern void vorbis_dsp_clear(vorbis_dsp_state *v); + +/* Vorbis PRIMITIVES: analysis/DSP layer ****************************/ + +extern int vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi); +extern int vorbis_commentheader_out(vorbis_comment *vc, ogg_packet *op); +extern int vorbis_analysis_headerout(vorbis_dsp_state *v, + vorbis_comment *vc, + ogg_packet *op, + ogg_packet *op_comm, + ogg_packet *op_code); +extern float **vorbis_analysis_buffer(vorbis_dsp_state *v,int vals); +extern int vorbis_analysis_wrote(vorbis_dsp_state *v,int vals); +extern int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb); +extern int vorbis_analysis(vorbis_block *vb,ogg_packet *op); + +extern int vorbis_bitrate_addblock(vorbis_block *vb); +extern int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd, + ogg_packet *op); + +/* Vorbis PRIMITIVES: synthesis layer *******************************/ +extern int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc, + ogg_packet *op); + +extern int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi); +extern int vorbis_synthesis(vorbis_block *vb,ogg_packet *op); +extern int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op); +extern int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb); +extern int vorbis_synthesis_pcmout(vorbis_dsp_state *v,float ***pcm); +extern int vorbis_synthesis_read(vorbis_dsp_state *v,int samples); +extern long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op); + +/* Vorbis ERRORS and return codes ***********************************/ + +#define OV_FALSE -1 +#define OV_EOF -2 +#define OV_HOLE -3 + +#define OV_EREAD -128 +#define OV_EFAULT -129 +#define OV_EIMPL -130 +#define OV_EINVAL -131 +#define OV_ENOTVORBIS -132 +#define OV_EBADHEADER -133 +#define OV_EVERSION -134 +#define OV_ENOTAUDIO -135 +#define OV_EBADPACKET -136 +#define OV_EBADLINK -137 +#define OV_ENOSEEK -138 + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif + diff --git a/SDK/LIBS/dcinclude/wchar.h b/SDK/LIBS/dcinclude/wchar.h new file mode 100644 index 00000000..2b19c7fc --- /dev/null +++ b/SDK/LIBS/dcinclude/wchar.h @@ -0,0 +1,15 @@ +/* KallistiOS 1.2.0 + + wchar.h + (c)2001 Dan Potter + + $Id: wchar.h,v 1.1 2002/02/09 06:15:42 bardtx Exp $ +*/ + +#ifndef __WCHAR_H +#define __WCHAR_H + +#define __need_wchar_t +#include + +#endif /* __WCHAR_H */ diff --git a/SDK/LIBS/dcinclude/zlib/zconf.h b/SDK/LIBS/dcinclude/zlib/zconf.h new file mode 100644 index 00000000..f488d534 --- /dev/null +++ b/SDK/LIBS/dcinclude/zlib/zconf.h @@ -0,0 +1,279 @@ +/* zconf.h -- configuration of the zlib compression library + * Copyright (C) 1995-2002 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id: zconf.h,v 1.1 2003/02/27 03:46:32 bardtx Exp $ */ + +#ifndef _ZCONF_H +#define _ZCONF_H + +/* + * If you *really* need a unique prefix for all types and library functions, + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. + */ +#ifdef Z_PREFIX +# define deflateInit_ z_deflateInit_ +# define deflate z_deflate +# define deflateEnd z_deflateEnd +# define inflateInit_ z_inflateInit_ +# define inflate z_inflate +# define inflateEnd z_inflateEnd +# define deflateInit2_ z_deflateInit2_ +# define deflateSetDictionary z_deflateSetDictionary +# define deflateCopy z_deflateCopy +# define deflateReset z_deflateReset +# define deflateParams z_deflateParams +# define inflateInit2_ z_inflateInit2_ +# define inflateSetDictionary z_inflateSetDictionary +# define inflateSync z_inflateSync +# define inflateSyncPoint z_inflateSyncPoint +# define inflateReset z_inflateReset +# define compress z_compress +# define compress2 z_compress2 +# define uncompress z_uncompress +# define adler32 z_adler32 +# define crc32 z_crc32 +# define get_crc_table z_get_crc_table + +# define Byte z_Byte +# define uInt z_uInt +# define uLong z_uLong +# define Bytef z_Bytef +# define charf z_charf +# define intf z_intf +# define uIntf z_uIntf +# define uLongf z_uLongf +# define voidpf z_voidpf +# define voidp z_voidp +#endif + +#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) +# define WIN32 +#endif +#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386) +# ifndef __32BIT__ +# define __32BIT__ +# endif +#endif +#if defined(__MSDOS__) && !defined(MSDOS) +# define MSDOS +#endif + +/* + * Compile with -DMAXSEG_64K if the alloc function cannot allocate more + * than 64k bytes at a time (needed on systems with 16-bit int). + */ +#if defined(MSDOS) && !defined(__32BIT__) +# define MAXSEG_64K +#endif +#ifdef MSDOS +# define UNALIGNED_OK +#endif + +#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC) +# define STDC +#endif +#if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__) +# ifndef STDC +# define STDC +# endif +#endif + +#ifndef STDC +# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +# define const +# endif +#endif + +/* Some Mac compilers merge all .h files incorrectly: */ +#if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__) +# define NO_DUMMY_DECL +#endif + +/* Old Borland C incorrectly complains about missing returns: */ +#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500) +# define NEED_DUMMY_RETURN +#endif + + +/* Maximum value for memLevel in deflateInit2 */ +#ifndef MAX_MEM_LEVEL +# ifdef MAXSEG_64K +# define MAX_MEM_LEVEL 8 +# else +# define MAX_MEM_LEVEL 9 +# endif +#endif + +/* Maximum value for windowBits in deflateInit2 and inflateInit2. + * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files + * created by gzip. (Files created by minigzip can still be extracted by + * gzip.) + */ +#ifndef MAX_WBITS +# define MAX_WBITS 15 /* 32K LZ77 window */ +#endif + +/* The memory requirements for deflate are (in bytes): + (1 << (windowBits+2)) + (1 << (memLevel+9)) + that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) + plus a few kilobytes for small objects. For example, if you want to reduce + the default memory requirements from 256K to 128K, compile with + make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" + Of course this will generally degrade compression (there's no free lunch). + + The memory requirements for inflate are (in bytes) 1 << windowBits + that is, 32K for windowBits=15 (default value) plus a few kilobytes + for small objects. +*/ + + /* Type declarations */ + +#ifndef OF /* function prototypes */ +# ifdef STDC +# define OF(args) args +# else +# define OF(args) () +# endif +#endif + +/* The following definitions for FAR are needed only for MSDOS mixed + * model programming (small or medium model with some far allocations). + * This was tested only with MSC; for other MSDOS compilers you may have + * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, + * just define FAR to be empty. + */ +#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__) + /* MSC small or medium model */ +# define SMALL_MEDIUM +# ifdef _MSC_VER +# define FAR _far +# else +# define FAR far +# endif +#endif +#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__)) +# ifndef __32BIT__ +# define SMALL_MEDIUM +# define FAR _far +# endif +#endif + +/* Compile with -DZLIB_DLL for Windows DLL support */ +#if defined(ZLIB_DLL) +# if defined(_WINDOWS) || defined(WINDOWS) +# ifdef FAR +# undef FAR +# endif +# include +# define ZEXPORT WINAPI +# ifdef WIN32 +# define ZEXPORTVA WINAPIV +# else +# define ZEXPORTVA FAR _cdecl _export +# endif +# endif +# if defined (__BORLANDC__) +# if (__BORLANDC__ >= 0x0500) && defined (WIN32) +# include +# define ZEXPORT __declspec(dllexport) WINAPI +# define ZEXPORTRVA __declspec(dllexport) WINAPIV +# else +# if defined (_Windows) && defined (__DLL__) +# define ZEXPORT _export +# define ZEXPORTVA _export +# endif +# endif +# endif +#endif + +#if defined (__BEOS__) +# if defined (ZLIB_DLL) +# define ZEXTERN extern __declspec(dllexport) +# else +# define ZEXTERN extern __declspec(dllimport) +# endif +#endif + +#ifndef ZEXPORT +# define ZEXPORT +#endif +#ifndef ZEXPORTVA +# define ZEXPORTVA +#endif +#ifndef ZEXTERN +# define ZEXTERN extern +#endif + +#ifndef FAR +# define FAR +#endif + +#if !defined(MACOS) && !defined(TARGET_OS_MAC) +typedef unsigned char Byte; /* 8 bits */ +#endif +typedef unsigned int uInt; /* 16 bits or more */ +typedef unsigned long uLong; /* 32 bits or more */ + +#ifdef SMALL_MEDIUM + /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ +# define Bytef Byte FAR +#else + typedef Byte FAR Bytef; +#endif +typedef char FAR charf; +typedef int FAR intf; +typedef uInt FAR uIntf; +typedef uLong FAR uLongf; + +#ifdef STDC + typedef void FAR *voidpf; + typedef void *voidp; +#else + typedef Byte FAR *voidpf; + typedef Byte *voidp; +#endif + +#ifdef HAVE_UNISTD_H +# include /* for off_t */ +# include /* for SEEK_* and off_t */ +# define z_off_t off_t +#endif +#ifndef SEEK_SET +# define SEEK_SET 0 /* Seek from beginning of file. */ +# define SEEK_CUR 1 /* Seek from current position. */ +# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +#endif +#ifndef z_off_t +# define z_off_t long +#endif + +/* MVS linker does not support external names larger than 8 bytes */ +#if defined(__MVS__) +# pragma map(deflateInit_,"DEIN") +# pragma map(deflateInit2_,"DEIN2") +# pragma map(deflateEnd,"DEEND") +# pragma map(inflateInit_,"ININ") +# pragma map(inflateInit2_,"ININ2") +# pragma map(inflateEnd,"INEND") +# pragma map(inflateSync,"INSY") +# pragma map(inflateSetDictionary,"INSEDI") +# pragma map(inflate_blocks,"INBL") +# pragma map(inflate_blocks_new,"INBLNE") +# pragma map(inflate_blocks_free,"INBLFR") +# pragma map(inflate_blocks_reset,"INBLRE") +# pragma map(inflate_codes_free,"INCOFR") +# pragma map(inflate_codes,"INCO") +# pragma map(inflate_fast,"INFA") +# pragma map(inflate_flush,"INFLU") +# pragma map(inflate_mask,"INMA") +# pragma map(inflate_set_dictionary,"INSEDI2") +# pragma map(inflate_copyright,"INCOPY") +# pragma map(inflate_trees_bits,"INTRBI") +# pragma map(inflate_trees_dynamic,"INTRDY") +# pragma map(inflate_trees_fixed,"INTRFI") +# pragma map(inflate_trees_free,"INTRFR") +#endif + +#endif /* _ZCONF_H */ diff --git a/SDK/LIBS/dcinclude/zlib/zlib.h b/SDK/LIBS/dcinclude/zlib/zlib.h new file mode 100644 index 00000000..5e07fe83 --- /dev/null +++ b/SDK/LIBS/dcinclude/zlib/zlib.h @@ -0,0 +1,896 @@ +/* zlib.h -- interface of the 'zlib' general purpose compression library + version 1.1.4, March 11th, 2002 + + Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + + + The data format used by the zlib library is described by RFCs (Request for + Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt + (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). +*/ + +#ifndef _ZLIB_H +#define _ZLIB_H + +#include "zconf.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define ZLIB_VERSION "1.1.4" + +/* + The 'zlib' compression library provides in-memory compression and + decompression functions, including integrity checks of the uncompressed + data. This version of the library supports only one compression method + (deflation) but other algorithms will be added later and will have the same + stream interface. + + Compression can be done in a single step if the buffers are large + enough (for example if an input file is mmap'ed), or can be done by + repeated calls of the compression function. In the latter case, the + application must provide more input and/or consume the output + (providing more output space) before each call. + + The library also supports reading and writing files in gzip (.gz) format + with an interface similar to that of stdio. + + The library does not install any signal handler. The decoder checks + the consistency of the compressed data, so the library should never + crash even in case of corrupted input. +*/ + +typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); +typedef void (*free_func) OF((voidpf opaque, voidpf address)); + +struct internal_state; + +typedef struct z_stream_s { + Bytef *next_in; /* next input byte */ + uInt avail_in; /* number of bytes available at next_in */ + uLong total_in; /* total nb of input bytes read so far */ + + Bytef *next_out; /* next output byte should be put there */ + uInt avail_out; /* remaining free space at next_out */ + uLong total_out; /* total nb of bytes output so far */ + + char *msg; /* last error message, NULL if no error */ + struct internal_state FAR *state; /* not visible by applications */ + + alloc_func zalloc; /* used to allocate the internal state */ + free_func zfree; /* used to free the internal state */ + voidpf opaque; /* private data object passed to zalloc and zfree */ + + int data_type; /* best guess about the data type: ascii or binary */ + uLong adler; /* adler32 value of the uncompressed data */ + uLong reserved; /* reserved for future use */ +} z_stream; + +typedef z_stream FAR *z_streamp; + +/* + The application must update next_in and avail_in when avail_in has + dropped to zero. It must update next_out and avail_out when avail_out + has dropped to zero. The application must initialize zalloc, zfree and + opaque before calling the init function. All other fields are set by the + compression library and must not be updated by the application. + + The opaque value provided by the application will be passed as the first + parameter for calls of zalloc and zfree. This can be useful for custom + memory management. The compression library attaches no meaning to the + opaque value. + + zalloc must return Z_NULL if there is not enough memory for the object. + If zlib is used in a multi-threaded application, zalloc and zfree must be + thread safe. + + On 16-bit systems, the functions zalloc and zfree must be able to allocate + exactly 65536 bytes, but will not be required to allocate more than this + if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, + pointers returned by zalloc for objects of exactly 65536 bytes *must* + have their offset normalized to zero. The default allocation function + provided by this library ensures this (see zutil.c). To reduce memory + requirements and avoid any allocation of 64K objects, at the expense of + compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). + + The fields total_in and total_out can be used for statistics or + progress reports. After compression, total_in holds the total size of + the uncompressed data and may be saved for use in the decompressor + (particularly if the decompressor wants to decompress everything in + a single step). +*/ + + /* constants */ + +#define Z_NO_FLUSH 0 +#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ +#define Z_SYNC_FLUSH 2 +#define Z_FULL_FLUSH 3 +#define Z_FINISH 4 +/* Allowed flush values; see deflate() below for details */ + +#define Z_OK 0 +#define Z_STREAM_END 1 +#define Z_NEED_DICT 2 +#define Z_ERRNO (-1) +#define Z_STREAM_ERROR (-2) +#define Z_DATA_ERROR (-3) +#define Z_MEM_ERROR (-4) +#define Z_BUF_ERROR (-5) +#define Z_VERSION_ERROR (-6) +/* Return codes for the compression/decompression functions. Negative + * values are errors, positive values are used for special but normal events. + */ + +#define Z_NO_COMPRESSION 0 +#define Z_BEST_SPEED 1 +#define Z_BEST_COMPRESSION 9 +#define Z_DEFAULT_COMPRESSION (-1) +/* compression levels */ + +#define Z_FILTERED 1 +#define Z_HUFFMAN_ONLY 2 +#define Z_DEFAULT_STRATEGY 0 +/* compression strategy; see deflateInit2() below for details */ + +#define Z_BINARY 0 +#define Z_ASCII 1 +#define Z_UNKNOWN 2 +/* Possible values of the data_type field */ + +#define Z_DEFLATED 8 +/* The deflate compression method (the only one supported in this version) */ + +#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ + +#define zlib_version zlibVersion() +/* for compatibility with versions < 1.0.2 */ + + /* basic functions */ + +ZEXTERN const char * ZEXPORT zlibVersion OF((void)); +/* The application can compare zlibVersion and ZLIB_VERSION for consistency. + If the first character differs, the library code actually used is + not compatible with the zlib.h header file used by the application. + This check is automatically made by deflateInit and inflateInit. + */ + +/* +ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); + + Initializes the internal stream state for compression. The fields + zalloc, zfree and opaque must be initialized before by the caller. + If zalloc and zfree are set to Z_NULL, deflateInit updates them to + use default allocation functions. + + The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: + 1 gives best speed, 9 gives best compression, 0 gives no compression at + all (the input data is simply copied a block at a time). + Z_DEFAULT_COMPRESSION requests a default compromise between speed and + compression (currently equivalent to level 6). + + deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if level is not a valid compression level, + Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible + with the version assumed by the caller (ZLIB_VERSION). + msg is set to null if there is no error message. deflateInit does not + perform any compression: this will be done by deflate(). +*/ + + +ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); +/* + deflate compresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce some + output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. deflate performs one or both of the + following actions: + + - Compress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in and avail_in are updated and + processing will resume at this point for the next call of deflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. This action is forced if the parameter flush is non zero. + Forcing flush frequently degrades the compression ratio, so this parameter + should be set only when necessary (in interactive applications). + Some output may be provided even if flush is not set. + + Before the call of deflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming + more output, and updating avail_in or avail_out accordingly; avail_out + should never be zero before the call. The application can consume the + compressed output when it wants, for example when the output buffer is full + (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK + and with zero avail_out, it must be called again after making room in the + output buffer because there might be more output pending. + + If the parameter flush is set to Z_SYNC_FLUSH, all pending output is + flushed to the output buffer and the output is aligned on a byte boundary, so + that the decompressor can get all input data available so far. (In particular + avail_in is zero after the call if enough output space has been provided + before the call.) Flushing may degrade compression for some compression + algorithms and so it should be used only when necessary. + + If flush is set to Z_FULL_FLUSH, all output is flushed as with + Z_SYNC_FLUSH, and the compression state is reset so that decompression can + restart from this point if previous compressed data has been damaged or if + random access is desired. Using Z_FULL_FLUSH too often can seriously degrade + the compression. + + If deflate returns with avail_out == 0, this function must be called again + with the same value of the flush parameter and more output space (updated + avail_out), until the flush is complete (deflate returns with non-zero + avail_out). + + If the parameter flush is set to Z_FINISH, pending input is processed, + pending output is flushed and deflate returns with Z_STREAM_END if there + was enough output space; if deflate returns with Z_OK, this function must be + called again with Z_FINISH and more output space (updated avail_out) but no + more input data, until it returns with Z_STREAM_END or an error. After + deflate has returned Z_STREAM_END, the only possible operations on the + stream are deflateReset or deflateEnd. + + Z_FINISH can be used immediately after deflateInit if all the compression + is to be done in a single step. In this case, avail_out must be at least + 0.1% larger than avail_in plus 12 bytes. If deflate does not return + Z_STREAM_END, then it must be called again as described above. + + deflate() sets strm->adler to the adler32 checksum of all input read + so far (that is, total_in bytes). + + deflate() may update data_type if it can make a good guess about + the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered + binary. This field is only for information purposes and does not affect + the compression algorithm in any manner. + + deflate() returns Z_OK if some progress has been made (more input + processed or more output produced), Z_STREAM_END if all input has been + consumed and all output has been produced (only when flush is set to + Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example + if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible + (for example avail_in or avail_out was zero). +*/ + + +ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any + pending output. + + deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the + stream state was inconsistent, Z_DATA_ERROR if the stream was freed + prematurely (some input or output was discarded). In the error case, + msg may be set but then points to a static string (which must not be + deallocated). +*/ + + +/* +ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); + + Initializes the internal stream state for decompression. The fields + next_in, avail_in, zalloc, zfree and opaque must be initialized before by + the caller. If next_in is not Z_NULL and avail_in is large enough (the exact + value depends on the compression method), inflateInit determines the + compression method from the zlib header and allocates all data structures + accordingly; otherwise the allocation will be deferred to the first call of + inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to + use default allocation functions. + + inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller. msg is set to null if there is no error + message. inflateInit does not perform any decompression apart from reading + the zlib header if present: this will be done by inflate(). (So next_in and + avail_in may be modified, but next_out and avail_out are unchanged.) +*/ + + +ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); +/* + inflate decompresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may some + introduce some output latency (reading input without producing any output) + except when forced to flush. + + The detailed semantics are as follows. inflate performs one or both of the + following actions: + + - Decompress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in is updated and processing + will resume at this point for the next call of inflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. inflate() provides as much output as possible, until there + is no more input data or no more space in the output buffer (see below + about the flush parameter). + + Before the call of inflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming + more output, and updating the next_* and avail_* values accordingly. + The application can consume the uncompressed output when it wants, for + example when the output buffer is full (avail_out == 0), or after each + call of inflate(). If inflate returns Z_OK and with zero avail_out, it + must be called again after making room in the output buffer because there + might be more output pending. + + If the parameter flush is set to Z_SYNC_FLUSH, inflate flushes as much + output as possible to the output buffer. The flushing behavior of inflate is + not specified for values of the flush parameter other than Z_SYNC_FLUSH + and Z_FINISH, but the current implementation actually flushes as much output + as possible anyway. + + inflate() should normally be called until it returns Z_STREAM_END or an + error. However if all decompression is to be performed in a single step + (a single call of inflate), the parameter flush should be set to + Z_FINISH. In this case all pending input is processed and all pending + output is flushed; avail_out must be large enough to hold all the + uncompressed data. (The size of the uncompressed data may have been saved + by the compressor for this purpose.) The next operation on this stream must + be inflateEnd to deallocate the decompression state. The use of Z_FINISH + is never required, but can be used to inform inflate that a faster routine + may be used for the single inflate() call. + + If a preset dictionary is needed at this point (see inflateSetDictionary + below), inflate sets strm-adler to the adler32 checksum of the + dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise + it sets strm->adler to the adler32 checksum of all output produced + so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or + an error code as described below. At the end of the stream, inflate() + checks that its computed adler32 checksum is equal to that saved by the + compressor and returns Z_STREAM_END only if the checksum is correct. + + inflate() returns Z_OK if some progress has been made (more input processed + or more output produced), Z_STREAM_END if the end of the compressed data has + been reached and all uncompressed output has been produced, Z_NEED_DICT if a + preset dictionary is needed at this point, Z_DATA_ERROR if the input data was + corrupted (input stream not conforming to the zlib format or incorrect + adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent + (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if no progress is possible or if there was not + enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR + case, the application may then call inflateSync to look for a good + compression block. +*/ + + +ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any + pending output. + + inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state + was inconsistent. In the error case, msg may be set but then points to a + static string (which must not be deallocated). +*/ + + /* Advanced functions */ + +/* + The following functions are needed only in some special applications. +*/ + +/* +ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, + int level, + int method, + int windowBits, + int memLevel, + int strategy)); + + This is another version of deflateInit with more compression options. The + fields next_in, zalloc, zfree and opaque must be initialized before by + the caller. + + The method parameter is the compression method. It must be Z_DEFLATED in + this version of the library. + + The windowBits parameter is the base two logarithm of the window size + (the size of the history buffer). It should be in the range 8..15 for this + version of the library. Larger values of this parameter result in better + compression at the expense of memory usage. The default value is 15 if + deflateInit is used instead. + + The memLevel parameter specifies how much memory should be allocated + for the internal compression state. memLevel=1 uses minimum memory but + is slow and reduces compression ratio; memLevel=9 uses maximum memory + for optimal speed. The default value is 8. See zconf.h for total memory + usage as a function of windowBits and memLevel. + + The strategy parameter is used to tune the compression algorithm. Use the + value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a + filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no + string match). Filtered data consists mostly of small values with a + somewhat random distribution. In this case, the compression algorithm is + tuned to compress them better. The effect of Z_FILTERED is to force more + Huffman coding and less string matching; it is somewhat intermediate + between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects + the compression ratio but not the correctness of the compressed output even + if it is not set appropriately. + + deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid + method). msg is set to null if there is no error message. deflateInit2 does + not perform any compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the compression dictionary from the given byte sequence + without producing any compressed output. This function must be called + immediately after deflateInit, deflateInit2 or deflateReset, before any + call of deflate. The compressor and decompressor must use exactly the same + dictionary (see inflateSetDictionary). + + The dictionary should consist of strings (byte sequences) that are likely + to be encountered later in the data to be compressed, with the most commonly + used strings preferably put towards the end of the dictionary. Using a + dictionary is most useful when the data to be compressed is short and can be + predicted with good accuracy; the data can then be compressed better than + with the default empty dictionary. + + Depending on the size of the compression data structures selected by + deflateInit or deflateInit2, a part of the dictionary may in effect be + discarded, for example if the dictionary is larger than the window size in + deflate or deflate2. Thus the strings most likely to be useful should be + put at the end of the dictionary, not at the front. + + Upon return of this function, strm->adler is set to the Adler32 value + of the dictionary; the decompressor may later use this value to determine + which dictionary has been used by the compressor. (The Adler32 value + applies to the whole dictionary even if only a subset of the dictionary is + actually used by the compressor.) + + deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a + parameter is invalid (such as NULL dictionary) or the stream state is + inconsistent (for example if deflate has already been called for this stream + or if the compression method is bsort). deflateSetDictionary does not + perform any compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when several compression strategies will be + tried, for example when there are several ways of pre-processing the input + data with a filter. The streams that will be discarded should then be freed + by calling deflateEnd. Note that deflateCopy duplicates the internal + compression state which can be quite large, so this strategy is slow and + can consume lots of memory. + + deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); +/* + This function is equivalent to deflateEnd followed by deflateInit, + but does not free and reallocate all the internal compression state. + The stream will keep the same compression level and any other attributes + that may have been set by deflateInit2. + + deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being NULL). +*/ + +ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, + int level, + int strategy)); +/* + Dynamically update the compression level and compression strategy. The + interpretation of level and strategy is as in deflateInit2. This can be + used to switch between compression and straight copy of the input data, or + to switch to a different kind of input data requiring a different + strategy. If the compression level is changed, the input available so far + is compressed with the old level (and may be flushed); the new level will + take effect only at the next call of deflate(). + + Before the call of deflateParams, the stream state must be set as for + a call of deflate(), since the currently available input may have to + be compressed and flushed. In particular, strm->avail_out must be non-zero. + + deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source + stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR + if strm->avail_out was zero. +*/ + +/* +ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, + int windowBits)); + + This is another version of inflateInit with an extra parameter. The + fields next_in, avail_in, zalloc, zfree and opaque must be initialized + before by the caller. + + The windowBits parameter is the base two logarithm of the maximum window + size (the size of the history buffer). It should be in the range 8..15 for + this version of the library. The default value is 15 if inflateInit is used + instead. If a compressed stream with a larger window size is given as + input, inflate() will return with the error code Z_DATA_ERROR instead of + trying to allocate a larger window. + + inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative + memLevel). msg is set to null if there is no error message. inflateInit2 + does not perform any decompression apart from reading the zlib header if + present: this will be done by inflate(). (So next_in and avail_in may be + modified, but next_out and avail_out are unchanged.) +*/ + +ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the decompression dictionary from the given uncompressed byte + sequence. This function must be called immediately after a call of inflate + if this call returned Z_NEED_DICT. The dictionary chosen by the compressor + can be determined from the Adler32 value returned by this call of + inflate. The compressor and decompressor must use exactly the same + dictionary (see deflateSetDictionary). + + inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a + parameter is invalid (such as NULL dictionary) or the stream state is + inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the + expected one (incorrect Adler32 value). inflateSetDictionary does not + perform any decompression: this will be done by subsequent calls of + inflate(). +*/ + +ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); +/* + Skips invalid compressed data until a full flush point (see above the + description of deflate with Z_FULL_FLUSH) can be found, or until all + available input is skipped. No output is provided. + + inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR + if no more input was provided, Z_DATA_ERROR if no flush point has been found, + or Z_STREAM_ERROR if the stream structure was inconsistent. In the success + case, the application may save the current current value of total_in which + indicates where valid compressed data was found. In the error case, the + application may repeatedly call inflateSync, providing more input each time, + until success or end of the input data. +*/ + +ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); +/* + This function is equivalent to inflateEnd followed by inflateInit, + but does not free and reallocate all the internal decompression state. + The stream will keep attributes that may have been set by inflateInit2. + + inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being NULL). +*/ + + + /* utility functions */ + +/* + The following utility functions are implemented on top of the + basic stream-oriented functions. To simplify the interface, some + default options are assumed (compression level and memory usage, + standard memory allocation functions). The source code of these + utility functions can easily be modified if you need special options. +*/ + +ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Compresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total + size of the destination buffer, which must be at least 0.1% larger than + sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the + compressed buffer. + This function can be used to compress a whole file at once if the + input file is mmap'ed. + compress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer. +*/ + +ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen, + int level)); +/* + Compresses the source buffer into the destination buffer. The level + parameter has the same meaning as in deflateInit. sourceLen is the byte + length of the source buffer. Upon entry, destLen is the total size of the + destination buffer, which must be at least 0.1% larger than sourceLen plus + 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. + + compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_BUF_ERROR if there was not enough room in the output buffer, + Z_STREAM_ERROR if the level parameter is invalid. +*/ + +ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Decompresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total + size of the destination buffer, which must be large enough to hold the + entire uncompressed data. (The size of the uncompressed data must have + been saved previously by the compressor and transmitted to the decompressor + by some mechanism outside the scope of this compression library.) + Upon exit, destLen is the actual size of the compressed buffer. + This function can be used to decompress a whole file at once if the + input file is mmap'ed. + + uncompress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer, or Z_DATA_ERROR if the input data was corrupted. +*/ + + +typedef voidp gzFile; + +/* Added on for convenience in the KOS files */ +int zlib_getlength(char *filename); + +ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); +/* + Opens a gzip (.gz) file for reading or writing. The mode parameter + is as in fopen ("rb" or "wb") but can also include a compression level + ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for + Huffman only compression as in "wb1h". (See the description + of deflateInit2 for more information about the strategy parameter.) + + gzopen can be used to read a file which is not in gzip format; in this + case gzread will directly read from the file without decompression. + + gzopen returns NULL if the file could not be opened or if there was + insufficient memory to allocate the (de)compression state; errno + can be checked to distinguish the two cases (if errno is zero, the + zlib error is Z_MEM_ERROR). */ + +ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); +/* + gzdopen() associates a gzFile with the file descriptor fd. File + descriptors are obtained from calls like open, dup, creat, pipe or + fileno (in the file has been previously opened with fopen). + The mode parameter is as in gzopen. + The next call of gzclose on the returned gzFile will also close the + file descriptor fd, just like fclose(fdopen(fd), mode) closes the file + descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). + gzdopen returns NULL if there was insufficient memory to allocate + the (de)compression state. +*/ + +ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); +/* + Dynamically update the compression level or strategy. See the description + of deflateInit2 for the meaning of these parameters. + gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not + opened for writing. +*/ + +ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); +/* + Reads the given number of uncompressed bytes from the compressed file. + If the input file was not in gzip format, gzread copies the given number + of bytes into the buffer. + gzread returns the number of uncompressed bytes actually read (0 for + end of file, -1 for error). */ + +ZEXTERN int ZEXPORT gzwrite OF((gzFile file, + const voidp buf, unsigned len)); +/* + Writes the given number of uncompressed bytes into the compressed file. + gzwrite returns the number of uncompressed bytes actually written + (0 in case of error). +*/ + +ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); +/* + Converts, formats, and writes the args to the compressed file under + control of the format string, as in fprintf. gzprintf returns the number of + uncompressed bytes actually written (0 in case of error). +*/ + +ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); +/* + Writes the given null-terminated string to the compressed file, excluding + the terminating null character. + gzputs returns the number of characters written, or -1 in case of error. +*/ + +ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); +/* + Reads bytes from the compressed file until len-1 characters are read, or + a newline character is read and transferred to buf, or an end-of-file + condition is encountered. The string is then terminated with a null + character. + gzgets returns buf, or Z_NULL in case of error. +*/ + +ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); +/* + Writes c, converted to an unsigned char, into the compressed file. + gzputc returns the value that was written, or -1 in case of error. +*/ + +ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); +/* + Reads one byte from the compressed file. gzgetc returns this byte + or -1 in case of end of file or error. +*/ + +ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); +/* + Flushes all pending output into the compressed file. The parameter + flush is as in the deflate() function. The return value is the zlib + error number (see function gzerror below). gzflush returns Z_OK if + the flush parameter is Z_FINISH and all output could be flushed. + gzflush should be called only when strictly necessary because it can + degrade compression. +*/ + +ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, + z_off_t offset, int whence)); +/* + Sets the starting position for the next gzread or gzwrite on the + given compressed file. The offset represents a number of bytes in the + uncompressed data stream. The whence parameter is defined as in lseek(2); + the value SEEK_END is not supported. + If the file is opened for reading, this function is emulated but can be + extremely slow. If the file is opened for writing, only forward seeks are + supported; gzseek then compresses a sequence of zeroes up to the new + starting position. + + gzseek returns the resulting offset location as measured in bytes from + the beginning of the uncompressed stream, or -1 in case of error, in + particular if the file is opened for writing and the new starting position + would be before the current position. +*/ + +ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); +/* + Rewinds the given file. This function is supported only for reading. + + gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) +*/ + +ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); +/* + Returns the starting position for the next gzread or gzwrite on the + given compressed file. This position represents a number of bytes in the + uncompressed data stream. + + gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) +*/ + +ZEXTERN int ZEXPORT gzeof OF((gzFile file)); +/* + Returns 1 when EOF has previously been detected reading the given + input stream, otherwise zero. +*/ + +ZEXTERN int ZEXPORT gzclose OF((gzFile file)); +/* + Flushes all pending output if necessary, closes the compressed file + and deallocates all the (de)compression state. The return value is the zlib + error number (see function gzerror below). +*/ + +ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); +/* + Returns the error message for the last error which occurred on the + given compressed file. errnum is set to zlib error number. If an + error occurred in the file system and not in the compression library, + errnum is set to Z_ERRNO and the application may consult errno + to get the exact error code. +*/ + + /* checksum functions */ + +/* + These functions are not related to compression but are exported + anyway because they might be useful in applications using the + compression library. +*/ + +ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); + +/* + Update a running Adler-32 checksum with the bytes buf[0..len-1] and + return the updated checksum. If buf is NULL, this function returns + the required initial value for the checksum. + An Adler-32 checksum is almost as reliable as a CRC32 but can be computed + much faster. Usage example: + + uLong adler = adler32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + adler = adler32(adler, buffer, length); + } + if (adler != original_adler) error(); +*/ + +ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); +/* + Update a running crc with the bytes buf[0..len-1] and return the updated + crc. If buf is NULL, this function returns the required initial value + for the crc. Pre- and post-conditioning (one's complement) is performed + within this function so it shouldn't be done by the application. + Usage example: + + uLong crc = crc32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + crc = crc32(crc, buffer, length); + } + if (crc != original_crc) error(); +*/ + + + /* various hacks, don't look :) */ + +/* deflateInit and inflateInit are macros to allow checking the zlib version + * and the compiler's view of z_stream: + */ +ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, + int windowBits, int memLevel, + int strategy, const char *version, + int stream_size)); +ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, + const char *version, int stream_size)); +#define deflateInit(strm, level) \ + deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) +#define inflateInit(strm) \ + inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) +#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ + deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ + (strategy), ZLIB_VERSION, sizeof(z_stream)) +#define inflateInit2(strm, windowBits) \ + inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) + + +#if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL) + struct internal_state {int dummy;}; /* hack for buggy compilers */ +#endif + +ZEXTERN const char * ZEXPORT zError OF((int err)); +ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); +ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); + +#ifdef __cplusplus +} +#endif + +#endif /* _ZLIB_H */ diff --git a/SDK/LIBS/dclib/libSDL.a b/SDK/LIBS/dclib/libSDL.a new file mode 100644 index 00000000..a73fa954 Binary files /dev/null and b/SDK/LIBS/dclib/libSDL.a differ diff --git a/SDK/LIBS/dclib/libbz2.a b/SDK/LIBS/dclib/libbz2.a new file mode 100644 index 00000000..b38c624e Binary files /dev/null and b/SDK/LIBS/dclib/libbz2.a differ diff --git a/SDK/LIBS/dclib/libconio.a b/SDK/LIBS/dclib/libconio.a new file mode 100644 index 00000000..1c92390d Binary files /dev/null and b/SDK/LIBS/dclib/libconio.a differ diff --git a/SDK/LIBS/dclib/libdcplib.a b/SDK/LIBS/dclib/libdcplib.a new file mode 100644 index 00000000..b44fd1a0 Binary files /dev/null and b/SDK/LIBS/dclib/libdcplib.a differ diff --git a/SDK/LIBS/dclib/libgl.a b/SDK/LIBS/dclib/libgl.a new file mode 100644 index 00000000..a5f54328 Binary files /dev/null and b/SDK/LIBS/dclib/libgl.a differ diff --git a/SDK/LIBS/dclib/libimageload.a b/SDK/LIBS/dclib/libimageload.a new file mode 100644 index 00000000..62abadd9 Binary files /dev/null and b/SDK/LIBS/dclib/libimageload.a differ diff --git a/SDK/LIBS/dclib/libjpeg.a b/SDK/LIBS/dclib/libjpeg.a new file mode 100644 index 00000000..4a460ef2 Binary files /dev/null and b/SDK/LIBS/dclib/libjpeg.a differ diff --git a/SDK/LIBS/dclib/libk++.a b/SDK/LIBS/dclib/libk++.a new file mode 100644 index 00000000..60234086 Binary files /dev/null and b/SDK/LIBS/dclib/libk++.a differ diff --git a/SDK/LIBS/dclib/libkallisti.a b/SDK/LIBS/dclib/libkallisti.a new file mode 100644 index 00000000..bbfd3b71 Binary files /dev/null and b/SDK/LIBS/dclib/libkallisti.a differ diff --git a/SDK/LIBS/dclib/libkglx.a b/SDK/LIBS/dclib/libkglx.a new file mode 100644 index 00000000..c31d185f Binary files /dev/null and b/SDK/LIBS/dclib/libkglx.a differ diff --git a/SDK/LIBS/dclib/libkmg.a b/SDK/LIBS/dclib/libkmg.a new file mode 100644 index 00000000..f286ac30 Binary files /dev/null and b/SDK/LIBS/dclib/libkmg.a differ diff --git a/SDK/LIBS/dclib/libkosh.a b/SDK/LIBS/dclib/libkosh.a new file mode 100644 index 00000000..2f67c2de Binary files /dev/null and b/SDK/LIBS/dclib/libkosh.a differ diff --git a/SDK/LIBS/dclib/liblua.a b/SDK/LIBS/dclib/liblua.a new file mode 100644 index 00000000..52a25c52 Binary files /dev/null and b/SDK/LIBS/dclib/liblua.a differ diff --git a/SDK/LIBS/dclib/liblualib.a b/SDK/LIBS/dclib/liblualib.a new file mode 100644 index 00000000..c4a27f25 Binary files /dev/null and b/SDK/LIBS/dclib/liblualib.a differ diff --git a/SDK/LIBS/dclib/liblwip4.a b/SDK/LIBS/dclib/liblwip4.a new file mode 100644 index 00000000..e1053207 Binary files /dev/null and b/SDK/LIBS/dclib/liblwip4.a differ diff --git a/SDK/LIBS/dclib/libm.a b/SDK/LIBS/dclib/libm.a new file mode 100644 index 00000000..ffdec663 Binary files /dev/null and b/SDK/LIBS/dclib/libm.a differ diff --git a/SDK/LIBS/dclib/libmodplug.a b/SDK/LIBS/dclib/libmodplug.a new file mode 100644 index 00000000..b724140d Binary files /dev/null and b/SDK/LIBS/dclib/libmodplug.a differ diff --git a/SDK/LIBS/dclib/libmp3.a b/SDK/LIBS/dclib/libmp3.a new file mode 100644 index 00000000..7625ff97 Binary files /dev/null and b/SDK/LIBS/dclib/libmp3.a differ diff --git a/SDK/LIBS/dclib/liboggvorbisplay.a b/SDK/LIBS/dclib/liboggvorbisplay.a new file mode 100644 index 00000000..d171e982 Binary files /dev/null and b/SDK/LIBS/dclib/liboggvorbisplay.a differ diff --git a/SDK/LIBS/dclib/libparallax.a b/SDK/LIBS/dclib/libparallax.a new file mode 100644 index 00000000..aca6ddc3 Binary files /dev/null and b/SDK/LIBS/dclib/libparallax.a differ diff --git a/SDK/LIBS/dclib/libpcx.a b/SDK/LIBS/dclib/libpcx.a new file mode 100644 index 00000000..351b6d91 Binary files /dev/null and b/SDK/LIBS/dclib/libpcx.a differ diff --git a/SDK/LIBS/dclib/libpng.a b/SDK/LIBS/dclib/libpng.a new file mode 100644 index 00000000..015b2bb7 Binary files /dev/null and b/SDK/LIBS/dclib/libpng.a differ diff --git a/SDK/LIBS/dclib/libtga.a b/SDK/LIBS/dclib/libtga.a new file mode 100644 index 00000000..af6d9575 Binary files /dev/null and b/SDK/LIBS/dclib/libtga.a differ diff --git a/SDK/LIBS/dclib/libtremor.a b/SDK/LIBS/dclib/libtremor.a new file mode 100644 index 00000000..32436c0a Binary files /dev/null and b/SDK/LIBS/dclib/libtremor.a differ diff --git a/SDK/LIBS/dclib/libtsunami.a b/SDK/LIBS/dclib/libtsunami.a new file mode 100644 index 00000000..40805d09 Binary files /dev/null and b/SDK/LIBS/dclib/libtsunami.a differ diff --git a/SDK/LIBS/dclib/libz.a b/SDK/LIBS/dclib/libz.a new file mode 100644 index 00000000..77d4cb6e Binary files /dev/null and b/SDK/LIBS/dclib/libz.a differ diff --git a/SDK/SRCS/PNG/ProjetPNG.dev b/SDK/SRCS/PNG/ProjetPNG.dev new file mode 100644 index 00000000..19175a52 --- /dev/null +++ b/SDK/SRCS/PNG/ProjetPNG.dev @@ -0,0 +1,66 @@ +[Project] +FileName=ProjetPNG.dev +Name=Projet1 +UnitCount=2 +Type=1 +Ver=1 +ObjFiles= +Includes= +Libs= +PrivateResource= +ResourceIncludes= +MakeIncludes=dreamcast.mak +Compiler=-Wall -g -ml -m4-single-only -O2 -fno-builtin -fno-strict-aliasing -fomit-frame-pointer -fno-optimize-sibling-calls _@@_-D_arch_dreamcast_@@__@@_ +CppCompiler= +Linker=-ml -m4-single-only -nostartfiles -nostdlib -Wl,-Ttext=0x8c010000_@@_startup.o romdisk.o wfont.o_@@_-lpng -lz -lm -lkallisti -lgcc_@@__@@_ +IsCpp=0 +Icon= +ExeOutput= +ObjectOutput= +OverrideOutput=1 +OverrideOutputName=PNG.elf +HostApplication= +Folders= +CommandLine= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=1 +CompilerSettings=000000000000000000 + +[Unit1] +FileName=example.c +CompileCpp=0 +Folder=Projet1 +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit2] +FileName=dreamcast.mak +Folder=Projet1 +Compile=0 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion= +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 + diff --git a/SDK/SRCS/PNG/dreamcast.mak b/SDK/SRCS/PNG/dreamcast.mak new file mode 100644 index 00000000..aa3ef5b7 --- /dev/null +++ b/SDK/SRCS/PNG/dreamcast.mak @@ -0,0 +1,9 @@ +all-before: + rm -f romdisk.img romdisk.o wfont.o + bin2o wfont.bin wfont wfont.o + genromfs -f romdisk.img -d romdisk -v + bin2o romdisk.img romdisk_boot romdisk.o + + +all-after : + dc-tool -e -x $(BIN) diff --git a/SDK/SRCS/PNG/dreamcast.mak.bak b/SDK/SRCS/PNG/dreamcast.mak.bak new file mode 100644 index 00000000..30c93454 --- /dev/null +++ b/SDK/SRCS/PNG/dreamcast.mak.bak @@ -0,0 +1,9 @@ +all-before: + rm -f romdisk.img romdisk.o wfont.o + bin2o wfont.bin wfont wfont.o + genromfs -f romdisk.img -d romdisk -v + bin2o romdisk.img romdisk_boot romdisk.o + + +all-after : + diff --git a/SDK/SRCS/PNG/example.c b/SDK/SRCS/PNG/example.c new file mode 100644 index 00000000..f9cf1cd8 --- /dev/null +++ b/SDK/SRCS/PNG/example.c @@ -0,0 +1,243 @@ +/* png example for KOS 1.1.x + * Jeffrey McBeth / Morphogenesis + * + * + * Heavily borrowed from from 2-D example + * AndrewK / Napalm 2001 + * + */ + +#include +#include +#include + +/* font data */ +extern char wfont[]; + +/* textures */ +pvr_ptr_t font_tex; +pvr_ptr_t back_tex; +char *data; + +/* init background */ +void back_init() +{ + back_tex = pvr_mem_malloc(512*512*2); + png_to_texture("/rd/background.png", back_tex, PNG_NO_ALPHA); +} + +/* init font */ +void font_init() +{ + int i,x,y,c; + unsigned short * temp_tex; + + font_tex = pvr_mem_malloc(256*256*2); + temp_tex = (unsigned short *)malloc(256*128*2); + + c = 0; + for(y = 0; y < 128 ; y+=16) + for(x = 0; x < 256 ; x+=8) { + for(i = 0; i < 16; i++) { + temp_tex[x + (y+i) * 256 + 0] = 0xffff * ((wfont[c+i] & 0x80)>>7); + temp_tex[x + (y+i) * 256 + 1] = 0xffff * ((wfont[c+i] & 0x40)>>6); + temp_tex[x + (y+i) * 256 + 2] = 0xffff * ((wfont[c+i] & 0x20)>>5); + temp_tex[x + (y+i) * 256 + 3] = 0xffff * ((wfont[c+i] & 0x10)>>4); + temp_tex[x + (y+i) * 256 + 4] = 0xffff * ((wfont[c+i] & 0x08)>>3); + temp_tex[x + (y+i) * 256 + 5] = 0xffff * ((wfont[c+i] & 0x04)>>2); + temp_tex[x + (y+i) * 256 + 6] = 0xffff * ((wfont[c+i] & 0x02)>>1); + temp_tex[x + (y+i) * 256 + 7] = 0xffff * (wfont[c+i] & 0x01); + } + c+=16; + } + pvr_txr_load_ex(temp_tex, font_tex, 256, 256, PVR_TXRLOAD_16BPP); +} + +void text_init() +{ + int length = zlib_getlength("/rd/text.gz"); + gzFile f; + + data = (char *)malloc(length+1); // I am not currently freeing it + + f = gzopen("/rd/text.gz", "r"); + gzread(f, data, length); + data[length] = 0; + gzclose(f); + + printf("length [%d]\n", length); +} + +/* draw background */ +void draw_back(void) +{ + pvr_poly_cxt_t cxt; + pvr_poly_hdr_t hdr; + pvr_vertex_t vert; + + pvr_poly_cxt_txr(&cxt, PVR_LIST_OP_POLY, PVR_TXRFMT_RGB565, 512, 512, back_tex, PVR_FILTER_BILINEAR); + pvr_poly_compile(&hdr, &cxt); + pvr_prim(&hdr, sizeof(hdr)); + + vert.argb = PVR_PACK_COLOR(1.0f, 1.0f, 1.0f, 1.0f); + vert.oargb = 0; + vert.flags = PVR_CMD_VERTEX; + + vert.x = 1; + vert.y = 1; + vert.z = 1; + vert.u = 0.0; + vert.v = 0.0; + pvr_prim(&vert, sizeof(vert)); + + vert.x = 640; + vert.y = 1; + vert.z = 1; + vert.u = 1.0; + vert.v = 0.0; + pvr_prim(&vert, sizeof(vert)); + + vert.x = 1; + vert.y = 480; + vert.z = 1; + vert.u = 0.0; + vert.v = 1.0; + pvr_prim(&vert, sizeof(vert)); + + vert.x = 640; + vert.y = 480; + vert.z = 1; + vert.u = 1.0; + vert.v = 1.0; + vert.flags = PVR_CMD_VERTEX_EOL; + pvr_prim(&vert, sizeof(vert)); +} + +/* draw one character */ +void draw_char(float x1, float y1, float z1, float a, float r, float g, float b, int c, float xs, float ys) +{ + pvr_vertex_t vert; + int ix, iy; + float u1, v1, u2, v2; + + ix = (c % 32) * 8; + iy = (c / 32) * 16; + u1 = (ix + 0.5f) * 1.0f / 256.0f; + v1 = (iy + 0.5f) * 1.0f / 256.0f; + u2 = (ix+7.5f) * 1.0f / 256.0f; + v2 = (iy+15.5f) * 1.0f / 256.0f; + + vert.flags = PVR_CMD_VERTEX; + vert.x = x1; + vert.y = y1 + 16.0f * ys; + vert.z = z1; + vert.u = u1; + vert.v = v2; + vert.argb = PVR_PACK_COLOR(a,r,g,b); + vert.oargb = 0; + pvr_prim(&vert, sizeof(vert)); + + vert.x = x1; + vert.y = y1; + vert.u = u1; + vert.v = v1; + pvr_prim(&vert, sizeof(vert)); + + vert.x = x1 + 8.0f * xs; + vert.y = y1 + 16.0f * ys; + vert.u = u2; + vert.v = v2; + pvr_prim(&vert, sizeof(vert)); + + vert.flags = PVR_CMD_VERTEX_EOL; + vert.x = x1 + 8.0f * xs; + vert.y = y1; + vert.u = u2; + vert.v = v1; + pvr_prim(&vert, sizeof(vert)); +} + +/* draw a string */ +void draw_string(float x, float y, float z, float a, float r, float g, float b, char *str, float xs, float ys) { + pvr_poly_cxt_t cxt; + pvr_poly_hdr_t hdr; + float orig_x = x; + + pvr_poly_cxt_txr(&cxt, PVR_LIST_TR_POLY, PVR_TXRFMT_ARGB4444, 256, 256, font_tex, PVR_FILTER_BILINEAR); + pvr_poly_compile(&hdr, &cxt); + pvr_prim(&hdr, sizeof(hdr)); + + while (*str) { + if (*str == '\n') + { + x = orig_x; + y += 40; + str++; + continue; + } + draw_char(x, y, z, a, r, g, b, *str++, xs, ys); + x+=8*xs; + } +} + +/* base y coordinate */ +int y = 0; + +/* draw one frame */ +void draw_frame(void) +{ + pvr_wait_ready(); + pvr_scene_begin(); + + pvr_list_begin(PVR_LIST_OP_POLY); + draw_back(); + pvr_list_finish(); + + pvr_list_begin(PVR_LIST_TR_POLY); + + /* 1720 and 480 are magic numbers directly related to the text scrolling + * 1720 is enough room for the whole text to scroll from the bottom of + * the screen to off the top. 31 lines * 40 pixels + 480 pixel high screen + * 480 is the height of the screen (starts the text at the bottom) + */ + draw_string(0, y % 1720 + 440, 3, 1, 1,1,1, data, 2, 2); + + pvr_list_finish(); + pvr_scene_finish(); + + y--; +} + +/* romdisk */ +extern uint8 romdisk_boot[]; +KOS_INIT_ROMDISK(romdisk_boot); + +int main(void) +{ + int done = 0; + + /* init kos */ + pvr_init_defaults(); + + /* init font */ + font_init(); + + /* init background */ + back_init(); + + /* init text */ + text_init(); + + /* keep drawing frames until start is pressed */ + while(!done) { + MAPLE_FOREACH_BEGIN(MAPLE_FUNC_CONTROLLER, cont_state_t, st) + if (st->buttons & CONT_START) + done = 1; + MAPLE_FOREACH_END() + + draw_frame(); + } + + return 0; +} + diff --git a/SDK/SRCS/PNG/romdisk/background.png b/SDK/SRCS/PNG/romdisk/background.png new file mode 100644 index 00000000..604f931d Binary files /dev/null and b/SDK/SRCS/PNG/romdisk/background.png differ diff --git a/SDK/SRCS/PNG/romdisk/text.gz b/SDK/SRCS/PNG/romdisk/text.gz new file mode 100644 index 00000000..7c6fb8e8 Binary files /dev/null and b/SDK/SRCS/PNG/romdisk/text.gz differ diff --git a/SDK/SRCS/PNG/startup.o b/SDK/SRCS/PNG/startup.o new file mode 100644 index 00000000..03251a83 Binary files /dev/null and b/SDK/SRCS/PNG/startup.o differ diff --git a/SDK/SRCS/PNG/wfont.bin b/SDK/SRCS/PNG/wfont.bin new file mode 100644 index 00000000..3dcbda90 Binary files /dev/null and b/SDK/SRCS/PNG/wfont.bin differ diff --git a/SDK/SRCS/testDc/dreamcast.mak b/SDK/SRCS/testDc/dreamcast.mak new file mode 100644 index 00000000..1e5558de --- /dev/null +++ b/SDK/SRCS/testDc/dreamcast.mak @@ -0,0 +1,4 @@ + +all-after : + dc-tool -e -x $(BIN) + diff --git a/SDK/SRCS/testDc/main.c b/SDK/SRCS/testDc/main.c new file mode 100644 index 00000000..4a696ac4 --- /dev/null +++ b/SDK/SRCS/testDc/main.c @@ -0,0 +1,24 @@ +#include + +int main(int argc, char **argv) { + int x, y; + + /* Bother us with output only if something died */ + dbglog_set_level(DBG_DEAD); + + /* Set the video mode */ + vid_set_mode(DM_640x480, PM_RGB565); + + for (y=0; y<480; y++) + for (x=0; x<640; x++) { + int c = (x ^ y) & 255; + vram_s[y*640+x] = ((c >> 3) << 12) + | ((c >> 2) << 5) + | ((c >> 3) << 0); + } + + /* Pause to see the results */ + usleep(5*1000*1000); + + return 0; +} diff --git a/SDK/SRCS/testDc/startup.o b/SDK/SRCS/testDc/startup.o new file mode 100644 index 00000000..03251a83 Binary files /dev/null and b/SDK/SRCS/testDc/startup.o differ diff --git a/SDK/SRCS/testDc/testdc.dev b/SDK/SRCS/testDc/testdc.dev new file mode 100644 index 00000000..9f5f6e39 --- /dev/null +++ b/SDK/SRCS/testDc/testdc.dev @@ -0,0 +1,75 @@ +[Project] +FileName=testdc.dev +Name=testdc +UnitCount=2 +Type=1 +Ver=1 +ObjFiles= +Includes=C:\WIN32\Dev-cpp\dcinclude +Libs=C:\WIN32\Dev-cpp\dclib +PrivateResource= +ResourceIncludes= +MakeIncludes=dreamcast.mak +Compiler=-Wall -g -ml -m4-single-only -O2 -fno-builtin -fno-strict-aliasing -fomit-frame-pointer -fno-optimize-sibling-calls _@@_-D_arch_dreamcast_@@_ +CppCompiler= +Linker=-ml -m4-single-only -nostartfiles -nostdlib -Wl,-Ttext=0x8c010000_@@_startup.o_@@_-lkallisti -lgcc_@@_ +IsCpp=0 +Icon= +ExeOutput= +ObjectOutput= +OverrideOutput=1 +OverrideOutputName=testdc.elf +HostApplication= +Folders= +CommandLine= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=1 +CompilerSettings=000000000000000000 + +[Unit1] +FileName=main.c +CompileCpp=0 +Folder= +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd=$(CC) -c main.c -o main.o $(CFLAGS) + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion= +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 + +[Unit3] +FileName=dreamcast.mak +Folder=testdc +Compile=0 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit2] +FileName=dreamcast.mak +Folder=testdc +Compile=0 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/SDK/SRCS/tunnel/dreamcast.mak b/SDK/SRCS/tunnel/dreamcast.mak new file mode 100644 index 00000000..9b3cfe47 --- /dev/null +++ b/SDK/SRCS/tunnel/dreamcast.mak @@ -0,0 +1,11 @@ +romdisk.img: + genromfs -f romdisk.img -d romdisk -v + +romdisk.o: romdisk.img + bin2o romdisk.img romdisk romdisk.o + +all-before: romdisk.o + + +all-after : +# dc-tool -e -x $(BIN) diff --git a/SDK/SRCS/tunnel/menu.cpp b/SDK/SRCS/tunnel/menu.cpp new file mode 100644 index 00000000..365a9bc8 --- /dev/null +++ b/SDK/SRCS/tunnel/menu.cpp @@ -0,0 +1,157 @@ +/* Kallistios 1.2.0 + + menu.cpp + (c)2001,2002 Paul Boese a.k.a. Axlen + + A cheap little menu class +*/ + +#include +#include +#include +#include +#include "plprint.h" +#include "menu.h" + +CVSID("$Id: menu.cpp,v 1.1 2002/03/04 02:57:32 axlen Exp $"); + +void Menu::add(int min, int max, int amt, int* pval, char *pformat) { + Menuitem_t* madd; + if (mlist == NULL) { + mlist = (Menuitem_t*) malloc(sizeof(Menuitem_t)); + mlist->prev = NULL; + mlist->next = NULL; + madd = mcur = mtail = mlist; + } else { + madd = (Menuitem_t*) malloc(sizeof(Menuitem_t)); + mtail->next = madd; + madd->prev = mtail; + madd->next = NULL; + mtail = madd; + } + madd->type = INTEGER_T; + madd->min = min; + madd->max = max; + madd->amt = amt; + madd->pvalue = pval; + madd->pformat = (char*) malloc(strlen(pformat)+1); + memcpy(madd->pformat, pformat, strlen(pformat)+1); + printf("[i**]menu->add = %d\n", strlen(pformat)+1); +} +void Menu::add(float min, float max, float amt, float* pval, char *pformat) { + Menuitem_t* madd; + if (mlist == NULL) { + mlist = (Menuitem_t*) malloc(sizeof(Menuitem_t)); + mlist->prev = NULL; + mlist->next = NULL; + madd = mcur = mtail = mlist; + } else { + madd = (Menuitem_t*) malloc(sizeof(Menuitem_t)); + mtail->next = madd; + madd->prev = mtail; + madd->next = NULL; + mtail = madd; + } + madd->type = FLOAT_T; + uf2i.f = min; madd->min = uf2i.i; + uf2i.f = max; madd->max = uf2i.i; + uf2i.f = amt; madd->amt = uf2i.i; + (float *)madd->pvalue = (float *)pval; + madd->pformat = (char*) malloc(strlen(pformat)+1); + memcpy(madd->pformat, pformat, strlen(pformat)+1); + printf("[f**]menu->add = %d\n", strlen(pformat)+1); +} +void Menu::next() { + if (mcur == NULL) return; + if (mcur->next != NULL) { + // point to next menu item + mcur = mcur->next; + } else { + // wrap around to first menu item + mcur = mlist; + } +} + +void Menu::prev() { + if (mcur == NULL) return; + if (mcur->prev != NULL) { + // point to prev menu item + mcur = mcur->prev; + } else { + // wrap around to last menu item + mcur = mtail; + } +} + +void Menu::inc() { + int tmp; + float fmp; + + if (mcur == NULL) return; + switch(mcur->type) { + case INTEGER_T: + tmp = *mcur->pvalue; + tmp += mcur->amt; + if (tmp > mcur->max) + return; + (*mcur->pvalue) = tmp; + break; + case FLOAT_T: + fmp = (float)*(float *)mcur->pvalue; + uf2i.i = mcur->amt; fmp += uf2i.f; + uf2i.i = mcur->max; + if (fmp > uf2i.f) + return; + (*(float *)mcur->pvalue) = fmp; + break; + } +} + +void Menu::dec() { + int tmp; + float fmp; + + if (mcur == NULL) return; + switch(mcur->type) { + case INTEGER_T: + tmp = *mcur->pvalue; + tmp -= mcur->amt; + if (tmp < mcur->min) + return; + (*mcur->pvalue) = tmp; + break; + case FLOAT_T: + fmp = (float)*(float *)mcur->pvalue; + uf2i.i = mcur->amt; fmp -= uf2i.f; + uf2i.i = mcur->min; + if (fmp < uf2i.f) + return; + (*(float *)mcur->pvalue) = fmp; + break; + } +} + +void Menu::draw(int x, int y, int yinc) { + Menuitem_t* pmi = mlist; + int cy = y; + char buf[80]; + + while (pmi != NULL) { + if(pmi->type == INTEGER_T) + sprintf(buf, pmi->pformat, *pmi->pvalue); + else + sprintf(buf, pmi->pformat, (float)*(float*)pmi->pvalue); + if (pmi == mcur) { + plprint(x,cy, 1.0f, 1.0f, 0.0f, buf, 1); + } else { + plprint(x,cy, 0.8f, 0.8f, 0.8f, buf, 1); + } + cy += yinc; + pmi = pmi->next; + } +} + +Menuitem_t* Menu::mlist = NULL; +Menuitem_t* Menu::mtail = NULL; +Menuitem_t* Menu::mcur = NULL; +union uf2i_t Menu::uf2i; diff --git a/SDK/SRCS/tunnel/menu.h b/SDK/SRCS/tunnel/menu.h new file mode 100644 index 00000000..58b57e71 --- /dev/null +++ b/SDK/SRCS/tunnel/menu.h @@ -0,0 +1,66 @@ +/* Kallistios 1.2.0 + + menu.h + (c)2001,2002 Paul Boese a.k.a. Axlen + + A cheap little menu class + + $Id: menu.h,v 1.1 2002/03/04 02:57:32 axlen Exp $ +*/ + +#ifndef __MENU_H +#define __MENU_H + +#ifndef NULL +#define NULL 0 +#endif +#define FLOAT_T 0 +#define INTEGER_T 1 + +typedef struct Menuitem_t { + int type; + int min; + int max; + int amt; + int* pvalue; + char* pformat; + Menuitem_t* prev; + Menuitem_t* next; +}; + +union uf2i_t { + int i; + float f; +}; + +class Menu { + + protected: + + static Menuitem_t* mlist; + static Menuitem_t* mtail; + static Menuitem_t* mcur; + static union uf2i_t uf2i; + + public: + + Menu () { + mlist = mtail = mcur = NULL; + } + + void add(int min, int max, int amt, int* pval, char *pformat); + + void add(float min, float max, float amt, float* pval, char *pformat); + + void next(); + + void prev(); + + void inc(); + + void dec(); + + void draw(int x, int y, int yinc); +}; + +#endif /* __MENU_H */ diff --git a/SDK/SRCS/tunnel/plprint.cpp b/SDK/SRCS/tunnel/plprint.cpp new file mode 100644 index 00000000..3a052bb2 --- /dev/null +++ b/SDK/SRCS/tunnel/plprint.cpp @@ -0,0 +1,48 @@ +/* KallistiOS 1.2.0 + + plprint.cpp + (c)2002 Paul Boese + + Uses Steve Baker's PLIB that was ported by Peter Hatch. +*/ + +#include +#include +#include +#include "plprint.h" + +CVSID("$Id: plprint.cpp,v 1.2 2002/04/12 01:05:12 axlen Exp $"); + +extern uint8 romdisk[]; + +static fntRenderer *text; +static fntTexFont *font; + +static int filter_mode = 1; + +void plinit() { + text = new fntRenderer (); + font = new fntTexFont("/rd/courier-bold.txf"); + printf("Loading font\n"); +} + +void plprint(int x, int y, float r, float g, float b, const char *s, int fp) { + text->setFilterMode(filter_mode); + font->setFixedPitch(fp); + if ((fp) == 1) { + font->setGap(0.1); + font->setWidth(0.5); + } + else { + font->setGap(0.1); + font->setWidth(1.0); + } + text->setFont(font); + text->setPointSize(20); + text->begin(); + text->setColor(r, g, b, 0.8f); + text->start2f(x*16, y*16); + text->puts(s); + text->end(); +} + diff --git a/SDK/SRCS/tunnel/plprint.h b/SDK/SRCS/tunnel/plprint.h new file mode 100644 index 00000000..b8bcbc9d --- /dev/null +++ b/SDK/SRCS/tunnel/plprint.h @@ -0,0 +1,23 @@ +/* KallistiOS 1.2.0 + + plprint.h + (c)2002 Paul Boese + + $Id: plprint.h,v 1.1 2002/03/04 02:57:32 axlen Exp $ +*/ + +#ifndef __PLPRINT_H +#define __PLPRINT_H + +#include +__BEGIN_DECLS + +#include + +void plinit(); + +void plprint(int x, int y, float r, float g, float b, const char *s, int fp); + +__END_DECLS + +#endif /* __PLPRINT_H */ diff --git a/SDK/SRCS/tunnel/romdisk/bw.pcx b/SDK/SRCS/tunnel/romdisk/bw.pcx new file mode 100644 index 00000000..926a566f Binary files /dev/null and b/SDK/SRCS/tunnel/romdisk/bw.pcx differ diff --git a/SDK/SRCS/tunnel/romdisk/courier-bold.txf b/SDK/SRCS/tunnel/romdisk/courier-bold.txf new file mode 100644 index 00000000..3bdf0db6 Binary files /dev/null and b/SDK/SRCS/tunnel/romdisk/courier-bold.txf differ diff --git a/SDK/SRCS/tunnel/romdisk/tile.pcx b/SDK/SRCS/tunnel/romdisk/tile.pcx new file mode 100644 index 00000000..64e2cb74 Binary files /dev/null and b/SDK/SRCS/tunnel/romdisk/tile.pcx differ diff --git a/SDK/SRCS/tunnel/startup.o b/SDK/SRCS/tunnel/startup.o new file mode 100644 index 00000000..03251a83 Binary files /dev/null and b/SDK/SRCS/tunnel/startup.o differ diff --git a/SDK/SRCS/tunnel/tunnel.cpp b/SDK/SRCS/tunnel/tunnel.cpp new file mode 100644 index 00000000..ac99cc2a --- /dev/null +++ b/SDK/SRCS/tunnel/tunnel.cpp @@ -0,0 +1,484 @@ +/* KallistiOS 1.2.0 + + tunnel.cpp + (c)2002 Paul Boese + + Adapted from the Mesa tunnel demo by David Bucciarelli +*/ +#include +#include +#include +#include +#include "plprint.h" +#include "menu.h" + +CVSID("$Id: tunnel.cpp,v 1.7 2003/03/09 01:20:06 bardtx Exp $"); + +#define DPAD_REPEAT_INTERVAL 7 /* frames */ + +/* tunnel */ +#define NUMBLOC 11 +extern int striplength_skin_13[]; +extern float stripdata_skin_13[]; + +extern int striplength_skin_12[]; +extern float stripdata_skin_12[]; + +extern int striplength_skin_11[]; +extern float stripdata_skin_11[]; + +extern int striplength_skin_9[]; +extern float stripdata_skin_9[]; + +static float obs[3] = { 1000.0, 0.0, 2.0 }; +static float dir[3]; +static int velocity = 10; +static float v = 0.1; +static float alpha = 90.0; +static float beta = 90.0; + +/* fog */ +static float density = 0.04; +static float fogcolor[4] = { 0.7, 0.7, 0.7, 1.0 }; +static float last_density = density; + +/* misc state */ +static int usefog = 1; +static int textog = 1; +static int cstrip = 0; +static int cullface = 0; +static int help = 1; +static int joyactive = 0; + +/* texture */ +static GLuint t1id, t2id; + +static Menu* fm; + +/* our own fmod cuz the newlib ieee32 version is broken! */ +static float fmod(float x, float y) { + int n; + n = (int)(x/y); + return x - (float)n*y; +} + +#define FABS(n) ((((n) < 0.0) ? (-1.0*(n)) : (n))) + +/*************************************************************************/ + +static void +drawobjs(int *l, float *f) +{ + int mend, j; + + if (cstrip) { + float r = 0.33, g = 0.33, b = 0.33; + + for (; (*l) != 0;) { + mend = *l++; + + r += 0.33; + if (r > 1.0) { + r = 0.33; + g += 0.33; + if (g > 1.0) { + g = 0.33; + b += 0.33; + if (b > 1.0) + b = 0.33; + } + } + + glColor3f(r, g, b); + glBegin(GL_TRIANGLE_STRIP); + for (j = 0; j < mend; j++) { + f += 4; + glTexCoord2fv(f); + f += 2; + glVertex3fv(f); + f += 3; + } + glEnd(); + } + } + else + for (; (*l) != 0;) { + mend = *l++; + + glBegin(GL_TRIANGLE_STRIP); + for (j = 0; j < mend; j++) { + glColor4fv(f); + f += 4; + glTexCoord2fv(f); + f += 2; + glVertex3fv(f); + f += 3; + } + glEnd(); + } +} + +static void calcposobs(void) { + dir[0] = fsin(alpha * F_PI / 180.0); + dir[1] = fcos(alpha * F_PI / 180.0) * fsin(beta * F_PI / 180.0); + dir[2] = fcos(beta * F_PI / 180.0); + + obs[0] += v * dir[0]; + obs[1] += v * dir[1]; + obs[2] += v * dir[2]; +} + +static void draw(void) +{ + int i; + float base, offset; + if (usefog & 1) { + glEnable(GL_FOG); + } else + glDisable(GL_FOG); + + if (textog & 1) { + glEnable(GL_TEXTURE_2D); + } else + glDisable(GL_TEXTURE_2D); + + if (cullface & 1) { + glEnable(GL_CULL_FACE); + } else + glDisable(GL_CULL_FACE); + + glPushMatrix(); + calcposobs(); + gluLookAt(obs[0], obs[1], obs[2], + obs[0] + dir[0], obs[1] + dir[1], obs[2] + dir[2], + 0.0, 0.0, 1.0); + + if (dir[0] > 0) { + offset = 8.0; + base = obs[0] - fmod(obs[0], 8.0); + } else { + offset = -8.0; + base = obs[0] + (8.0 - fmod(obs[0], 8.0)); + } + + glPushMatrix(); + glTranslatef((base - offset / 2.0), 0.0, 0.0); + for (i = 0; i < NUMBLOC; i++) { + glTranslatef(offset, 0.0, 0.0); + glBindTexture(GL_TEXTURE_2D, t1id); + drawobjs(striplength_skin_11, stripdata_skin_11); + glBindTexture(GL_TEXTURE_2D, t2id); + drawobjs(striplength_skin_12, stripdata_skin_12); + drawobjs(striplength_skin_9, stripdata_skin_9); + drawobjs(striplength_skin_13, stripdata_skin_13); + } + glPopMatrix(); + glPopMatrix(); +} + +/*************************************************************************/ + +static void rect(int x, int y, int w, int h) { + glBegin(GL_QUADS); + glVertex3f(x,y,0); + glVertex3f(x+w,y,0); + glVertex3f(x+w,y+h,0); + glVertex3f(x,y+h,0); + glEnd(); +} + +/* Load a texture using pcx_load_texture and glKosTex2D */ +void loadtxr(const char *fn, GLuint *txr) { + kos_img_t img; + pvr_ptr_t txaddr; + + if (pcx_to_img(fn, &img) < 0) { + printf("can't load %s\n", fn); + return; + } + + txaddr = pvr_mem_malloc(img.w * img.h * 2); + pvr_txr_load_kimg(&img, txaddr, PVR_TXRLOAD_INVERT_Y); + kos_img_free(&img, 0); + + glGenTextures(1, txr); + glBindTexture(GL_TEXTURE_2D, *txr); + glKosTex2D(GL_RGB565_TWID, img.w, img.h, txaddr); +} + +pvr_init_params_t params = { + /* Enable opaque and punchthru polygons with size 16 */ + { PVR_BINSIZE_32, PVR_BINSIZE_0, PVR_BINSIZE_32, PVR_BINSIZE_0, PVR_BINSIZE_0 }, + + /* Vertex buffer size 512K */ + 512*1024 +}; + +extern uint8 romdisk[]; +KOS_INIT_ROMDISK(romdisk); + +static void do_init() { + pvr_init(¶ms); + printf("[DCTunnel] KGL Initialing\n"); + + /* Setup KGL */ + glKosInit(); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(45.0, 640.0f/480.0f, 1.0, 50.0); + glMatrixMode(GL_MODELVIEW); + glEnable(GL_TEXTURE_2D); + glClearColor(0.7f, 0.7f, 0.7f, 1.0f); + glShadeModel(GL_SMOOTH); + glDisable(GL_DEPTH_TEST); + glDepthMask(GL_TRUE); + glDepthFunc(GL_LESS); + + /* fog */ + glEnable(GL_FOG); + glFogi(GL_FOG_MODE, GL_EXP2); + glFogfv(GL_FOG_COLOR, fogcolor); + glFogf(GL_FOG_DENSITY, density); + glHint(GL_FOG_HINT, GL_NICEST); + + /* textures */ + printf("[DCTunnel] Loading Textures\n"); + loadtxr("/rd/tile.pcx", &t1id); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_FILTER, GL_FILTER_BILINEAR); + loadtxr("/rd/bw.pcx", &t2id); + + /* PLIB for fonts */ + plinit(); + + /* Setup Menu */ + printf("[DCTunnel] Initializing Menu\n"); + fm = (Menu*) malloc(sizeof(Menu)); + /* min max amt pvalue format */ + fm->add(0, 1, 1, &cstrip, "See Strips....... %d"); + fm->add(0, 1, 1, &usefog, "Fog.............. %d"); + fm->add(0.0, 1.0, 0.001, &density, "Fog Density...... %1.3f"); + fm->add(0, 1, 1, &textog, "Texture.......... %d"); + fm->add(0, 1, 1, &cullface, "Cull Backface.... %d"); + fm->add(-100, 100, 1, &velocity, "Velocity......... %+03d"); + + calcposobs(); +} + +static void reset_view() { + velocity = 10; + alpha = 90.0; + beta = 90.0; + obs[0] = 1000.0; + obs[1] = 0.0; + obs[2] = 2.0; +} + +void do_help() { + glPushMatrix(); + glLoadIdentity(); + glOrtho(0,640,0,480,-1,0); + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + + glDisable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glColor4f(0.0, 0.0, 0.0, 0.5); + rect(150, 120, 340, 220); + + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); + + glEnable(GL_TEXTURE_2D); + fm->draw(11, 11, 2); +} + +static void do_text() { + plprint(1, 1, 1.0f, 0.0f, 0.0f, + "Tunnel V1.5 Written by David Bucciarelli", 0); + if (help) { + plprint(1, 29, 1.0f, 0.0f, 0.0f, + "[Y][D-Pad] help [A] Reset [L/R] Velocity", 0); + plprint(1, 27, 1.0f, 0.0f, 0.0f, "[Joystick]", 0); + } +} + +typedef struct JOYINFO { + float wXpos; + float wYpos; +}; + +static float max[2] = { 0.0, 0.0 }; +static float min[2] = { 255.0, 255.0 }, center[2]; +static void do_joy(cont_cond_t *cond) { + + JOYINFO joy; + + joy.wXpos = (float)cond->joyx; + joy.wYpos = (float)cond->joyy; + + if (!joyactive) { + /* save joystick center */ + if (max[0] < joy.wXpos) + max[0] = joy.wXpos; + if (min[0] > joy.wXpos) + min[0] = joy.wXpos; + center[0] = (max[0] + min[0]) / 2.0; + + if (max[1] < joy.wYpos) + max[1] = joy.wYpos; + if (min[1] > joy.wYpos) + min[1] = joy.wYpos; + center[1] = (max[1] + min[1]) / 2.0; + joyactive = 1; + } + + if (joyactive){ + /* use joystick values */ + if (FABS(center[0] - joy.wXpos) > 5.0 ) + alpha -= (center[0] - joy.wXpos)/100.0f; + if (FABS(center[1] - joy.wYpos) > 5.0 ) + beta += (center[1] - joy.wYpos)/100.0f; + } + + + /* left/right trigger control velocity */ + if ((cond->rtrig > 128) && (velocity < 100)) + velocity += 1; + if ((cond->ltrig > 128) && (velocity > -100)) + velocity -= 1; + /* both triggers - full stop */ + if ((cond->ltrig > 128) && (cond->rtrig > 128)) + velocity = 0; +} + +static GLboolean yp = GL_FALSE; +int do_controller(uint8 c) { + static int dpad = 0; + static int dpadrep = DPAD_REPEAT_INTERVAL; + static cont_cond_t cond; + + /* Check key status */ + if (cont_get_cond(c, &cond) < 0) + return 0; + if (!(cond.buttons & CONT_START)) + return 0; + + /* DPAD Menu controls */ + if (!(cond.buttons & CONT_DPAD_UP)) { + if (dpad == 0) { + dpad |= 0x1000; + if (help) { + fm->prev(); + } else + ; + } + } else + dpad &= ~0x1000; + + if (!(cond.buttons & CONT_DPAD_DOWN)) { + if (dpad == 0) { + dpad |= 0x0100; + if (help) { + fm->next(); + } else + ; + } + } else + dpad &= ~0x0100; + + if (!(cond.buttons & CONT_DPAD_LEFT)) { + if (dpad == 0) { + dpad |= 0x0001; + if (help) { + fm->dec(); + } else + ; + } + } else + dpad &= ~0x0001; + + if (!(cond.buttons & CONT_DPAD_RIGHT)) { + if (dpad == 0) { + dpad |= 0x0010; + if (help) { + fm->inc(); + } else + ; + } + } else + dpad &= ~0x0010; + + // cheap dpad hold and repeat... + if (dpad != 0) { + dpadrep--; + if (dpadrep < 0) { + dpadrep = DPAD_REPEAT_INTERVAL; + dpad = 0; + } + } else + dpadrep = DPAD_REPEAT_INTERVAL; + + /* Help toggle */ + if (!(cond.buttons & CONT_Y) && !yp) { + yp = GL_TRUE; + help = !help; + } + if (cond.buttons & CONT_Y) + yp = GL_FALSE; + + /* Reset view */ + if (!(cond.buttons & CONT_A)) + reset_view(); + + do_joy(&cond); + + v = (float)(velocity/100.0f); + + if (last_density != density) { + glFogf(GL_FOG_DENSITY, density); + last_density = density; + } + return 1; +} /* do_controller */ + +extern uint8 romdisk[]; +int main(void) { + uint8 c; + pvr_stats_t stats; + + do_init(); + + c = maple_first_controller(); + + printf("[DCTunnel] Entering Main Loop\n"); + while(1) { + if (!do_controller(c)) + break; + + /* Begin frame */ + glKosBeginFrame(); + glLoadIdentity(); + + draw(); + + /* Done with Opaque Polys */ + glKosFinishList(); + glDisable(GL_FOG); + + if (help) + do_help(); + do_text(); + + /* Finish the frame */ + glKosFinishFrame(); + } + + pvr_get_stats(&stats); + printf("VBL Count: %d, last_time: %f, frame rate: %f fps\n", + stats.vbl_count, stats.frame_last_time, stats.frame_rate); + + printf("[DCTunnel] Exited main loop\n"); + return 0; +} diff --git a/SDK/SRCS/tunnel/tunnel.dev b/SDK/SRCS/tunnel/tunnel.dev new file mode 100644 index 00000000..6889f196 --- /dev/null +++ b/SDK/SRCS/tunnel/tunnel.dev @@ -0,0 +1,126 @@ +[Project] +FileName=tunnel.dev +Name=tunnel +UnitCount=7 +Type=1 +Ver=1 +ObjFiles= +Includes= +Libs= +PrivateResource= +ResourceIncludes= +MakeIncludes=dreamcast.mak +Compiler=-Wall -g -ml -m4-single-only -O2 -fno-builtin -fno-strict-aliasing -fomit-frame-pointer -fno-optimize-sibling-calls _@@_-D_arch_dreamcast_@@__@@_ +CppCompiler=-Wall -g -ml -m4-single-only -O2 -fno-builtin -fno-strict-aliasing -fomit-frame-pointer -fno-optimize-sibling-calls _@@_-D_arch_dreamcast_@@_-fno-operator-names -fno-rtti -fno-exceptions_@@_ +Linker=-ml -m4-single-only -nostartfiles -nostdlib -Wl,-Ttext=0x8c010000_@@_startup.o romdisk.o_@@_-ldcplib -lk++ -lstdc++ -lgl -lpcx -lm -lkallisti -lgcc_@@__@@_ +IsCpp=1 +Icon= +ExeOutput= +ObjectOutput= +OverrideOutput=1 +OverrideOutputName=tunnel.elf +HostApplication= +Folders= +CommandLine= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=1 +CompilerSettings=000000000000000000 + +[Unit1] +FileName=tunneldat.c +CompileCpp=1 +Folder=tunnel +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit2] +FileName=menu.h +CompileCpp=1 +Folder=tunnel +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit3] +FileName=plprint.cpp +CompileCpp=1 +Folder=tunnel +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit4] +FileName=plprint.h +CompileCpp=1 +Folder=tunnel +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit5] +FileName=tunnel.cpp +CompileCpp=1 +Folder=tunnel +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit6] +FileName=menu.cpp +CompileCpp=1 +Folder=tunnel +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit7] +FileName=dreamcast.mak +CompileCpp=1 +Folder=tunnel +Compile=0 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion= +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 + +[Unit8] +FileName=dreamcast.mak +Folder=tunnel +Compile=0 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/SDK/SRCS/tunnel/tunneldat.c b/SDK/SRCS/tunnel/tunneldat.c new file mode 100644 index 00000000..a4506694 --- /dev/null +++ b/SDK/SRCS/tunnel/tunneldat.c @@ -0,0 +1,83 @@ +/* Object: skin_13 */ + +#if defined(_MSC_VER) && defined(_WIN32) +#pragma warning( disable : 4305 ) /* 'initializing' : truncation from 'const double' to 'float' */ +#endif + +int striplength_skin_13[]={ +10,7,3,5,5,4,4,4,4,5,3,4,5,4,4,4,4,4,4,6, +6,3,6,3,3,3,3,0}; + +float stripdata_skin_13[]={ +0.415686,0.415686,0.415686,1.000000,0.000000,1.500000,2.000000,4.000000,0.000000,0.341176,0.341176,0.341176,1.000000,-0.500000,1.500000,4.000000,4.000000,0.000000,0.545098,0.545098,0.545098,1.000000,0.000000,1.000000,2.000000,4.000000,2.000000,0.435294,0.435294,0.435294,1.000000,-0.500000,1.000000,4.000000,4.000000,2.000000,0.517647,0.517647,0.517647,1.000000,0.000000,0.500000,2.000000,4.000000,4.000000,0.450980,0.450980,0.450980,1.000000,-0.500000,0.500000,4.000000,4.000000,4.000000,0.427451,0.427451,0.427451,1.000000,0.000000,0.000000,2.000000,4.000000,6.000000,0.388235,0.388235,0.388235,1.000000,-0.500000,0.000000,4.000000,4.000000,6.000000,0.356863,0.356863,0.356863,1.000000,0.000000,-0.500000,2.000000,4.000000,8.000000,0.333333,0.333333,0.333333,1.000000,-0.500000,-0.500000,4.000000,4.000000,8.000000, +0.435294,0.435294,0.435294,1.000000,1.500000,1.000000,-4.000000,4.000000,2.000000,0.415686,0.415686,0.415686,1.000000,1.000000,1.500000,-2.000000,4.000000,0.000000,0.545098,0.545098,0.545098,1.000000,1.000000,1.000000,-2.000000,4.000000,2.000000,0.450980,0.450980,0.450980,1.000000,0.500000,1.500000,0.000000,4.000000,0.000000,0.600000,0.600000,0.600000,1.000000,0.500000,1.000000,0.000000,4.000000,2.000000,0.415686,0.415686,0.415686,1.000000,0.000000,1.500000,2.000000,4.000000,0.000000,0.545098,0.545098,0.545098,1.000000,0.000000,1.000000,2.000000,4.000000,2.000000, +0.435294,0.435294,0.435294,1.000000,1.500000,1.000000,-4.000000,4.000000,2.000000,0.341176,0.341176,0.341176,1.000000,1.500000,1.500000,-4.000000,4.000000,0.000000,0.415686,0.415686,0.415686,1.000000,1.000000,1.500000,-2.000000,4.000000,0.000000, +0.356863,0.356863,0.356863,1.000000,0.000000,-0.500000,2.000000,4.000000,8.000000,0.364706,0.364706,0.364706,1.000000,0.500000,-0.500000,0.000000,4.000000,8.000000,0.427451,0.427451,0.427451,1.000000,0.000000,0.000000,2.000000,4.000000,6.000000,0.415686,0.415686,0.415686,1.000000,0.395020,-0.133318,0.420032,4.000000,6.533272,0.423529,0.423529,0.423529,1.000000,0.388550,-0.103582,0.445932,4.000000,6.414327, +0.423529,0.423529,0.423529,1.000000,0.388550,-0.103582,0.445932,4.000000,6.414327,0.427451,0.427451,0.427451,1.000000,0.383423,-0.069344,0.466541,4.000000,6.277375,0.427451,0.427451,0.427451,1.000000,0.000000,0.000000,2.000000,4.000000,6.000000,0.435294,0.435294,0.435294,1.000000,0.380371,-0.034595,0.478689,4.000000,6.138380,0.439216,0.439216,0.439216,1.000000,0.379272,0.000000,0.482673,4.000000,6.000000, +0.407843,0.407843,0.407843,1.000000,0.414673,-0.191394,0.341301,4.000000,6.765576,0.411765,0.411765,0.411765,1.000000,0.403687,-0.162957,0.385368,4.000000,6.651829,0.364706,0.364706,0.364706,1.000000,0.500000,-0.500000,0.000000,4.000000,8.000000,0.415686,0.415686,0.415686,1.000000,0.395020,-0.133318,0.420032,4.000000,6.533272, +0.400000,0.400000,0.400000,1.000000,0.438232,-0.232438,0.247284,4.000000,6.929754,0.403922,0.403922,0.403922,1.000000,0.425171,-0.212276,0.299425,4.000000,6.849104,0.364706,0.364706,0.364706,1.000000,0.500000,-0.500000,0.000000,4.000000,8.000000,0.407843,0.407843,0.407843,1.000000,0.414673,-0.191394,0.341301,4.000000,6.765576, +0.396078,0.396078,0.396078,1.000000,0.467285,-0.260554,0.130636,4.000000,7.042214,0.400000,0.400000,0.400000,1.000000,0.453857,-0.250068,0.184711,4.000000,7.000273,0.364706,0.364706,0.364706,1.000000,0.500000,-0.500000,0.000000,4.000000,8.000000,0.400000,0.400000,0.400000,1.000000,0.438232,-0.232438,0.247284,4.000000,6.929754, +0.396078,0.396078,0.396078,1.000000,0.500000,-0.270672,0.000000,4.000000,7.082688,0.396078,0.396078,0.396078,1.000000,0.482788,-0.267902,0.068730,4.000000,7.071609,0.364706,0.364706,0.364706,1.000000,0.500000,-0.500000,0.000000,4.000000,8.000000,0.396078,0.396078,0.396078,1.000000,0.467285,-0.260554,0.130636,4.000000,7.042214, +0.439216,0.439216,0.439216,1.000000,0.379272,0.000000,0.482673,4.000000,6.000000,0.474510,0.474510,0.474510,1.000000,0.379272,0.180448,0.482673,4.000000,5.278208,0.517647,0.517647,0.517647,1.000000,0.000000,0.500000,2.000000,4.000000,4.000000,0.513726,0.513726,0.513726,1.000000,0.379272,0.360896,0.482673,4.000000,4.556417,0.545098,0.545098,0.545098,1.000000,0.379272,0.500000,0.482673,4.000000,4.000000, +0.545098,0.545098,0.545098,1.000000,0.379272,0.500000,0.482673,4.000000,4.000000,0.545098,0.545098,0.545098,1.000000,0.000000,1.000000,2.000000,4.000000,2.000000,0.517647,0.517647,0.517647,1.000000,0.000000,0.500000,2.000000,4.000000,4.000000, +0.600000,0.600000,0.600000,1.000000,0.500000,1.000000,0.000000,4.000000,2.000000,0.545098,0.545098,0.545098,1.000000,0.000000,1.000000,2.000000,4.000000,2.000000,0.552941,0.552941,0.552941,1.000000,0.379272,0.541344,0.482673,4.000000,3.834625,0.545098,0.545098,0.545098,1.000000,0.379272,0.500000,0.482673,4.000000,4.000000, +0.552941,0.552941,0.552941,1.000000,0.379272,0.541344,0.482673,4.000000,3.834625,0.556863,0.556863,0.556863,1.000000,0.459717,0.541344,0.160891,4.000000,3.834625,0.600000,0.600000,0.600000,1.000000,0.500000,1.000000,0.000000,4.000000,2.000000,0.556863,0.556863,0.556863,1.000000,0.500000,0.541344,0.000000,4.000000,3.834625,0.556863,0.556863,0.556863,1.000000,0.540283,0.541344,-0.160891,4.000000,3.834625, +0.396078,0.396078,0.396078,1.000000,0.517212,-0.267902,-0.068730,4.000000,7.071609,0.396078,0.396078,0.396078,1.000000,0.500000,-0.270672,0.000000,4.000000,7.082688,0.356863,0.356863,0.356863,1.000000,1.000000,-0.500000,-2.000000,4.000000,8.000000,0.364706,0.364706,0.364706,1.000000,0.500000,-0.500000,0.000000,4.000000,8.000000, +0.400000,0.400000,0.400000,1.000000,0.546143,-0.250068,-0.184711,4.000000,7.000273,0.396078,0.396078,0.396078,1.000000,0.532715,-0.260554,-0.130636,4.000000,7.042214,0.356863,0.356863,0.356863,1.000000,1.000000,-0.500000,-2.000000,4.000000,8.000000,0.396078,0.396078,0.396078,1.000000,0.517212,-0.267902,-0.068730,4.000000,7.071609, +0.403922,0.403922,0.403922,1.000000,0.574829,-0.212276,-0.299425,4.000000,6.849104,0.400000,0.400000,0.400000,1.000000,0.561768,-0.232438,-0.247284,4.000000,6.929754,0.356863,0.356863,0.356863,1.000000,1.000000,-0.500000,-2.000000,4.000000,8.000000,0.400000,0.400000,0.400000,1.000000,0.546143,-0.250068,-0.184711,4.000000,7.000273, +0.411765,0.411765,0.411765,1.000000,0.596313,-0.162957,-0.385368,4.000000,6.651829,0.407843,0.407843,0.407843,1.000000,0.585327,-0.191394,-0.341301,4.000000,6.765576,0.356863,0.356863,0.356863,1.000000,1.000000,-0.500000,-2.000000,4.000000,8.000000,0.403922,0.403922,0.403922,1.000000,0.574829,-0.212276,-0.299425,4.000000,6.849104, +0.423529,0.423529,0.423529,1.000000,0.611450,-0.103582,-0.445931,4.000000,6.414327,0.415686,0.415686,0.415686,1.000000,0.604980,-0.133318,-0.420033,4.000000,6.533272,0.356863,0.356863,0.356863,1.000000,1.000000,-0.500000,-2.000000,4.000000,8.000000,0.411765,0.411765,0.411765,1.000000,0.596313,-0.162957,-0.385368,4.000000,6.651829, +0.435294,0.435294,0.435294,1.000000,0.619629,-0.034595,-0.478689,4.000000,6.138380,0.427451,0.427451,0.427451,1.000000,0.616577,-0.069344,-0.466541,4.000000,6.277375,0.356863,0.356863,0.356863,1.000000,1.000000,-0.500000,-2.000000,4.000000,8.000000,0.423529,0.423529,0.423529,1.000000,0.611450,-0.103582,-0.445931,4.000000,6.414327, +0.513726,0.513726,0.513726,1.000000,0.620728,0.360896,-0.482673,4.000000,4.556417,0.474510,0.474510,0.474510,1.000000,0.620728,0.180448,-0.482673,4.000000,5.278208,0.427451,0.427451,0.427451,1.000000,1.000000,0.000000,-2.000000,4.000000,6.000000,0.439216,0.439216,0.439216,1.000000,0.620728,0.000000,-0.482673,4.000000,6.000000,0.356863,0.356863,0.356863,1.000000,1.000000,-0.500000,-2.000000,4.000000,8.000000,0.435294,0.435294,0.435294,1.000000,0.619629,-0.034595,-0.478689,4.000000,6.138380, +0.333333,0.333333,0.333333,1.000000,1.500000,-0.500000,-4.000000,4.000000,8.000000,0.388235,0.388235,0.388235,1.000000,1.500000,0.000000,-4.000000,4.000000,6.000000,0.427451,0.427451,0.427451,1.000000,1.000000,0.000000,-2.000000,4.000000,6.000000,0.517647,0.517647,0.517647,1.000000,1.000000,0.500000,-2.000000,4.000000,4.000000,0.513726,0.513726,0.513726,1.000000,0.620728,0.360896,-0.482673,4.000000,4.556417,0.545098,0.545098,0.545098,1.000000,0.620728,0.500000,-0.482673,4.000000,4.000000, +0.333333,0.333333,0.333333,1.000000,1.500000,-0.500000,-4.000000,4.000000,8.000000,0.427451,0.427451,0.427451,1.000000,1.000000,0.000000,-2.000000,4.000000,6.000000,0.356863,0.356863,0.356863,1.000000,1.000000,-0.500000,-2.000000,4.000000,8.000000, +0.556863,0.556863,0.556863,1.000000,0.540283,0.541344,-0.160891,4.000000,3.834625,0.552941,0.552941,0.552941,1.000000,0.620728,0.541344,-0.482673,4.000000,3.834625,0.545098,0.545098,0.545098,1.000000,1.000000,1.000000,-2.000000,4.000000,2.000000,0.517647,0.517647,0.517647,1.000000,1.000000,0.500000,-2.000000,4.000000,4.000000,0.450980,0.450980,0.450980,1.000000,1.500000,0.500000,-4.000000,4.000000,4.000000,0.388235,0.388235,0.388235,1.000000,1.500000,0.000000,-4.000000,4.000000,6.000000, +0.517647,0.517647,0.517647,1.000000,1.000000,0.500000,-2.000000,4.000000,4.000000,0.552941,0.552941,0.552941,1.000000,0.620728,0.541344,-0.482673,4.000000,3.834625,0.545098,0.545098,0.545098,1.000000,0.620728,0.500000,-0.482673,4.000000,4.000000, +0.450980,0.450980,0.450980,1.000000,1.500000,0.500000,-4.000000,4.000000,4.000000,0.435294,0.435294,0.435294,1.000000,1.500000,1.000000,-4.000000,4.000000,2.000000,0.545098,0.545098,0.545098,1.000000,1.000000,1.000000,-2.000000,4.000000,2.000000, +0.439216,0.439216,0.439216,1.000000,0.379272,0.000000,0.482673,4.000000,6.000000,0.517647,0.517647,0.517647,1.000000,0.000000,0.500000,2.000000,4.000000,4.000000,0.427451,0.427451,0.427451,1.000000,0.000000,0.000000,2.000000,4.000000,6.000000, +0.556863,0.556863,0.556863,1.000000,0.540283,0.541344,-0.160891,4.000000,3.834625,0.545098,0.545098,0.545098,1.000000,1.000000,1.000000,-2.000000,4.000000,2.000000,0.600000,0.600000,0.600000,1.000000,0.500000,1.000000,0.000000,4.000000,2.000000 + +}; + + +/* Object: skin_12 */ + +int striplength_skin_12[]={ +12,12,12,12,12,0}; + +float stripdata_skin_12[]={ +0.498039,0.498039,0.498039,1.000000,-0.099976,1.500000,-2.400000,-4.000000,-0.000002,0.337255,0.337255,0.337255,1.000000,-0.500000,1.500000,-4.000000,-4.000000,-0.000002,0.568627,0.568627,0.568627,1.000000,-0.099976,1.100000,-2.400000,-4.000000,1.599999,0.341176,0.341176,0.341176,1.000000,-0.500000,1.100000,-4.000000,-4.000000,1.599999,0.498039,0.498039,0.498039,1.000000,-0.099976,0.700000,-2.400000,-4.000000,3.200000,0.325490,0.325490,0.325490,1.000000,-0.500000,0.700000,-4.000000,-4.000000,3.199999,0.352941,0.352941,0.352941,1.000000,-0.099976,0.300000,-2.400000,-4.000000,4.800000,0.282353,0.282353,0.282353,1.000000,-0.500000,0.300000,-4.000000,-4.000000,4.800000,0.282353,0.282353,0.282353,1.000000,-0.099976,-0.100000,-2.400000,-4.000000,6.400001,0.254902,0.254902,0.254902,1.000000,-0.500000,-0.100000,-4.000000,-4.000000,6.400000,0.239216,0.239216,0.239216,1.000000,-0.099976,-0.500000,-2.400000,-4.000000,8.000000,0.227451,0.227451,0.227451,1.000000,-0.500000,-0.500000,-4.000000,-4.000000,8.000000, +0.239216,0.239216,0.239216,1.000000,1.099976,-0.500000,2.400001,-4.000000,8.000000,0.227451,0.227451,0.227451,1.000000,1.500000,-0.500000,4.000002,-4.000000,8.000000,0.282353,0.282353,0.282353,1.000000,1.099976,-0.100000,2.400001,-4.000000,6.400001,0.254902,0.254902,0.254902,1.000000,1.500000,-0.100000,4.000002,-4.000000,6.400001,0.352941,0.352941,0.352941,1.000000,1.099976,0.300000,2.400002,-4.000000,4.800001,0.282353,0.282353,0.282353,1.000000,1.500000,0.300000,4.000002,-4.000000,4.800001,0.498039,0.498039,0.498039,1.000000,1.099976,0.700000,2.400002,-4.000000,3.200000,0.321569,0.321569,0.321569,1.000000,1.500000,0.700000,4.000003,-4.000000,3.200000,0.568627,0.568627,0.568627,1.000000,1.099976,1.100000,2.400002,-4.000000,1.599999,0.341176,0.341176,0.341176,1.000000,1.500000,1.100000,4.000003,-4.000000,1.599999,0.494118,0.494118,0.494118,1.000000,1.099976,1.500000,2.400003,-4.000000,-0.000002,0.337255,0.337255,0.337255,1.000000,1.500000,1.500000,4.000004,-4.000000,-0.000002, +0.639216,0.639216,0.639216,1.000000,0.300049,1.500000,-0.799999,-4.000000,-0.000002,0.498039,0.498039,0.498039,1.000000,-0.099976,1.500000,-2.400000,-4.000000,-0.000002,0.858824,0.858824,0.858824,1.000000,0.300049,1.100000,-0.799999,-4.000000,1.599999,0.568627,0.568627,0.568627,1.000000,-0.099976,1.100000,-2.400000,-4.000000,1.599999,0.686275,0.686275,0.686275,1.000000,0.300049,0.700000,-0.799999,-4.000000,3.200000,0.498039,0.498039,0.498039,1.000000,-0.099976,0.700000,-2.400000,-4.000000,3.200000,0.419608,0.419608,0.419608,1.000000,0.300049,0.300000,-0.800000,-4.000000,4.800000,0.352941,0.352941,0.352941,1.000000,-0.099976,0.300000,-2.400000,-4.000000,4.800000,0.298039,0.298039,0.298039,1.000000,0.300049,-0.100000,-0.800000,-4.000000,6.400001,0.282353,0.282353,0.282353,1.000000,-0.099976,-0.100000,-2.400000,-4.000000,6.400001,0.247059,0.247059,0.247059,1.000000,0.300049,-0.500000,-0.800000,-4.000000,8.000000,0.239216,0.239216,0.239216,1.000000,-0.099976,-0.500000,-2.400000,-4.000000,8.000000, +0.639216,0.639216,0.639216,1.000000,0.699951,1.500000,0.800002,-4.000000,-0.000002,0.639216,0.639216,0.639216,1.000000,0.300049,1.500000,-0.799999,-4.000000,-0.000002,0.858824,0.858824,0.858824,1.000000,0.699951,1.100000,0.800001,-4.000000,1.599999,0.858824,0.858824,0.858824,1.000000,0.300049,1.100000,-0.799999,-4.000000,1.599999,0.686275,0.686275,0.686275,1.000000,0.699951,0.700000,0.800001,-4.000000,3.200000,0.686275,0.686275,0.686275,1.000000,0.300049,0.700000,-0.799999,-4.000000,3.200000,0.419608,0.419608,0.419608,1.000000,0.699951,0.300000,0.800001,-4.000000,4.800001,0.419608,0.419608,0.419608,1.000000,0.300049,0.300000,-0.800000,-4.000000,4.800000,0.298039,0.298039,0.298039,1.000000,0.699951,-0.100000,0.800001,-4.000000,6.400001,0.298039,0.298039,0.298039,1.000000,0.300049,-0.100000,-0.800000,-4.000000,6.400001,0.247059,0.247059,0.247059,1.000000,0.699951,-0.500000,0.800000,-4.000000,8.000000,0.247059,0.247059,0.247059,1.000000,0.300049,-0.500000,-0.800000,-4.000000,8.000000, +0.494118,0.494118,0.494118,1.000000,1.099976,1.500000,2.400003,-4.000000,-0.000002,0.639216,0.639216,0.639216,1.000000,0.699951,1.500000,0.800002,-4.000000,-0.000002,0.568627,0.568627,0.568627,1.000000,1.099976,1.100000,2.400002,-4.000000,1.599999,0.858824,0.858824,0.858824,1.000000,0.699951,1.100000,0.800001,-4.000000,1.599999,0.498039,0.498039,0.498039,1.000000,1.099976,0.700000,2.400002,-4.000000,3.200000,0.686275,0.686275,0.686275,1.000000,0.699951,0.700000,0.800001,-4.000000,3.200000,0.352941,0.352941,0.352941,1.000000,1.099976,0.300000,2.400002,-4.000000,4.800001,0.419608,0.419608,0.419608,1.000000,0.699951,0.300000,0.800001,-4.000000,4.800001,0.282353,0.282353,0.282353,1.000000,1.099976,-0.100000,2.400001,-4.000000,6.400001,0.298039,0.298039,0.298039,1.000000,0.699951,-0.100000,0.800001,-4.000000,6.400001,0.239216,0.239216,0.239216,1.000000,1.099976,-0.500000,2.400001,-4.000000,8.000000,0.247059,0.247059,0.247059,1.000000,0.699951,-0.500000,0.800000,-4.000000,8.000000 + +}; + + +/* Object: skin_11 */ + +int striplength_skin_11[]={ +12,12,12,12,12,0}; + +float stripdata_skin_11[]={ +0.145098,0.145098,0.145098,1.000000,-0.099976,1.500000,-2.400000,4.000002,0.000000,0.141176,0.141176,0.141176,1.000000,-0.500000,1.500000,-4.000000,4.000002,0.000000,0.176471,0.176471,0.176471,1.000000,-0.099976,1.100000,-2.400000,2.400001,0.000000,0.145098,0.145098,0.145098,1.000000,-0.500000,1.100000,-4.000000,2.400001,0.000000,0.341176,0.341176,0.341176,1.000000,-0.099976,0.700000,-2.400000,0.800000,0.000000,0.188235,0.188235,0.188235,1.000000,-0.500000,0.700000,-4.000000,0.800000,0.000000,0.450980,0.450980,0.450980,1.000000,-0.099976,0.300000,-2.400000,-0.800000,0.000000,0.247059,0.247059,0.247059,1.000000,-0.500000,0.300000,-4.000000,-0.800000,0.000000,0.439216,0.439216,0.439216,1.000000,-0.099976,-0.100000,-2.400000,-2.400000,0.000000,0.270588,0.270588,0.270588,1.000000,-0.500000,-0.100000,-4.000000,-2.400000,0.000000,0.364706,0.364706,0.364706,1.000000,-0.099976,-0.500000,-2.400000,-4.000000,0.000000,0.258824,0.258824,0.258824,1.000000,-0.500000,-0.500000,-4.000000,-4.000000,0.000000, +0.364706,0.364706,0.364706,1.000000,1.099976,-0.500000,2.400001,-4.000000,0.000000,0.258824,0.258824,0.258824,1.000000,1.500000,-0.500000,4.000002,-4.000000,0.000000,0.439216,0.439216,0.439216,1.000000,1.099976,-0.100000,2.400001,-2.400001,0.000000,0.270588,0.270588,0.270588,1.000000,1.500000,-0.100000,4.000002,-2.400001,0.000000,0.454902,0.454902,0.454902,1.000000,1.099976,0.300000,2.400002,-0.800000,0.000000,0.247059,0.247059,0.247059,1.000000,1.500000,0.300000,4.000002,-0.800000,0.000000,0.341176,0.341176,0.341176,1.000000,1.099976,0.700000,2.400002,0.800000,0.000000,0.184314,0.184314,0.184314,1.000000,1.500000,0.700000,4.000003,0.800000,0.000000,0.176471,0.176471,0.176471,1.000000,1.099976,1.100000,2.400002,2.400001,0.000000,0.145098,0.145098,0.145098,1.000000,1.500000,1.100000,4.000003,2.400001,0.000000,0.145098,0.145098,0.145098,1.000000,1.099976,1.500000,2.400003,4.000003,0.000000,0.141176,0.141176,0.141176,1.000000,1.500000,1.500000,4.000004,4.000002,0.000000, +0.145098,0.145098,0.145098,1.000000,0.300049,1.500000,-0.799999,4.000002,0.000000,0.145098,0.145098,0.145098,1.000000,-0.099976,1.500000,-2.400000,4.000002,0.000000,0.262745,0.262745,0.262745,1.000000,0.300049,1.100000,-0.799999,2.400001,0.000000,0.176471,0.176471,0.176471,1.000000,-0.099976,1.100000,-2.400000,2.400001,0.000000,0.580392,0.580392,0.580392,1.000000,0.300049,0.700000,-0.799999,0.800000,0.000000,0.341176,0.341176,0.341176,1.000000,-0.099976,0.700000,-2.400000,0.800000,0.000000,0.709804,0.709804,0.709804,1.000000,0.300049,0.300000,-0.800000,-0.800000,0.000000,0.450980,0.450980,0.450980,1.000000,-0.099976,0.300000,-2.400000,-0.800000,0.000000,0.627451,0.627451,0.627451,1.000000,0.300049,-0.100000,-0.800000,-2.400001,0.000000,0.439216,0.439216,0.439216,1.000000,-0.099976,-0.100000,-2.400000,-2.400000,0.000000,0.458824,0.458824,0.458824,1.000000,0.300049,-0.500000,-0.800000,-4.000000,0.000000,0.364706,0.364706,0.364706,1.000000,-0.099976,-0.500000,-2.400000,-4.000000,0.000000, +0.145098,0.145098,0.145098,1.000000,0.699951,1.500000,0.800002,4.000002,0.000000,0.145098,0.145098,0.145098,1.000000,0.300049,1.500000,-0.799999,4.000002,0.000000,0.262745,0.262745,0.262745,1.000000,0.699951,1.100000,0.800001,2.400001,0.000000,0.262745,0.262745,0.262745,1.000000,0.300049,1.100000,-0.799999,2.400001,0.000000,0.580392,0.580392,0.580392,1.000000,0.699951,0.700000,0.800001,0.800000,0.000000,0.580392,0.580392,0.580392,1.000000,0.300049,0.700000,-0.799999,0.800000,0.000000,0.713726,0.713726,0.713726,1.000000,0.699951,0.300000,0.800001,-0.800000,0.000000,0.709804,0.709804,0.709804,1.000000,0.300049,0.300000,-0.800000,-0.800000,0.000000,0.631373,0.631373,0.631373,1.000000,0.699951,-0.100000,0.800001,-2.400001,0.000000,0.627451,0.627451,0.627451,1.000000,0.300049,-0.100000,-0.800000,-2.400001,0.000000,0.458824,0.458824,0.458824,1.000000,0.699951,-0.500000,0.800000,-4.000000,0.000000,0.458824,0.458824,0.458824,1.000000,0.300049,-0.500000,-0.800000,-4.000000,0.000000, +0.145098,0.145098,0.145098,1.000000,1.099976,1.500000,2.400003,4.000003,0.000000,0.145098,0.145098,0.145098,1.000000,0.699951,1.500000,0.800002,4.000002,0.000000,0.176471,0.176471,0.176471,1.000000,1.099976,1.100000,2.400002,2.400001,0.000000,0.262745,0.262745,0.262745,1.000000,0.699951,1.100000,0.800001,2.400001,0.000000,0.341176,0.341176,0.341176,1.000000,1.099976,0.700000,2.400002,0.800000,0.000000,0.580392,0.580392,0.580392,1.000000,0.699951,0.700000,0.800001,0.800000,0.000000,0.454902,0.454902,0.454902,1.000000,1.099976,0.300000,2.400002,-0.800000,0.000000,0.713726,0.713726,0.713726,1.000000,0.699951,0.300000,0.800001,-0.800000,0.000000,0.439216,0.439216,0.439216,1.000000,1.099976,-0.100000,2.400001,-2.400001,0.000000,0.631373,0.631373,0.631373,1.000000,0.699951,-0.100000,0.800001,-2.400001,0.000000,0.364706,0.364706,0.364706,1.000000,1.099976,-0.500000,2.400001,-4.000000,0.000000,0.458824,0.458824,0.458824,1.000000,0.699951,-0.500000,0.800000,-4.000000,0.000000 + +}; + + +/* Object: skin_9 */ + +int striplength_skin_9[]={ +18,0}; + +float stripdata_skin_9[]={ +0.384314,0.384314,0.384314,1.000000,-0.500000,1.500000,-4.000000,4.000000,8.000000,0.384314,0.384314,0.384314,1.000000,1.500000,1.500000,4.000000,4.000000,8.000000,0.376471,0.376471,0.376471,1.000000,-0.500000,1.250000,-4.000000,3.695518,9.530733,0.403922,0.403922,0.403922,1.000000,1.500000,1.250000,4.000000,3.695518,9.530733,0.415686,0.415686,0.415686,1.000000,-0.500000,1.000000,-4.000000,2.828427,10.828427,0.431373,0.431373,0.431373,1.000000,1.500000,1.000000,4.000000,2.828427,10.828427,0.435294,0.435294,0.435294,1.000000,-0.500000,0.750000,-4.000000,1.530734,11.695518,0.443137,0.443137,0.443137,1.000000,1.500000,0.750000,4.000000,1.530734,11.695518,0.439216,0.439216,0.439216,1.000000,-0.500000,0.500000,-4.000000,0.000000,12.000000,0.435294,0.435294,0.435294,1.000000,1.500000,0.500000,4.000000,0.000000,12.000000,0.427451,0.427451,0.427451,1.000000,-0.500000,0.250000,-4.000000,-1.530734,11.695518,0.411765,0.411765,0.411765,1.000000,1.500000,0.250000,4.000000,-1.530734,11.695518,0.396078,0.396078,0.396078,1.000000,-0.500000,0.000000,-4.000000,-2.828427,10.828427,0.368627,0.368627,0.368627,1.000000,1.500000,0.000000,4.000000,-2.828427,10.828427,0.341176,0.341176,0.341176,1.000000,-0.500000,-0.250000,-4.000000,-3.695518,9.530733,0.301961,0.301961,0.301961,1.000000,1.500000,-0.250000,4.000000,-3.695518,9.530733,0.294118,0.294118,0.294118,1.000000,-0.500000,-0.500000,-4.000000,-4.000000,8.000000,0.294118,0.294118,0.294118,1.000000,1.500000,-0.500000,4.000000,-4.000000,8.000000 + +}; + + diff --git a/VMU/DOCS/vmu.pdf b/VMU/DOCS/vmu.pdf new file mode 100644 index 00000000..1581d3bb Binary files /dev/null and b/VMU/DOCS/vmu.pdf differ