implement jumper reading

assign function pointers for PATA functions, or MMC functions depending on the jumper setting
move a '04 gate in the circuit diagram from one slot to another
This commit is contained in:
Oliver Lehmann 2012-06-13 20:17:45 +00:00
parent 5087b5d18e
commit edcf3936b0
14 changed files with 189 additions and 60 deletions

View File

@ -36,6 +36,7 @@ SUBDIRS :=
# Add inputs and outputs from these tool invocations to the build variables # Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \ C_SRCS += \
../wdc_avr.c \ ../wdc_avr.c \
../wdc_drv_pata.c \
../wdc_main.c \ ../wdc_main.c \
../wdc_drv_mmc.c \ ../wdc_drv_mmc.c \
../wdc_drv_mmc_perf.c \ ../wdc_drv_mmc_perf.c \
@ -54,6 +55,7 @@ ASM_SRCS +=
OBJS += \ OBJS += \
wdc_avr.o \ wdc_avr.o \
wdc_drv_pata.o \
wdc_main.o \ wdc_main.o \
wdc_drv_mmc.o \ wdc_drv_mmc.o \
wdc_drv_mmc_perf.o \ wdc_drv_mmc_perf.o \
@ -66,6 +68,7 @@ wdc_ram.o
OBJS_AS_ARGS += \ OBJS_AS_ARGS += \
wdc_avr.o \ wdc_avr.o \
wdc_drv_pata.o \
wdc_main.o \ wdc_main.o \
wdc_drv_mmc.o \ wdc_drv_mmc.o \
wdc_drv_mmc_perf.o \ wdc_drv_mmc_perf.o \
@ -78,6 +81,7 @@ wdc_ram.o
C_DEPS += \ C_DEPS += \
wdc_avr.d \ wdc_avr.d \
wdc_drv_pata.d \
wdc_main.d \ wdc_main.d \
wdc_drv_mmc.d \ wdc_drv_mmc.d \
wdc_drv_mmc_perf.d \ wdc_drv_mmc_perf.d \
@ -90,6 +94,7 @@ wdc_ram.d
C_DEPS_AS_ARGS += \ C_DEPS_AS_ARGS += \
wdc_avr.d \ wdc_avr.d \
wdc_drv_pata.d \
wdc_main.d \ wdc_main.d \
wdc_drv_mmc.d \ wdc_drv_mmc.d \
wdc_drv_mmc_perf.d \ wdc_drv_mmc_perf.d \
@ -127,6 +132,8 @@ OUTPUT_FILE_DEP:= ./makedep.mk
./%.o: .././%.c ./%.o: .././%.c
@echo Building file: $< @echo Building file: $<
@ -159,7 +166,7 @@ all: $(OUTPUT_FILE_PATH) $(ADDITIONAL_DEPENDENCIES)
$(OUTPUT_FILE_PATH): $(OBJS) $(USER_OBJS) $(OUTPUT_FILE_DEP) $(OUTPUT_FILE_PATH): $(OBJS) $(USER_OBJS) $(OUTPUT_FILE_DEP)
@echo Building target: $@ @echo Building target: $@
@echo Invoking: AVR/GNU Linker : (AVR_8_bit_GNU_Toolchain_3.4.0_663) 4.6.2 @echo Invoking: AVR/GNU Linker : (AVR_8_bit_GNU_Toolchain_3.4.0_663) 4.6.2
$(QUOTE)C:\Program Files (x86)\Atmel\Atmel Studio 6.0\extensions\Atmel\AVRGCC\3.4.0.65\AVRToolchain\bin\avr-gcc.exe$(QUOTE) -o$(OUTPUT_FILE_PATH_AS_ARGS) $(OBJS_AS_ARGS) $(USER_OBJS) $(LIBS) -Wl,-Map="P8000_WDC_Emulator.map" -Wl,--start-group -Wl,-lm -Wl,--end-group -Wl,--gc-sections -mrelax -mmcu=atmega1284p $(QUOTE)C:\Program Files (x86)\Atmel\Atmel Studio 6.0\extensions\Atmel\AVRGCC\3.4.0.65\AVRToolchain\bin\avr-gcc.exe$(QUOTE) -o$(OUTPUT_FILE_PATH_AS_ARGS) $(OBJS_AS_ARGS) $(USER_OBJS) $(LIBS) -Wl,-Map="P8000_WDC_Emulator.map" -Wl,--start-group -Wl,-lm -Wl,--end-group -Wl,--gc-sections -mmcu=atmega1284p
@echo Finished building target: $@ @echo Finished building target: $@
"C:\Program Files (x86)\Atmel\Atmel Studio 6.0\extensions\Atmel\AVRGCC\3.4.0.65\AVRToolchain\bin\avr-objcopy.exe" -O ihex -R .eeprom -R .fuse -R .lock -R .signature "P8000_WDC_Emulator.elf" "P8000_WDC_Emulator.hex" "C:\Program Files (x86)\Atmel\Atmel Studio 6.0\extensions\Atmel\AVRGCC\3.4.0.65\AVRToolchain\bin\avr-objcopy.exe" -O ihex -R .eeprom -R .fuse -R .lock -R .signature "P8000_WDC_Emulator.elf" "P8000_WDC_Emulator.hex"
"C:\Program Files (x86)\Atmel\Atmel Studio 6.0\extensions\Atmel\AVRGCC\3.4.0.65\AVRToolchain\bin\avr-objcopy.exe" -j .eeprom --set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O ihex "P8000_WDC_Emulator.elf" "P8000_WDC_Emulator.eep" || exit 0 "C:\Program Files (x86)\Atmel\Atmel Studio 6.0\extensions\Atmel\AVRGCC\3.4.0.65\AVRToolchain\bin\avr-objcopy.exe" -j .eeprom --set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O ihex "P8000_WDC_Emulator.elf" "P8000_WDC_Emulator.eep" || exit 0

