parent
b631bb9cad
commit
4a5b6a356a
@ -0,0 +1,40 @@ |
||||
#
|
||||
# (C) Copyright 2000
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk |
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS = $(BOARD).o flash.o
|
||||
|
||||
$(LIB): .depend $(OBJS) |
||||
$(AR) crv $@ $^
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c) |
||||
$(CC) -M $(CFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
sinclude .depend |
||||
|
||||
#########################################################################
|
@ -0,0 +1,121 @@ |
||||
/* |
||||
* (C) Copyright 2000 |
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
||||
* |
||||
* See file CREDITS for list of people who contributed to this |
||||
* project. |
||||
* |
||||
* 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 |
||||
*/ |
||||
|
||||
OUTPUT_ARCH(powerpc) |
||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib); |
||||
/* Do we need any of these for elf? |
||||
__DYNAMIC = 0; */ |
||||
SECTIONS |
||||
{ |
||||
/* Read-only sections, merged into text segment: */ |
||||
. = + SIZEOF_HEADERS; |
||||
.interp : { *(.interp) } |
||||
.hash : { *(.hash) } |
||||
.dynsym : { *(.dynsym) } |
||||
.dynstr : { *(.dynstr) } |
||||
.rel.text : { *(.rel.text) } |
||||
.rela.text : { *(.rela.text) } |
||||
.rel.data : { *(.rel.data) } |
||||
.rela.data : { *(.rela.data) } |
||||
.rel.rodata : { *(.rel.rodata) } |
||||
.rela.rodata : { *(.rela.rodata) } |
||||
.rel.got : { *(.rel.got) } |
||||
.rela.got : { *(.rela.got) } |
||||
.rel.ctors : { *(.rel.ctors) } |
||||
.rela.ctors : { *(.rela.ctors) } |
||||
.rel.dtors : { *(.rel.dtors) } |
||||
.rela.dtors : { *(.rela.dtors) } |
||||
.rel.bss : { *(.rel.bss) } |
||||
.rela.bss : { *(.rela.bss) } |
||||
.rel.plt : { *(.rel.plt) } |
||||
.rela.plt : { *(.rela.plt) } |
||||
.init : { *(.init) } |
||||
.plt : { *(.plt) } |
||||
.text : |
||||
{ |
||||
*(.text) |
||||
common/environment.o(.text) |
||||
*(.fixup) |
||||
*(.got1) |
||||
} |
||||
_etext = .; |
||||
PROVIDE (etext = .); |
||||
.rodata : |
||||
{ |
||||
*(.rodata) |
||||
*(.rodata1) |
||||
} |
||||
.fini : { *(.fini) } =0 |
||||
.ctors : { *(.ctors) } |
||||
.dtors : { *(.dtors) } |
||||
|
||||
/* Read-write section, merged into data segment: */ |
||||
. = (. + 0x0FFF) & 0xFFFFF000; |
||||
_erotext = .; |
||||
PROVIDE (erotext = .); |
||||
.reloc : |
||||
{ |
||||
*(.got) |
||||
_GOT2_TABLE_ = .; |
||||
*(.got2) |
||||
_FIXUP_TABLE_ = .; |
||||
*(.fixup) |
||||
} |
||||
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2; |
||||
__fixup_entries = (. - _FIXUP_TABLE_)>>2; |
||||
|
||||
.data : |
||||
{ |
||||
*(.data) |
||||
*(.data1) |
||||
*(.sdata) |
||||
*(.sdata2) |
||||
*(.dynamic) |
||||
CONSTRUCTORS |
||||
} |
||||
_edata = .; |
||||
PROVIDE (edata = .); |
||||
|
||||
__start___ex_table = .; |
||||
__ex_table : { *(__ex_table) } |
||||
__stop___ex_table = .; |
||||
|
||||
. = ALIGN(4096); |
||||
__init_begin = .; |
||||
.text.init : { *(.text.init) } |
||||
.data.init : { *(.data.init) } |
||||
. = ALIGN(4096); |
||||
__init_end = .; |
||||
|
||||
__bss_start = .; |
||||
.bss : |
||||
{ |
||||
*(.sbss) *(.scommon) |
||||
*(.dynbss) |
||||
*(.bss) |
||||
*(COMMON) |
||||
} |
||||
_end = . ; |
||||
PROVIDE (end = .); |
||||
} |
||||
|
@ -0,0 +1,40 @@ |
||||
#
|
||||
# (C) Copyright 2000
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk |
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS = $(BOARD).o flash.o
|
||||
|
||||
$(LIB): .depend $(OBJS) |
||||
$(AR) crv $@ $^
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c) |
||||
$(CC) -M $(CFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
sinclude .depend |
||||
|
||||
#########################################################################
|
@ -0,0 +1,40 @@ |
||||
#
|
||||
# (C) Copyright 2000
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk |
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS = $(BOARD).o flash.o
|
||||
|
||||
$(LIB): .depend $(OBJS) |
||||
$(AR) crv $@ $^
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c) |
||||
$(CC) -M $(CFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
sinclude .depend |
||||
|
||||
#########################################################################
|
@ -0,0 +1,40 @@ |
||||
#
|
||||
# (C) Copyright 2000
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk |
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS = $(BOARD).o flash.o lamp.o
|
||||
|
||||
$(LIB): .depend $(OBJS) |
||||
$(AR) crv $@ $^
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c) |
||||
$(CC) -M $(CFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
sinclude .depend |
||||
|
||||
#########################################################################
|
@ -0,0 +1,40 @@ |
||||
#
|
||||
# (C) Copyright 2000
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk |
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS = $(BOARD).o flash.o
|
||||
|
||||
$(LIB): .depend $(OBJS) |
||||
$(AR) crv $@ $^
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c) |
||||
$(CC) -M $(CFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
sinclude .depend |
||||
|
||||
#########################################################################
|
@ -0,0 +1,40 @@ |
||||
#
|
||||
# (C) Copyright 2000
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk |
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS = $(BOARD).o flash.o
|
||||
|
||||
$(LIB): .depend $(OBJS) |
||||
$(AR) crv $@ $^
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c) |
||||
$(CC) -M $(CFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
sinclude .depend |
||||
|
||||
#########################################################################
|
@ -0,0 +1,40 @@ |
||||
#
|
||||
# (C) Copyright 2001
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk |
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS = $(BOARD).o flash.o
|
||||
|
||||
$(LIB): .depend $(OBJS) |
||||
$(AR) crv $@ $^
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c) |
||||
$(CC) -M $(CFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
sinclude .depend |
||||
|
||||
#########################################################################
|
@ -0,0 +1,122 @@ |
||||
/* |
||||
* (C) Copyright 2001 |
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
||||
* |
||||
* See file CREDITS for list of people who contributed to this |
||||
* project. |
||||
* |
||||
* 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 |
||||
*/ |
||||
|
||||
OUTPUT_ARCH(powerpc) |
||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib); |
||||
/* Do we need any of these for elf? |
||||
__DYNAMIC = 0; */ |
||||
SECTIONS |
||||
{ |
||||
/* Read-only sections, merged into text segment: */ |
||||
. = + SIZEOF_HEADERS; |
||||
.interp : { *(.interp) } |
||||
.hash : { *(.hash) } |
||||
.dynsym : { *(.dynsym) } |
||||
.dynstr : { *(.dynstr) } |
||||
.rel.text : { *(.rel.text) } |
||||
.rela.text : { *(.rela.text) } |
||||
.rel.data : { *(.rel.data) } |
||||
.rela.data : { *(.rela.data) } |
||||
.rel.rodata : { *(.rel.rodata) } |
||||
.rela.rodata : { *(.rela.rodata) } |
||||
.rel.got : { *(.rel.got) } |
||||
.rela.got : { *(.rela.got) } |
||||
.rel.ctors : { *(.rel.ctors) } |
||||
.rela.ctors : { *(.rela.ctors) } |
||||
.rel.dtors : { *(.rel.dtors) } |
||||
.rela.dtors : { *(.rela.dtors) } |
||||
.rel.bss : { *(.rel.bss) } |
||||
.rela.bss : { *(.rela.bss) } |
||||
.rel.plt : { *(.rel.plt) } |
||||
.rela.plt : { *(.rela.plt) } |
||||
.init : { *(.init) } |
||||
.plt : { *(.plt) } |
||||
.text : |
||||
{ |
||||
cpu/mpc8xx/start.o (.text) |
||||
common/environment.o(.text) |
||||
*(.text) |
||||
*(.fixup) |
||||
*(.got1) |
||||
} |
||||
_etext = .; |
||||
PROVIDE (etext = .); |
||||
.rodata : |
||||
{ |
||||
*(.rodata) |
||||
*(.rodata1) |
||||
} |
||||
.fini : { *(.fini) } =0 |
||||
.ctors : { *(.ctors) } |
||||
.dtors : { *(.dtors) } |
||||
|
||||
/* Read-write section, merged into data segment: */ |
||||
. = (. + 0x0FF) & 0xFFFFFF00; |
||||
_erotext = .; |
||||
PROVIDE (erotext = .); |
||||
.reloc : |
||||
{ |
||||
*(.got) |
||||
_GOT2_TABLE_ = .; |
||||
*(.got2) |
||||
_FIXUP_TABLE_ = .; |
||||
*(.fixup) |
||||
} |
||||
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2; |
||||
__fixup_entries = (. - _FIXUP_TABLE_)>>2; |
||||
|
||||
.data : |
||||
{ |
||||
*(.data) |
||||
*(.data1) |
||||
*(.sdata) |
||||
*(.sdata2) |
||||
*(.dynamic) |
||||
CONSTRUCTORS |
||||
} |
||||
_edata = .; |
||||
PROVIDE (edata = .); |
||||
|
||||
__start___ex_table = .; |
||||
__ex_table : { *(__ex_table) } |
||||
__stop___ex_table = .; |
||||
|
||||
. = ALIGN(256); |
||||
__init_begin = .; |
||||
.text.init : { *(.text.init) } |
||||
.data.init : { *(.data.init) } |
||||
. = ALIGN(256); |
||||
__init_end = .; |
||||
|
||||
__bss_start = .; |
||||
.bss : |
||||
{ |
||||
*(.sbss) *(.scommon) |
||||
*(.dynbss) |
||||
*(.bss) |
||||
*(COMMON) |
||||
} |
||||
_end = . ; |
||||
PROVIDE (end = .); |
||||
} |
||||
|
@ -0,0 +1,40 @@ |
||||
#
|
||||
# (C) Copyright 2000
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk |
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS = $(BOARD).o flash.o vpd.o
|
||||
|
||||
$(LIB): .depend $(OBJS) |
||||
$(AR) crv $@ $^
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c) |
||||
$(CC) -M $(CFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
sinclude .depend |
||||
|
||||
#########################################################################
|
@ -0,0 +1,60 @@ |
||||
#ifndef __csr_h |
||||
#define __csr_h |
||||
|
||||
/*
|
||||
* (C) Copyright 2000 |
||||
* Sysgo Real-Time Solutions, GmbH <www.elinos.com> |
||||
* Marius Groeger <mgroeger@sysgo.de> |
||||
* |
||||
* Control and Status Register definitions for the MBX |
||||
* |
||||
*-------------------------------------------------------------------- |
||||
* See file CREDITS for list of people who contributed to this |
||||
* project. |
||||
* |
||||
* 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 |
||||
*/ |
||||
|
||||
/* bits for control register #1 / status register #1 */ |
||||
#define CSR1_ETEN 0x80 /* Ethernet Transceiver Enabled */ |
||||
#define CSR1_ELEN 0x40 /* Ethernet XCVR in Internal Loopback */ |
||||
#define CSR1_EAEN 0x20 /* Auto selection TP/AUI Enabled */ |
||||
#define CSR1_TPEN 0x10 /* TP manually selected */ |
||||
#define CSR1_FDDIS 0x08 /* Full Duplex Mode disabled */ |
||||
#define CSR1_FCTEN 0x04 /* Collision Testing of XCVR disabled */ |
||||
#define CSR1_COM1EN 0x02 /* COM1 signals routed to RS232 Transceiver */ |
||||
#define CSR1_XCVRDIS 0x01 /* Onboard RS232 Transceiver Disabled */ |
||||
|
||||
/* bits for control register #2 */ |
||||
#define CR2_VDDSEL 0xC0 /* PCMCIA Supply Voltage */ |
||||
#define CR2_VPPSEL 0x30 /* PCMCIA Programming Voltage */ |
||||
#define CR2_BRDFAIL 0x08 /* Board fail */ |
||||
#define CR2_SWS1 0x04 /* Software Status #2 LED */ |
||||
#define CR2_SWS2 0x02 /* Software Status #2 LED */ |
||||
#define CR2_QSPANRST 0x01 /* Reset QSPAN */ |
||||
|
||||
/* bits for status register #2 */ |
||||
#define SR2_VDDSEL 0xC0 /* PCMCIA Supply Voltage */ |
||||
#define SR2_VPPSEL 0x30 /* PCMCIA Programming Voltage */ |
||||
#define SR2_BATGD 0x08 /* Low Voltage indication for onboard bat */ |
||||
#define SR2_NVBATGD 0x04 /* Low Voltage indication for NVRAM */ |
||||
#define SR2_RDY 0x02 /* Flash programming status bit */ |
||||
#define SR2_FT 0x01 /* Reserved for Factory test purposes */ |
||||
|
||||
#define MBX_CSR1 (*((uchar *)CFG_CSR_BASE)) |
||||
#define MBX_CSR2 (*((uchar *)CFG_CSR_BASE + 1)) |
||||
|
||||
#endif /* __csr_h */ |
@ -0,0 +1,98 @@ |
||||
#ifndef __dimm_h |
||||
#define __dimm_h |
||||
|
||||
/*
|
||||
* Module name: %M% |
||||
* Description: |
||||
* Serial Presence Detect Definitions Module |
||||
* SCCS identification: %I% |
||||
* Branch: %B% |
||||
* Sequence: %S% |
||||
* Date newest applied delta was created (MM/DD/YY): %G% |
||||
* Time newest applied delta was created (HH:MM:SS): %U% |
||||
* SCCS file name %F% |
||||
* Fully qualified SCCS file name: |
||||
* %P% |
||||
* Copyright: |
||||
* (C) COPYRIGHT MOTOROLA, INC. 1996 |
||||
* ALL RIGHTS RESERVED |
||||
* Notes: |
||||
* 1. All data was taken from an IBM application note titled |
||||
* "Serial Presence Detect Definitions". |
||||
* History: |
||||
* Date Who |
||||
* |
||||
* 10/24/96 Rob Baxter |
||||
* Initial release. |
||||
* |
||||
*/ |
||||
|
||||
/*
|
||||
* serial PD byte assignment address map (256 byte EEPROM) |
||||
*/ |
||||
typedef struct dimm |
||||
{ |
||||
uchar n_bytes; /* 00 number of bytes written/used */ |
||||
uchar t_bytes; /* 01 total number of bytes in serial PD device */ |
||||
uchar fmt; /* 02 fundamental memory type (FPM/EDO/SDRAM) */ |
||||
uchar n_row; /* 03 number of rows */ |
||||
uchar n_col; /* 04 number of columns */ |
||||
uchar n_banks; /* 05 number of banks */ |
||||
uchar data_w_lo; /* 06 data width */ |
||||
uchar data_w_hi; /* 07 data width */ |
||||
uchar ifl; /* 08 interface levels */ |
||||
uchar a_ras; /* 09 RAS access */ |
||||
uchar a_cas; /* 0A CAS access */ |
||||
uchar ct; /* 0B configuration type (non-parity/parity/ECC) */ |
||||
uchar refresh_rt; /* 0C refresh rate/type */ |
||||
uchar p_dram_o; /* 0D primary DRAM organization */ |
||||
uchar s_dram_o; /* 0E secondary DRAM organization (parity/ECC-checkbits) */ |
||||
uchar reserved[17]; /* 0F reserved fields for future offerings */ |
||||
uchar ss_info[32]; /* 20 superset information (may be used in the future) */ |
||||
uchar m_info[64]; /* 40 manufacturer information (optional) */ |
||||
uchar unused[128]; /* 80 unused storage locations */ |
||||
} dimm_t; |
||||
|
||||
/*
|
||||
* memory type definitions |
||||
*/ |
||||
#define DIMM_MT_FPM 1 /* standard FPM (fast page mode) DRAM */ |
||||
#define DIMM_MT_EDO 2 /* EDO (extended data out) */ |
||||
#define DIMM_MT_PN 3 /* pipelined nibble */ |
||||
#define DIMM_MT_SDRAM 4 /* SDRAM (synchronous DRAM) */ |
||||
|
||||
/*
|
||||
* row addresses definitions |
||||
*/ |
||||
#define DIMM_RA_RDNDNT (1<<7) /* redundant addressing */ |
||||
#define DIMM_RA_MASK 0x7f /* number of row addresses mask */ |
||||
|
||||
/*
|
||||
* module interface levels definitions |
||||
*/ |
||||
#define DIMM_IFL_TTL 0 /* TTL/5V tolerant */ |
||||
#define DIMM_IFL_LVTTL 1 /* LVTTL (not 5V tolerant) */ |
||||
#define DIMM_IFL_HSTL15 2 /* HSTL 1.5 */ |
||||
#define DIMM_IFL_SSTL33 3 /* SSTL 3.3 */ |
||||
#define DIMM_IFL_SSTL25 4 /* SSTL 2.5 */ |
||||
|
||||
/*
|
||||
* DIMM configuration type definitions |
||||
*/ |
||||
#define DIMM_CT_NONE 0 /* none */ |
||||
#define DIMM_CT_PARITY 1 /* parity */ |
||||
#define DIMM_CT_ECC 2 /* ECC */ |
||||
|
||||
/*
|
||||
* row addresses definitions |
||||
*/ |
||||
#define DIMM_RRT_SR (1<<7) /* self refresh flag */ |
||||
#define DIMM_RRT_MASK 0x7f /* refresh rate mask */ |
||||
#define DIMM_RRT_NRML 0x00 /* normal (15.625us) */ |
||||
#define DIMM_RRT_R_3_9 0x01 /* reduced .25x (3.9us) */ |
||||
#define DIMM_RRT_R_7_8 0x02 /* reduced .5x (7.8us) */ |
||||
#define DIMM_RRT_E_31_3 0x03 /* extended 2x (31.3us) */ |
||||
#define DIMM_RRT_E_62_5 0x04 /* extended 4x (62.5us) */ |
||||
#define DIMM_RRT_E_125 0x05 /* extended 8x (125us) */ |
||||
|
||||
#endif /* __dimm_h */ |
@ -0,0 +1,122 @@ |
||||
/* |
||||
* (C) Copyright 2000 |
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
||||
* |
||||
* See file CREDITS for list of people who contributed to this |
||||
* project. |
||||
* |
||||
* 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 |
||||
*/ |
||||
|
||||
OUTPUT_ARCH(powerpc) |
||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib); |
||||
/* Do we need any of these for elf? |
||||
__DYNAMIC = 0; */ |
||||
SECTIONS |
||||
{ |
||||
/* Read-only sections, merged into text segment: */ |
||||
. = + SIZEOF_HEADERS; |
||||
.interp : { *(.interp) } |
||||
.hash : { *(.hash) } |
||||
.dynsym : { *(.dynsym) } |
||||
.dynstr : { *(.dynstr) } |
||||
.rel.text : { *(.rel.text) } |
||||
.rela.text : { *(.rela.text) } |
||||
.rel.data : { *(.rel.data) } |
||||
.rela.data : { *(.rela.data) } |
||||
.rel.rodata : { *(.rel.rodata) } |
||||
.rela.rodata : { *(.rela.rodata) } |
||||
.rel.got : { *(.rel.got) } |
||||
.rela.got : { *(.rela.got) } |
||||
.rel.ctors : { *(.rel.ctors) } |
||||
.rela.ctors : { *(.rela.ctors) } |
||||
.rel.dtors : { *(.rel.dtors) } |
||||
.rela.dtors : { *(.rela.dtors) } |
||||
.rel.bss : { *(.rel.bss) } |
||||
.rela.bss : { *(.rela.bss) } |
||||
.rel.plt : { *(.rel.plt) } |
||||
.rela.plt : { *(.rela.plt) } |
||||
.init : { *(.init) } |
||||
.plt : { *(.plt) } |
||||
.text : |
||||
{ |
||||
cpu/mpc8xx/start.o (.text) |
||||
|
||||
*(.text) |
||||
*(.fixup) |
||||
*(.got1) |
||||
} |
||||
_etext = .; |
||||
PROVIDE (etext = .); |
||||
.rodata : |
||||
{ |
||||
*(.rodata) |
||||
*(.rodata1) |
||||
} |
||||
.fini : { *(.fini) } =0 |
||||
.ctors : { *(.ctors) } |
||||
.dtors : { *(.dtors) } |
||||
|
||||
/* Read-write section, merged into data segment: */ |
||||
. = (. + 0x00FF) & 0xFFFFFF00; |
||||
_erotext = .; |
||||
PROVIDE (erotext = .); |
||||
.reloc : |
||||
{ |
||||
*(.got) |
||||
_GOT2_TABLE_ = .; |
||||
*(.got2) |
||||
_FIXUP_TABLE_ = .; |
||||
*(.fixup) |
||||
} |
||||
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2; |
||||
__fixup_entries = (. - _FIXUP_TABLE_)>>2; |
||||
|
||||
.data : |
||||
{ |
||||
*(.data) |
||||
*(.data1) |
||||
*(.sdata) |
||||
*(.sdata2) |
||||
*(.dynamic) |
||||
CONSTRUCTORS |
||||
} |
||||
_edata = .; |
||||
PROVIDE (edata = .); |
||||
|
||||
__start___ex_table = .; |
||||
__ex_table : { *(__ex_table) } |
||||
__stop___ex_table = .; |
||||
|
||||
. = ALIGN(256); |
||||
__init_begin = .; |
||||
.text.init : { *(.text.init) } |
||||
.data.init : { *(.data.init) } |
||||
. = ALIGN(256); |
||||
__init_end = .; |
||||
|
||||
__bss_start = .; |
||||
.bss : |
||||
{ |
||||
*(.sbss) *(.scommon) |
||||
*(.dynbss) |
||||
*(.bss) |
||||
*(COMMON) |
||||
} |
||||
_end = . ; |
||||
PROVIDE (end = .); |
||||
} |
||||
|
@ -0,0 +1,119 @@ |
||||
#ifndef __vpd_h |
||||
#define __vpd_h |
||||
|
||||
/*
|
||||
* Module name: %M% |
||||
* Description: |
||||
* Vital Product Data (VPD) Header Module |
||||
* SCCS identification: %I% |
||||
* Branch: %B% |
||||
* Sequence: %S% |
||||
* Date newest applied delta was created (MM/DD/YY): %G% |
||||
* Time newest applied delta was created (HH:MM:SS): %U% |
||||
* SCCS file name %F% |
||||
* Fully qualified SCCS file name: |
||||
* %P% |
||||
* Copyright: |
||||
* (C) COPYRIGHT MOTOROLA, INC. 1996 |
||||
* ALL RIGHTS RESERVED |
||||
* Notes: |
||||
* History: |
||||
* Date Who |
||||
* |
||||
* 10/24/96 Rob Baxter |
||||
* Initial release. |
||||
* |
||||
*/ |
||||
|
||||
#define VPD_EEPROM_SIZE 256 /* EEPROM size in bytes */ |
||||
|
||||
/*
|
||||
* packet tuple identifiers |
||||
* |
||||
* 0x0D - 0xBF reserved |
||||
* 0xC0 - 0xFE user defined |
||||
*/ |
||||
#define VPD_PID_GI 0x00 /* guaranteed illegal */ |
||||
#define VPD_PID_PID 0x01 /* product identifier (ASCII) */ |
||||
#define VPD_PID_FAN 0x02 /* factory assembly-number (ASCII) */ |
||||
#define VPD_PID_SN 0x03 /* serial-number (ASCII) */ |
||||
#define VPD_PID_PCO 0x04 /* product configuration options(binary) */ |
||||
#define VPD_PID_ICS 0x05 /* internal clock speed in HZ (integer) */ |
||||
#define VPD_PID_ECS 0x06 /* external clock speed in HZ (integer) */ |
||||
#define VPD_PID_RCS 0x07 /* reference clock speed in HZ(integer) */ |
||||
#define VPD_PID_EA 0x08 /* ethernet address (binary) */ |
||||
#define VPD_PID_MT 0x09 /* microprocessor type (ASCII) */ |
||||
#define VPD_PID_CRC 0x0A /* EEPROM CRC (integer) */ |
||||
#define VPD_PID_FMC 0x0B /* FLASH memory configuration (binary) */ |
||||
#define VPD_PID_VLSI 0x0C /* VLSI revisions/versions (binary) */ |
||||
#define VPD_PID_TERM 0xFF /* termination */ |
||||
|
||||
/*
|
||||
* VPD structure (format) |
||||
*/ |
||||
#define VPD_EYE_SIZE 8 /* eyecatcher size */ |
||||
typedef struct vpd_header |
||||
{ |
||||
uchar eyecatcher[VPD_EYE_SIZE]; /* eyecatcher - "MOTOROLA" */ |
||||
ushort size; /* size of EEPROM */ |
||||
} vpd_header_t; |
||||
|
||||
#define VPD_DATA_SIZE (VPD_EEPROM_SIZE-sizeof(vpd_header_t)) |
||||
typedef struct vpd |
||||
{ |
||||
vpd_header_t header; /* header */ |
||||
uchar packets[VPD_DATA_SIZE]; /* data */ |
||||
} vpd_t; |
||||
|
||||
/*
|
||||
* packet tuple structure (format) |
||||
*/ |
||||
typedef struct vpd_packet |
||||
{ |
||||
uchar identifier; /* identifier (PIDs above) */ |
||||
uchar size; /* size of the following data area */ |
||||
uchar data[1]; /* data (size is dependent upon PID) */ |
||||
} vpd_packet_t; |
||||
|
||||
/*
|
||||
* MBX product configuration options bit definitions |
||||
* |
||||
* Notes: |
||||
* 1. The bit numbering is reversed in perspective with the C compiler. |
||||
*/ |
||||
#define PCO_BBRAM (1<<0) /* battery-backed RAM (BBRAM) and socket */ |
||||
#define PCO_BOOTROM (1<<1) /* boot ROM and socket (i.e., socketed FLASH) */ |
||||
#define PCO_KAPWR (1<<2) /* keep alive power source (lithium battey) and control circuit */ |
||||
#define PCO_ENET_TP (1<<3) /* ethernet twisted pair (TP) connector (RJ45) */ |
||||
#define PCO_ENET_AUI (1<<4) /* ethernet attachment unit interface (AUI) header */ |
||||
#define PCO_PCMCIA (1<<5) /* PCMCIA socket */ |
||||
#define PCO_DIMM (1<<6) /* DIMM module socket */ |
||||
#define PCO_DTT (1<<7) /* digital thermometer and thermostat (DTT) device */ |
||||
#define PCO_LCD (1<<8) /* liquid crystal display (LCD) device */ |
||||
#define PCO_PCI (1<<9) /* PCI-Bus bridge device (QSpan) and ISA-Bus bridge device (Winbond) */ |
||||
#define PCO_PCIO (1<<10) /* PC I/O (COM1, COM2, FDC, LPT, Keyboard/Mouse) */ |
||||
#define PCO_EIDE (1<<11) /* enhanced IDE (EIDE) header */ |
||||
#define PCO_FDC (1<<12) /* floppy disk controller (FDC) header */ |
||||
#define PCO_LPT_8XX (1<<13) /* parallel port header via MPC8xx */ |
||||
#define PCO_LPT_PCIO (1<<14) /* parallel port header via PC I/O */ |
||||
|
||||
/*
|
||||
* FLASH memory configuration packet data |
||||
*/ |
||||
typedef struct vpd_fmc |
||||
{ |
||||
ushort mid; /* manufacturer's idenitfier */ |
||||
ushort did; /* manufacturer's device idenitfier */ |
||||
uchar ddw; /* device data width (e.g., 8-bits, 16-bits) */ |
||||
uchar nod; /* number of devices present */ |
||||
uchar noc; /* number of columns */ |
||||
uchar cw; /* column width in bits */ |
||||
uchar wedw; /* write/erase data width */ |
||||
} vpd_fmc_t; |
||||
|
||||
/* function prototypes */ |
||||
extern void vpd_init(void); |
||||
extern int vpd_read(uint iic_device, uchar *buf, int count, int offset); |
||||
extern vpd_packet_t *vpd_find_packet(u_char ident); |
||||
|
||||
#endif /* __vpd_h */ |
@ -0,0 +1,117 @@ |
||||
/* |
||||
* (C) Copyright 2000 |
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
||||
* |
||||
* See file CREDITS for list of people who contributed to this |
||||
* project. |
||||
* |
||||
* 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 |
||||
*/ |
||||
|
||||
OUTPUT_ARCH(powerpc) |
||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib); |
||||
/* Do we need any of these for elf? |
||||
__DYNAMIC = 0; */ |
||||
SECTIONS |
||||
{ |
||||
/* Read-only sections, merged into text segment: */ |
||||
. = + SIZEOF_HEADERS; |
||||
.interp : { *(.interp) } |
||||
.hash : { *(.hash) } |
||||
.dynsym : { *(.dynsym) } |
||||
.dynstr : { *(.dynstr) } |
||||
.rel.text : { *(.rel.text) } |
||||
.rela.text : { *(.rela.text) } |
||||
.rel.data : { *(.rel.data) } |
||||
.rela.data : { *(.rela.data) } |
||||
.rel.rodata : { *(.rel.rodata) } |
||||
.rela.rodata : { *(.rela.rodata) } |
||||
.rel.got : { *(.rel.got) } |
||||
.rela.got : { *(.rela.got) } |
||||
.rel.ctors : { *(.rel.ctors) } |
||||
.rela.ctors : { *(.rela.ctors) } |
||||
.rel.dtors : { *(.rel.dtors) } |
||||
.rela.dtors : { *(.rela.dtors) } |
||||
.rel.bss : { *(.rel.bss) } |
||||
.rela.bss : { *(.rela.bss) } |
||||
.rel.plt : { *(.rel.plt) } |
||||
.rela.plt : { *(.rela.plt) } |
||||
.init : { *(.init) } |
||||
.plt : { *(.plt) } |
||||
.text : |
||||
{ |
||||
cpu/mpc8260/start.o (.text) |
||||
*(.text) |
||||
*(.fixup) |
||||
*(.got1) |
||||
. = ALIGN(16); |
||||
*(.rodata) |
||||
*(.rodata1) |
||||
} |
||||
.fini : { *(.fini) } =0 |
||||
.ctors : { *(.ctors) } |
||||
.dtors : { *(.dtors) } |
||||
|
||||
/* Read-write section, merged into data segment: */ |
||||
. = (. + 0x0FFF) & 0xFFFFF000; |
||||
_erotext = .; |
||||
PROVIDE (erotext = .); |
||||
.reloc : |
||||
{ |
||||
*(.got) |
||||
_GOT2_TABLE_ = .; |
||||
*(.got2) |
||||
_FIXUP_TABLE_ = .; |
||||
*(.fixup) |
||||
} |
||||
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2; |
||||
__fixup_entries = (. - _FIXUP_TABLE_) >> 2; |
||||
|
||||
.data : |
||||
{ |
||||
*(.data) |
||||
*(.data1) |
||||
*(.sdata) |
||||
*(.sdata2) |
||||
*(.dynamic) |
||||
CONSTRUCTORS |
||||
} |
||||
_edata = .; |
||||
PROVIDE (edata = .); |
||||
|
||||
__start___ex_table = .; |
||||
__ex_table : { *(__ex_table) } |
||||
__stop___ex_table = .; |
||||
|
||||
. = ALIGN(4096); |
||||
__init_begin = .; |
||||
.text.init : { *(.text.init) } |
||||
.data.init : { *(.data.init) } |
||||
. = ALIGN(4096); |
||||
__init_end = .; |
||||
|
||||
__bss_start = .; |
||||
.bss : |
||||
{ |
||||
*(.sbss) *(.scommon) |
||||
*(.dynbss) |
||||
*(.bss) |
||||
*(COMMON) |
||||
} |
||||
_end = . ; |
||||
PROVIDE (end = .); |
||||
} |
||||
|
@ -0,0 +1,39 @@ |
||||
/* |
||||
* -*- mode:c -*- |
||||
* |
||||
* (C) Copyright 2000 |
||||
* Marius Groeger <mgroeger@sysgo.de>
|
||||
* Sysgo Real-Time Solutions, GmbH <www.elinos.com> |
||||
* |
||||
* void ull_write(unsigned long long volatile *address, |
||||
* unsigned long long volatile *data) |
||||
* r3 = address |
||||
* r4 = data |
||||
* |
||||
* void ull_read(unsigned long long volatile *address, |
||||
* unsigned long long volatile *data) |
||||
* r3 = address |
||||
* r4 = data |
||||
* |
||||
* Uses the floating point unit to read and write 64 bit wide |
||||
* data (unsigned long long) on the 60x bus. This is necessary |
||||
* because all 4 flash chips use the /WE line from byte lane 0 |
||||
* |
||||
* IMPORTANT: data should always be 8-aligned, otherwise an exception will |
||||
* occur. |
||||
*/ |
||||
|
||||
#include <ppc_asm.tmpl> |
||||
#include <ppc_defs.h> |
||||
|
||||
.globl ull_write
|
||||
ull_write: |
||||
lfd 0,0(r4) |
||||
stfd 0,0(r3) |
||||
blr |
||||
|
||||
.globl ull_read
|
||||
ull_read: |
||||
lfd 0, 0(r3) |
||||
stfd 0, 0(r4) |
||||
blr |
@ -0,0 +1,122 @@ |
||||
/* |
||||
* (C) Copyright 2000 |
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
||||
* |
||||
* See file CREDITS for list of people who contributed to this |
||||
* project. |
||||
* |
||||
* 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 |
||||
*/ |
||||
|
||||
OUTPUT_ARCH(powerpc) |
||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib); |
||||
/* Do we need any of these for elf? |
||||
__DYNAMIC = 0; */ |
||||
SECTIONS |
||||
{ |
||||
/* Read-only sections, merged into text segment: */ |
||||
. = + SIZEOF_HEADERS; |
||||
.interp : { *(.interp) } |
||||
.hash : { *(.hash) } |
||||
.dynsym : { *(.dynsym) } |
||||
.dynstr : { *(.dynstr) } |
||||
.rel.text : { *(.rel.text) } |
||||
.rela.text : { *(.rela.text) } |
||||
.rel.data : { *(.rel.data) } |
||||
.rela.data : { *(.rela.data) } |
||||
.rel.rodata : { *(.rel.rodata) } |
||||
.rela.rodata : { *(.rela.rodata) } |
||||
.rel.got : { *(.rel.got) } |
||||
.rela.got : { *(.rela.got) } |
||||
.rel.ctors : { *(.rel.ctors) } |
||||
.rela.ctors : { *(.rela.ctors) } |
||||
.rel.dtors : { *(.rel.dtors) } |
||||
.rela.dtors : { *(.rela.dtors) } |
||||
.rel.bss : { *(.rel.bss) } |
||||
.rela.bss : { *(.rela.bss) } |
||||
.rel.plt : { *(.rel.plt) } |
||||
.rela.plt : { *(.rela.plt) } |
||||
.init : { *(.init) } |
||||
.plt : { *(.plt) } |
||||
.text : |
||||
{ |
||||
cpu/mpc8260/start.o (.text) |
||||
*(.text) |
||||
*(.fixup) |
||||
*(.got1) |
||||
/*. = env_offset; */ |
||||
} |
||||
_etext = .; |
||||
PROVIDE (etext = .); |
||||
.rodata : |
||||
{ |
||||
*(.rodata) |
||||
*(.rodata1) |
||||
} |
||||
.fini : { *(.fini) } =0 |
||||
.ctors : { *(.ctors) } |
||||
.dtors : { *(.dtors) } |
||||
|
||||
/* Read-write section, merged into data segment: */ |
||||
. = (. + 0x0FFF) & 0xFFFFF000; |
||||
_erotext = .; |
||||
PROVIDE (erotext = .); |
||||
.reloc : |
||||
{ |
||||
*(.got) |
||||
_GOT2_TABLE_ = .; |
||||
*(.got2) |
||||
_FIXUP_TABLE_ = .; |
||||
*(.fixup) |
||||
} |
||||
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2; |
||||
__fixup_entries = (. - _FIXUP_TABLE_)>>2; |
||||
|
||||
.data : |
||||
{ |
||||
*(.data) |
||||
*(.data1) |
||||
*(.sdata) |
||||
*(.sdata2) |
||||
*(.dynamic) |
||||
CONSTRUCTORS |
||||
} |
||||
_edata = .; |
||||
PROVIDE (edata = .); |
||||
|
||||
__start___ex_table = .; |
||||
__ex_table : { *(__ex_table) } |
||||
__stop___ex_table = .; |
||||
|
||||
. = ALIGN(4096); |
||||
__init_begin = .; |
||||
.text.init : { *(.text.init) } |
||||
.data.init : { *(.data.init) } |
||||
. = ALIGN(4096); |
||||
__init_end = .; |
||||
|
||||
__bss_start = .; |
||||
.bss : |
||||
{ |
||||
*(.sbss) *(.scommon) |
||||
*(.dynbss) |
||||
*(.bss) |
||||
*(COMMON) |
||||
} |
||||
_end = . ; |
||||
PROVIDE (end = .); |
||||
} |
||||
|
@ -0,0 +1,54 @@ |
||||
/*
|
||||
* (C) Copyright 2000 |
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
||||
* |
||||
* See file CREDITS for list of people who contributed to this |
||||
* project. |
||||
* |
||||
* 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 |
||||
*/ |
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Timer value for timer 2, ICLK = 10 |
||||
* |
||||
* SPEED_FCOUNT2 = GCLK / (16 * (TIMER_TMR_PS + 1)) |
||||
* SPEED_TMR3_PS = (GCLK / (16 * SPEED_FCOUNT3)) - 1 |
||||
* |
||||
* SPEED_FCOUNT2 timer 2 counting frequency |
||||
* GCLK CPU clock |
||||
* SPEED_TMR2_PS prescaler |
||||
*/ |
||||
#define SPEED_TMR2_PS (250 - 1) /* divide by 250 */ |
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Timer value for PIT |
||||
* |
||||
* PIT_TIME = SPEED_PITC / PITRTCLK |
||||
* PITRTCLK = 8192 |
||||
*/ |
||||
#define SPEED_PITC (82 << 16) /* start counting from 82 */ |
||||
|
||||
/*
|
||||
* The new value for PTA is calculated from |
||||
* |
||||
* PTA = (gclk * Trefresh) / (2 ^ (2 * DFBRG) * PTP * NCS) |
||||
* |
||||
* gclk CPU clock (not bus clock !) |
||||
* Trefresh Refresh cycle * 4 (four word bursts used) |
||||
* DFBRG For normal mode (no clock reduction) always 0 |
||||
* PTP Prescaler (already adjusted for no. of banks and 4K / 8K refresh) |
||||
* NCS Number of SDRAM banks (chip selects) on this UPM. |
||||
*/ |
@ -0,0 +1,117 @@ |
||||
/* |
||||
* (C) Copyright 2000 |
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
||||
* |
||||
* See file CREDITS for list of people who contributed to this |
||||
* project. |
||||
* |
||||
* 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 |
||||
*/ |
||||
|
||||
OUTPUT_ARCH(powerpc) |
||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib); |
||||
/* Do we need any of these for elf? |
||||
__DYNAMIC = 0; */ |
||||
SECTIONS |
||||
{ |
||||
/* Read-only sections, merged into text segment: */ |
||||
. = + SIZEOF_HEADERS; |
||||
.interp : { *(.interp) } |
||||
.hash : { *(.hash) } |
||||
.dynsym : { *(.dynsym) } |
||||
.dynstr : { *(.dynstr) } |
||||
.rel.text : { *(.rel.text) } |
||||
.rela.text : { *(.rela.text) } |
||||
.rel.data : { *(.rel.data) } |
||||
.rela.data : { *(.rela.data) } |
||||
.rel.rodata : { *(.rel.rodata) } |
||||
.rela.rodata : { *(.rela.rodata) } |
||||
.rel.got : { *(.rel.got) } |
||||
.rela.got : { *(.rela.got) } |
||||
.rel.ctors : { *(.rel.ctors) } |
||||
.rela.ctors : { *(.rela.ctors) } |
||||
.rel.dtors : { *(.rel.dtors) } |
||||
.rela.dtors : { *(.rela.dtors) } |
||||
.rel.bss : { *(.rel.bss) } |
||||
.rela.bss : { *(.rela.bss) } |
||||
.rel.plt : { *(.rel.plt) } |
||||
.rela.plt : { *(.rela.plt) } |
||||
.init : { *(.init) } |
||||
.plt : { *(.plt) } |
||||
.text : |
||||
{ |
||||
cpu/mpc8260/start.o (.text) |
||||
*(.text) |
||||
*(.fixup) |
||||
*(.got1) |
||||
. = ALIGN(16); |
||||
*(.rodata) |
||||
*(.rodata1) |
||||
} |
||||
.fini : { *(.fini) } =0 |
||||
.ctors : { *(.ctors) } |
||||
.dtors : { *(.dtors) } |
||||
|
||||
/* Read-write section, merged into data segment: */ |
||||
. = (. + 0x0FFF) & 0xFFFFF000; |
||||
_erotext = .; |
||||
PROVIDE (erotext = .); |
||||
.reloc : |
||||
{ |
||||
*(.got) |
||||
_GOT2_TABLE_ = .; |
||||
*(.got2) |
||||
_FIXUP_TABLE_ = .; |
||||
*(.fixup) |
||||
} |
||||
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2; |
||||
__fixup_entries = (. - _FIXUP_TABLE_) >> 2; |
||||
|
||||
.data : |
||||
{ |
||||
*(.data) |
||||
*(.data1) |
||||
*(.sdata) |
||||
*(.sdata2) |
||||
*(.dynamic) |
||||
CONSTRUCTORS |
||||
} |
||||
_edata = .; |
||||
PROVIDE (edata = .); |
||||
|
||||
__start___ex_table = .; |
||||
__ex_table : { *(__ex_table) } |
||||
__stop___ex_table = .; |
||||
|
||||
. = ALIGN(4096); |
||||
__init_begin = .; |
||||
.text.init : { *(.text.init) } |
||||
.data.init : { *(.data.init) } |
||||
. = ALIGN(4096); |
||||
__init_end = .; |
||||
|
||||
__bss_start = .; |
||||
.bss : |
||||
{ |
||||
*(.sbss) *(.scommon) |
||||
*(.dynbss) |
||||
*(.bss) |
||||
*(COMMON) |
||||
} |
||||
_end = . ; |
||||
PROVIDE (end = .); |
||||
} |
||||
|
@ -0,0 +1,40 @@ |
||||
#
|
||||
# (C) Copyright 2000
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk |
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS = $(BOARD).o flash.o
|
||||
|
||||
$(LIB): .depend $(OBJS) |
||||
$(AR) crv $@ $^
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c) |
||||
$(CC) -M $(CFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
sinclude .depend |
||||
|
||||
#########################################################################
|
@ -0,0 +1,122 @@ |
||||
/* |
||||
* (C) Copyright 2000 |
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
||||
* |
||||
* See file CREDITS for list of people who contributed to this |
||||
* project. |
||||
* |
||||
* 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 |
||||
*/ |
||||
|
||||
OUTPUT_ARCH(powerpc) |
||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib); |
||||
/* Do we need any of these for elf? |
||||
__DYNAMIC = 0; */ |
||||
SECTIONS |
||||
{ |
||||
/* Read-only sections, merged into text segment: */ |
||||
. = + SIZEOF_HEADERS; |
||||
.interp : { *(.interp) } |
||||
.hash : { *(.hash) } |
||||
.dynsym : { *(.dynsym) } |
||||
.dynstr : { *(.dynstr) } |
||||
.rel.text : { *(.rel.text) } |
||||
.rela.text : { *(.rela.text) } |
||||
.rel.data : { *(.rel.data) } |
||||
.rela.data : { *(.rela.data) } |
||||
.rel.rodata : { *(.rel.rodata) } |
||||
.rela.rodata : { *(.rela.rodata) } |
||||
.rel.got : { *(.rel.got) } |
||||
.rela.got : { *(.rela.got) } |
||||
.rel.ctors : { *(.rel.ctors) } |
||||
.rela.ctors : { *(.rela.ctors) } |
||||
.rel.dtors : { *(.rel.dtors) } |
||||
.rela.dtors : { *(.rela.dtors) } |
||||
.rel.bss : { *(.rel.bss) } |
||||
.rela.bss : { *(.rela.bss) } |
||||
.rel.plt : { *(.rel.plt) } |
||||
.rela.plt : { *(.rela.plt) } |
||||
.init : { *(.init) } |
||||
.plt : { *(.plt) } |
||||
.text : |
||||
{ |
||||
cpu/mpc8xx/start.o (.text) |
||||
common/environment.o(.text) |
||||
*(.text) |
||||
*(.fixup) |
||||
*(.got1) |
||||
} |
||||
_etext = .; |
||||
PROVIDE (etext = .); |
||||
.rodata : |
||||
{ |
||||
*(.rodata) |
||||
*(.rodata1) |
||||
} |
||||
.fini : { *(.fini) } =0 |
||||
.ctors : { *(.ctors) } |
||||
.dtors : { *(.dtors) } |
||||
|
||||
/* Read-write section, merged into data segment: */ |
||||
. = (. + 0x0FFF) & 0xFFFFF000; |
||||
_erotext = .; |
||||
PROVIDE (erotext = .); |
||||
.reloc : |
||||
{ |
||||
*(.got) |
||||
_GOT2_TABLE_ = .; |
||||
*(.got2) |
||||
_FIXUP_TABLE_ = .; |
||||
*(.fixup) |
||||
} |
||||
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2; |
||||
__fixup_entries = (. - _FIXUP_TABLE_)>>2; |
||||
|
||||
.data : |
||||
{ |
||||
*(.data) |
||||
*(.data1) |
||||
*(.sdata) |
||||
*(.sdata2) |
||||
*(.dynamic) |
||||
CONSTRUCTORS |
||||
} |
||||
_edata = .; |
||||
PROVIDE (edata = .); |
||||
|
||||
__start___ex_table = .; |
||||
__ex_table : { *(__ex_table) } |
||||
__stop___ex_table = .; |
||||
|
||||
. = ALIGN(4096); |
||||
__init_begin = .; |
||||
.text.init : { *(.text.init) } |
||||
.data.init : { *(.data.init) } |
||||
. = ALIGN(4096); |
||||
__init_end = .; |
||||
|
||||
__bss_start = .; |
||||
.bss : |
||||
{ |
||||
*(.sbss) *(.scommon) |
||||
*(.dynbss) |
||||
*(.bss) |
||||
*(COMMON) |
||||
} |
||||
_end = . ; |
||||
PROVIDE (end = .); |
||||
} |
||||
|
@ -0,0 +1,40 @@ |
||||
#
|
||||
# (C) Copyright 2000
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk |
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS = $(BOARD).o flash.o
|
||||
|
||||
$(LIB): .depend $(OBJS) |
||||
$(AR) crv $@ $^
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c) |
||||
$(CC) -M $(CFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
sinclude .depend |
||||
|
||||
#########################################################################
|
@ -0,0 +1,122 @@ |
||||
/* |
||||
* (C) Copyright 2000 |
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
||||
* |
||||
* See file CREDITS for list of people who contributed to this |
||||
* project. |
||||
* |
||||
* 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 |
||||
*/ |
||||
|
||||
OUTPUT_ARCH(powerpc) |
||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib); |
||||
/* Do we need any of these for elf? |
||||
__DYNAMIC = 0; */ |
||||
SECTIONS |
||||
{ |
||||
/* Read-only sections, merged into text segment: */ |
||||
. = + SIZEOF_HEADERS; |
||||
.interp : { *(.interp) } |
||||
.hash : { *(.hash) } |
||||
.dynsym : { *(.dynsym) } |
||||
.dynstr : { *(.dynstr) } |
||||
.rel.text : { *(.rel.text) } |
||||
.rela.text : { *(.rela.text) } |
||||
.rel.data : { *(.rel.data) } |
||||
.rela.data : { *(.rela.data) } |
||||
.rel.rodata : { *(.rel.rodata) } |
||||
.rela.rodata : { *(.rela.rodata) } |
||||
.rel.got : { *(.rel.got) } |
||||
.rela.got : { *(.rela.got) } |
||||
.rel.ctors : { *(.rel.ctors) } |
||||
.rela.ctors : { *(.rela.ctors) } |
||||
.rel.dtors : { *(.rel.dtors) } |
||||
.rela.dtors : { *(.rela.dtors) } |
||||
.rel.bss : { *(.rel.bss) } |
||||
.rela.bss : { *(.rela.bss) } |
||||
.rel.plt : { *(.rel.plt) } |
||||
.rela.plt : { *(.rela.plt) } |
||||
.init : { *(.init) } |
||||
.plt : { *(.plt) } |
||||
.text : |
||||
{ |
||||
cpu/mpc8xx/start.o (.text) |
||||
common/environment.o(.text) |
||||
*(.text) |
||||
*(.fixup) |
||||
*(.got1) |
||||
} |
||||
_etext = .; |
||||
PROVIDE (etext = .); |
||||
.rodata : |
||||
{ |
||||
*(.rodata) |
||||
*(.rodata1) |
||||
} |
||||
.fini : { *(.fini) } =0 |
||||
.ctors : { *(.ctors) } |
||||
.dtors : { *(.dtors) } |
||||
|
||||
/* Read-write section, merged into data segment: */ |
||||
. = (. + 0x0FF) & 0xFFFFFF00; |
||||
_erotext = .; |
||||
PROVIDE (erotext = .); |
||||
.reloc : |
||||
{ |
||||
*(.got) |
||||
_GOT2_TABLE_ = .; |
||||
*(.got2) |
||||
_FIXUP_TABLE_ = .; |
||||
*(.fixup) |
||||
} |
||||
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2; |
||||
__fixup_entries = (. - _FIXUP_TABLE_)>>2; |
||||
|
||||
.data : |
||||
{ |
||||
*(.data) |
||||
*(.data1) |
||||
*(.sdata) |
||||
*(.sdata2) |
||||
*(.dynamic) |
||||
CONSTRUCTORS |
||||
} |
||||
_edata = .; |
||||
PROVIDE (edata = .); |
||||
|
||||
__start___ex_table = .; |
||||
__ex_table : { *(__ex_table) } |
||||
__stop___ex_table = .; |
||||
|
||||
. = ALIGN(256); |
||||
__init_begin = .; |
||||
.text.init : { *(.text.init) } |
||||
.data.init : { *(.data.init) } |
||||
. = ALIGN(256); |
||||
__init_end = .; |
||||
|
||||
__bss_start = .; |
||||
.bss : |
||||
{ |
||||
*(.sbss) *(.scommon) |
||||
*(.dynbss) |
||||
*(.bss) |
||||
*(COMMON) |
||||
} |
||||
_end = . ; |
||||
PROVIDE (end = .); |
||||
} |
||||
|
@ -0,0 +1,54 @@ |
||||
/*
|
||||
* (C) Copyright 2000 |
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
||||
* |
||||
* See file CREDITS for list of people who contributed to this |
||||
* project. |
||||
* |
||||
* 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 |
||||
*/ |
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Timer value for timer 2, ICLK = 10 |
||||
* |
||||
* SPEED_FCOUNT2 = GCLK / (16 * (TIMER_TMR_PS + 1)) |
||||
* SPEED_TMR3_PS = (GCLK / (16 * SPEED_FCOUNT3)) - 1 |
||||
* |
||||
* SPEED_FCOUNT2 timer 2 counting frequency |
||||
* GCLK CPU clock |
||||
* SPEED_TMR2_PS prescaler |
||||
*/ |
||||
#define SPEED_TMR2_PS (250 - 1) /* divide by 250 */ |
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Timer value for PIT |
||||
* |
||||
* PIT_TIME = SPEED_PITC / PITRTCLK |
||||
* PITRTCLK = 8192 |
||||
*/ |
||||
#define SPEED_PITC (82 << 16) /* start counting from 82 */ |
||||
|
||||
/*
|
||||
* The new value for PTA is calculated from |
||||
* |
||||
* PTA = (gclk * Trefresh) / (2 ^ (2 * DFBRG) * PTP * NCS) |
||||
* |
||||
* gclk CPU clock (not bus clock !) |
||||
* Trefresh Refresh cycle * 4 (four word bursts used) |
||||
* DFBRG For normal mode (no clock reduction) always 0 |
||||
* PTP Prescaler (already adjusted for no. of banks and 4K / 8K refresh) |
||||
* NCS Number of SDRAM banks (chip selects) on this UPM. |
||||
*/ |
@ -0,0 +1,106 @@ |
||||
/* include/mal.h, openbios_walnut, walnut_bios 8/6/99 08:48:40 */ |
||||
/*----------------------------------------------------------------------------+
|
||||
| |
||||
| This source code has been made available to you by IBM on an AS-IS |
||||
| basis. Anyone receiving this source is licensed under IBM |
||||
| copyrights to use it in any way he or she deems fit, including |
||||
| copying it, modifying it, compiling it, and redistributing it either |
||||
| with or without modifications. No license under IBM patents or |
||||
| patent applications is to be implied by the copyright license. |
||||
| |
||||
| Any user of this software should understand that IBM cannot provide |
||||
| technical support for this software and will not be responsible for |
||||
| any consequences resulting from the use of this software. |
||||
| |
||||
| Any person who transfers this source code or any derivative work |
||||
| must include the IBM copyright notice, this paragraph, and the |
||||
| preceding two paragraphs in the transferred software. |
||||
| |
||||
| COPYRIGHT I B M CORPORATION 1999 |
||||
| LICENSED MATERIAL - PROGRAM PROPERTY OF I B M |
||||
+----------------------------------------------------------------------------*/ |
||||
/*----------------------------------------------------------------------------+
|
||||
| |
||||
| File Name: mal.h |
||||
| |
||||
| Function: Header file for the MAL (MADMAL) macro on the 405GP. |
||||
| |
||||
| Author: Mark Wisner |
||||
| |
||||
| Change Activity- |
||||
| |
||||
| Date Description of Change BY |
||||
| --------- --------------------- --- |
||||
| 29-Apr-99 Created MKW |
||||
| |
||||
+----------------------------------------------------------------------------*/ |
||||
#ifndef _mal_h_ |
||||
#define _mal_h_ |
||||
/* MADMAL transmit and receive status/control bits */ |
||||
/* for COMMAC bits, refer to the COMMAC header file */ |
||||
|
||||
#define MAL_TX_CTRL_READY 0x8000 |
||||
#define MAL_TX_CTRL_WRAP 0x4000 |
||||
#define MAL_TX_CTRL_CM 0x2000 |
||||
#define MAL_TX_CTRL_LAST 0x1000 |
||||
#define MAL_TX_CTRL_INTR 0x0400 |
||||
|
||||
#define MAL_RX_CTRL_EMPTY 0x8000 |
||||
#define MAL_RX_CTRL_WRAP 0x4000 |
||||
#define MAL_RX_CTRL_CM 0x2000 |
||||
#define MAL_RX_CTRL_LAST 0x1000 |
||||
#define MAL_RX_CTRL_FIRST 0x0800 |
||||
#define MAL_RX_CTRL_INTR 0x0400 |
||||
|
||||
/* Configuration Reg */ |
||||
#define MAL_CR_MMSR 0x80000000 |
||||
#define MAL_CR_PLBP_1 0x00400000 /* lowsest is 00 */ |
||||
#define MAL_CR_PLBP_2 0x00800000 |
||||
#define MAL_CR_PLBP_3 0x00C00000 /* highest */ |
||||
#define MAL_CR_GA 0x00200000 |
||||
#define MAL_CR_OA 0x00100000 |
||||
#define MAL_CR_PLBLE 0x00080000 |
||||
#define MAL_CR_PLBLT_1 0x00040000 |
||||
#define MAL_CR_PLBLT_2 0x00020000 |
||||
#define MAL_CR_PLBLT_3 0x00010000 |
||||
#define MAL_CR_PLBLT_4 0x00008000 |
||||
#define MAL_CR_PLBLT_DEFAULT 0x00078000 /* ????? */ |
||||
#define MAL_CR_PLBB 0x00004000 |
||||
#define MAL_CR_OPBBL 0x00000080 |
||||
#define MAL_CR_EOPIE 0x00000004 |
||||
#define MAL_CR_LEA 0x00000002 |
||||
#define MAL_CR_MSD 0x00000001 |
||||
|
||||
/* Error Status Reg */ |
||||
#define MAL_ESR_EVB 0x80000000 |
||||
#define MAL_ESR_CID 0x40000000 |
||||
#define MAL_ESR_DE 0x00100000 |
||||
#define MAL_ESR_ONE 0x00080000 |
||||
#define MAL_ESR_OTE 0x00040000 |
||||
#define MAL_ESR_OSE 0x00020000 |
||||
#define MAL_ESR_PEIN 0x00010000 |
||||
/* same bit position as the IER */ |
||||
/* VV VV */ |
||||
#define MAL_ESR_DEI 0x00000010 |
||||
#define MAL_ESR_ONEI 0x00000008 |
||||
#define MAL_ESR_OTEI 0x00000004 |
||||
#define MAL_ESR_OSEI 0x00000002 |
||||
#define MAL_ESR_PBEI 0x00000001 |
||||
/* ^^ ^^ */ |
||||
/* Mal IER */ |
||||
#define MAL_IER_DE 0x00000010 |
||||
#define MAL_IER_NE 0x00000008 |
||||
#define MAL_IER_TE 0x00000004 |
||||
#define MAL_IER_OPBE 0x00000002 |
||||
#define MAL_IER_PLBE 0x00000001 |
||||
|
||||
|
||||
/* MAL Buffer Descriptor structure */ |
||||
typedef struct { |
||||
short ctrl; /* MAL / Commac status control bits */ |
||||
short data_len; /* Max length is 4K-1 (12 bits) */ |
||||
char *data_ptr; /* pointer to actual data buffer */ |
||||
} mal_desc_t; |
||||
|
||||
#endif |
||||
|
@ -0,0 +1,95 @@ |
||||
/*
|
||||
* PowerPC atomic operations |
||||
*/ |
||||
|
||||
#ifndef _ASM_PPC_ATOMIC_H_ |
||||
#define _ASM_PPC_ATOMIC_H_ |
||||
|
||||
#include <linux/config.h> |
||||
|
||||
#ifdef CONFIG_SMP |
||||
typedef struct { volatile int counter; } atomic_t; |
||||
#else |
||||
typedef struct { int counter; } atomic_t; |
||||
#endif |
||||
|
||||
#define ATOMIC_INIT(i) { (i) } |
||||
|
||||
#define atomic_read(v) ((v)->counter) |
||||
#define atomic_set(v,i) (((v)->counter) = (i)) |
||||
|
||||
extern void atomic_clear_mask(unsigned long mask, unsigned long *addr); |
||||
extern void atomic_set_mask(unsigned long mask, unsigned long *addr); |
||||
|
||||
extern __inline__ int atomic_add_return(int a, atomic_t *v) |
||||
{ |
||||
int t; |
||||
|
||||
__asm__ __volatile__("\n\
|
||||
1: lwarx %0,0,%3\n\
|
||||
add %0,%2,%0\n\
|
||||
stwcx. %0,0,%3\n\
|
||||
bne- 1b" |
||||
: "=&r" (t), "=m" (*v) |
||||
: "r" (a), "r" (v), "m" (*v) |
||||
: "cc"); |
||||
|
||||
return t; |
||||
} |
||||
|
||||
extern __inline__ int atomic_sub_return(int a, atomic_t *v) |
||||
{ |
||||
int t; |
||||
|
||||
__asm__ __volatile__("\n\
|
||||
1: lwarx %0,0,%3\n\
|
||||
subf %0,%2,%0\n\
|
||||
stwcx. %0,0,%3\n\
|
||||
bne- 1b" |
||||
: "=&r" (t), "=m" (*v) |
||||
: "r" (a), "r" (v), "m" (*v) |
||||
: "cc"); |
||||
|
||||
return t; |
||||
} |
||||
|
||||
extern __inline__ int atomic_inc_return(atomic_t *v) |
||||
{ |
||||
int t; |
||||
|
||||
__asm__ __volatile__("\n\
|
||||
1: lwarx %0,0,%2\n\
|
||||
addic %0,%0,1\n\
|
||||
stwcx. %0,0,%2\n\
|
||||
bne- 1b" |
||||
: "=&r" (t), "=m" (*v) |
||||
: "r" (v), "m" (*v) |
||||
: "cc"); |
||||
|
||||
return t; |
||||
} |
||||
|
||||
extern __inline__ int atomic_dec_return(atomic_t *v) |
||||
{ |
||||
int t; |
||||
|
||||
__asm__ __volatile__("\n\
|
||||
1: lwarx %0,0,%2\n\
|
||||
addic %0,%0,-1\n\
|
||||
stwcx. %0,0,%2\n\
|
||||
bne 1b" |
||||
: "=&r" (t), "=m" (*v) |
||||
: "r" (v), "m" (*v) |
||||
: "cc"); |
||||
|
||||
return t; |
||||
} |
||||
|
||||
#define atomic_add(a, v) ((void) atomic_add_return((a), (v))) |
||||
#define atomic_sub(a, v) ((void) atomic_sub_return((a), (v))) |
||||
#define atomic_sub_and_test(a, v) (atomic_sub_return((a), (v)) == 0) |
||||
#define atomic_inc(v) ((void) atomic_inc_return((v))) |
||||
#define atomic_dec(v) ((void) atomic_dec_return((v))) |
||||
#define atomic_dec_and_test(v) (atomic_dec_return((v)) == 0) |
||||
|
||||
#endif /* _ASM_PPC_ATOMIC_H_ */ |
@ -0,0 +1,109 @@ |
||||
#ifndef _PPC_POSIX_TYPES_H |
||||
#define _PPC_POSIX_TYPES_H |
||||
|
||||
/*
|
||||
* This file is generally used by user-level software, so you need to |
||||
* be a little careful about namespace pollution etc. Also, we cannot |
||||
* assume GCC is being used. |
||||
*/ |
||||
|
||||
typedef unsigned int __kernel_dev_t; |
||||
typedef unsigned int __kernel_ino_t; |
||||
typedef unsigned int __kernel_mode_t; |
||||
typedef unsigned short __kernel_nlink_t; |
||||
typedef long __kernel_off_t; |
||||
typedef int __kernel_pid_t; |
||||
typedef unsigned int __kernel_uid_t; |
||||
typedef unsigned int __kernel_gid_t; |
||||
typedef unsigned int __kernel_size_t; |
||||
typedef int __kernel_ssize_t; |
||||
typedef long __kernel_ptrdiff_t; |
||||
typedef long __kernel_time_t; |
||||
typedef long __kernel_suseconds_t; |
||||
typedef long __kernel_clock_t; |
||||
typedef int __kernel_daddr_t; |
||||
typedef char * __kernel_caddr_t; |
||||
typedef short __kernel_ipc_pid_t; |
||||
typedef unsigned short __kernel_uid16_t; |
||||
typedef unsigned short __kernel_gid16_t; |
||||
typedef unsigned int __kernel_uid32_t; |
||||
typedef unsigned int __kernel_gid32_t; |
||||
|
||||
typedef unsigned int __kernel_old_uid_t; |
||||
typedef unsigned int __kernel_old_gid_t; |
||||
|
||||
#ifdef __GNUC__ |
||||
typedef long long __kernel_loff_t; |
||||
#endif |
||||
|
||||
typedef struct { |
||||
int val[2]; |
||||
} __kernel_fsid_t; |
||||
|
||||
#ifndef __GNUC__ |
||||
|
||||
#define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d)) |
||||
#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d)) |
||||
#define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) |
||||
#define __FD_ZERO(set) \ |
||||
((void) memset ((__ptr_t) (set), 0, sizeof (__kernel_fd_set))) |
||||
|
||||
#else /* __GNUC__ */ |
||||
|
||||
#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) \ |
||||
|| (__GLIBC__ == 2 && __GLIBC_MINOR__ == 0) |
||||
/* With GNU C, use inline functions instead so args are evaluated only once: */ |
||||
|
||||
#undef __FD_SET |
||||
static __inline__ void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp) |
||||
{ |
||||
unsigned long _tmp = fd / __NFDBITS; |
||||
unsigned long _rem = fd % __NFDBITS; |
||||
fdsetp->fds_bits[_tmp] |= (1UL<<_rem); |
||||
} |
||||
|
||||
#undef __FD_CLR |
||||
static __inline__ void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp) |
||||
{ |
||||
unsigned long _tmp = fd / __NFDBITS; |
||||
unsigned long _rem = fd % __NFDBITS; |
||||
fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem); |
||||
} |
||||
|
||||
#undef __FD_ISSET |
||||
static __inline__ int __FD_ISSET(unsigned long fd, __kernel_fd_set *p) |
||||
{ |
||||
unsigned long _tmp = fd / __NFDBITS; |
||||
unsigned long _rem = fd % __NFDBITS; |
||||
return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0; |
||||
} |
||||
|
||||
/*
|
||||
* This will unroll the loop for the normal constant case (8 ints, |
||||
* for a 256-bit fd_set) |
||||
*/ |
||||
#undef __FD_ZERO |
||||
static __inline__ void __FD_ZERO(__kernel_fd_set *p) |
||||
{ |
||||
unsigned int *tmp = (unsigned int *)p->fds_bits; |
||||
int i; |
||||
|
||||
if (__builtin_constant_p(__FDSET_LONGS)) { |
||||
switch (__FDSET_LONGS) { |
||||
case 8: |
||||
tmp[0] = 0; tmp[1] = 0; tmp[2] = 0; tmp[3] = 0; |
||||
tmp[4] = 0; tmp[5] = 0; tmp[6] = 0; tmp[7] = 0; |
||||
return; |
||||
} |
||||
} |
||||
i = __FDSET_LONGS; |
||||
while (i) { |
||||
i--; |
||||
*tmp = 0; |
||||
tmp++; |
||||
} |
||||
} |
||||
|
||||
#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */ |
||||
#endif /* __GNUC__ */ |
||||
#endif /* _PPC_POSIX_TYPES_H */ |
@ -0,0 +1,154 @@ |
||||
#ifndef _ASMPPC_SIGNAL_H |
||||
#define _ASMPPC_SIGNAL_H |
||||
|
||||
#include <linux/types.h> |
||||
|
||||
/* Avoid too many header ordering problems. */ |
||||
struct siginfo; |
||||
|
||||
/* Most things should be clean enough to redefine this at will, if care
|
||||
is taken to make libc match. */ |
||||
|
||||
#define _NSIG 64 |
||||
#define _NSIG_BPW 32 |
||||
#define _NSIG_WORDS (_NSIG / _NSIG_BPW) |
||||
|
||||
typedef unsigned long old_sigset_t; /* at least 32 bits */ |
||||
|
||||
typedef struct { |
||||
unsigned long sig[_NSIG_WORDS]; |
||||
} sigset_t; |
||||
|
||||
#define SIGHUP 1 |
||||
#define SIGINT 2 |
||||
#define SIGQUIT 3 |
||||
#define SIGILL 4 |
||||
#define SIGTRAP 5 |
||||
#define SIGABRT 6 |
||||
#define SIGIOT 6 |
||||
#define SIGBUS 7 |
||||
#define SIGFPE 8 |
||||
#define SIGKILL 9 |
||||
#define SIGUSR1 10 |
||||
#define SIGSEGV 11 |
||||
#define SIGUSR2 12 |
||||
#define SIGPIPE 13 |
||||
#define SIGALRM 14 |
||||
#define SIGTERM 15 |
||||
#define SIGSTKFLT 16 |
||||
#define SIGCHLD 17 |
||||
#define SIGCONT 18 |
||||
#define SIGSTOP 19 |
||||
#define SIGTSTP 20 |
||||
#define SIGTTIN 21 |
||||
#define SIGTTOU 22 |
||||
#define SIGURG 23 |
||||
#define SIGXCPU 24 |
||||
#define SIGXFSZ 25 |
||||
#define SIGVTALRM 26 |
||||
#define SIGPROF 27 |
||||
#define SIGWINCH 28 |
||||
#define SIGIO 29 |
||||
#define SIGPOLL SIGIO |
||||
/*
|
||||
#define SIGLOST 29 |
||||
*/ |
||||
#define SIGPWR 30 |
||||
#define SIGSYS 31 |
||||
#define SIGUNUSED 31 |
||||
|
||||
/* These should not be considered constants from userland. */ |
||||
#define SIGRTMIN 32 |
||||
#define SIGRTMAX (_NSIG-1) |
||||
|
||||
/*
|
||||
* SA_FLAGS values: |
||||
* |
||||
* SA_ONSTACK is not currently supported, but will allow sigaltstack(2). |
||||
* SA_INTERRUPT is a no-op, but left due to historical reasons. Use the |
||||
* SA_RESTART flag to get restarting signals (which were the default long ago) |
||||
* SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. |
||||
* SA_RESETHAND clears the handler when the signal is delivered. |
||||
* SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. |
||||
* SA_NODEFER prevents the current signal from being masked in the handler. |
||||
* |
||||
* SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single |
||||
* Unix names RESETHAND and NODEFER respectively. |
||||
*/ |
||||
#define SA_NOCLDSTOP 0x00000001 |
||||
#define SA_NOCLDWAIT 0x00000002 /* not supported yet */ |
||||
#define SA_SIGINFO 0x00000004 |
||||
#define SA_ONSTACK 0x08000000 |
||||
#define SA_RESTART 0x10000000 |
||||
#define SA_NODEFER 0x40000000 |
||||
#define SA_RESETHAND 0x80000000 |
||||
|
||||
#define SA_NOMASK SA_NODEFER |
||||
#define SA_ONESHOT SA_RESETHAND |
||||
#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */ |
||||
|
||||
#define SA_RESTORER 0x04000000 |
||||
|
||||
/*
|
||||
* sigaltstack controls |
||||
*/ |
||||
#define SS_ONSTACK 1 |
||||
#define SS_DISABLE 2 |
||||
|
||||
#define MINSIGSTKSZ 2048 |
||||
#define SIGSTKSZ 8192 |
||||
#ifdef __KERNEL__ |
||||
|
||||
/*
|
||||
* These values of sa_flags are used only by the kernel as part of the |
||||
* irq handling routines. |
||||
* |
||||
* SA_INTERRUPT is also used by the irq handling routines. |
||||
* SA_SHIRQ is for shared interrupt support on PCI and EISA. |
||||
*/ |
||||
#define SA_PROBE SA_ONESHOT |
||||
#define SA_SAMPLE_RANDOM SA_RESTART |
||||
#define SA_SHIRQ 0x04000000 |
||||
#endif |
||||
|
||||
#define SIG_BLOCK 0 /* for blocking signals */ |
||||
#define SIG_UNBLOCK 1 /* for unblocking signals */ |
||||
#define SIG_SETMASK 2 /* for setting the signal mask */ |
||||
|
||||
/* Type of a signal handler. */ |
||||
typedef void (*__sighandler_t)(int); |
||||
|
||||
#define SIG_DFL ((__sighandler_t)0) /* default signal handling */ |
||||
#define SIG_IGN ((__sighandler_t)1) /* ignore signal */ |
||||
#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ |
||||
|
||||
struct old_sigaction { |
||||
__sighandler_t sa_handler; |
||||
old_sigset_t sa_mask; |
||||
unsigned long sa_flags; |
||||
void (*sa_restorer)(void); |
||||
}; |
||||
|
||||
struct sigaction { |
||||
__sighandler_t sa_handler; |
||||
unsigned long sa_flags; |
||||
void (*sa_restorer)(void); |
||||
sigset_t sa_mask; /* mask last for extensibility */ |
||||
}; |
||||
|
||||
struct k_sigaction { |
||||
struct sigaction sa; |
||||
}; |
||||
|
||||
typedef struct sigaltstack { |
||||
void *ss_sp; |
||||
int ss_flags; |
||||
size_t ss_size; |
||||
} stack_t; |
||||
|
||||
#ifdef __KERNEL__ |
||||
#include <asm/sigcontext.h> |
||||
|
||||
#endif |
||||
|
||||
#endif |
@ -0,0 +1,48 @@ |
||||
#ifndef _LINUX_POSIX_TYPES_H |
||||
#define _LINUX_POSIX_TYPES_H |
||||
|
||||
#include <linux/stddef.h> |
||||
|
||||
/*
|
||||
* This allows for 1024 file descriptors: if NR_OPEN is ever grown |
||||
* beyond that you'll have to change this too. But 1024 fd's seem to be |
||||
* enough even for such "real" unices like OSF/1, so hopefully this is |
||||
* one limit that doesn't have to be changed [again]. |
||||
* |
||||
* Note that POSIX wants the FD_CLEAR(fd,fdsetp) defines to be in |
||||
* <sys/time.h> (and thus <linux/time.h>) - but this is a more logical |
||||
* place for them. Solved by having dummy defines in <sys/time.h>. |
||||
*/ |
||||
|
||||
/*
|
||||
* Those macros may have been defined in <gnu/types.h>. But we always |
||||
* use the ones here. |
||||
*/ |
||||
#undef __NFDBITS |
||||
#define __NFDBITS (8 * sizeof(unsigned long)) |
||||
|
||||
#undef __FD_SETSIZE |
||||
#define __FD_SETSIZE 1024 |
||||
|
||||
#undef __FDSET_LONGS |
||||
#define __FDSET_LONGS (__FD_SETSIZE/__NFDBITS) |
||||
|
||||
#undef __FDELT |
||||
#define __FDELT(d) ((d) / __NFDBITS) |
||||
|
||||
#undef __FDMASK |
||||
#define __FDMASK(d) (1UL << ((d) % __NFDBITS)) |
||||
|
||||
typedef struct { |
||||
unsigned long fds_bits [__FDSET_LONGS]; |
||||
} __kernel_fd_set; |
||||
|
||||
/* Type of a signal handler. */ |
||||
typedef void (*__kernel_sighandler_t)(int); |
||||
|
||||
/* Type of a SYSV IPC key. */ |
||||
typedef int __kernel_key_t; |
||||
|
||||
#include <asm/posix_types.h> |
||||
|
||||
#endif /* _LINUX_POSIX_TYPES_H */ |
@ -0,0 +1,59 @@ |
||||
#ifndef _MPC8XX_IRQ_H |
||||
#define _MPC8XX_IRQ_H |
||||
|
||||
/* The MPC8xx cores have 16 possible interrupts. There are eight
|
||||
* possible level sensitive interrupts assigned and generated internally |
||||
* from such devices as CPM, PCMCIA, RTC, PIT, TimeBase and Decrementer. |
||||
* There are eight external interrupts (IRQs) that can be configured |
||||
* as either level or edge sensitive. |
||||
* |
||||
* On some implementations, there is also the possibility of an 8259 |
||||
* through the PCI and PCI-ISA bridges. |
||||
* |
||||
* We don't support the 8259 (yet). |
||||
*/ |
||||
#define NR_SIU_INTS 16 |
||||
#define NR_8259_INTS 0 |
||||
|
||||
#define NR_IRQS (NR_SIU_INTS + NR_8259_INTS) |
||||
|
||||
/* These values must be zero-based and map 1:1 with the SIU configuration.
|
||||
* They are used throughout the 8xx I/O subsystem to generate |
||||
* interrupt masks, flags, and other control patterns. This is why the |
||||
* current kernel assumption of the 8259 as the base controller is such |
||||
* a pain in the butt. |
||||
*/ |
||||
#define SIU_IRQ0 (0) /* Highest priority */ |
||||
#define SIU_LEVEL0 (1) |
||||
#define SIU_IRQ1 (2) |
||||
#define SIU_LEVEL1 (3) |
||||
#define SIU_IRQ2 (4) |
||||
#define SIU_LEVEL2 (5) |
||||
#define SIU_IRQ3 (6) |
||||
#define SIU_LEVEL3 (7) |
||||
#define SIU_IRQ4 (8) |
||||
#define SIU_LEVEL4 (9) |
||||
#define SIU_IRQ5 (10) |
||||
#define SIU_LEVEL5 (11) |
||||
#define SIU_IRQ6 (12) |
||||
#define SIU_LEVEL6 (13) |
||||
#define SIU_IRQ7 (14) |
||||
#define SIU_LEVEL7 (15) |
||||
|
||||
/* The internal interrupts we can configure as we see fit.
|
||||
* My personal preference is CPM at level 2, which puts it above the |
||||
* MBX PCI/ISA/IDE interrupts. |
||||
*/ |
||||
|
||||
#ifdef CFG_CPM_INTERRUPT |
||||
# define CPM_INTERRUPT CFG_CPM_INTERRUPT |
||||
#else |
||||
# define CPM_INTERRUPT SIU_LEVEL2 |
||||
#endif |
||||
|
||||
/* Some internal interrupt registers use an 8-bit mask for the interrupt
|
||||
* level instead of a number. |
||||
*/ |
||||
#define mk_int_int_mask(IL) (1 << (7 - (IL/2))) |
||||
|
||||
#endif /* _MPC8XX_IRQ_H */ |
@ -0,0 +1,114 @@ |
||||
/*
|
||||
* (C) Copyright 2000 |
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
||||
* |
||||
* See file CREDITS for list of people who contributed to this |
||||
* project. |
||||
* |
||||
* 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 |
||||
*/ |
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
* |
||||
* Motorola S-Record Format: |
||||
* |
||||
* Motorola S-Records are an industry-standard format for |
||||
* transmitting binary files to target systems and PROM |
||||
* programmers. LSI Logic have extended this standard to include |
||||
* an S4-record containing an address and a symbol. |
||||
* |
||||
* The extended S-record standard is as follows: |
||||
* |
||||
* S<type><length><address><data....><checksum> |
||||
* S4<length><address><name>,<checksum> |
||||
* |
||||
* Where: |
||||
* |
||||
* type |
||||
* is the record type. Where: |
||||
* |
||||
* 0 starting record (optional) |
||||
* 1 data record with 16-bit address |
||||
* 2 data record with 24-bit address |
||||
* 3 data record with 32-bit address |
||||
* 4 symbol record (LSI extension) |
||||
* 5 number of data records in preceeding block |
||||
* 6 unused |
||||
* 7 ending record for S3 records |
||||
* 8 ending record for S2 records |
||||
* 9 ending record for S1 records |
||||
* |
||||
* length |
||||
* is two hex characters. This defines the length of the |
||||
* record in bytes (not characters). It includes the address |
||||
* field, the data field, and the checksum field. |
||||
* |
||||
* address |
||||
* is 4, 6, or 8 characters. Corresponding to a 16-, 24-, or |
||||
* 32-bit address. The address field for S4 records is |
||||
* always 32 bits. |
||||
* |
||||
* data |
||||
* |
||||
* Are the data bytes. Each pair of hex characters represent |
||||
* one byte in memory. |
||||
* |
||||
* name |
||||
* Is the symbol name. The symbol is terminated by a ','. |
||||
* |
||||
* checksum |
||||
* Is the one's complement of the 8-bit checksum. |
||||
* |
||||
* Example |
||||
* |
||||
* S0030000FC |
||||
* . |
||||
* . |
||||
* S325000004403C0880018D08DD900000000011000026000000003C0880012508DC50C50000B401 |
||||
* S32500000460C50100B8C50200BCC50300C0C50400C4C50500C8C50600CCC50700D0C50800D4FA |
||||
* S32500000480C50900D8C50A00DCC50B00E0C50C00E4C50D00E8C50E00ECC50F00F0C51000F49A |
||||
* S325000004A0C51100F8C51200FCC5130100C5140104C5150108C516010CC5170110C518011434 |
||||
* . |
||||
* . |
||||
* S70500000000FA |
||||
* |
||||
* The S0 record starts the file. The S3 records contain the |
||||
* data. The S7 record contains the entry address and terminates |
||||
* the download. |
||||
* |
||||
*-------------------------------------------------------------------------- |
||||
*/ |
||||
|
||||
#define SREC_START 0 /* Start Record (module name) */ |
||||
#define SREC_DATA2 1 /* Data Record with 2 byte address */ |
||||
#define SREC_DATA3 2 /* Data Record with 3 byte address */ |
||||
#define SREC_DATA4 3 /* Data Record with 4 byte address */ |
||||
#define SREC_COUNT 5 /* Count Record (previously transmitted) */ |
||||
#define SREC_END4 7 /* End Record with 4 byte start address */ |
||||
#define SREC_END3 8 /* End Record with 3 byte start address */ |
||||
#define SREC_END2 9 /* End Record with 2 byte start address */ |
||||
#define SREC_EMPTY 10 /* Empty Record without any data */ |
||||
|
||||
#define SREC_REC_OK SREC_EMPTY /* last code without error condition */ |
||||
|
||||
#define SREC_E_BADTYPE -1 /* no valid S-Record */ |
||||
#define SREC_E_NOSREC -2 /* line format differs from s-record */ |
||||
#define SREC_E_BADCHKS -3 /* checksum error in an s-record line */ |
||||
|
||||
#define SREC_MAXRECLEN (512 + 4) /* max ASCII record length */ |
||||
#define SREC_MAXBINLEN 255 /* resulting binary length */ |
||||
|
||||
int srec_decode (char *input, int *count, ulong *addr, char *data); |
@ -0,0 +1,434 @@ |
||||
/*
|
||||
* This file is derived from zlib.h and zconf.h from the zlib-0.95 |
||||
* distribution by Jean-loup Gailly and Mark Adler, with some additions |
||||
* by Paul Mackerras to aid in implementing Deflate compression and |
||||
* decompression for PPP packets. |
||||
*/ |
||||
|
||||
/*
|
||||
* ==FILEVERSION 960122== |
||||
* |
||||
* This marker is used by the Linux installation script to determine |
||||
* whether an up-to-date version of this file is already installed. |
||||
*/ |
||||
|
||||
/* zlib.h -- interface of the 'zlib' general purpose compression library
|
||||
version 0.95, Aug 16th, 1995. |
||||
|
||||
Copyright (C) 1995 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 |
||||
gzip@prep.ai.mit.edu madler@alumni.caltech.edu |
||||
*/ |
||||
|
||||
#ifndef _ZLIB_H |
||||
#define _ZLIB_H |
||||
|
||||
/* #include "zconf.h" */ /* included directly here */ |
||||
|
||||
/* zconf.h -- configuration of the zlib compression library
|
||||
* Copyright (C) 1995 Jean-loup Gailly. |
||||
* For conditions of distribution and use, see copyright notice in zlib.h |
||||
*/ |
||||
|
||||
/* From: zconf.h,v 1.12 1995/05/03 17:27:12 jloup Exp */ |
||||
|
||||
/*
|
||||
The library does not install any signal handler. It is recommended to |
||||
add at least a handler for SIGSEGV when decompressing; the library checks |
||||
the consistency of the input data whenever possible but may go nuts |
||||
for some forms of corrupted input. |
||||
*/ |
||||
|
||||
/*
|
||||
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more |
||||
* than 64k bytes at a time (needed on systems with 16-bit int). |
||||
* Compile with -DUNALIGNED_OK if it is OK to access shorts or ints |
||||
* at addresses which are not a multiple of their size. |
||||
* Under DOS, -DFAR=far or -DFAR=__far may be needed. |
||||
*/ |
||||
|
||||
#ifndef STDC |
||||
# if defined(MSDOS) || defined(__STDC__) || defined(__cplusplus) |
||||
# define STDC |
||||
# endif |
||||
#endif |
||||
|
||||
#ifdef __MWERKS__ /* Metrowerks CodeWarrior declares fileno() in unix.h */ |
||||
# include <unix.h> |
||||
#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 |
||||
|
||||
#ifndef FAR |
||||
# define FAR |
||||
#endif |
||||
|
||||
/* Maximum value for windowBits in deflateInit2 and inflateInit2 */ |
||||
#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 |
||||
|
||||
typedef unsigned char Byte; /* 8 bits */ |
||||
typedef unsigned int uInt; /* 16 bits or more */ |
||||
typedef unsigned long uLong; /* 32 bits or more */ |
||||
|
||||
typedef Byte FAR Bytef; |
||||
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 |
||||
|
||||
/* end of original zconf.h */ |
||||
|
||||
#define ZLIB_VERSION "0.95P" |
||||
|
||||
/*
|
||||
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 may be added later and will have the same |
||||
stream interface. |
||||
|
||||
For compression the application must provide the output buffer and |
||||
may optionally provide the input buffer for optimization. For decompression, |
||||
the application must provide the input buffer and may optionally provide |
||||
the output buffer for optimization. |
||||
|
||||
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. |
||||
*/ |
||||
|
||||
typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); |
||||
typedef void (*free_func) OF((voidpf opaque, voidpf address, uInt nbytes)); |
||||
|
||||
typedef void (*cb_func) OF((Bytef *buf, uInt len)); |
||||
|
||||
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 */ |
||||
voidp opaque; /* private data object passed to zalloc and zfree */ |
||||
|
||||
Byte data_type; /* best guess about the data type: ascii or binary */ |
||||
|
||||
cb_func outcb; /* called regularly just before blocks of output */ |
||||
|
||||
} z_stream; |
||||
|
||||
/*
|
||||
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. |
||||
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 |
||||
#define Z_FULL_FLUSH 2 |
||||
#define Z_SYNC_FLUSH 3 /* experimental: partial_flush + byte align */ |
||||
#define Z_FINISH 4 |
||||
#define Z_PACKET_FLUSH 5 |
||||
/* See deflate() below for the usage of these constants */ |
||||
|
||||
#define Z_OK 0 |
||||
#define Z_STREAM_END 1 |
||||
#define Z_ERRNO (-1) |
||||
#define Z_STREAM_ERROR (-2) |
||||
#define Z_DATA_ERROR (-3) |
||||
#define Z_MEM_ERROR (-4) |
||||
#define Z_BUF_ERROR (-5) |
||||
/* error codes for the compression/decompression functions */ |
||||
|
||||
#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 |
||||
|
||||
#define Z_BINARY 0 |
||||
#define Z_ASCII 1 |
||||
#define Z_UNKNOWN 2 |
||||
/* Used to set the data_type field */ |
||||
|
||||
#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ |
||||
|
||||
extern char *zlib_version; |
||||
/* The application can compare zlib_version 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. |
||||
*/ |
||||
|
||||
/* basic functions */ |
||||
|
||||
extern int inflateInit OF((z_stream *strm)); |
||||
/*
|
||||
Initializes the internal stream state for decompression. The fields |
||||
zalloc and zfree must be initialized before by the caller. 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. msg is set to null if there is no error message. |
||||
inflateInit does not perform any decompression: this will be done by |
||||
inflate(). |
||||
*/ |
||||
|
||||
|
||||
extern int inflate OF((z_stream *strm, int flush)); |
||||
/*
|
||||
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() always provides as much output as possible |
||||
(until there is no more input data or no more space in the output buffer). |
||||
|
||||
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 the parameter flush is set to Z_PARTIAL_FLUSH or Z_PACKET_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_PARTIAL_FLUSH, Z_PACKET_FLUSH or Z_FINISH, but the |
||||
current implementation actually flushes as much output as possible |
||||
anyway. For Z_PACKET_FLUSH, inflate checks that once all the input data |
||||
has been consumed, it is expecting to see the length field of a stored |
||||
block; if not, it returns Z_DATA_ERROR. |
||||
|
||||
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. |
||||
|
||||
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_DATA_ERROR if the input data was corrupted, 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. */ |
||||
|
||||
|
||||
extern int inflateEnd OF((z_stream *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 */ |
||||
|
||||
extern int inflateInit2 OF((z_stream *strm, |
||||
int windowBits)); |
||||
/*
|
||||
This is another version of inflateInit with more compression options. The |
||||
fields next_out, zalloc and zfree 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 value 16 will be allowed soon). 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. |
||||
|
||||
If next_out is not null, the library will use this buffer for the history |
||||
buffer; the buffer must either be large enough to hold the entire output |
||||
data, or have at least 1<<windowBits bytes. If next_out is null, the |
||||
library will allocate its own buffer (and leave next_out null). next_in |
||||
need not be provided here but must be provided by the application for the |
||||
next call of inflate(). |
||||
|
||||
If the history buffer is provided by the application, next_out must |
||||
never be changed by the application since the decompressor maintains |
||||
history information inside this buffer from call to call; the application |
||||
can only reset next_out to the beginning of the history buffer when |
||||
avail_out is zero and all output has been consumed. |
||||
|
||||
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 |
||||
windowBits < 8). msg is set to null if there is no error message. |
||||
inflateInit2 does not perform any decompression: this will be done by |
||||
inflate(). |
||||
*/ |
||||
|
||||
extern int inflateSync OF((z_stream *strm)); |
||||
/*
|
||||
Skips invalid compressed data until the special marker (see deflate() |
||||
above) can be found, or until all available input is skipped. No output |
||||
is provided. |
||||
|
||||
inflateSync returns Z_OK if the special marker has been found, Z_BUF_ERROR |
||||
if no more input was provided, Z_DATA_ERROR if no marker 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. |
||||
*/ |
||||
|
||||
extern int inflateReset OF((z_stream *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). |
||||
*/ |
||||
|
||||
extern int inflateIncomp OF((z_stream *strm)); |
||||
/*
|
||||
This function adds the data at next_in (avail_in bytes) to the output |
||||
history without performing any output. There must be no pending output, |
||||
and the decompressor must be expecting to see the start of a block. |
||||
Calling this function is equivalent to decompressing a stored block |
||||
containing the data at next_in (except that the data is not output). |
||||
*/ |
||||
|
||||
/* checksum functions */ |
||||
|
||||
/*
|
||||
This function is not related to compression but is exported |
||||
anyway because it might be useful in applications using the |
||||
compression library. |
||||
*/ |
||||
|
||||
extern uLong adler32 OF((uLong adler, 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(); |
||||
*/ |
||||
|
||||
#ifndef _Z_UTIL_H |
||||
struct internal_state {int dummy;}; /* hack for buggy compilers */ |
||||
#endif |
||||
|
||||
#endif /* _ZLIB_H */ |
@ -0,0 +1,55 @@ |
||||
/* Copyright (C) 1992, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library. |
||||
|
||||
The GNU C 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. |
||||
|
||||
The GNU C 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 the GNU C Library; see the file COPYING.LIB. If not, |
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
||||
Boston, MA 02111-1307, USA. */ |
||||
|
||||
typedef struct { |
||||
long quot; |
||||
long rem; |
||||
} ldiv_t; |
||||
/* Return the `ldiv_t' representation of NUMER over DENOM. */ |
||||
ldiv_t |
||||
ldiv (long int numer, long int denom) |
||||
{ |
||||
ldiv_t result; |
||||
|
||||
result.quot = numer / denom; |
||||
result.rem = numer % denom; |
||||
|
||||
/* The ANSI standard says that |QUOT| <= |NUMER / DENOM|, where
|
||||
NUMER / DENOM is to be computed in infinite precision. In |
||||
other words, we should always truncate the quotient towards |
||||
zero, never -infinity. Machine division and remainer may |
||||
work either way when one or both of NUMER or DENOM is |
||||
negative. If only one is negative and QUOT has been |
||||
truncated towards -infinity, REM will have the same sign as |
||||
DENOM and the opposite sign of NUMER; if both are negative |
||||
and QUOT has been truncated towards -infinity, REM will be |
||||
positive (will have the opposite sign of NUMER). These are |
||||
considered `wrong'. If both are NUM and DENOM are positive, |
||||
RESULT will always be positive. This all boils down to: if |
||||
NUMER >= 0, but REM < 0, we got the wrong answer. In that |
||||
case, to get the right answer, add 1 to QUOT and subtract |
||||
DENOM from REM. */ |
||||
|
||||
if (numer >= 0 && result.rem < 0) |
||||
{ |
||||
++result.quot; |
||||
result.rem -= denom; |
||||
} |
||||
|
||||
return result; |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,928 @@ |
||||
/*
|
||||
* taken from gdb/remote.c |
||||
* |
||||
* I am only interested in the write to memory stuff - everything else |
||||
* has been ripped out |
||||
* |
||||
* all the copyright notices etc have been left in |
||||
*/ |
||||
|
||||
/* enough so that it will compile */ |
||||
#include <stdio.h> |
||||
#include <stdlib.h> |
||||
#include <string.h> |
||||
#include <errno.h> |
||||
|
||||
/*nicked from gcc..*/ |
||||
|
||||
#ifndef alloca |
||||
#ifdef __GNUC__ |
||||
#define alloca __builtin_alloca |
||||
#else /* not GNU C. */ |
||||
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) |
||||
#include <alloca.h> |
||||
#else /* not sparc */ |
||||
#if defined (MSDOS) && !defined (__TURBOC__) |
||||
#include <malloc.h> |
||||
#else /* not MSDOS, or __TURBOC__ */ |
||||
#if defined(_AIX) |
||||
#include <malloc.h> |
||||
#pragma alloca |
||||
#else /* not MSDOS, __TURBOC__, or _AIX */ |
||||
#ifdef __hpux |
||||
#endif /* __hpux */ |
||||
#endif /* not _AIX */ |
||||
#endif /* not MSDOS, or __TURBOC__ */ |
||||
#endif /* not sparc. */ |
||||
#endif /* not GNU C. */ |
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
void* alloca(size_t); |
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
#endif /* alloca not defined. */ |
||||
|
||||
|
||||
#include "serial.h" |
||||
#include "error.h" |
||||
#include "remote.h" |
||||
#define REGISTER_BYTES 0 |
||||
#define fprintf_unfiltered fprintf |
||||
#define fprintf_filtered fprintf |
||||
#define fputs_unfiltered fputs |
||||
#define fputs_filtered fputs |
||||
#define fputc_unfiltered fputc |
||||
#define fputc_filtered fputc |
||||
#define printf_unfiltered printf |
||||
#define printf_filtered printf |
||||
#define puts_unfiltered puts |
||||
#define puts_filtered puts |
||||
#define putchar_unfiltered putchar |
||||
#define putchar_filtered putchar |
||||
#define fputstr_unfiltered(a,b,c) fputs((a), (c)) |
||||
#define gdb_stdlog stderr |
||||
#define SERIAL_READCHAR(fd,timo) serialreadchar((fd), (timo)) |
||||
#define SERIAL_WRITE(fd, addr, len) serialwrite((fd), (addr), (len)) |
||||
#define error Error |
||||
#define perror_with_name Perror |
||||
#define gdb_flush fflush |
||||
#define max(a,b) (((a)>(b))?(a):(b)) |
||||
#define min(a,b) (((a)<(b))?(a):(b)) |
||||
#define target_mourn_inferior() {} |
||||
#define ULONGEST unsigned long |
||||
#define CORE_ADDR unsigned long |
||||
|
||||
static int putpkt (char *); |
||||
static int putpkt_binary(char *, int); |
||||
static void getpkt (char *, int); |
||||
|
||||
static int remote_debug = 0, remote_register_buf_size = 0, watchdog = 0; |
||||
|
||||
int remote_desc = -1, remote_timeout = 10; |
||||
|
||||
static void |
||||
fputstrn_unfiltered(char *s, int n, int x, FILE *fp) |
||||
{ |
||||
while (n-- > 0) |
||||
fputc(*s++, fp); |
||||
} |
||||
|
||||
void |
||||
remote_reset(void) |
||||
{ |
||||
SERIAL_WRITE(remote_desc, "+", 1); |
||||
} |
||||
|
||||
void |
||||
remote_continue(void) |
||||
{ |
||||
putpkt("c"); |
||||
} |
||||
|
||||
/* Remote target communications for serial-line targets in custom GDB protocol
|
||||
Copyright 1988, 91, 92, 93, 94, 95, 96, 97, 98, 1999 |
||||
Free Software Foundation, Inc. |
||||
|
||||
This file is part of GDB. |
||||
|
||||
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. */ |
||||
/* *INDENT-OFF* */ |
||||
/* Remote communication protocol.
|
||||
|
||||
A debug packet whose contents are <data> |
||||
is encapsulated for transmission in the form: |
||||
|
||||
$ <data> # CSUM1 CSUM2 |
||||
|
||||
<data> must be ASCII alphanumeric and cannot include characters |
||||
'$' or '#'. If <data> starts with two characters followed by |
||||
':', then the existing stubs interpret this as a sequence number. |
||||
|
||||
CSUM1 and CSUM2 are ascii hex representation of an 8-bit |
||||
checksum of <data>, the most significant nibble is sent first. |
||||
the hex digits 0-9,a-f are used. |
||||
|
||||
Receiver responds with: |
||||
|
||||
+ - if CSUM is correct and ready for next packet |
||||
- - if CSUM is incorrect |
||||
|
||||
<data> is as follows: |
||||
Most values are encoded in ascii hex digits. Signal numbers are according |
||||
to the numbering in target.h. |
||||
|
||||
Request Packet |
||||
|
||||
set thread Hct... Set thread for subsequent operations. |
||||
c = 'c' for thread used in step and |
||||
continue; t... can be -1 for all |
||||
threads. |
||||
c = 'g' for thread used in other |
||||
operations. If zero, pick a thread, |
||||
any thread. |
||||
reply OK for success |
||||
ENN for an error. |
||||
|
||||
read registers g |
||||
reply XX....X Each byte of register data |
||||
is described by two hex digits. |
||||
Registers are in the internal order |
||||
for GDB, and the bytes in a register |
||||
are in the same order the machine uses. |
||||
or ENN for an error. |
||||
|
||||
write regs GXX..XX Each byte of register data |
||||
is described by two hex digits. |
||||
reply OK for success |
||||
ENN for an error |
||||
|
||||
write reg Pn...=r... Write register n... with value r..., |
||||
which contains two hex digits for each |
||||
byte in the register (target byte |
||||
order). |
||||
reply OK for success |
||||
ENN for an error |
||||
(not supported by all stubs). |
||||
|
||||
read mem mAA..AA,LLLL AA..AA is address, LLLL is length. |
||||
reply XX..XX XX..XX is mem contents |
||||
Can be fewer bytes than requested |
||||
if able to read only part of the data. |
||||
or ENN NN is errno |
||||
|
||||
write mem MAA..AA,LLLL:XX..XX |
||||
AA..AA is address, |
||||
LLLL is number of bytes, |
||||
XX..XX is data |
||||
reply OK for success |
||||
ENN for an error (this includes the case |
||||
where only part of the data was |
||||
written). |
||||
|
||||
write mem XAA..AA,LLLL:XX..XX |
||||
(binary) AA..AA is address, |
||||
LLLL is number of bytes, |
||||
XX..XX is binary data |
||||
reply OK for success |
||||
ENN for an error |
||||
|
||||
continue cAA..AA AA..AA is address to resume |
||||
If AA..AA is omitted, |
||||
resume at same address. |
||||
|
||||
step sAA..AA AA..AA is address to resume |
||||
If AA..AA is omitted, |
||||
resume at same address. |
||||
|
||||
continue with Csig;AA..AA Continue with signal sig (hex signal |
||||
signal number). If ;AA..AA is omitted, |
||||
resume at same address. |
||||
|
||||
step with Ssig;AA..AA Like 'C' but step not continue. |
||||
signal |
||||
|
||||
last signal ? Reply the current reason for stopping. |
||||
This is the same reply as is generated |
||||
for step or cont : SAA where AA is the |
||||
signal number. |
||||
|
||||
detach D Reply OK. |
||||
|
||||
There is no immediate reply to step or cont. |
||||
The reply comes when the machine stops. |
||||
It is SAA AA is the signal number. |
||||
|
||||
or... TAAn...:r...;n...:r...;n...:r...; |
||||
AA = signal number |
||||
n... = register number (hex) |
||||
r... = register contents |
||||
n... = `thread' |
||||
r... = thread process ID. This is |
||||
a hex integer. |
||||
n... = other string not starting |
||||
with valid hex digit. |
||||
gdb should ignore this n,r pair |
||||
and go on to the next. This way |
||||
we can extend the protocol. |
||||
or... WAA The process exited, and AA is |
||||
the exit status. This is only |
||||
applicable for certains sorts of |
||||
targets. |
||||
or... XAA The process terminated with signal |
||||
AA. |
||||
or (obsolete) NAA;tttttttt;dddddddd;bbbbbbbb |
||||
AA = signal number |
||||
tttttttt = address of symbol "_start" |
||||
dddddddd = base of data section |
||||
bbbbbbbb = base of bss section. |
||||
Note: only used by Cisco Systems |
||||
targets. The difference between this |
||||
reply and the "qOffsets" query is that |
||||
the 'N' packet may arrive spontaneously |
||||
whereas the 'qOffsets' is a query |
||||
initiated by the host debugger. |
||||
or... OXX..XX XX..XX is hex encoding of ASCII data. This |
||||
can happen at any time while the |
||||
program is running and the debugger |
||||
should continue to wait for |
||||
'W', 'T', etc. |
||||
|
||||
thread alive TXX Find out if the thread XX is alive. |
||||
reply OK thread is still alive |
||||
ENN thread is dead |
||||
|
||||
remote restart RXX Restart the remote server |
||||
|
||||
extended ops ! Use the extended remote protocol. |
||||
Sticky -- only needs to be set once. |
||||
|
||||
kill request k |
||||
|
||||
toggle debug d toggle debug flag (see 386 & 68k stubs) |
||||
reset r reset -- see sparc stub. |
||||
reserved <other> On other requests, the stub should |
||||
ignore the request and send an empty |
||||
response ($#<checksum>). This way |
||||
we can extend the protocol and GDB |
||||
can tell whether the stub it is |
||||
talking to uses the old or the new. |
||||
search tAA:PP,MM Search backwards starting at address |
||||
AA for a match with pattern PP and |
||||
mask MM. PP and MM are 4 bytes. |
||||
Not supported by all stubs. |
||||
|
||||
general query qXXXX Request info about XXXX. |
||||
general set QXXXX=yyyy Set value of XXXX to yyyy. |
||||
query sect offs qOffsets Get section offsets. Reply is |
||||
Text=xxx;Data=yyy;Bss=zzz |
||||
|
||||
Responses can be run-length encoded to save space. A '*' means that |
||||
the next character is an ASCII encoding giving a repeat count which |
||||
stands for that many repititions of the character preceding the '*'. |
||||
The encoding is n+29, yielding a printable character where n >=3 |
||||
(which is where rle starts to win). Don't use an n > 126. |
||||
|
||||
So |
||||
"0* " means the same as "0000". */ |
||||
/* *INDENT-ON* */ |
||||
|
||||
/* This variable (available to the user via "set remotebinarydownload")
|
||||
dictates whether downloads are sent in binary (via the 'X' packet). |
||||
We assume that the stub can, and attempt to do it. This will be cleared if |
||||
the stub does not understand it. This switch is still needed, though |
||||
in cases when the packet is supported in the stub, but the connection |
||||
does not allow it (i.e., 7-bit serial connection only). */ |
||||
static int remote_binary_download = 1; |
||||
|
||||
/* Have we already checked whether binary downloads work? */ |
||||
static int remote_binary_checked; |
||||
|
||||
/* Maximum number of bytes to read/write at once. The value here
|
||||
is chosen to fill up a packet (the headers account for the 32). */ |
||||
#define MAXBUFBYTES(N) (((N)-32)/2) |
||||
|
||||
/* Having this larger than 400 causes us to be incompatible with m68k-stub.c
|
||||
and i386-stub.c. Normally, no one would notice because it only matters |
||||
for writing large chunks of memory (e.g. in downloads). Also, this needs |
||||
to be more than 400 if required to hold the registers (see below, where |
||||
we round it up based on REGISTER_BYTES). */ |
||||
/* Round up PBUFSIZ to hold all the registers, at least. */ |
||||
#define PBUFSIZ ((REGISTER_BYTES > MAXBUFBYTES (400)) \ |
||||
? (REGISTER_BYTES * 2 + 32) \
|
||||
: 400) |
||||
|
||||
|
||||
/* This variable sets the number of bytes to be written to the target
|
||||
in a single packet. Normally PBUFSIZ is satisfactory, but some |
||||
targets need smaller values (perhaps because the receiving end |
||||
is slow). */ |
||||
|
||||
static int remote_write_size = 0x7fffffff; |
||||
|
||||
/* This variable sets the number of bits in an address that are to be
|
||||
sent in a memory ("M" or "m") packet. Normally, after stripping |
||||
leading zeros, the entire address would be sent. This variable |
||||
restricts the address to REMOTE_ADDRESS_SIZE bits. HISTORY: The |
||||
initial implementation of remote.c restricted the address sent in |
||||
memory packets to ``host::sizeof long'' bytes - (typically 32 |
||||
bits). Consequently, for 64 bit targets, the upper 32 bits of an |
||||
address was never sent. Since fixing this bug may cause a break in |
||||
some remote targets this variable is principly provided to |
||||
facilitate backward compatibility. */ |
||||
|
||||
static int remote_address_size; |
||||
|
||||
/* Convert hex digit A to a number. */ |
||||
|
||||
static int |
||||
fromhex (int a) |
||||
{ |
||||
if (a >= '0' && a <= '9') |
||||
return a - '0'; |
||||
else if (a >= 'a' && a <= 'f') |
||||
return a - 'a' + 10; |
||||
else if (a >= 'A' && a <= 'F') |
||||
return a - 'A' + 10; |
||||
else { |
||||
error ("Reply contains invalid hex digit %d", a); |
||||
return -1; |
||||
} |
||||
} |
||||
|
||||
/* Convert number NIB to a hex digit. */ |
||||
|
||||
static int |
||||
tohex (int nib) |
||||
{ |
||||
if (nib < 10) |
||||
return '0' + nib; |
||||
else |
||||
return 'a' + nib - 10; |
||||
} |
||||
|
||||
/* Return the number of hex digits in num. */ |
||||
|
||||
static int |
||||
hexnumlen (ULONGEST num) |
||||
{ |
||||
int i; |
||||
|
||||
for (i = 0; num != 0; i++) |
||||
num >>= 4; |
||||
|
||||
return max (i, 1); |
||||
} |
||||
|
||||
/* Set BUF to the hex digits representing NUM. */ |
||||
|
||||
static int |
||||
hexnumstr (char *buf, ULONGEST num) |
||||
{ |
||||
int i; |
||||
int len = hexnumlen (num); |
||||
|
||||
buf[len] = '\0'; |
||||
|
||||
for (i = len - 1; i >= 0; i--) |
||||
{ |
||||
buf[i] = "0123456789abcdef"[(num & 0xf)]; |
||||
num >>= 4; |
||||
} |
||||
|
||||
return len; |
||||
} |
||||
|
||||
/* Mask all but the least significant REMOTE_ADDRESS_SIZE bits. */ |
||||
|
||||
static CORE_ADDR |
||||
remote_address_masked (CORE_ADDR addr) |
||||
{ |
||||
if (remote_address_size > 0 |
||||
&& remote_address_size < (sizeof (ULONGEST) * 8)) |
||||
{ |
||||
/* Only create a mask when that mask can safely be constructed
|
||||
in a ULONGEST variable. */ |
||||
ULONGEST mask = 1; |
||||
mask = (mask << remote_address_size) - 1; |
||||
addr &= mask; |
||||
} |
||||
return addr; |
||||
} |
||||
|
||||
/* Determine whether the remote target supports binary downloading.
|
||||
This is accomplished by sending a no-op memory write of zero length |
||||
to the target at the specified address. It does not suffice to send |
||||
the whole packet, since many stubs strip the eighth bit and subsequently |
||||
compute a wrong checksum, which causes real havoc with remote_write_bytes. |
||||
|
||||
NOTE: This can still lose if the serial line is not eight-bit clean. In |
||||
cases like this, the user should clear "remotebinarydownload". */ |
||||
static void |
||||
check_binary_download (CORE_ADDR addr) |
||||
{ |
||||
if (remote_binary_download && !remote_binary_checked) |
||||
{ |
||||
char *buf = alloca (PBUFSIZ); |
||||
char *p; |
||||
remote_binary_checked = 1; |
||||
|
||||
p = buf; |
||||
*p++ = 'X'; |
||||
p += hexnumstr (p, (ULONGEST) addr); |
||||
*p++ = ','; |
||||
p += hexnumstr (p, (ULONGEST) 0); |
||||
*p++ = ':'; |
||||
*p = '\0'; |
||||
|
||||
putpkt_binary (buf, (int) (p - buf)); |
||||
getpkt (buf, 0); |
||||
|
||||
if (buf[0] == '\0') |
||||
remote_binary_download = 0; |
||||
} |
||||
|
||||
if (remote_debug) |
||||
{ |
||||
if (remote_binary_download) |
||||
fprintf_unfiltered (gdb_stdlog, |
||||
"binary downloading suppported by target\n"); |
||||
else |
||||
fprintf_unfiltered (gdb_stdlog, |
||||
"binary downloading NOT suppported by target\n"); |
||||
} |
||||
} |
||||
|
||||
/* Write memory data directly to the remote machine.
|
||||
This does not inform the data cache; the data cache uses this. |
||||
MEMADDR is the address in the remote memory space. |
||||
MYADDR is the address of the buffer in our space. |
||||
LEN is the number of bytes. |
||||
|
||||
Returns number of bytes transferred, or 0 for error. */ |
||||
|
||||
int |
||||
remote_write_bytes (memaddr, myaddr, len) |
||||
CORE_ADDR memaddr; |
||||
char *myaddr; |
||||
int len; |
||||
{ |
||||
unsigned char *buf = alloca (PBUFSIZ); |
||||
int max_buf_size; /* Max size of packet output buffer */ |
||||
int origlen; |
||||
extern int verbose; |
||||
|
||||
/* Verify that the target can support a binary download */ |
||||
check_binary_download (memaddr); |
||||
|
||||
/* Chop the transfer down if necessary */ |
||||
|
||||
max_buf_size = min (remote_write_size, PBUFSIZ); |
||||
if (remote_register_buf_size != 0) |
||||
max_buf_size = min (max_buf_size, remote_register_buf_size); |
||||
|
||||
/* Subtract header overhead from max payload size - $M<memaddr>,<len>:#nn */ |
||||
max_buf_size -= 2 + hexnumlen (memaddr + len - 1) + 1 + hexnumlen (len) + 4; |
||||
|
||||
origlen = len; |
||||
while (len > 0) |
||||
{ |
||||
unsigned char *p, *plen; |
||||
int todo; |
||||
int i; |
||||
|
||||
/* construct "M"<memaddr>","<len>":" */ |
||||
/* sprintf (buf, "M%lx,%x:", (unsigned long) memaddr, todo); */ |
||||
memaddr = remote_address_masked (memaddr); |
||||
p = buf; |
||||
if (remote_binary_download) |
||||
{ |
||||
*p++ = 'X'; |
||||
todo = min (len, max_buf_size); |
||||
} |
||||
else |
||||
{ |
||||
*p++ = 'M'; |
||||
todo = min (len, max_buf_size / 2); /* num bytes that will fit */ |
||||
} |
||||
|
||||
p += hexnumstr ((char *)p, (ULONGEST) memaddr); |
||||
*p++ = ','; |
||||
|
||||
plen = p; /* remember where len field goes */ |
||||
p += hexnumstr ((char *)p, (ULONGEST) todo); |
||||
*p++ = ':'; |
||||
*p = '\0'; |
||||
|
||||
/* We send target system values byte by byte, in increasing byte
|
||||
addresses, each byte encoded as two hex characters (or one |
||||
binary character). */ |
||||
if (remote_binary_download) |
||||
{ |
||||
int escaped = 0; |
||||
for (i = 0; |
||||
(i < todo) && (i + escaped) < (max_buf_size - 2); |
||||
i++) |
||||
{ |
||||
switch (myaddr[i] & 0xff) |
||||
{ |
||||
case '$': |
||||
case '#': |
||||
case 0x7d: |
||||
/* These must be escaped */ |
||||
escaped++; |
||||
*p++ = 0x7d; |
||||
*p++ = (myaddr[i] & 0xff) ^ 0x20; |
||||
break; |
||||
default: |
||||
*p++ = myaddr[i] & 0xff; |
||||
break; |
||||
} |
||||
} |
||||
|
||||
if (i < todo) |
||||
{ |
||||
/* Escape chars have filled up the buffer prematurely,
|
||||
and we have actually sent fewer bytes than planned. |
||||
Fix-up the length field of the packet. */ |
||||
|
||||
/* FIXME: will fail if new len is a shorter string than
|
||||
old len. */ |
||||
|
||||
plen += hexnumstr ((char *)plen, (ULONGEST) i); |
||||
*plen++ = ':'; |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
for (i = 0; i < todo; i++) |
||||
{ |
||||
*p++ = tohex ((myaddr[i] >> 4) & 0xf); |
||||
*p++ = tohex (myaddr[i] & 0xf); |
||||
} |
||||
*p = '\0'; |
||||
} |
||||
|
||||
putpkt_binary ((char *)buf, (int) (p - buf)); |
||||
getpkt ((char *)buf, 0); |
||||
|
||||
if (buf[0] == 'E') |
||||
{ |
||||
/* There is no correspondance between what the remote protocol uses
|
||||
for errors and errno codes. We would like a cleaner way of |
||||
representing errors (big enough to include errno codes, bfd_error |
||||
codes, and others). But for now just return EIO. */ |
||||
errno = EIO; |
||||
return 0; |
||||
} |
||||
|
||||
/* Increment by i, not by todo, in case escape chars
|
||||
caused us to send fewer bytes than we'd planned. */ |
||||
myaddr += i; |
||||
memaddr += i; |
||||
len -= i; |
||||
|
||||
if (verbose) |
||||
putc('.', stderr); |
||||
} |
||||
return origlen; |
||||
} |
||||
|
||||
/* Stuff for dealing with the packets which are part of this protocol.
|
||||
See comment at top of file for details. */ |
||||
|
||||
/* Read a single character from the remote end, masking it down to 7 bits. */ |
||||
|
||||
static int |
||||
readchar (int timeout) |
||||
{ |
||||
int ch; |
||||
|
||||
ch = SERIAL_READCHAR (remote_desc, timeout); |
||||
|
||||
switch (ch) |
||||
{ |
||||
case SERIAL_EOF: |
||||
error ("Remote connection closed"); |
||||
case SERIAL_ERROR: |
||||
perror_with_name ("Remote communication error"); |
||||
case SERIAL_TIMEOUT: |
||||
return ch; |
||||
default: |
||||
return ch & 0x7f; |
||||
} |
||||
} |
||||
|
||||
static int |
||||
putpkt (buf) |
||||
char *buf; |
||||
{ |
||||
return putpkt_binary (buf, strlen (buf)); |
||||
} |
||||
|
||||
/* Send a packet to the remote machine, with error checking. The data
|
||||
of the packet is in BUF. The string in BUF can be at most PBUFSIZ - 5 |
||||
to account for the $, # and checksum, and for a possible /0 if we are |
||||
debugging (remote_debug) and want to print the sent packet as a string */ |
||||
|
||||
static int |
||||
putpkt_binary (buf, cnt) |
||||
char *buf; |
||||
int cnt; |
||||
{ |
||||
int i; |
||||
unsigned char csum = 0; |
||||
char *buf2 = alloca (PBUFSIZ); |
||||
char *junkbuf = alloca (PBUFSIZ); |
||||
|
||||
int ch; |
||||
int tcount = 0; |
||||
char *p; |
||||
|
||||
/* Copy the packet into buffer BUF2, encapsulating it
|
||||
and giving it a checksum. */ |
||||
|
||||
if (cnt > BUFSIZ - 5) /* Prosanity check */ |
||||
abort (); |
||||
|
||||
p = buf2; |
||||
*p++ = '$'; |
||||
|
||||
for (i = 0; i < cnt; i++) |
||||
{ |
||||
csum += buf[i]; |
||||
*p++ = buf[i]; |
||||
} |
||||
*p++ = '#'; |
||||
*p++ = tohex ((csum >> 4) & 0xf); |
||||
*p++ = tohex (csum & 0xf); |
||||
|
||||
/* Send it over and over until we get a positive ack. */ |
||||
|
||||
while (1) |
||||
{ |
||||
int started_error_output = 0; |
||||
|
||||
if (remote_debug) |
||||
{ |
||||
*p = '\0'; |
||||
fprintf_unfiltered (gdb_stdlog, "Sending packet: "); |
||||
fputstrn_unfiltered (buf2, p - buf2, 0, gdb_stdlog); |
||||
fprintf_unfiltered (gdb_stdlog, "..."); |
||||
gdb_flush (gdb_stdlog); |
||||
} |
||||
if (SERIAL_WRITE (remote_desc, buf2, p - buf2)) |
||||
perror_with_name ("putpkt: write failed"); |
||||
|
||||
/* read until either a timeout occurs (-2) or '+' is read */ |
||||
while (1) |
||||
{ |
||||
ch = readchar (remote_timeout); |
||||
|
||||
if (remote_debug) |
||||
{ |
||||
switch (ch) |
||||
{ |
||||
case '+': |
||||
case SERIAL_TIMEOUT: |
||||
case '$': |
||||
if (started_error_output) |
||||
{ |
||||
putchar_unfiltered ('\n'); |
||||
started_error_output = 0; |
||||
} |
||||
} |
||||
} |
||||
|
||||
switch (ch) |
||||
{ |
||||
case '+': |
||||
if (remote_debug) |
||||
fprintf_unfiltered (gdb_stdlog, "Ack\n"); |
||||
return 1; |
||||
case SERIAL_TIMEOUT: |
||||
tcount++; |
||||
if (tcount > 3) |
||||
return 0; |
||||
break; /* Retransmit buffer */ |
||||
case '$': |
||||
{ |
||||
/* It's probably an old response, and we're out of sync.
|
||||
Just gobble up the packet and ignore it. */ |
||||
getpkt (junkbuf, 0); |
||||
continue; /* Now, go look for + */ |
||||
} |
||||
default: |
||||
if (remote_debug) |
||||
{ |
||||
if (!started_error_output) |
||||
{ |
||||
started_error_output = 1; |
||||
fprintf_unfiltered (gdb_stdlog, "putpkt: Junk: "); |
||||
} |
||||
fputc_unfiltered (ch & 0177, gdb_stdlog); |
||||
} |
||||
continue; |
||||
} |
||||
break; /* Here to retransmit */ |
||||
} |
||||
|
||||
#if 0 |
||||
/* This is wrong. If doing a long backtrace, the user should be
|
||||
able to get out next time we call QUIT, without anything as |
||||
violent as interrupt_query. If we want to provide a way out of |
||||
here without getting to the next QUIT, it should be based on |
||||
hitting ^C twice as in remote_wait. */ |
||||
if (quit_flag) |
||||
{ |
||||
quit_flag = 0; |
||||
interrupt_query (); |
||||
} |
||||
#endif |
||||
} |
||||
} |
||||
|
||||
/* Come here after finding the start of the frame. Collect the rest
|
||||
into BUF, verifying the checksum, length, and handling run-length |
||||
compression. Returns 0 on any error, 1 on success. */ |
||||
|
||||
static int |
||||
read_frame (char *buf) |
||||
{ |
||||
unsigned char csum; |
||||
char *bp; |
||||
int c; |
||||
|
||||
csum = 0; |
||||
bp = buf; |
||||
|
||||
while (1) |
||||
{ |
||||
c = readchar (remote_timeout); |
||||
|
||||
switch (c) |
||||
{ |
||||
case SERIAL_TIMEOUT: |
||||
if (remote_debug) |
||||
fputs_filtered ("Timeout in mid-packet, retrying\n", gdb_stdlog); |
||||
return 0; |
||||
case '$': |
||||
if (remote_debug) |
||||
fputs_filtered ("Saw new packet start in middle of old one\n", |
||||
gdb_stdlog); |
||||
return 0; /* Start a new packet, count retries */ |
||||
case '#': |
||||
{ |
||||
unsigned char pktcsum; |
||||
|
||||
*bp = '\000'; |
||||
|
||||
pktcsum = fromhex (readchar (remote_timeout)) << 4; |
||||
pktcsum |= fromhex (readchar (remote_timeout)); |
||||
|
||||
if (csum == pktcsum) |
||||
{ |
||||
return 1; |
||||
} |
||||
|
||||
if (remote_debug) |
||||
{ |
||||
fprintf_filtered (gdb_stdlog, |
||||
"Bad checksum, sentsum=0x%x, csum=0x%x, buf=", |
||||
pktcsum, csum); |
||||
fputs_filtered (buf, gdb_stdlog); |
||||
fputs_filtered ("\n", gdb_stdlog); |
||||
} |
||||
return 0; |
||||
} |
||||
case '*': /* Run length encoding */ |
||||
csum += c; |
||||
c = readchar (remote_timeout); |
||||
csum += c; |
||||
c = c - ' ' + 3; /* Compute repeat count */ |
||||
|
||||
if (c > 0 && c < 255 && bp + c - 1 < buf + PBUFSIZ - 1) |
||||
{ |
||||
memset (bp, *(bp - 1), c); |
||||
bp += c; |
||||
continue; |
||||
} |
||||
|
||||
*bp = '\0'; |
||||
printf_filtered ("Repeat count %d too large for buffer: ", c); |
||||
puts_filtered (buf); |
||||
puts_filtered ("\n"); |
||||
return 0; |
||||
default: |
||||
if (bp < buf + PBUFSIZ - 1) |
||||
{ |
||||
*bp++ = c; |
||||
csum += c; |
||||
continue; |
||||
} |
||||
|
||||
*bp = '\0'; |
||||
puts_filtered ("Remote packet too long: "); |
||||
puts_filtered (buf); |
||||
puts_filtered ("\n"); |
||||
|
||||
return 0; |
||||
} |
||||
} |
||||
} |
||||
|
||||
/* Read a packet from the remote machine, with error checking, and
|
||||
store it in BUF. BUF is expected to be of size PBUFSIZ. If |
||||
FOREVER, wait forever rather than timing out; this is used while |
||||
the target is executing user code. */ |
||||
|
||||
static void |
||||
getpkt (buf, forever) |
||||
char *buf; |
||||
int forever; |
||||
{ |
||||
int c; |
||||
int tries; |
||||
int timeout; |
||||
int val; |
||||
|
||||
strcpy (buf, "timeout"); |
||||
|
||||
if (forever) |
||||
{ |
||||
timeout = watchdog > 0 ? watchdog : -1; |
||||
} |
||||
|
||||
else |
||||
timeout = remote_timeout; |
||||
|
||||
#define MAX_TRIES 3 |
||||
|
||||
for (tries = 1; tries <= MAX_TRIES; tries++) |
||||
{ |
||||
/* This can loop forever if the remote side sends us characters
|
||||
continuously, but if it pauses, we'll get a zero from readchar |
||||
because of timeout. Then we'll count that as a retry. */ |
||||
|
||||
/* Note that we will only wait forever prior to the start of a packet.
|
||||
After that, we expect characters to arrive at a brisk pace. They |
||||
should show up within remote_timeout intervals. */ |
||||
|
||||
do |
||||
{ |
||||
c = readchar (timeout); |
||||
|
||||
if (c == SERIAL_TIMEOUT) |
||||
{ |
||||
if (forever) /* Watchdog went off. Kill the target. */ |
||||
{ |
||||
target_mourn_inferior (); |
||||
error ("Watchdog has expired. Target detached.\n"); |
||||
} |
||||
if (remote_debug) |
||||
fputs_filtered ("Timed out.\n", gdb_stdlog); |
||||
goto retry; |
||||
} |
||||
} |
||||
while (c != '$'); |
||||
|
||||
/* We've found the start of a packet, now collect the data. */ |
||||
|
||||
val = read_frame (buf); |
||||
|
||||
if (val == 1) |
||||
{ |
||||
if (remote_debug) |
||||
{ |
||||
fprintf_unfiltered (gdb_stdlog, "Packet received: "); |
||||
fputstr_unfiltered (buf, 0, gdb_stdlog); |
||||
fprintf_unfiltered (gdb_stdlog, "\n"); |
||||
} |
||||
SERIAL_WRITE (remote_desc, "+", 1); |
||||
return; |
||||
} |
||||
|
||||
/* Try the whole thing again. */ |
||||
retry: |
||||
SERIAL_WRITE (remote_desc, "-", 1); |
||||
} |
||||
|
||||
/* We have tried hard enough, and just can't receive the packet. Give up. */ |
||||
|
||||
printf_unfiltered ("Ignoring packet error, continuing...\n"); |
||||
SERIAL_WRITE (remote_desc, "+", 1); |
||||
} |
Loading…
Reference in new issue