o add io test
This commit is contained in:
parent
d69d2bf398
commit
2fd08d0df7
438
poc/avr_iotest/Makefile
Normal file
438
poc/avr_iotest/Makefile
Normal file
@ -0,0 +1,438 @@
|
||||
# Hey Emacs, this is a -*- makefile -*-
|
||||
#
|
||||
# WinAVR makefile written by Eric B. Weddington, Jörg Wunsch, et al.
|
||||
# Released to the Public Domain
|
||||
# Please read the make user manual!
|
||||
#
|
||||
# Additional material for this makefile was submitted by:
|
||||
# Tim Henigan
|
||||
# Peter Fleury
|
||||
# Reiner Patommel
|
||||
# Sander Pool
|
||||
# Frederik Rouleau
|
||||
# Markus Pfaff
|
||||
#
|
||||
# On command line:
|
||||
#
|
||||
# make all = Make software.
|
||||
#
|
||||
# make clean = Clean out built project files.
|
||||
#
|
||||
# make coff = Convert ELF to AVR COFF (for use with AVR Studio 3.x or VMLAB).
|
||||
#
|
||||
# make extcoff = Convert ELF to AVR Extended COFF (for use with AVR Studio
|
||||
# 4.07 or greater).
|
||||
#
|
||||
# make program = Download the hex file to the device, using avrdude. Please
|
||||
# customize the avrdude settings below first!
|
||||
#
|
||||
# make filename.s = Just compile filename.c into the assembler code only
|
||||
#
|
||||
# To rebuild project do "make clean" then "make all".
|
||||
#
|
||||
|
||||
# mth 2004/09
|
||||
# Differences from WinAVR 20040720 sample:
|
||||
# - DEPFLAGS according to Eric Weddingtion's fix (avrfreaks/gcc-forum)
|
||||
# - F_OSC Define in CFLAGS and AFLAGS
|
||||
|
||||
|
||||
# MCU name
|
||||
MCU = atmega16
|
||||
|
||||
# Main Oscillator Frequency
|
||||
# This is only used to define F_OSC in all assembler and c-sources.
|
||||
F_OSC = 16000000
|
||||
|
||||
# Output format. (can be srec, ihex, binary)
|
||||
FORMAT = ihex
|
||||
|
||||
# Target file name (without extension).
|
||||
TARGET = main
|
||||
|
||||
|
||||
# List C source files here. (C dependencies are automatically generated.)
|
||||
SRC = $(TARGET).c uart.c
|
||||
|
||||
|
||||
# List Assembler source files here.
|
||||
# Make them always end in a capital .S. Files ending in a lowercase .s
|
||||
# will not be considered source files but generated files (assembler
|
||||
# output from the compiler), and will be deleted upon "make clean"!
|
||||
# Even though the DOS/Win* filesystem matches both .s and .S the same,
|
||||
# it will preserve the spelling of the filenames, and gcc itself does
|
||||
# care about how the name is spelled on its command-line.
|
||||
ASRC =
|
||||
|
||||
|
||||
|
||||
# Optimization level, can be [0, 1, 2, 3, s].
|
||||
# 0 = turn off optimization. s = optimize for size.
|
||||
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
|
||||
OPT = s
|
||||
|
||||
# Debugging format.
|
||||
# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2.
|
||||
# AVR (extended) COFF requires stabs, plus an avr-objcopy run.
|
||||
#DEBUG = stabs
|
||||
#DEBUG = dwarf-2
|
||||
|
||||
# List any extra directories to look for include files here.
|
||||
# Each directory must be seperated by a space.
|
||||
EXTRAINCDIRS =
|
||||
|
||||
|
||||
# Compiler flag to set the C Standard level.
|
||||
# c89 - "ANSI" C
|
||||
# gnu89 - c89 plus GCC extensions
|
||||
# c99 - ISO C99 standard (not yet fully implemented)
|
||||
# gnu99 - c99 plus GCC extensions
|
||||
CSTANDARD = -std=gnu99
|
||||
|
||||
# Place -D or -U options here
|
||||
CDEFS =
|
||||
|
||||
# Place -I options here
|
||||
CINCS =
|
||||
|
||||
|
||||
# Compiler flags.
|
||||
# -g*: generate debugging information
|
||||
# -O*: optimization level
|
||||
# -f...: tuning, see GCC manual and avr-libc documentation
|
||||
# -Wall...: warning level
|
||||
# -Wa,...: tell GCC to pass this to the assembler.
|
||||
# -adhlns...: create assembler listing
|
||||
CFLAGS = -g$(DEBUG)
|
||||
CFLAGS += $(CDEFS) $(CINCS)
|
||||
CFLAGS += -O$(OPT)
|
||||
CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
|
||||
CFLAGS += -Wall -Wstrict-prototypes
|
||||
CFLAGS += -Wa,-adhlns=$(<:.c=.lst)
|
||||
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
|
||||
CFLAGS += $(CSTANDARD)
|
||||
CFLAGS += -DF_OSC=$(F_OSC)
|
||||
CFLAGS += -DF_CPU=16000000UL
|
||||
#CFLAGS += -DF_CPU=3686400UL
|
||||
|
||||
|
||||
# Assembler flags.
|
||||
# -Wa,...: tell GCC to pass this to the assembler.
|
||||
# -ahlms: create listing
|
||||
# -gstabs: have the assembler create line number information; note that
|
||||
# for use in COFF files, additional information about filenames
|
||||
# and function names needs to be present in the assembler source
|
||||
# files -- see avr-libc docs [FIXME: not yet described there]
|
||||
ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
|
||||
ASFLAGS += -DF_OSC=$(F_OSC)
|
||||
|
||||
|
||||
#Additional libraries.
|
||||
|
||||
# Minimalistic printf version
|
||||
PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
|
||||
|
||||
# Floating point printf version (requires MATH_LIB = -lm below)
|
||||
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
|
||||
|
||||
PRINTF_LIB =
|
||||
|
||||
# Minimalistic scanf version
|
||||
SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
|
||||
|
||||
# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
|
||||
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
|
||||
|
||||
SCANF_LIB =
|
||||
|
||||
MATH_LIB = -lm
|
||||
|
||||
# External memory options
|
||||
|
||||
# 64 KB of external RAM, starting after internal RAM (ATmega128!),
|
||||
# used for variables (.data/.bss) and heap (malloc()).
|
||||
#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
|
||||
|
||||
# 64 KB of external RAM, starting after internal RAM (ATmega128!),
|
||||
# only used for heap (malloc()).
|
||||
#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff
|
||||
|
||||
EXTMEMOPTS =
|
||||
|
||||
# Linker flags.
|
||||
# -Wl,...: tell GCC to pass this to linker.
|
||||
# -Map: create map file
|
||||
# --cref: add cross reference to map file
|
||||
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
|
||||
LDFLAGS += $(EXTMEMOPTS)
|
||||
LDFLAGS += $(PRINTF_LIB_MIN) $(SCANF_LIB) $(MATH_LIB)
|
||||
|
||||
|
||||
|
||||
|
||||
# Programming support using avrdude. Settings and variables.
|
||||
|
||||
# Programming hardware: alf avr910 avrisp bascom bsd
|
||||
# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
|
||||
#
|
||||
# Type: avrdude -c ?
|
||||
# to get a full listing.
|
||||
#
|
||||
AVRDUDE_PROGRAMMER = stk500v2
|
||||
|
||||
# com1 = serial port. Use lpt1 to connect to parallel port.
|
||||
|
||||
AVRDUDE_PORT = /dev/tty.PL2303-00002126
|
||||
|
||||
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
|
||||
|
||||
# Uncomment the following if you want avrdude's erase cycle counter.
|
||||
# Note that this counter needs to be initialized first using -Yn,
|
||||
# see avrdude manual.
|
||||
#AVRDUDE_ERASE_COUNTER = -y
|
||||
|
||||
# Uncomment the following if you do /not/ wish a verification to be
|
||||
# performed after programming the device.
|
||||
AVRDUDE_NO_VERIFY = -V
|
||||
|
||||
# Increase verbosity level. Please use this when submitting bug
|
||||
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
|
||||
# to submit bug reports.
|
||||
AVRDUDE_VERBOSE = -v -v
|
||||
|
||||
AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
|
||||
AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
|
||||
AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
|
||||
AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
|
||||
|
||||
#flash_fuse:
|
||||
# avrdude -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) -U lfuse:w:0xfe:m
|
||||
# avrdude -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) -U hfuse:w:0xd9:m
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Define directories, if needed.
|
||||
DIRAVR = c:/winavr
|
||||
DIRAVRBIN = $(DIRAVR)/bin
|
||||
DIRAVRUTILS = $(DIRAVR)/utils/bin
|
||||
DIRINC = .
|
||||
DIRLIB = $(DIRAVR)/avr/lib
|
||||
|
||||
|
||||
# Define programs and commands.
|
||||
SHELL = sh
|
||||
CC = avr-gcc
|
||||
OBJCOPY = avr-objcopy
|
||||
OBJDUMP = avr-objdump
|
||||
SIZE = avr-size
|
||||
NM = avr-nm
|
||||
AVRDUDE = avrdude
|
||||
REMOVE = rm -f
|
||||
COPY = cp
|
||||
|
||||
|
||||
|
||||
|
||||
# Define Messages
|
||||
# English
|
||||
MSG_ERRORS_NONE = Errors: none
|
||||
MSG_BEGIN = -------- begin --------
|
||||
MSG_END = -------- end --------
|
||||
MSG_SIZE_BEFORE = Size before:
|
||||
MSG_SIZE_AFTER = Size after:
|
||||
MSG_COFF = Converting to AVR COFF:
|
||||
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
|
||||
MSG_FLASH = Creating load file for Flash:
|
||||
MSG_EEPROM = Creating load file for EEPROM:
|
||||
MSG_EXTENDED_LISTING = Creating Extended Listing:
|
||||
MSG_SYMBOL_TABLE = Creating Symbol Table:
|
||||
MSG_LINKING = Linking:
|
||||
MSG_COMPILING = Compiling:
|
||||
MSG_ASSEMBLING = Assembling:
|
||||
MSG_CLEANING = Cleaning project:
|
||||
|
||||
|
||||
|
||||
|
||||
# Define all object files.
|
||||
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o)
|
||||
|
||||
# Define all listing files.
|
||||
LST = $(ASRC:.S=.lst) $(SRC:.c=.lst)
|
||||
|
||||
|
||||
# Compiler flags to generate dependency files.
|
||||
### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d
|
||||
GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d
|
||||
|
||||
# Combine all necessary flags and optional flags.
|
||||
# Add target processor to flags.
|
||||
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
|
||||
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Default target.
|
||||
all: begin gccversion sizebefore build sizeafter finished end
|
||||
|
||||
build: elf hex eep lss sym
|
||||
|
||||
elf: $(TARGET).elf
|
||||
hex: $(TARGET).hex
|
||||
eep: $(TARGET).eep
|
||||
lss: $(TARGET).lss
|
||||
sym: $(TARGET).sym
|
||||
|
||||
|
||||
|
||||
# Eye candy.
|
||||
# AVR Studio 3.x does not check make's exit code but relies on
|
||||
# the following magic strings to be generated by the compile job.
|
||||
begin:
|
||||
@echo
|
||||
@echo $(MSG_BEGIN)
|
||||
|
||||
finished:
|
||||
@echo $(MSG_ERRORS_NONE)
|
||||
|
||||
end:
|
||||
@echo $(MSG_END)
|
||||
@echo
|
||||
|
||||
|
||||
# Display size of file.
|
||||
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
|
||||
ELFSIZE = $(SIZE) -A $(TARGET).elf
|
||||
sizebefore:
|
||||
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi
|
||||
|
||||
sizeafter:
|
||||
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
|
||||
|
||||
|
||||
|
||||
# Display compiler version information.
|
||||
gccversion :
|
||||
@$(CC) --version
|
||||
|
||||
|
||||
|
||||
# Program the device.
|
||||
|
||||
|
||||
flash: $(TARGET).hex $(TARGET).eep
|
||||
sudo $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
|
||||
|
||||
# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
|
||||
COFFCONVERT=$(OBJCOPY) --debugging \
|
||||
--change-section-address .data-0x800000 \
|
||||
--change-section-address .bss-0x800000 \
|
||||
--change-section-address .noinit-0x800000 \
|
||||
--change-section-address .eeprom-0x810000
|
||||
|
||||
|
||||
coff: $(TARGET).elf
|
||||
@echo
|
||||
@echo $(MSG_COFF) $(TARGET).cof
|
||||
$(COFFCONVERT) -O coff-avr $< $(TARGET).cof
|
||||
|
||||
|
||||
extcoff: $(TARGET).elf
|
||||
@echo
|
||||
@echo $(MSG_EXTENDED_COFF) $(TARGET).cof
|
||||
$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
|
||||
|
||||
|
||||
|
||||
# Create final output files (.hex, .eep) from ELF output file.
|
||||
%.hex: %.elf
|
||||
@echo
|
||||
@echo $(MSG_FLASH) $@
|
||||
$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
|
||||
|
||||
%.eep: %.elf
|
||||
@echo
|
||||
@echo $(MSG_EEPROM) $@
|
||||
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
|
||||
--change-section-lma .eeprom=0 -O $(FORMAT) $< $@
|
||||
|
||||
# Create extended listing file from ELF output file.
|
||||
%.lss: %.elf
|
||||
@echo
|
||||
@echo $(MSG_EXTENDED_LISTING) $@
|
||||
$(OBJDUMP) -h -S $< > $@
|
||||
|
||||
# Create a symbol table from ELF output file.
|
||||
%.sym: %.elf
|
||||
@echo
|
||||
@echo $(MSG_SYMBOL_TABLE) $@
|
||||
$(NM) -n $< > $@
|
||||
|
||||
|
||||
|
||||
# Link: create ELF output file from object files.
|
||||
.SECONDARY : $(TARGET).elf
|
||||
.PRECIOUS : $(OBJ)
|
||||
%.elf: $(OBJ)
|
||||
@echo
|
||||
@echo $(MSG_LINKING) $@
|
||||
$(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS)
|
||||
|
||||
|
||||
# Compile: create object files from C source files.
|
||||
%.o : %.c
|
||||
@echo
|
||||
@echo $(MSG_COMPILING) $<
|
||||
$(CC) -c $(ALL_CFLAGS) $< -o $@
|
||||
|
||||
|
||||
# Compile: create assembler files from C source files.
|
||||
%.s : %.c
|
||||
$(CC) -S $(ALL_CFLAGS) $< -o $@
|
||||
|
||||
|
||||
# Assemble: create object files from assembler source files.
|
||||
%.o : %.S
|
||||
@echo
|
||||
@echo $(MSG_ASSEMBLING) $<
|
||||
$(CC) -c $(ALL_ASFLAGS) $< -o $@
|
||||
|
||||
|
||||
|
||||
# Target: clean project.
|
||||
clean: begin clean_list finished end
|
||||
|
||||
clean_list :
|
||||
@echo
|
||||
@echo $(MSG_CLEANING)
|
||||
$(REMOVE) $(TARGET).hex
|
||||
$(REMOVE) $(TARGET).eep
|
||||
$(REMOVE) $(TARGET).obj
|
||||
$(REMOVE) $(TARGET).cof
|
||||
$(REMOVE) $(TARGET).elf
|
||||
$(REMOVE) $(TARGET).map
|
||||
$(REMOVE) $(TARGET).obj
|
||||
$(REMOVE) $(TARGET).a90
|
||||
$(REMOVE) $(TARGET).sym
|
||||
$(REMOVE) $(TARGET).lnk
|
||||
$(REMOVE) $(TARGET).lss
|
||||
$(REMOVE) $(OBJ)
|
||||
$(REMOVE) $(LST)
|
||||
$(REMOVE) $(SRC:.c=.s)
|
||||
$(REMOVE) $(SRC:.c=.d)
|
||||
$(REMOVE) .dep/*
|
||||
|
||||
|
||||
|
||||
# Include the dependency files.
|
||||
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
|
||||
|
||||
|
||||
# Listing of phony targets.
|
||||
.PHONY : all begin finish end sizebefore sizeafter gccversion \
|
||||
build elf hex eep lss sym coff extcoff \
|
||||
clean clean_list program
|
||||
|
||||
35
poc/avr_iotest/checksize
Normal file
35
poc/avr_iotest/checksize
Normal file
@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
# Name: checksize
|
||||
# Project: PowerSwitch/AVR-USB
|
||||
# Author: Christian Starkjohann
|
||||
# Creation Date: 2004-12-29
|
||||
# Tabsize: 4
|
||||
# Copyright: (c) 2005 OBJECTIVE DEVELOPMENT Software GmbH.
|
||||
# Revision: $Id: checksize 83 2006-01-05 22:20:53Z cs $
|
||||
|
||||
error=0
|
||||
codelimit=2048 # default value
|
||||
datalimit=96 # default value; leave 32 bytes for stack
|
||||
|
||||
if [ $# -gt 1 ]; then
|
||||
codelimit="$2"
|
||||
fi
|
||||
if [ $# -gt 2 ]; then
|
||||
datalimit="$3"
|
||||
fi
|
||||
|
||||
set -- `avr-size -d "$1" | awk '/[0-9]/ {print $1 + $2, $2 + $3, $2}'`
|
||||
if [ $1 -gt $codelimit ]; then
|
||||
echo "*** code size $1 exceeds limit of $codelimit"
|
||||
error=1
|
||||
else
|
||||
echo "ROM: $1 bytes (data=$3)"
|
||||
fi
|
||||
if [ $2 -gt $datalimit ]; then
|
||||
echo "*** data size $2 exceeds limit of $datalimit"
|
||||
error=1
|
||||
else
|
||||
echo "RAM: $2 bytes"
|
||||
fi
|
||||
|
||||
exit $error
|
||||
28
poc/avr_iotest/fifo.c
Normal file
28
poc/avr_iotest/fifo.c
Normal file
@ -0,0 +1,28 @@
|
||||
#include "fifo.h"
|
||||
|
||||
void fifo_init(fifo_t * f, uint8_t * buffer, const uint8_t size)
|
||||
{
|
||||
f->count = 0;
|
||||
f->pread = f->pwrite = buffer;
|
||||
f->read2end = f->write2end = f->size = size;
|
||||
}
|
||||
|
||||
uint8_t fifo_put(fifo_t * f, const uint8_t data)
|
||||
{
|
||||
return _inline_fifo_put(f, data);
|
||||
}
|
||||
|
||||
uint8_t fifo_get_wait(fifo_t * f)
|
||||
{
|
||||
while (!f->count);
|
||||
|
||||
return _inline_fifo_get(f);
|
||||
}
|
||||
|
||||
int fifo_get_nowait(fifo_t * f)
|
||||
{
|
||||
if (!f->count)
|
||||
return -1;
|
||||
|
||||
return (int) _inline_fifo_get(f);
|
||||
}
|
||||
69
poc/avr_iotest/fifo.h
Normal file
69
poc/avr_iotest/fifo.h
Normal file
@ -0,0 +1,69 @@
|
||||
#ifndef _FIFO_H_
|
||||
#define _FIFO_H_
|
||||
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
|
||||
typedef struct {
|
||||
uint8_t volatile count; // # Zeichen im Puffer
|
||||
uint8_t size; // Puffer-Größe
|
||||
uint8_t *pread; // Lesezeiger
|
||||
uint8_t *pwrite; // Schreibzeiger
|
||||
uint8_t read2end, write2end; // # Zeichen bis zum Überlauf Lese-/Schreibzeiger
|
||||
} fifo_t;
|
||||
|
||||
extern void fifo_init(fifo_t *, uint8_t * buf, const uint8_t size);
|
||||
extern uint8_t fifo_put(fifo_t *, const uint8_t data);
|
||||
extern uint8_t fifo_get_wait(fifo_t *);
|
||||
extern int fifo_get_nowait(fifo_t *);
|
||||
|
||||
static inline uint8_t _inline_fifo_put(fifo_t * f, const uint8_t data)
|
||||
{
|
||||
if (f->count >= f->size)
|
||||
return 0;
|
||||
|
||||
uint8_t *pwrite = f->pwrite;
|
||||
|
||||
*(pwrite++) = data;
|
||||
|
||||
uint8_t write2end = f->write2end;
|
||||
|
||||
if (--write2end == 0) {
|
||||
write2end = f->size;
|
||||
pwrite -= write2end;
|
||||
}
|
||||
|
||||
f->write2end = write2end;
|
||||
f->pwrite = pwrite;
|
||||
|
||||
uint8_t sreg = SREG;
|
||||
cli();
|
||||
f->count++;
|
||||
SREG = sreg;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static inline uint8_t _inline_fifo_get(fifo_t * f)
|
||||
{
|
||||
uint8_t *pread = f->pread;
|
||||
uint8_t data = *(pread++);
|
||||
uint8_t read2end = f->read2end;
|
||||
|
||||
if (--read2end == 0) {
|
||||
read2end = f->size;
|
||||
pread -= read2end;
|
||||
}
|
||||
|
||||
f->pread = pread;
|
||||
f->read2end = read2end;
|
||||
|
||||
uint8_t sreg = SREG;
|
||||
cli();
|
||||
f->count--;
|
||||
SREG = sreg;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
#endif /* _FIFO_H_ */
|
||||
35
poc/avr_iotest/main.c
Normal file
35
poc/avr_iotest/main.c
Normal file
@ -0,0 +1,35 @@
|
||||
|
||||
#include <avr/io.h>
|
||||
#include <util/delay.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "uart.h"
|
||||
extern FILE uart_stdout;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
||||
uart_init();
|
||||
stdout = &uart_stdout;
|
||||
printf("Init done\n");
|
||||
|
||||
DDRD |= (1 << PD7);
|
||||
|
||||
while(1){
|
||||
|
||||
/*
|
||||
PORTD |= (1 << PD7);
|
||||
PORTD &= ~(1 << PD7);
|
||||
*/
|
||||
PORTD ^= (1 << PD7);
|
||||
|
||||
}
|
||||
|
||||
return 0 ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
79
poc/avr_iotest/uart.c
Normal file
79
poc/avr_iotest/uart.c
Normal file
@ -0,0 +1,79 @@
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdio.h>
|
||||
#include "uart.h"
|
||||
#include "fifo.h"
|
||||
|
||||
volatile struct
|
||||
{
|
||||
uint8_t tmr_int: 1;
|
||||
uint8_t adc_int: 1;
|
||||
uint8_t rx_int: 1;
|
||||
}
|
||||
intflags;
|
||||
|
||||
/*
|
||||
* * Last character read from the UART.
|
||||
*
|
||||
*/
|
||||
volatile char rxbuff;
|
||||
|
||||
|
||||
FILE uart_stdout = FDEV_SETUP_STREAM(uart_stream, NULL, _FDEV_SETUP_WRITE);
|
||||
|
||||
void uart_init(void)
|
||||
{
|
||||
UCSRA = _BV(U2X); /* improves baud rate error @ F_CPU = 1 MHz */
|
||||
UCSRB = _BV(TXEN)|_BV(RXEN)|_BV(RXCIE); /* tx/rx enable, rx complete intr */
|
||||
UBRRL = (F_CPU / (8 * 115200UL)) - 1; /* 9600 Bd */
|
||||
|
||||
}
|
||||
|
||||
|
||||
ISR(USART_RXC_vect)
|
||||
{
|
||||
uint8_t c;
|
||||
c = UDR;
|
||||
if (bit_is_clear(UCSRA, FE)){
|
||||
rxbuff = c;
|
||||
intflags.rx_int = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void uart_putc(uint8_t c)
|
||||
{
|
||||
loop_until_bit_is_set(UCSRA, UDRE);
|
||||
UDR = c;
|
||||
}
|
||||
|
||||
|
||||
void uart_puts(const char *s)
|
||||
{
|
||||
do {
|
||||
uart_putc(*s);
|
||||
}
|
||||
while (*s++);
|
||||
}
|
||||
|
||||
void uart_puts_P(PGM_P s)
|
||||
{
|
||||
while (1) {
|
||||
unsigned char c = pgm_read_byte(s);
|
||||
s++;
|
||||
if ('\0' == c)
|
||||
break;
|
||||
uart_putc(c);
|
||||
}
|
||||
}
|
||||
|
||||
static int uart_stream(char c, FILE *stream)
|
||||
{
|
||||
if (c == '\n')
|
||||
uart_putc('\r');
|
||||
loop_until_bit_is_set(UCSRA, UDRE);
|
||||
UDR = c;
|
||||
return 0;
|
||||
}
|
||||
|
||||
18
poc/avr_iotest/uart.h
Normal file
18
poc/avr_iotest/uart.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef _UART_H_
|
||||
#define _UART_H_
|
||||
|
||||
#define CR "\r\n"
|
||||
|
||||
|
||||
#include <avr/io.h>
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void uart_init(void);
|
||||
void uart_putc(const uint8_t);
|
||||
void uart_puts(const char *s);
|
||||
void uart_puts_P(PGM_P s);
|
||||
static int uart_stream(char c, FILE *stream);
|
||||
|
||||
|
||||
#endif /* _UART_H_ */
|
||||
@ -182,7 +182,7 @@ AVRDUDE_PROGRAMMER = stk500v2
|
||||
|
||||
# com1 = serial port. Use lpt1 to connect to parallel port.
|
||||
|
||||
AVRDUDE_PORT =/dev/tty.PL2303-00001124
|
||||
AVRDUDE_PORT = /dev/tty.PL2303-00002126
|
||||
|
||||
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
|
||||
|
||||
|
||||
@ -58,14 +58,15 @@ extern FILE uart_stdout;
|
||||
//#define FILENAME "vram2.smc" //ok
|
||||
//#define FILENAME "super02.smc" //ok
|
||||
//#define FILENAME "super01.smc"//ok
|
||||
//#define FILENAME "crc.smc" //ok
|
||||
#define FILENAME "crc.smc" //ok
|
||||
//#define FILENAME "banks.smc" //ok
|
||||
//#define FILENAME "hungry.smc" //ok
|
||||
//#define FILENAME "arkanoid.smc"//ok
|
||||
//#define FILENAME "eric.smc"
|
||||
#define FILENAME "turrican.smc"
|
||||
//#define FILENAME "super01.smc"
|
||||
|
||||
#define ROMSIZE 4
|
||||
#define ROMSIZE 2 // 4 == 4mbit == 512kb
|
||||
// 2 == 2mbit == 256kb
|
||||
#define DUMPNAME "dump256.smc"
|
||||
#define BUFFER_SIZE 512
|
||||
#define BLOCKS (ROMSIZE << 8)
|
||||
@ -213,20 +214,29 @@ void sram_write(uint32_t addr, uint8_t data)
|
||||
{
|
||||
RAM_DIR = 0xff;
|
||||
|
||||
CTRL_PORT |= (1<<R_RD);
|
||||
/* deactive RD and WR on ram */
|
||||
CTRL_PORT |= (1<<R_RD);
|
||||
CTRL_PORT |= (1<<R_WR);
|
||||
|
||||
/* setup address */
|
||||
spi_master_transmit((uint8_t)(addr>>16));
|
||||
spi_master_transmit((uint8_t)(addr>>8));
|
||||
spi_master_transmit((uint8_t)(addr>>0));
|
||||
|
||||
/* passthru address in sreg */
|
||||
LATCH_PORT |= (1<<S_LATCH);
|
||||
LATCH_PORT &= ~(1<<S_LATCH);
|
||||
|
||||
|
||||
/* write enable */
|
||||
CTRL_PORT &= ~(1<<R_WR);
|
||||
|
||||
/* busdriver toggle */
|
||||
|
||||
|
||||
/* write data */
|
||||
RAM_PORT = data;
|
||||
|
||||
/* disable write */
|
||||
CTRL_PORT |= (1<<R_WR);
|
||||
|
||||
RAM_DIR = 0x00;
|
||||
|
||||
@ -11,8 +11,8 @@ DEVICE = atmega16
|
||||
F_CPU = 16000000 # in Hz
|
||||
FUSE_L = # see below for fuse values for particular devices
|
||||
FUSE_H =
|
||||
AVRDUDE = avrdude -c stk500v2 -p $(DEVICE) -P /dev/tty.PL2303-00002006
|
||||
#AVRDUDE = avrdude -c stk500v2 -p $(DEVICE) -P /dev/tty.PL2303-00001424
|
||||
#AVRDUDE = avrdude -c stk500v2 -p $(DEVICE) -P /dev/tty.PL2303-00002006
|
||||
AVRDUDE = sudo avrdude -c stk500v2 -p $(DEVICE) -P /dev/tty.PL2303-00002126
|
||||
|
||||
CFLAGS = -Iusbdrv -I. -DDEBUG_LEVEL=0
|
||||
#-std=gnu99
|
||||
|
||||
@ -178,11 +178,16 @@ int main(int argc, char **argv)
|
||||
for (step = 0; step < READ_BUFFER_SIZE; step += SEND_BUFFER_SIZE) {
|
||||
addr_lo = addr & 0xffff;
|
||||
addr_hi = (addr >> 16) & 0xff;
|
||||
usb_control_msg(handle,
|
||||
cnt = usb_control_msg(handle,
|
||||
USB_TYPE_VENDOR | USB_RECIP_DEVICE |
|
||||
USB_ENDPOINT_OUT, USB_UPLOAD_ADDR, addr_hi,
|
||||
addr_lo, (char *) read_buffer + step,
|
||||
SEND_BUFFER_SIZE, 5000);
|
||||
|
||||
if (cnt < 0) {
|
||||
fprintf(stderr, "USB error: %s\n", usb_strerror());
|
||||
exit(-1);
|
||||
}
|
||||
#if 0
|
||||
dump_packet(addr, SEND_BUFFER_SIZE, read_buffer + step);
|
||||
#endif
|
||||
|
||||
@ -179,7 +179,7 @@ uint8_t usbFunctionRead(uint8_t * data, uint8_t len)
|
||||
int main(void)
|
||||
{
|
||||
uint8_t i;
|
||||
wdt_enable(WDTO_1S);
|
||||
//wdt_enable(WDTO_1S);
|
||||
uart_init();
|
||||
stdout = &uart_stdout;
|
||||
sram_init();
|
||||
|
||||
@ -27,6 +27,7 @@ void uart_init(void)
|
||||
* intr */
|
||||
UBRRL = (F_CPU / (8 * 115200UL)) - 1; /* 9600 Bd */
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -24,7 +24,10 @@ LD=$(WINE) $(SDK)/bin/WDCLN.exe
|
||||
# Project
|
||||
|
||||
INC=$(SDK)/include
|
||||
LIBS=$(SDK)/lib/cc
|
||||
LIBS=-L$(SDK)/lib/cc
|
||||
#-L$(SDK)/lib/c134
|
||||
|
||||
|
||||
OBJS=StartupSnes.obj main.obj pad.obj PPU.obj debug.obj ressource.obj diskio.obj ff.obj
|
||||
APP=fatfs.smc
|
||||
GFX=debugfont
|
||||
@ -62,7 +65,7 @@ $(APP): $(OBJS)
|
||||
-Avectors=FFE4,7FE4 \
|
||||
-Aregistration_data=FFB0,7FB0 \
|
||||
-Aressource=18000,8000 \
|
||||
-N $(OBJS) -L$(LIBS) -O $@
|
||||
-N $(OBJS) $(LIBS) -O $@
|
||||
ucon64 -snes -chk $(APP)
|
||||
|
||||
clean:
|
||||
|
||||
@ -1,20 +1,33 @@
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "data.h"
|
||||
#include "pad.h"
|
||||
#include "PPU.h"
|
||||
#include "ressource.h"
|
||||
|
||||
word debugMap[0x400];
|
||||
|
||||
static char debug_buffer[255];
|
||||
char hex_chars[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
|
||||
|
||||
void debug_init(void) {
|
||||
word i;
|
||||
for(i=0; i<0x400; i++) {
|
||||
debugMap[i] = 0x00;
|
||||
}
|
||||
memset(debug_buffer,0,255);
|
||||
}
|
||||
|
||||
void debug_enable(void){
|
||||
VRAMLoad((word) debugFont_pic, 0x5000, 2048);
|
||||
CGRAMLoad((word) debugFont_pal, (byte) 0x00, (word) 16);
|
||||
VRAMLoad((word) debugMap, 0x4000, 0x0800);
|
||||
setTileMapLocation(0x4000, (byte) 0x00, (byte) 0);
|
||||
setCharacterLocation(0x5000, (byte) 0);
|
||||
*(byte*) 0x2100 = 0x0f; // enable background
|
||||
}
|
||||
|
||||
char hex_chars[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
|
||||
|
||||
void int2hex(unsigned long number, char *buf,word size)
|
||||
{
|
||||
@ -30,6 +43,8 @@ void int2hex(unsigned long number, char *buf,word size)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void print_screen(char *buffer,word y){
|
||||
char i;
|
||||
char l;
|
||||
@ -43,16 +58,55 @@ void print_screen(char *buffer,word y){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void print_console(char *buffer){
|
||||
while(*buffer)
|
||||
*(byte*) 0x3000=*buffer++;
|
||||
}
|
||||
|
||||
void debug_enable(void){
|
||||
VRAMLoad((word) debugFont_pic, 0x5000, 2048);
|
||||
CGRAMLoad((word) debugFont_pal, (byte) 0x00, (word) 16);
|
||||
VRAMLoad((word) debugMap, 0x4000, 0x0800);
|
||||
setTileMapLocation(0x4000, (byte) 0x00, (byte) 0);
|
||||
setCharacterLocation(0x5000, (byte) 0);
|
||||
*(byte*) 0x2100 = 0x0f; // enable background
|
||||
}
|
||||
|
||||
void printfc(char *fmt, ...){
|
||||
va_list arg;
|
||||
va_start(arg,fmt);
|
||||
vsprintf(debug_buffer,fmt,arg);
|
||||
print_console(debug_buffer);
|
||||
}
|
||||
|
||||
|
||||
/* keep the linker happy */
|
||||
int open(const char * _name, int _mode){
|
||||
print_console("open called\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
int close(int fd){
|
||||
print_console("close called\n");
|
||||
return -1;
|
||||
|
||||
}
|
||||
|
||||
size_t read(int fd, void * buff, size_t len){
|
||||
print_console("read called\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t write(int fd, void * buffer, size_t len){
|
||||
print_console("write called\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
long lseek(int fd, long off, int count){
|
||||
print_console("lseek called\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int unlink(const char * name){
|
||||
print_console("unlink called\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
int isatty(){
|
||||
print_console("isatty called\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -3,8 +3,9 @@
|
||||
#include "diskio.h"
|
||||
#include "config.h"
|
||||
#include "data.h"
|
||||
#include "debug.h"
|
||||
|
||||
static
|
||||
volatile static
|
||||
DSTATUS Stat = STA_NOINIT; /* Disk status */
|
||||
|
||||
|
||||
@ -38,6 +39,7 @@ BYTE *image_addr;
|
||||
DSTATUS disk_initialize (BYTE drv) {
|
||||
|
||||
byte retval;
|
||||
print_console("disk_initialize\n");
|
||||
if (drv) return STA_NOINIT; /* Supports only single drive */
|
||||
|
||||
|
||||
@ -46,7 +48,8 @@ DSTATUS disk_initialize (BYTE drv) {
|
||||
*(byte*) MMIO_CMD = CMD_INIT;
|
||||
while(*(byte*) MMIO_RETVAL == STA_VOID);
|
||||
retval = *(byte*) MMIO_RETVAL;
|
||||
Stat &= ~retval; /* When device goes ready, clear STA_NOINIT */
|
||||
Stat &= ~STA_NOINIT; /* When device goes ready, clear STA_NOINIT */
|
||||
print_console("disk_initialize done\n");
|
||||
return Stat;
|
||||
}
|
||||
|
||||
@ -76,11 +79,12 @@ DRESULT disk_read (
|
||||
INT size;
|
||||
byte retval;
|
||||
word i;
|
||||
for (i=0;i<(count*512);i++)
|
||||
*(byte*)(SHARED_ADDR+i) = buff[i];
|
||||
|
||||
if (drv || !count) return RES_PARERR;
|
||||
print_console("disk_read enter\n");
|
||||
//if (drv || !count) return RES_PARERR;
|
||||
print_console("drv ok\n");
|
||||
if (Stat & STA_NOINIT) return RES_NOTRDY;
|
||||
print_console("sta ok\n");
|
||||
|
||||
*(byte*) MMIO_RETVAL = STA_VOID;
|
||||
*(byte*) MMIO_CMD = CMD_READ;
|
||||
@ -95,6 +99,9 @@ DRESULT disk_read (
|
||||
while(*(byte*) MMIO_RETVAL == STA_VOID);
|
||||
retval = *(byte*) MMIO_RETVAL;
|
||||
|
||||
print_console("copy buffer\n");
|
||||
for (i=0;i<(count*512);i++)
|
||||
*(byte*)(SHARED_ADDR+i) = buff[i];
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
/ performance and code efficiency. */
|
||||
|
||||
|
||||
#define _FS_READONLY 1
|
||||
#define _FS_READONLY 0
|
||||
/* Setting _FS_READONLY to 1 defines read only configuration. This removes
|
||||
/ writing functions, f_write, f_sync, f_unlink, f_mkdir, f_chmod, f_rename,
|
||||
/ f_truncate and useless f_getfree. */
|
||||
|
||||
@ -5,12 +5,29 @@
|
||||
#include "ressource.h";
|
||||
#include "PPU.h"
|
||||
#include "debug.h"
|
||||
#include "ff.h"
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
padStatus pad1;
|
||||
|
||||
|
||||
WORD acc_size; /* Work register for fs command */
|
||||
WORD acc_files, acc_dirs;
|
||||
FILINFO finfo;
|
||||
|
||||
FATFS fatfs[2]; /* File system object for each logical drive */
|
||||
BYTE buff[512]; /* Working buffer */
|
||||
|
||||
FATFS *fs;
|
||||
DIR dir; /* Directory object */
|
||||
FIL file1, file2; /* File object */
|
||||
DWORD p1, p2, p3;
|
||||
|
||||
|
||||
void initInternalRegisters(void) {
|
||||
characterLocation[0] = 0x0000;
|
||||
characterLocation[1] = 0x0000;
|
||||
@ -24,14 +41,73 @@ void preInit(void) {
|
||||
// Insert code here to be executed before register init
|
||||
}
|
||||
|
||||
DWORD get_fattime ()
|
||||
{
|
||||
time_t rawtime;
|
||||
struct tm * ptm;
|
||||
//time ( &rawtime );
|
||||
ptm = gmtime ( &rawtime );
|
||||
|
||||
return ((DWORD)(ptm->tm_year - 80) << 25)
|
||||
| ((DWORD)(ptm->tm_mon +1) << 21)
|
||||
| ((DWORD)ptm->tm_mday << 16)
|
||||
| ((DWORD)ptm->tm_hour << 11)
|
||||
| ((DWORD)ptm->tm_min << 5)
|
||||
| ((DWORD)ptm->tm_sec >> 1);
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
FRESULT scan_files (char* path)
|
||||
{
|
||||
DIR dirs;
|
||||
FRESULT res;
|
||||
int i;
|
||||
|
||||
if ((res = f_opendir(&dirs, path)) == FR_OK) {
|
||||
i = strlen(path);
|
||||
//printf("Ok\n");
|
||||
while (((res = f_readdir(&dirs, &finfo)) == FR_OK) && finfo.fname[0]) {
|
||||
if (finfo.fattrib & AM_DIR) {
|
||||
acc_dirs++;
|
||||
*(path+i) = '/'; strcpy(path+i+1, &finfo.fname[0]);
|
||||
res = scan_files(path);
|
||||
*(path+i) = '\0';
|
||||
if (res != FR_OK) break;
|
||||
} else {
|
||||
acc_files++;
|
||||
acc_size += finfo.fsize;
|
||||
}
|
||||
}
|
||||
}
|
||||
print_console("scan_files ret\n");
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
void put_rc (FRESULT rc)
|
||||
{
|
||||
char *p;
|
||||
static char str[] =
|
||||
"OK\0" "NOT_READY\0" "NO_FILE\0" "FR_NO_PATH\0" "INVALID_NAME\0" "INVALID_DRIVE\0"
|
||||
"DENIED\0" "EXIST\0" "RW_ERROR\0" "WRITE_PROTECTED\0" "NOT_ENABLED\0"
|
||||
"NO_FILESYSTEM\0" "INVALID_OBJECT\0" "MKFS_ABORTED\0";
|
||||
FRESULT i;
|
||||
|
||||
for (p = str, i = 0; i != rc && *p; i++) {
|
||||
while(*p++);
|
||||
}
|
||||
print_console(p);
|
||||
}
|
||||
|
||||
void halt(void) {
|
||||
while(1);
|
||||
|
||||
}
|
||||
void main(void) {
|
||||
word i,j;
|
||||
word crc01;
|
||||
word crc02;
|
||||
padStatus pad1;
|
||||
char line_header[32] = "OK2";
|
||||
BYTE res;
|
||||
initInternalRegisters();
|
||||
|
||||
*(byte*) 0x2105 = 0x01; // MODE 1 value
|
||||
*(byte*) 0x212c = 0x01; // Plane 0 (bit one) enable register
|
||||
*(byte*) 0x212d = 0x00; // All subPlane disable
|
||||
@ -39,9 +115,45 @@ void main(void) {
|
||||
|
||||
debug_enable();
|
||||
print_screen("FATFS TEST",0);
|
||||
print_console("Debugging console test\n");
|
||||
print_console("test me\n");
|
||||
print_console("mount ");
|
||||
|
||||
put_rc(f_mount(0, &fatfs[0]));
|
||||
|
||||
print_console("disk_initialize \n");
|
||||
disk_initialize(0);
|
||||
print_console("disk_read \n");
|
||||
disk_read(0,buff,0xaabb,1);
|
||||
print_console("disk_done \n");
|
||||
|
||||
|
||||
halt();
|
||||
|
||||
res = f_getfree("/", &p2, &fs);
|
||||
if (res) {
|
||||
put_rc(res);
|
||||
}
|
||||
/*
|
||||
printf("FAT type = %u\nBytes/Cluster = %lu\nNumber of FATs = %u\n"
|
||||
"Root DIR entries = %u\nSectors/FAT = %lu\nNumber of clusters = %lu\n"
|
||||
"FAT start (lba) = %lu\nDIR start (lba,clustor) = %lu\nData start (lba) = %lu\n",
|
||||
(WORD)fs->fs_type, (DWORD)fs->csize * 512, (WORD)fs->n_fats,
|
||||
fs->n_rootdir, (DWORD)fs->sects_fat, (DWORD)fs->max_clust - 2,
|
||||
fs->fatbase, fs->dirbase, fs->database
|
||||
);
|
||||
*/
|
||||
acc_size = acc_files = acc_dirs = 0;
|
||||
res = scan_files("/");
|
||||
if (res) {
|
||||
put_rc(res);
|
||||
}
|
||||
/*
|
||||
printf("%u files, %lu bytes.\n%u folders.\n"
|
||||
"%lu KB total disk space.\n%lu KB available.\n",
|
||||
acc_files, acc_size, acc_dirs,
|
||||
(fs->max_clust - 2) * (fs->csize / 2), p2 * (fs->csize / 2)
|
||||
);
|
||||
*/
|
||||
|
||||
while(1){
|
||||
while(!pad1.start) {
|
||||
waitForVBlank();
|
||||
|
||||
385
snesram.tmproj
385
snesram.tmproj
@ -2,6 +2,8 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>currentDocument</key>
|
||||
<string>snes/fatfstest/diskio.c</string>
|
||||
<key>documents</key>
|
||||
<array>
|
||||
<dict>
|
||||
@ -75,6 +77,146 @@
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>211</integer>
|
||||
</dict>
|
||||
<key>snes/fatfstest/data.h</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>0</integer>
|
||||
<key>line</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>firstVisibleColumn</key>
|
||||
<integer>0</integer>
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>snes/fatfstest/debug.c</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>0</integer>
|
||||
<key>line</key>
|
||||
<integer>71</integer>
|
||||
</dict>
|
||||
<key>firstVisibleColumn</key>
|
||||
<integer>0</integer>
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>43</integer>
|
||||
</dict>
|
||||
<key>snes/fatfstest/debug.h</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>19</integer>
|
||||
<key>line</key>
|
||||
<integer>4</integer>
|
||||
</dict>
|
||||
<key>firstVisibleColumn</key>
|
||||
<integer>0</integer>
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>snes/fatfstest/diskio.c</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>9</integer>
|
||||
<key>line</key>
|
||||
<integer>7</integer>
|
||||
</dict>
|
||||
<key>firstVisibleColumn</key>
|
||||
<integer>0</integer>
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>snes/fatfstest/diskio.h</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>28</integer>
|
||||
<key>line</key>
|
||||
<integer>50</integer>
|
||||
</dict>
|
||||
<key>firstVisibleColumn</key>
|
||||
<integer>0</integer>
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>3</integer>
|
||||
</dict>
|
||||
<key>snes/fatfstest/event.c</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>0</integer>
|
||||
<key>line</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>firstVisibleColumn</key>
|
||||
<integer>0</integer>
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>snes/fatfstest/ff.c</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>0</integer>
|
||||
<key>line</key>
|
||||
<integer>169</integer>
|
||||
</dict>
|
||||
<key>firstVisibleColumn</key>
|
||||
<integer>0</integer>
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>136</integer>
|
||||
</dict>
|
||||
<key>snes/fatfstest/ff.h</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>22</integer>
|
||||
<key>line</key>
|
||||
<integer>40</integer>
|
||||
</dict>
|
||||
<key>firstVisibleColumn</key>
|
||||
<integer>0</integer>
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>49</integer>
|
||||
</dict>
|
||||
<key>snes/fatfstest/main.c</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>0</integer>
|
||||
<key>line</key>
|
||||
<integer>114</integer>
|
||||
</dict>
|
||||
<key>firstVisibleColumn</key>
|
||||
<integer>0</integer>
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>98</integer>
|
||||
</dict>
|
||||
<key>snes/fatfstest/pad.h</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>0</integer>
|
||||
<key>line</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>firstVisibleColumn</key>
|
||||
<integer>0</integer>
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>tools/bsnes/cart/cart.cpp</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
@ -103,6 +245,118 @@
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>24</integer>
|
||||
</dict>
|
||||
<key>tools/bsnes/chip/cmmio/cmmio.cpp</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>14</integer>
|
||||
<key>line</key>
|
||||
<integer>34</integer>
|
||||
</dict>
|
||||
<key>firstVisibleColumn</key>
|
||||
<integer>0</integer>
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>tools/bsnes/chip/cmmio/cmmio.hpp</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>0</integer>
|
||||
<key>line</key>
|
||||
<integer>16</integer>
|
||||
</dict>
|
||||
<key>firstVisibleColumn</key>
|
||||
<integer>0</integer>
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>tools/bsnes/chip/fatfs/config.h</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>0</integer>
|
||||
<key>line</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
<key>firstVisibleColumn</key>
|
||||
<integer>0</integer>
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>tools/bsnes/chip/fatfs/diskio.cpp</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>0</integer>
|
||||
<key>line</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>firstVisibleColumn</key>
|
||||
<integer>0</integer>
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>89</integer>
|
||||
</dict>
|
||||
<key>tools/bsnes/chip/fatfs/diskio.h</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>28</integer>
|
||||
<key>line</key>
|
||||
<integer>50</integer>
|
||||
</dict>
|
||||
<key>firstVisibleColumn</key>
|
||||
<integer>0</integer>
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>11</integer>
|
||||
</dict>
|
||||
<key>tools/bsnes/chip/fatfs/fatfs.cpp</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>23</integer>
|
||||
<key>line</key>
|
||||
<integer>69</integer>
|
||||
</dict>
|
||||
<key>firstVisibleColumn</key>
|
||||
<integer>0</integer>
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>tools/bsnes/chip/fatfs/fatfs.hpp</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>0</integer>
|
||||
<key>line</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>firstVisibleColumn</key>
|
||||
<integer>0</integer>
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>tools/bsnes/chip/fatfs/integer.h</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>0</integer>
|
||||
<key>line</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>firstVisibleColumn</key>
|
||||
<integer>0</integer>
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>tools/bsnes/cpu/scpu/memory/memory.hpp</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
@ -117,10 +371,139 @@
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>tools/ffsample/linux/diskio.c</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>0</integer>
|
||||
<key>line</key>
|
||||
<integer>141</integer>
|
||||
</dict>
|
||||
<key>firstVisibleColumn</key>
|
||||
<integer>0</integer>
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>115</integer>
|
||||
</dict>
|
||||
<key>tools/ffsample/linux/main.c</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>0</integer>
|
||||
<key>line</key>
|
||||
<integer>63</integer>
|
||||
</dict>
|
||||
<key>columnSelection</key>
|
||||
<false/>
|
||||
<key>firstVisibleColumn</key>
|
||||
<integer>0</integer>
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>149</integer>
|
||||
<key>selectFrom</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>0</integer>
|
||||
<key>line</key>
|
||||
<integer>52</integer>
|
||||
</dict>
|
||||
<key>selectTo</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>0</integer>
|
||||
<key>line</key>
|
||||
<integer>63</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>tools/wdcheader/TIME.H</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>13</integer>
|
||||
<key>line</key>
|
||||
<integer>103</integer>
|
||||
</dict>
|
||||
<key>columnSelection</key>
|
||||
<false/>
|
||||
<key>firstVisibleColumn</key>
|
||||
<integer>0</integer>
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>71</integer>
|
||||
<key>selectFrom</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>12</integer>
|
||||
<key>line</key>
|
||||
<integer>103</integer>
|
||||
</dict>
|
||||
<key>selectTo</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>18</integer>
|
||||
<key>line</key>
|
||||
<integer>103</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>tools/wdcheader/WCHAR.H</key>
|
||||
<dict>
|
||||
<key>caret</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>0</integer>
|
||||
<key>line</key>
|
||||
<integer>76</integer>
|
||||
</dict>
|
||||
<key>columnSelection</key>
|
||||
<false/>
|
||||
<key>firstVisibleColumn</key>
|
||||
<integer>0</integer>
|
||||
<key>firstVisibleLine</key>
|
||||
<integer>0</integer>
|
||||
<key>selectFrom</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>74</integer>
|
||||
<key>line</key>
|
||||
<integer>76</integer>
|
||||
</dict>
|
||||
<key>selectTo</key>
|
||||
<dict>
|
||||
<key>column</key>
|
||||
<integer>0</integer>
|
||||
<key>line</key>
|
||||
<integer>76</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>openDocuments</key>
|
||||
<array>
|
||||
<string>snes/fatfstest/debug.c</string>
|
||||
<string>tools/bsnes/chip/cmmio/cmmio.hpp</string>
|
||||
<string>tools/bsnes/chip/cmmio/cmmio.cpp</string>
|
||||
<string>snes/fatfstest/ff.h</string>
|
||||
<string>snes/fatfstest/ff.c</string>
|
||||
<string>tools/ffsample/linux/main.c</string>
|
||||
<string>snes/fatfstest/pad.h</string>
|
||||
<string>snes/fatfstest/event.c</string>
|
||||
<string>snes/fatfstest/main.c</string>
|
||||
<string>tools/wdcheader/TIME.H</string>
|
||||
<string>tools/wdcheader/WCHAR.H</string>
|
||||
<string>snes/fatfstest/debug.h</string>
|
||||
<string>tools/ffsample/linux/diskio.c</string>
|
||||
<string>snes/fatfstest/data.h</string>
|
||||
<string>tools/bsnes/chip/fatfs/fatfs.cpp</string>
|
||||
<string>snes/fatfstest/diskio.c</string>
|
||||
<string>snes/fatfstest/diskio.h</string>
|
||||
<string>tools/bsnes/chip/fatfs/config.h</string>
|
||||
<string>tools/bsnes/chip/fatfs/diskio.cpp</string>
|
||||
<string>tools/bsnes/chip/fatfs/diskio.h</string>
|
||||
<string>tools/bsnes/chip/fatfs/integer.h</string>
|
||||
<string>tools/bsnes/chip/fatfs/fatfs.hpp</string>
|
||||
</array>
|
||||
<key>showFileHierarchyDrawer</key>
|
||||
<false/>
|
||||
<key>windowFrame</key>
|
||||
<string>{{0, 51}, {1110, 827}}</string>
|
||||
<string>{{0, 55}, {1110, 823}}</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@ -67,7 +67,7 @@ void FATFS::mmio_write(unsigned addr, uint8 data) {
|
||||
case CMD_INIT:
|
||||
printf("FATFS::mmio_write CMD_INIT \n");
|
||||
command = CMD_INIT;
|
||||
disk_initialize(0);
|
||||
retval = disk_initialize(0);
|
||||
break;
|
||||
case CMD_READ:
|
||||
printf("FATFS::mmio_write CMD_READ \n");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user