From 8576a53f286db15e7477ece56f10f6acf8929a9a Mon Sep 17 00:00:00 2001 From: Oliver Lehmann Date: Wed, 6 Jun 2012 22:05:06 +0000 Subject: [PATCH] split wdc_ram.[ch] into wdc_ram.[ch] and additionally wdc_par.[ch] remove direct accessing of par_table --- .../P8000_WDC_Emulator/Debug/Makefile | 7 ++ .../P8000_WDC_Emulator/Debug/makedep.mk | 2 + .../P8000_WDC_Emulator.cproj | 50 ++++---- .../P8000_WDC_Emulator/wdc_if_disk.c | 31 ++--- .../P8000_WDC_Emulator/wdc_main.c | 8 +- .../P8000_WDC_Emulator/wdc_main.h | 26 ++-- .../P8000_WDC_Emulator/wdc_par.c | 114 ++++++++++++++++++ .../P8000_WDC_Emulator/wdc_par.h | 34 ++++++ .../P8000_WDC_Emulator/wdc_ram.c | 101 +--------------- .../P8000_WDC_Emulator/wdc_ram.h | 32 +---- 10 files changed, 220 insertions(+), 185 deletions(-) create mode 100644 P8000_WDC_Emulator/P8000_WDC_Emulator/wdc_par.c create mode 100644 P8000_WDC_Emulator/P8000_WDC_Emulator/wdc_par.h diff --git a/P8000_WDC_Emulator/P8000_WDC_Emulator/Debug/Makefile b/P8000_WDC_Emulator/P8000_WDC_Emulator/Debug/Makefile index fb2a763..bc0c925 100755 --- a/P8000_WDC_Emulator/P8000_WDC_Emulator/Debug/Makefile +++ b/P8000_WDC_Emulator/P8000_WDC_Emulator/Debug/Makefile @@ -40,6 +40,7 @@ C_SRCS += \ ../uart.c \ ../wdc_if_pio.c \ ../wdc_if_sdcard.c \ +../wdc_par.c \ ../wdc_ram.c @@ -55,6 +56,7 @@ mmc.o \ uart.o \ wdc_if_pio.o \ wdc_if_sdcard.o \ +wdc_par.o \ wdc_ram.o @@ -64,6 +66,7 @@ mmc.o \ uart.o \ wdc_if_pio.o \ wdc_if_sdcard.o \ +wdc_par.o \ wdc_ram.o @@ -73,6 +76,7 @@ mmc.d \ uart.d \ wdc_if_pio.d \ wdc_if_sdcard.d \ +wdc_par.d \ wdc_ram.d @@ -82,6 +86,7 @@ mmc.d \ uart.d \ wdc_if_pio.d \ wdc_if_sdcard.d \ +wdc_par.d \ wdc_ram.d @@ -107,6 +112,8 @@ OUTPUT_FILE_DEP:= ./makedep.mk + + ./%.o: .././%.c @echo Building file: $< @echo Invoking: AVR/GNU C Compiler : (AVR_8_bit_GNU_Toolchain_3.4.0_663) 4.6.2 diff --git a/P8000_WDC_Emulator/P8000_WDC_Emulator/Debug/makedep.mk b/P8000_WDC_Emulator/P8000_WDC_Emulator/Debug/makedep.mk index 78fdc23..91e0f9c 100755 --- a/P8000_WDC_Emulator/P8000_WDC_Emulator/Debug/makedep.mk +++ b/P8000_WDC_Emulator/P8000_WDC_Emulator/Debug/makedep.mk @@ -12,5 +12,7 @@ wdc_if_pio.c wdc_if_sdcard.c +wdc_par.c + wdc_ram.c diff --git a/P8000_WDC_Emulator/P8000_WDC_Emulator/P8000_WDC_Emulator.cproj b/P8000_WDC_Emulator/P8000_WDC_Emulator/P8000_WDC_Emulator.cproj index 3c4dd7d..a619f77 100644 --- a/P8000_WDC_Emulator/P8000_WDC_Emulator/P8000_WDC_Emulator.cproj +++ b/P8000_WDC_Emulator/P8000_WDC_Emulator/P8000_WDC_Emulator.cproj @@ -45,28 +45,28 @@ - True - True - True - True - True - Optimize (-O1) - True - True - True - True - True - True - True - True - - - m - - - True - True - + True + True + True + True + True + Optimize (-O1) + True + True + True + True + True + True + True + True + + + m + + + True + True + @@ -103,6 +103,12 @@ compile + + compile + + + compile + compile diff --git a/P8000_WDC_Emulator/P8000_WDC_Emulator/wdc_if_disk.c b/P8000_WDC_Emulator/P8000_WDC_Emulator/wdc_if_disk.c index 62536d0..120f870 100644 --- a/P8000_WDC_Emulator/P8000_WDC_Emulator/wdc_if_disk.c +++ b/P8000_WDC_Emulator/P8000_WDC_Emulator/wdc_if_disk.c @@ -1,14 +1,16 @@ /* * P8000 WDC Emulator * - * $Id: wdc_if_disk.c,v 1.5 2012/06/05 18:21:48 olivleh1 Exp $ + * $Id: wdc_if_disk.c,v 1.6 2012/06/06 22:05:06 olivleh1 Exp $ * */ #include #include "mmc.h" #include "uart.h" -extern uint8_t par_table[200]; +#include "wdc_par.h" + +extern uint8_t par_table[]; uint8_t wdc_init_sdcard() { @@ -17,24 +19,15 @@ uint8_t wdc_init_sdcard() uint32_t wdc_sector2sdblock ( uint16_t req_cylinder, uint8_t req_head, uint8_t req_sector ) { - /* TODO: no direct access of par_table - use getter functions instead - but only after speed is sufficient */ - /* +-------------------------------------------------------------- requested cylinder from P8000 - * | +----------------------------------------------- configured heads form the harddisk - * | | +------------------------------- configured sectors for the harddisk - * | | | +-------------- requested head from P8000 - * | | | | +-- configured sectors for the harddisk - * | | | | | +---- requested sector from P8000 - 1 as we start counting with 0 - * | | | | | | */ - return ( ( req_cylinder * par_table[25] * par_table[26] ) + ( req_head * par_table[26] ) + ( req_sector - 1 ) ); + return ( ( req_cylinder * wdc_get_hdd_heads() * wdc_get_hdd_sectors() ) + + ( req_head * wdc_get_hdd_sectors() ) + + ( req_sector - 1 ) ); } uint32_t wdc_p8kblock2sdblock ( uint32_t blockno ) { - /* TODO: no direct access of par_table - use getter functions instead - but only after speed is sufficient */ - /* +----------------------------------------------- configured heads form the harddisk - * | +------------------------------- configured sectors for the harddisk - * | |*/ - return ( blockno + ( par_table[25] * par_table[26] ) ); + return ( blockno + + ( wdc_get_hdd_heads() * wdc_get_hdd_sectors() ) ); } uint8_t wdc_write_sector ( uint32_t addr, uint8_t *sector ) @@ -82,7 +75,7 @@ uint8_t wdc_read_multiblock ( uint32_t addr, uint8_t *sector, uint8_t numblocks uart_putc ( '\n' ); return errorcode; } else - return 0; + return 0; } uint8_t wdc_write_multiblock ( uint32_t addr, uint8_t *sector, uint8_t numblocks ) @@ -90,7 +83,7 @@ uint8_t wdc_write_multiblock ( uint32_t addr, uint8_t *sector, uint8_t numblocks uint8_t errorcode; errorcode = mmc_write_multiblock ( addr, sector, numblocks ); -// errorcode = mmc_write_multiblock_predef ( addr, sector, numblocks ); + // errorcode = mmc_write_multiblock_predef ( addr, sector, numblocks ); if ( errorcode ) { uart_puts_p ( PSTR ( " write error at address: " ) ); uart_putdw_dec ( addr ); @@ -99,5 +92,5 @@ uint8_t wdc_write_multiblock ( uint32_t addr, uint8_t *sector, uint8_t numblocks uart_putc ( '\n' ); return errorcode; } else - return 0; + return 0; } \ No newline at end of file diff --git a/P8000_WDC_Emulator/P8000_WDC_Emulator/wdc_main.c b/P8000_WDC_Emulator/P8000_WDC_Emulator/wdc_main.c index 36d96eb..6ed12b7 100644 --- a/P8000_WDC_Emulator/P8000_WDC_Emulator/wdc_main.c +++ b/P8000_WDC_Emulator/P8000_WDC_Emulator/wdc_main.c @@ -1,11 +1,10 @@ /* * P8000 WDC Emulator * - * $Id: wdc_main.c,v 1.12 2012/06/05 20:30:09 olivleh1 Exp $ + * $Id: wdc_main.c,v 1.13 2012/06/06 22:05:06 olivleh1 Exp $ * * TODO: - Different Errorcodes in the MMC layer (use defines) * - errorchecking in several places - * - Prio 1: more commandcodes * - Prio 2: check if BTT is really cleaned when sa.format gets called all the time with a real drive * ----------> no the old BTT from the previous formatting is shown * ----------> check if after formatting, no BTT is written to the disk, the old BTT is still there @@ -24,12 +23,17 @@ #include "main.h" #include "uart.h" #include "wdc_ram.h" +#include "wdc_par.h" #include "wdc_if_pio.h" #include "wdc_if_sdcard.h" #define DEBUG 1 #undef MEASURE_SDCARD_TIME +/* switched from local to global for keeping an eye on memory usage */ +uint8_t data_buffer[4096]; +uint8_t cmd_buffer[9]; + void atmega_setup ( void ); #ifdef MEASURE_SDCARD_TIME diff --git a/P8000_WDC_Emulator/P8000_WDC_Emulator/wdc_main.h b/P8000_WDC_Emulator/P8000_WDC_Emulator/wdc_main.h index f262620..e659582 100644 --- a/P8000_WDC_Emulator/P8000_WDC_Emulator/wdc_main.h +++ b/P8000_WDC_Emulator/P8000_WDC_Emulator/wdc_main.h @@ -1,7 +1,7 @@ /* * P8000 WDC Emulator * - * $Id: wdc_main.h,v 1.8 2012/06/03 13:38:03 olivleh1 Exp $ + * $Id: wdc_main.h,v 1.9 2012/06/06 22:05:06 olivleh1 Exp $ * */ @@ -10,12 +10,12 @@ #define MAIN_H_ #define CMD_RD_SECTOR 0x01 /* read data beginning at given sector */ -#define _CMD_WR_SECTOR 0x02 /* write sector */ -#define _CMD_FMT_TRACK 0x04 /* format a track */ +#define ___CMD_WR_SECTOR 0x02 /* write sector */ +#define ___CMD_FMT_TRACK 0x04 /* format a track */ #define CMD_RD_WDC_RAM 0x08 /* read data from WDC RAM */ -#define NO_CMD_RDBTT_SECTOR 0x11 /* read sector taking BTT into account */ -#define NO_CMD_WRBTT_SECTOR 0x12 /* write sector taking BTT into account */ -#define NO_CMD_FMTRD_TRACK 0x14 /* format and reread a track */ +#define ___CMD_RDBTT_SECTOR 0x11 /* read sector taking BTT into account */ +#define ___CMD_WRBTT_SECTOR 0x12 /* write sector taking BTT into account */ +#define ___CMD_FMTRD_TRACK 0x14 /* format and reread a track */ #define CMD_WR_WDC_RAM 0x18 /* write data to WDC RAM */ #define CMD_RD_BLOCK 0x21 /* read data beginning at given block */ #define CMD_WR_BLOCK 0x22 /* write data beginning at given block */ @@ -27,12 +27,12 @@ #define CMD_RD_BTTAB 0x58 /* read Bad Track Table from WDC RAM */ #define CMD_WR_BTTAB 0x68 /* write Bad Track Table to WDC RAM */ #define CMD_WR_PARTAB 0x78 /* write Parameter block to WDC RAM */ -#define NO_CMD_VER_SECTOR 0x81 /* verify sector */ -#define NO_CMD_WRRD_SECTOR 0x82 /* write and reread sector */ -#define NO_CMD_DL_TRACK 0x84 /* delete a track */ -#define NO_CMD_WRRDBTT_SECTOR 0x92 /* write and reread sector taking BTT into account */ -#define NO_CMD_CP_BLOCK 0xa1 /* copy block from drive 1 to drive 0 */ -#define NO_CMD_WRRD_BLOCK 0xa2 /* write and reread block */ -#define CMD_ST_PARBTT 0xc2 /* store PAR and BTT on harddisk */ +#define ___CMD_VER_SECTOR 0x81 /* verify sector */ +#define ___CMD_WRRD_SECTOR 0x82 /* write and reread sector */ +#define ___CMD_DL_TRACK 0x84 /* delete a track */ +#define ___CMD_WRRDBTT_SECTOR 0x92 /* write and reread sector taking BTT into account */ +#define ___CMD_CP_BLOCK 0xa1 /* copy block from drive 1 to drive 0 */ +#define ___CMD_WRRD_BLOCK 0xa2 /* write and reread block */ +#define CMD_ST_PARBTT 0xc2 /* store PAR and BTT on hard disk */ #endif /* MAIN_H_ */ diff --git a/P8000_WDC_Emulator/P8000_WDC_Emulator/wdc_par.c b/P8000_WDC_Emulator/P8000_WDC_Emulator/wdc_par.c new file mode 100644 index 0000000..a69ae36 --- /dev/null +++ b/P8000_WDC_Emulator/P8000_WDC_Emulator/wdc_par.c @@ -0,0 +1,114 @@ +/* + * P8000 WDC Emulator + * + * $Id: wdc_par.c,v 1.1 2012/06/06 22:05:06 olivleh1 Exp $ + * + */ + +#include +#include "wdc_par.h" + +uint8_t par_table[512] = {'W', 'D', 'C', '_', '4', '.', '2', 0x00, 'R', 'O', 'B', ' ', 'K', '5', '5', '0', + '4', '.', '5', '0', 0x00, 0x00, 0x00, 0x00, 0x04, 0x05, 0x12, 0x00, 0x04, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa5, 0x67, 0x01, 0x00, 0x01, 0x01, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + + +void wdc_read_par_table ( uint8_t *buffer, uint16_t count ) +{ + do { + count--; + buffer[count] = par_table[count]; + } while ( count > 0 ); +} + +void wdc_write_par_table ( uint8_t *buffer, uint16_t count ) +{ + do { + count--; + par_table[count] = buffer[count]; + } while ( count > 0 ); +} + + +void wdc_read_wdc_par ( uint8_t *buffer, uint16_t count ) +{ + do { + count--; + buffer[count] = par_table[count + POS_PAR_WDC_PAR]; + } while ( count > 0 ); +} + +void wdc_write_wdc_par ( uint8_t *buffer, uint16_t count ) +{ + do { + count--; + par_table[count + POS_PAR_WDC_PAR] = buffer[count]; + } while ( count > 0 ); +} + +void wdc_del_wdc_btt() +{ + uint8_t i; + for ( i = 0; i < 125; i++ ) + par_table[i + POS_PAR_WDC_BTT] = 0x00; + par_table[122 + POS_PAR_WDC_BTT] = 0xff; +} + +void wdc_read_wdc_btt ( uint8_t *buffer, uint16_t count ) +{ + do { + count--; + buffer[count] = par_table[count + POS_PAR_WDC_BTT]; + } while ( count > 0 ); +} + +void wdc_write_wdc_btt ( uint8_t *buffer, uint16_t count ) +{ + do { + count--; + par_table[count + POS_PAR_WDC_BTT] = buffer[count]; + } while ( count > 0 ); +} + +uint16_t wdc_get_btt_count() +{ + return ( ( par_table[0 + POS_PAR_WDC_BTT] | ( par_table[1 + POS_PAR_WDC_BTT] << 8 ) ) ); +} + +void wdc_set_btt_count ( uint16_t btt_count ) +{ + par_table[0 + POS_PAR_WDC_BTT] = ( uint8_t ) btt_count; + par_table[1 + POS_PAR_WDC_BTT] = ( btt_count >> 8 ); +} + +uint8_t wdc_add_btt_entry ( uint16_t cylinder, uint8_t head ) +{ + uint16_t btt_count = wdc_get_btt_count(); + + if ( btt_count < 120 ) { + /* +2 because btt_count is just the amount of bytes for the BTT - but in front of it, there are two bytes */ + /* storing the amount of bytes for the BTT */ + par_table[btt_count + 2 + POS_PAR_WDC_BTT] = ( cylinder >> 8 ); + btt_count++; + par_table[btt_count + 2 + POS_PAR_WDC_BTT] = ( uint8_t ) cylinder; + btt_count++; + par_table[btt_count + 2 + POS_PAR_WDC_BTT] = ( uint8_t ) head; + btt_count++; + wdc_set_btt_count ( btt_count ); + return ( 0 ); + } else { + return ( 1 ); + } +} + +uint8_t wdc_get_hdd_sectors() +{ + return ( par_table[18 + POS_PAR_WDC_PAR] ); +} + +uint8_t wdc_get_hdd_heads() +{ + return ( par_table[17 + POS_PAR_WDC_PAR] ); +} diff --git a/P8000_WDC_Emulator/P8000_WDC_Emulator/wdc_par.h b/P8000_WDC_Emulator/P8000_WDC_Emulator/wdc_par.h new file mode 100644 index 0000000..f6a37cc --- /dev/null +++ b/P8000_WDC_Emulator/P8000_WDC_Emulator/wdc_par.h @@ -0,0 +1,34 @@ +/* + * P8000 WDC Emulator + * + * $IdS$ + * + */ + +#ifndef WDC_PAR_H_ +#define WDC_PAR_H_ + +extern void wdc_read_par_table ( uint8_t *buffer, uint16_t count ); +extern void wdc_write_par_table ( uint8_t *buffer, uint16_t count ); + +extern void wdc_read_wdc_par ( uint8_t *buffer, uint16_t count ); +extern void wdc_write_wdc_par ( uint8_t *buffer, uint16_t count ); + +extern void wdc_del_wdc_btt(); +extern void wdc_read_wdc_btt ( uint8_t *buffer, uint16_t count ); +extern void wdc_write_wdc_btt ( uint8_t *buffer, uint16_t count ); +extern uint16_t wdc_get_btt_count(); +extern uint8_t wdc_add_btt_entry ( uint16_t cylinder, uint8_t head ); + +extern uint8_t wdc_get_hdd_sectors(); +extern uint8_t wdc_get_hdd_heads(); + +#define POS_PAR_VERSION 0 +#define POS_PAR_WDC_PAR 8 +#define POS_PAR_WDC_BTT 88 + +#define SIZE_PAR_VERSION 8 +#define SIZE_PAR_WDC_PAR 80 +#define SIZE_PAR_WDC_BTT 125 + +#endif /* WDC_PAR_H_ */ \ No newline at end of file diff --git a/P8000_WDC_Emulator/P8000_WDC_Emulator/wdc_ram.c b/P8000_WDC_Emulator/P8000_WDC_Emulator/wdc_ram.c index abc0c56..4b844cb 100644 --- a/P8000_WDC_Emulator/P8000_WDC_Emulator/wdc_ram.c +++ b/P8000_WDC_Emulator/P8000_WDC_Emulator/wdc_ram.c @@ -1,7 +1,7 @@ /* * P8000 WDC Emulator * - * $Id: wdc_ram.c,v 1.3 2012/06/02 00:51:55 olivleh1 Exp $ + * $Id: wdc_ram.c,v 1.4 2012/06/06 22:05:06 olivleh1 Exp $ * */ @@ -9,11 +9,6 @@ #include "wdc_ram.h" uint8_t wdc_ram[2048]; -uint8_t par_table[512] = {'W', 'D', 'C', '_', '4', '.', '2', 0x00, 'R', 'O', 'B', ' ', 'K', '5', '5', '0', - '4', '.', '5', '0', 0x00, 0x00, 0x00, 0x00, 0x04, 0x05, 0x12, 0x00, 0x04, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa5, 0x67, 0x01, 0x00, 0x01, 0x01, - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - }; void wdc_write_data_to_ram ( uint8_t *buffer, uint16_t address, uint16_t count ) { @@ -30,97 +25,3 @@ void wdc_read_data_from_ram ( uint8_t *buffer, uint16_t address, uint16_t count buffer[count] = wdc_ram[address + count]; } while ( count > 0 ); } - - -void wdc_read_par_table ( uint8_t *buffer, uint16_t count ) -{ - do { - count--; - buffer[count] = par_table[count]; - } while ( count > 0 ); -} - -void wdc_write_par_table ( uint8_t *buffer, uint16_t count ) -{ - do { - count--; - par_table[count] = buffer[count]; - } while ( count > 0 ); -} - - -void wdc_read_wdc_par ( uint8_t *buffer, uint16_t count ) -{ - do { - count--; - buffer[count] = par_table[count + POS_PAR_WDC_PAR]; - } while ( count > 0 ); -} - -void wdc_write_wdc_par ( uint8_t *buffer, uint16_t count ) -{ - do { - count--; - par_table[count + POS_PAR_WDC_PAR] = buffer[count]; - } while ( count > 0 ); -} - -void wdc_del_wdc_btt() -{ - uint8_t i; - for ( i = 0; i < 125; i++ ) - par_table[i + POS_PAR_WDC_BTT] = 0x00; - par_table[122 + POS_PAR_WDC_BTT] = 0xff; -} - -void wdc_read_wdc_btt ( uint8_t *buffer, uint16_t count ) -{ - do { - count--; - buffer[count] = par_table[count + POS_PAR_WDC_BTT]; - } while ( count > 0 ); -} - -void wdc_write_wdc_btt ( uint8_t *buffer, uint16_t count ) -{ - do { - count--; - par_table[count + POS_PAR_WDC_BTT] = buffer[count]; - } while ( count > 0 ); -} - -uint16_t wdc_get_btt_count() -{ - return ( ( par_table[0 + POS_PAR_WDC_BTT] | ( par_table[1 + POS_PAR_WDC_BTT] << 8 ) ) ); -} - -void wdc_set_btt_count ( uint16_t btt_count ) -{ - par_table[0 + POS_PAR_WDC_BTT] = ( uint8_t ) btt_count; - par_table[1 + POS_PAR_WDC_BTT] = ( btt_count >> 8 ); -} - -uint8_t wdc_add_btt_entry ( uint16_t cylinder, uint8_t head ) -{ - uint16_t btt_count = wdc_get_btt_count(); - - if ( btt_count < 120 ) { - /* +2 because btt_count is just the amount of bytes for the BTT - but in front of it, there are two bytes */ - /* storing the amount of bytes for the BTT */ - par_table[btt_count + 2 + POS_PAR_WDC_BTT] = ( cylinder >> 8 ); - btt_count++; - par_table[btt_count + 2 + POS_PAR_WDC_BTT] = ( uint8_t ) cylinder; - btt_count++; - par_table[btt_count + 2 + POS_PAR_WDC_BTT] = ( uint8_t ) head; - btt_count++; - wdc_set_btt_count ( btt_count ); - return ( 0 ); - } else { - return ( 1 ); - } -} - -uint8_t wdc_get_hdd_sectors() -{ - return ( par_table[18 + POS_PAR_WDC_PAR] ); -} \ No newline at end of file diff --git a/P8000_WDC_Emulator/P8000_WDC_Emulator/wdc_ram.h b/P8000_WDC_Emulator/P8000_WDC_Emulator/wdc_ram.h index f2f0606..e9a30ab 100644 --- a/P8000_WDC_Emulator/P8000_WDC_Emulator/wdc_ram.h +++ b/P8000_WDC_Emulator/P8000_WDC_Emulator/wdc_ram.h @@ -1,42 +1,16 @@ /* * P8000 WDC Emulator * - * $Id: wdc_ram.h,v 1.3 2012/06/05 20:30:09 olivleh1 Exp $ + * $Id: wdc_ram.h,v 1.4 2012/06/06 22:05:06 olivleh1 Exp $ * */ #ifndef WDC_RAM_H_ #define WDC_RAM_H_ -void wdc_write_data_to_ram ( uint8_t *buffer, uint16_t address, uint16_t count ); -void wdc_read_data_from_ram ( uint8_t *buffer, uint16_t address, uint16_t count ); - -void wdc_read_par_table ( uint8_t *buffer, uint16_t count ); -void wdc_write_par_table ( uint8_t *buffer, uint16_t count ); - -void wdc_read_wdc_par ( uint8_t *buffer, uint16_t count ); -void wdc_write_wdc_par ( uint8_t *buffer, uint16_t count ); - -void wdc_del_wdc_btt(); -void wdc_read_wdc_btt ( uint8_t *buffer, uint16_t count ); -void wdc_write_wdc_btt ( uint8_t *buffer, uint16_t count ); -uint16_t wdc_get_btt_count(); -uint8_t wdc_add_btt_entry ( uint16_t cylinder, uint8_t head ); - -uint8_t wdc_get_hdd_sectors(); +extern void wdc_write_data_to_ram ( uint8_t *buffer, uint16_t address, uint16_t count ); +extern void wdc_read_data_from_ram ( uint8_t *buffer, uint16_t address, uint16_t count ); #define convert_ram_address(x) ((x) - 0x2000) /* The S-RAM of the original WDC hardware starts at 0x2000. We use an array as RAM here and no direct RAM access */ -#define POS_PAR_VERSION 0 -#define POS_PAR_WDC_PAR 8 -#define POS_PAR_WDC_BTT 88 - -#define SIZE_PAR_VERSION 8 -#define SIZE_PAR_WDC_PAR 80 -#define SIZE_PAR_WDC_BTT 125 - -/* switched from local to global for keeping an eye on memory usage */ -uint8_t data_buffer[4096]; -uint8_t cmd_buffer[9]; - #endif /* WDC_RAM_H_ */ \ No newline at end of file