View File

@ -4,6 +4,8 @@
wdc_avr.c wdc_avr.c
wdc_drv_pata.c
wdc_main.c wdc_main.c
wdc_drv_mmc.c wdc_drv_mmc.c

View File

@ -174,7 +174,7 @@ T 67100 33100 9 8 1 0 0 0 1
T 68500 33100 9 8 1 0 0 0 1 T 68500 33100 9 8 1 0 0 0 1
1 1
T 71000 33400 9 7 1 0 0 0 1 T 71000 33400 9 7 1 0 0 0 1
$Revision: 1.13 $ / $Date: 2012/06/12 17:34:14 $ $Revision: 1.14 $ / $Date: 2012/06/13 20:17:45 $
T 71000 33100 9 8 1 0 0 0 1 T 71000 33100 9 8 1 0 0 0 1
Oliver Lehmann <lehmann@ans-netz.de> Oliver Lehmann <lehmann@ans-netz.de>
N 50600 59400 51200 59400 4 N 50600 59400 51200 59400 4
@ -1698,7 +1698,7 @@ refdes=D8
T 51300 45500 5 10 0 0 0 0 1 T 51300 45500 5 10 0 0 0 0 1
footprint=DIP14 footprint=DIP14
T 50700 42000 5 10 0 0 0 0 1 T 50700 42000 5 10 0 0 0 0 1
slot=2 slot=4
} }
N 51800 42500 51900 42500 4 N 51800 42500 51900 42500 4
N 51900 36100 51900 42500 4 N 51900 36100 51900 42500 4
@ -1973,6 +1973,6 @@ refdes=D8
T 39700 63800 5 10 0 0 0 6 1 T 39700 63800 5 10 0 0 0 6 1
footprint=DIP14 footprint=DIP14
T 40300 60300 5 10 0 0 0 6 1 T 40300 60300 5 10 0 0 0 6 1
slot=4 slot=2
} }
N 37600 60800 39200 60800 4 N 37600 60800 39200 60800 4

View File

