diff options
author | Ian C <ianc@noddybox.co.uk> | 2007-01-12 00:40:03 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2007-01-12 00:40:03 +0000 |
commit | ef641589bf763ea12e73abf4bf42e45ac1acd2ff (patch) | |
tree | 0afa591a9c5294a07508f6c5c56a0857adfd2285 /arm7 | |
parent | 50d960d99f0783799f81236d9225a6940606fe38 (diff) |
Gone back to a simpler ARM9 only build as the new dynamic libfat library means I can use that, and dswifi wouldn't work with my AP.
Diffstat (limited to 'arm7')
-rw-r--r-- | arm7/.cvsignore | 2 | ||||
-rw-r--r-- | arm7/Makefile | 132 | ||||
-rw-r--r-- | arm7/source/main.c | 179 |
3 files changed, 0 insertions, 313 deletions
diff --git a/arm7/.cvsignore b/arm7/.cvsignore deleted file mode 100644 index 970db45..0000000 --- a/arm7/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -build -ds81.arm7.elf
\ No newline at end of file diff --git a/arm7/Makefile b/arm7/Makefile deleted file mode 100644 index f3f6c8f..0000000 --- a/arm7/Makefile +++ /dev/null @@ -1,132 +0,0 @@ -#--------------------------------------------------------------------------------- -.SUFFIXES: -#--------------------------------------------------------------------------------- -ifeq ($(strip $(DEVKITARM)),) -$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM") -endif - -include $(DEVKITARM)/ds_rules - -#--------------------------------------------------------------------------------- -# BUILD is the directory where object files & intermediate files will be placed -# SOURCES is a list of directories containing source code -# INCLUDES is a list of directories containing extra header files -# DATA is a list of directories containing binary files -# all directories are relative to this makefile -#--------------------------------------------------------------------------------- -BUILD := build -SOURCES := source -INCLUDES := include build ../common -DATA := - -#--------------------------------------------------------------------------------- -# options for code generation -#--------------------------------------------------------------------------------- -ARCH := -mthumb-interwork - -CFLAGS := -g -Wall -O2\ - -mcpu=arm7tdmi -mtune=arm7tdmi -fomit-frame-pointer\ - -ffast-math \ - $(ARCH) - -CFLAGS += $(INCLUDE) -DARM7 -CXXFLAGS := $(CFLAGS) - - -ASFLAGS := -g $(ARCH) -LDFLAGS = -specs=ds_arm7.specs -g $(ARCH) -mno-fpu -Wl,-Map,$(notdir $*).map - -LIBS := -lnds7 -ldswifi7 - -#--------------------------------------------------------------------------------- -# list of directories containing libraries, this must be the top level containing -# include and lib -#--------------------------------------------------------------------------------- -LIBDIRS := $(LIBNDS) - - -#--------------------------------------------------------------------------------- -# no real need to edit anything past this point unless you need to add additional -# rules for different file extensions -#--------------------------------------------------------------------------------- -ifneq ($(BUILD),$(notdir $(CURDIR))) -#--------------------------------------------------------------------------------- - -export ARM7BIN := $(TOPDIR)/$(TARGET).arm7 -export ARM7ELF := $(CURDIR)/$(TARGET).arm7.elf -export DEPSDIR := $(CURDIR)/$(BUILD) - -export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) - -CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) -CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) -SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) -BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) - -export OFILES := $(addsuffix .o,$(BINFILES)) \ - $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) - -export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ - $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ - -I$(CURDIR)/$(BUILD) - -export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) - -#--------------------------------------------------------------------------------- -# use CXX for linking C++ projects, CC for standard C -#--------------------------------------------------------------------------------- -ifeq ($(strip $(CPPFILES)),) -#--------------------------------------------------------------------------------- - export LD := $(CC) -#--------------------------------------------------------------------------------- -else -#--------------------------------------------------------------------------------- - export LD := $(CXX) -#--------------------------------------------------------------------------------- -endif -#--------------------------------------------------------------------------------- - -.PHONY: $(BUILD) clean - -#--------------------------------------------------------------------------------- -$(BUILD): - @[ -d $@ ] || mkdir -p $@ - @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile - -#--------------------------------------------------------------------------------- -clean: - @echo clean ... - @rm -fr $(BUILD) *.elf - - -#--------------------------------------------------------------------------------- -else - -DEPENDS := $(OFILES:.o=.d) - -#--------------------------------------------------------------------------------- -# main targets -#--------------------------------------------------------------------------------- -$(ARM7BIN) : $(ARM7ELF) - @$(OBJCOPY) -O binary $< $@ - @echo built ... $(notdir $@) - - -$(ARM7ELF) : $(OFILES) - @echo linking $(notdir $@) - @$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@ - - -#--------------------------------------------------------------------------------- -# you need a rule like this for each extension you use as binary data -#--------------------------------------------------------------------------------- -%.bin.o : %.bin -#--------------------------------------------------------------------------------- - @echo $(notdir $<) - @$(bin2o) - --include $(DEPENDS) - -#--------------------------------------------------------------------------------------- -endif -#--------------------------------------------------------------------------------------- diff --git a/arm7/source/main.c b/arm7/source/main.c deleted file mode 100644 index 6579ad2..0000000 --- a/arm7/source/main.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - ds81 - Nintendo DS ZX81 emulator. - - Copyright (C) 2006 Ian Cowburn <ianc@noddybox.co.uk> - - 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. - - $Id$ - - This file is largely based on the libnds examples. -*/ - -#include <nds.h> - -#include <nds/bios.h> -#include <nds/arm7/touch.h> -#include <nds/arm7/clock.h> - -#include <dswifi7.h> - -#include "ds81_ipc.h" - -static void FIFO_Handler(u32 msg); - -static void VblankHandler(void) -{ - static int heartbeat = 0; - - uint16 but=0, x=0, y=0, xpx=0, ypx=0, z1=0, z2=0, batt=0, aux=0; - int t1=0, t2=0; - uint32 temp=0; - uint8 ct[sizeof(IPC->curtime)]; - u32 i; - - /* Update the heartbeat */ - heartbeat++; - - /* Read the touch screen */ - but = REG_KEYXY; - - if (!(but & (1<<6))) - { - touchPosition tempPos = touchReadXY(); - - x = tempPos.x; - y = tempPos.y; - xpx = tempPos.px; - ypx = tempPos.py; - } - - z1 = touchRead(TSC_MEASURE_Z1); - z2 = touchRead(TSC_MEASURE_Z2); - - batt = touchRead(TSC_MEASURE_BATTERY); - aux = touchRead(TSC_MEASURE_AUX); - - /* Read the time */ - rtcGetTime((uint8 *)ct); - BCDToInteger((uint8 *)&(ct[1]), 7); - - /* Read the temperature */ - temp = touchReadTemperature(&t1, &t2); - - /* Update the IPC struct */ - IPC->mailBusy = 1; - - IPC->heartbeat = heartbeat; - IPC->buttons = but; - IPC->touchX = x; - IPC->touchY = y; - IPC->touchXpx = xpx; - IPC->touchYpx = ypx; - IPC->touchZ1 = z1; - IPC->touchZ2 = z2; - IPC->battery = batt; - IPC->aux = aux; - - for(i=0; i<sizeof(ct); i++) - { - IPC->curtime[i] = ct[i]; - } - - IPC->temperature = temp; - IPC->tdiode1 = t1; - IPC->tdiode2 = t2; - - IPC->mailBusy = 0; - - Wifi_Update(); -} - -/* callback to allow wifi library to notify arm9 -*/ -static void ARM7_SyncToARM9(void) -{ - REG_IPC_FIFO_TX = DS81_WIFI_SYNC_IPC; -} - -/* interrupt handler to allow incoming notifications from arm9 -*/ -static void ARM7_Fifo(void) -{ - while(!(REG_IPC_FIFO_CR & IPC_FIFO_RECV_EMPTY)) - { - u32 msg; - - msg = REG_IPC_FIFO_RX; - FIFO_Handler(msg); - } -} - -/* Handler for FIFO messages -*/ -static void FIFO_Handler(u32 msg) -{ - static int next_is_wifi=0; - - if (next_is_wifi) - { - next_is_wifi = 0; - Wifi_Init(msg); - Wifi_SetSyncHandler(ARM7_SyncToARM9); - - irqSet(IRQ_WIFI, Wifi_Interrupt); - irqEnable(IRQ_WIFI); - } - else - { - switch(msg) - { - case DS81_WIFI_INIT_IPC: - next_is_wifi = 1; - break; - - case DS81_WIFI_SYNC_IPC: - Wifi_Sync(); - break; - } - } -} - -int main(int argc, char ** argv) -{ - /* enable & prepare fifo asap */ - REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_SEND_CLEAR; - - IPC->mailBusy = 1; - - /* Reset the clock if needed */ - rtcReset(); - - irqInit(); - irqSet(IRQ_VBLANK, VblankHandler); - irqEnable(IRQ_VBLANK); - - irqSet(IRQ_FIFO_NOT_EMPTY,ARM7_Fifo); /* set up fifo irq */ - irqEnable(IRQ_FIFO_NOT_EMPTY); - - REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_RECV_IRQ; - - while (1) - { - swiWaitForVBlank(); - } -} - - |