@ -67,7 +67,6 @@
</ListValues> </ListValues>
</avrgcc.linker.libraries.Libraries> </avrgcc.linker.libraries.Libraries>
<avrgcc.linker.optimization.GarbageCollectUnusedSections>True</avrgcc.linker.optimization.GarbageCollectUnusedSections> <avrgcc.linker.optimization.GarbageCollectUnusedSections>True</avrgcc.linker.optimization.GarbageCollectUnusedSections>
<avrgcc.linker.optimization.RelaxBranches>True</avrgcc.linker.optimization.RelaxBranches>
</AvrGcc> </AvrGcc>
</ToolchainSettings> </ToolchainSettings>
</PropertyGroup> </PropertyGroup>
@ -81,6 +80,12 @@
<Compile Include="wdc_avr.h"> <Compile Include="wdc_avr.h">
<SubType>compile</SubType> <SubType>compile</SubType>
</Compile> </Compile>
<Compile Include="wdc_drv_pata.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="wdc_drv_pata.h">
<SubType>compile</SubType>
</Compile>
<Compile Include="wdc_main.c"> <Compile Include="wdc_main.c">
<SubType>compile</SubType> <SubType>compile</SubType>
</Compile> </Compile>

View File

@ -26,13 +26,16 @@
*/ */
/* /*
* $Id: wdc_avr.c,v 1.1 2012/06/12 17:34:14 olivleh1 Exp $ * $Id: wdc_avr.c,v 1.2 2012/06/13 20:17:45 olivleh1 Exp $
*/ */
#include <avr/io.h> #include <avr/io.h>
#include "wdc_config.h" #include "wdc_config.h"
#include "wdc_avr.h" #include "wdc_avr.h"
#include "wdc_drv_mmc.h"
#include "wdc_drv_pata.h"
#include "wdc_if_disk.h"
void wdc_init_avr() void wdc_init_avr()
{ {
@ -60,3 +63,24 @@ void wdc_init_avr()
configure_pin_mosi(); configure_pin_mosi();
configure_pin_mmc_cs(); configure_pin_mmc_cs();
} }
void wdc_get_sysconf()
{
enable_sysconf();
nop();
nop();
if ( jumper_pata_set() ) {
drv_init = pata_init;
drv_read_block = pata_read_block;
drv_write_block = pata_write_block;
drv_read_multiblock = pata_read_multiblock;
drv_write_multiblock = pata_write_multiblock;
} else {
drv_init = mmc_init;
drv_read_block = mmc_read_sector;
drv_write_block = mmc_write_sector;
drv_read_multiblock = mmc_read_multiblock;
drv_write_multiblock = mmc_write_multiblock;
}
disable_sysconf();
}

View File

@ -26,7 +26,7 @@
*/ */
/* /*
* $Id: wdc_avr.h,v 1.1 2012/06/12 17:34:14 olivleh1 Exp $ * $Id: wdc_avr.h,v 1.2 2012/06/13 20:17:45 olivleh1 Exp $
*/ */
@ -55,11 +55,12 @@
#define configure_pin_addr2() DDR_ADRDEC |= ( 1 << PIN_ADRDEC_ADDR2 ) #define configure_pin_addr2() DDR_ADRDEC |= ( 1 << PIN_ADRDEC_ADDR2 )
#define init_addressdecoder() PORT_ADRDEC &= ~( ( 1 << PIN_ADRDEC_ADDR0 ) | ( 1 << PIN_ADRDEC_ADDR1 ) | ( 1 << PIN_ADRDEC_ADDR2 ) ) #define init_addressdecoder() PORT_ADRDEC &= ~( ( 1 << PIN_ADRDEC_ADDR0 ) | ( 1 << PIN_ADRDEC_ADDR1 ) | ( 1 << PIN_ADRDEC_ADDR2 ) )
#define enable_p8000_transeiver() PORT_ADRDEC |= ( 1 << PIN_ADRDEC_ADDR0 ) #define enable_p8000com() PORT_ADRDEC |= ( 1 << PIN_ADRDEC_ADDR0 )
#define disable_p8000_transeiver() PORT_ADRDEC &= ~( 1 << PIN_ADRDEC_ADDR0 ) #define disable_p8000com() PORT_ADRDEC &= ~( 1 << PIN_ADRDEC_ADDR0 )
#define enable_sysconf() PORT_ADRDEC |= ( ( 1 << PIN_ADRDEC_ADDR0 ) | ( 1 << PIN_ADRDEC_ADDR1 ) | ( 1 << PIN_ADRDEC_ADDR2 ) )
#define disable_sysconf() PORT_ADRDEC &= ~( ( 1 << PIN_ADRDEC_ADDR0 ) | ( 1 << PIN_ADRDEC_ADDR1 ) | ( 1 << PIN_ADRDEC_ADDR2 ) )
/* functions dealing with the MMC interface */ /* functions dealing with the MMC interface */
#define configure_pin_miso() DDR_MMC &= ~ ( 1 << PIN_MMC_MISO ) #define configure_pin_miso() DDR_MMC &= ~ ( 1 << PIN_MMC_MISO )
#define configure_pin_sck() DDR_MMC |= ( 1 << PIN_MMC_SCK ) #define configure_pin_sck() DDR_MMC |= ( 1 << PIN_MMC_SCK )
#define configure_pin_mosi() DDR_MMC |= ( 1 << PIN_MMC_MOSI ) #define configure_pin_mosi() DDR_MMC |= ( 1 << PIN_MMC_MOSI )
@ -68,6 +69,13 @@
#define mmc_disable() PORT_MMC|= (1<<PIN_MMC_CS); #define mmc_disable() PORT_MMC|= (1<<PIN_MMC_CS);
#define mmc_enable() PORT_MMC&=~(1<<PIN_MMC_CS); #define mmc_enable() PORT_MMC&=~(1<<PIN_MMC_CS);
/* functions dealing with the sysconf jumperpad */
#define jumper_pata_set() ~port_data_get() & (1<<PIN_DATA_D0)
#define jumper_nn2_set() ~port_data_get() & (1<<PIN_DATA_D1)
#define jumper_nn3_set() ~port_data_get() & (1<<PIN_DATA_D2)
#define jumper_nn4_set() ~port_data_get() & (1<<PIN_DATA_D3)
extern void wdc_init_avr(); extern void wdc_init_avr();
extern void wdc_get_sysconf();
#endif /* WDC_AVR_H_ */ #endif /* WDC_AVR_H_ */

View File

@ -26,7 +26,7 @@
*/ */
/* /*
* $Id: wdc_config.h,v 1.14 2012/06/12 17:34:14 olivleh1 Exp $ * $Id: wdc_config.h,v 1.15 2012/06/13 20:17:45 olivleh1 Exp $
*/ */
@ -51,6 +51,15 @@
#define PIN_ADRDEC PIND #define PIN_ADRDEC PIND
#define DDR_ADRDEC DDRD #define DDR_ADRDEC DDRD
#define PIN_DATA_D0 PINA0
#define PIN_DATA_D1 PINA1
#define PIN_DATA_D2 PINA2
#define PIN_DATA_D3 PINA3
#define PIN_DATA_D4 PINA4
#define PIN_DATA_D5 PINA5
#define PIN_DATA_D6 PINA6
#define PIN_DATA_D7 PINA7
#define PIN_INFO_STATUS0 PINC0 #define PIN_INFO_STATUS0 PINC0
#define PIN_INFO_STATUS1 PINC1 #define PIN_INFO_STATUS1 PINC1
#define PIN_INFO_STATUS2 PINC2 #define PIN_INFO_STATUS2 PINC2
@ -89,4 +98,6 @@
#define DEBUG 1 #define DEBUG 1
#define nop() __asm__ __volatile__ ("nop" ::)
#endif /* CONFIG_H_ */ #endif /* CONFIG_H_ */

View File

@ -26,7 +26,7 @@
*/ */
/* /*
* $Id: wdc_drv_mmc.c,v 1.17 2012/06/12 17:34:14 olivleh1 Exp $ * $Id: wdc_drv_mmc.c,v 1.18 2012/06/13 20:17:45 olivleh1 Exp $
*/ */
#include <avr/io.h> #include <avr/io.h>
@ -40,7 +40,6 @@
#define send_dummy_byte() SPDR = 0xFF; wait_till_send_done() #define send_dummy_byte() SPDR = 0xFF; wait_till_send_done()
#define recv_byte() SPDR #define recv_byte() SPDR
#define xmit_byte(x) SPDR = x #define xmit_byte(x) SPDR = x
#define nop() __asm__ __volatile__ ("nop" ::)
#define CMD0 (0x40 + 0) #define CMD0 (0x40 + 0)
#define CMD1 (0x40 + 1) #define CMD1 (0x40 + 1)

View File

@ -1,6 +1,58 @@
/* /*-
* wdc_drv_pata.c * Copyright (c) 2012 Oliver Lehmann
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer
* in this position and unchanged.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* Created: 12.06.2012 21:56:52
* Author: olivleh1
*/ */
/*
* $Id: wdc_drv_pata.c,v 1.2 2012/06/13 20:17:45 olivleh1 Exp $
*/
#include <avr/io.h>
#include "wdc_config.h"
uint8_t pata_init ()
{
return 1;
}
uint8_t pata_read_block ( uint32_t addr, uint8_t *buffer )
{
return 1;
}
uint8_t pata_write_block ( uint32_t addr, uint8_t *buffer )
{
return 1;
}
uint8_t pata_read_multiblock ( uint32_t addr, uint8_t *buffer, uint8_t numblocks )
{
return 1;
}
uint8_t pata_write_multiblock ( uint32_t addr, uint8_t *buffer, uint8_t numblocks )
{
return 1;
}

View File

@ -9,8 +9,12 @@
#ifndef WDC_DRV_PATA_H_ #ifndef WDC_DRV_PATA_H_
#define WDC_DRV_PATA_H_ #define WDC_DRV_PATA_H_
extern uint8_t pata_init ();
extern uint8_t pata_read_block ( uint32_t addr, uint8_t *buffer );
extern uint8_t pata_write_block ( uint32_t addr, uint8_t *buffer );
extern uint8_t pata_read_multiblock ( uint32_t addr, uint8_t *buffer, uint8_t numblocks );
extern uint8_t pata_write_multiblock ( uint32_t addr, uint8_t *buffer, uint8_t numblocks );
#endif /* WDC_DRV_PATA_H_ */ #endif /* WDC_DRV_PATA_H_ */

View File

@ -26,17 +26,19 @@
*/ */
/* /*
* $Id: wdc_if_disk.c,v 1.12 2012/06/12 17:34:14 olivleh1 Exp $ * $Id: wdc_if_disk.c,v 1.13 2012/06/13 20:17:45 olivleh1 Exp $
*/ */
#include <stdint.h> #include <stdint.h>
#include "wdc_if_disk.h"
#include "wdc_drv_mmc.h" #include "wdc_drv_mmc.h"
#include "wdc_drv_pata.h"
#include "uart.h" #include "uart.h"
#include "wdc_par.h" #include "wdc_par.h"
uint8_t wdc_init_disk() uint8_t wdc_init_disk()
{ {
return mmc_init(); return (*drv_init)();
} }
uint32_t wdc_sector2diskblock ( uint16_t req_cylinder, uint8_t req_head, uint8_t req_sector ) uint32_t wdc_sector2diskblock ( uint16_t req_cylinder, uint8_t req_head, uint8_t req_sector )
@ -56,7 +58,7 @@ uint8_t wdc_write_sector ( uint32_t addr, uint8_t *sector )
{ {
uint8_t errorcode; uint8_t errorcode;
errorcode = mmc_write_sector ( addr, sector ); errorcode = drv_write_block ( addr, sector );
if ( errorcode ) { if ( errorcode ) {
uart_puts_p ( PSTR ( " write error at address: " ) ); uart_puts_p ( PSTR ( " write error at address: " ) );
uart_putdw_dec ( addr ); uart_putdw_dec ( addr );
@ -72,7 +74,7 @@ uint8_t wdc_read_sector ( uint32_t addr, uint8_t *sector )
{ {
uint8_t errorcode; uint8_t errorcode;
errorcode = mmc_read_sector ( addr, sector ); errorcode = drv_read_block ( addr, sector );
if ( errorcode ) { if ( errorcode ) {
uart_puts_p ( PSTR ( " read error at address: " ) ); uart_puts_p ( PSTR ( " read error at address: " ) );
uart_putdw_dec ( addr ); uart_putdw_dec ( addr );
@ -88,7 +90,7 @@ uint8_t wdc_read_multiblock ( uint32_t addr, uint8_t *sector, uint8_t numblocks
{ {
uint8_t errorcode; uint8_t errorcode;
errorcode = mmc_read_multiblock ( addr, sector, numblocks ); errorcode = drv_read_multiblock ( addr, sector, numblocks );
if ( errorcode ) { if ( errorcode ) {
uart_puts_p ( PSTR ( " read error at address: " ) ); uart_puts_p ( PSTR ( " read error at address: " ) );
uart_putdw_dec ( addr ); uart_putdw_dec ( addr );
@ -104,7 +106,7 @@ uint8_t wdc_write_multiblock ( uint32_t addr, uint8_t *sector, uint8_t numblocks
{ {
uint8_t errorcode; uint8_t errorcode;
errorcode = mmc_write_multiblock ( addr, sector, numblocks ); errorcode = drv_write_multiblock ( addr, sector, numblocks );
if ( errorcode ) { if ( errorcode ) {
uart_puts_p ( PSTR ( " write error at address: " ) ); uart_puts_p ( PSTR ( " write error at address: " ) );
uart_putdw_dec ( addr ); uart_putdw_dec ( addr );

View File

@ -26,12 +26,14 @@
*/ */
/* /*
* $Id: wdc_if_disk.h,v 1.7 2012/06/12 17:34:14 olivleh1 Exp $ * $Id: wdc_if_disk.h,v 1.8 2012/06/13 20:17:45 olivleh1 Exp $
*/ */
#ifndef WDC_IF_DISK_H_ #ifndef WDC_IF_DISK_H_
#define WDC_IF_DISK_H_ #define WDC_IF_DISK_H_
#include <stdio.h>
extern uint8_t wdc_init_disk(); extern uint8_t wdc_init_disk();
extern uint32_t wdc_sector2diskblock ( uint16_t req_cylinder, uint8_t req_head, uint8_t req_sector ); extern uint32_t wdc_sector2diskblock ( uint16_t req_cylinder, uint8_t req_head, uint8_t req_sector );
extern uint32_t wdc_p8kblock2diskblock ( uint32_t blockno ); extern uint32_t wdc_p8kblock2diskblock ( uint32_t blockno );
@ -40,6 +42,20 @@ extern uint8_t wdc_read_sector ( uint32_t addr, uint8_t *sector );
extern uint8_t wdc_read_multiblock ( uint32_t addr, uint8_t *sector, uint8_t numblocks ); extern uint8_t wdc_read_multiblock ( uint32_t addr, uint8_t *sector, uint8_t numblocks );
extern uint8_t wdc_write_multiblock ( uint32_t addr, uint8_t *sector, uint8_t numblocks ); extern uint8_t wdc_write_multiblock ( uint32_t addr, uint8_t *sector, uint8_t numblocks );
typedef uint8_t (*t_drv_init) ();
typedef uint8_t (*t_drv_read_block) ( uint32_t addr, uint8_t *buffer );
typedef uint8_t (*t_drv_write_block) ( uint32_t addr, uint8_t *buffer );
typedef uint8_t (*t_drv_read_multiblock) ( uint32_t addr, uint8_t *buffer, uint8_t numblocks );
typedef uint8_t (*t_drv_write_multiblock) ( uint32_t addr, uint8_t *buffer, uint8_t numblocks );
t_drv_init drv_init;
t_drv_read_block drv_read_block;
t_drv_write_block drv_write_block;
t_drv_read_multiblock drv_read_multiblock;
t_drv_write_multiblock drv_write_multiblock;
#define WDC_BLOCKLEN 512 #define WDC_BLOCKLEN 512
#endif /* WDC_IF_DISK_H_ */ #endif /* WDC_IF_DISK_H_ */

View File

@ -26,7 +26,7 @@
*/ */
/* /*
* $Id: wdc_if_p8000.c,v 1.10 2012/06/12 17:43:38 olivleh1 Exp $ * $Id: wdc_if_p8000.c,v 1.11 2012/06/13 20:17:45 olivleh1 Exp $
*/ */
#include "wdc_config.h" #include "wdc_config.h"
@ -36,8 +36,6 @@
#include "wdc_if_p8000.h" #include "wdc_if_p8000.h"
#include "wdc_par.h" #include "wdc_par.h"
#define nop() __asm__ __volatile__ ("nop" ::)
void wdc_wait_for_reset() void wdc_wait_for_reset()
{ {
while ( !isset_info_reset() ) { while ( !isset_info_reset() ) {
@ -62,10 +60,10 @@ uint8_t wdc_read_data_from_p8k ( uint8_t *buffer, uint16_t count, uint8_t wdc_st
return 0; return 0;
while ( !isset_info_wdardy() ); while ( !isset_info_wdardy() );
do { do {
enable_p8000_transeiver(); /* this also generates /ASTB in the moment /WDARDY gets low with a 7403 */ enable_p8000com(); /* this also generates /ASTB in the moment /WDARDY gets low with a 7403 */
while ( isset_info_wdardy() ); while ( isset_info_wdardy() );
*buffer++ = port_data_get(); *buffer++ = port_data_get();
disable_p8000_transeiver(); /* this additionally brings /ASTB to high */ disable_p8000com(); /* this additionally brings /ASTB to high */
while ( !isset_info_wdardy() ); while ( !isset_info_wdardy() );
datacnt++; datacnt++;
} while ( datacnt < count ); } while ( datacnt < count );
@ -85,18 +83,18 @@ void wdc_write_data_to_p8k ( uint8_t *buffer, uint16_t count, uint8_t wdc_status
configure_port_data_write(); configure_port_data_write();
while ( !isset_info_wdardy() ); while ( !isset_info_wdardy() );
do { do {
enable_p8000_transeiver(); /* this also generates /ASTB in the moment /WDARDY gets low with a 7403 */ enable_p8000com(); /* this also generates /ASTB in the moment /WDARDY gets low with a 7403 */
while ( isset_info_wdardy() ); while ( isset_info_wdardy() );
port_data_set ( *buffer++ ); port_data_set ( *buffer++ );
disable_p8000_transeiver(); /* this additionally brings /ASTB to high */ disable_p8000com(); /* this additionally brings /ASTB to high */
while ( !isset_info_wdardy() ); while ( !isset_info_wdardy() );
datacnt++; datacnt++;
} while ( datacnt < count ); } while ( datacnt < count );
while ( isset_info_wdardy() ); while ( isset_info_wdardy() );
enable_p8000_transeiver(); enable_p8000com();
nop(); nop();
disable_p8000_transeiver(); disable_p8000com();
configure_port_data_read(); configure_port_data_read();
while ( !isset_info_wdardy() ); while ( !isset_info_wdardy() );
port_info_set ( INFO_CLEAR ); port_info_set ( INFO_CLEAR );

View File

@ -29,7 +29,7 @@
/* /*
* P8000 WDC Emulator * P8000 WDC Emulator
* *
* $Id: wdc_main.c,v 1.27 2012/06/12 17:34:14 olivleh1 Exp $ * $Id: wdc_main.c,v 1.28 2012/06/13 20:17:45 olivleh1 Exp $
* *
* TODO: - right now, BTT entries are not taken into account * TODO: - right now, BTT entries are not taken into account
*/ */
@ -417,6 +417,7 @@ void atmega_setup ( void )
set_sleep_mode ( SLEEP_MODE_IDLE ); set_sleep_mode ( SLEEP_MODE_IDLE );
uart_init(); uart_init();
wdc_init_avr(); wdc_init_avr();
wdc_get_sysconf();
if ( wdc_init_disk() ) { if ( wdc_init_disk() ) {
wdc_set_no_disk(); wdc_set_no_disk();
} }