revision 422:61a0598e07ff
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 422:61a0598e07ff |
parent | 421:e51bf0aedd90 |
child | 423:f92f80fe64da |
author | nkeynes |
date | Sat Oct 06 09:03:24 2007 +0000 (16 years ago) |
Fix compilation warnings
1.1 --- a/src/asic.c Sat Oct 06 08:52:08 2007 +00001.2 +++ b/src/asic.c Sat Oct 06 09:03:24 2007 +00001.3 @@ -1,5 +1,5 @@1.4 /**1.5 - * $Id: asic.c,v 1.28 2007-01-31 10:58:42 nkeynes Exp $1.6 + * $Id: asic.c,v 1.29 2007-10-06 08:59:42 nkeynes Exp $1.7 *1.8 * Support for the miscellaneous ASIC functions (Primarily event multiplexing,1.9 * and DMA).1.10 @@ -25,9 +25,11 @@1.11 #include "mem.h"1.12 #include "sh4/intc.h"1.13 #include "sh4/dmac.h"1.14 +#include "sh4/sh4core.h"1.15 #include "dreamcast.h"1.16 #include "maple/maple.h"1.17 #include "gdrom/ide.h"1.18 +#include "pvr2/pvr2.h"1.19 #include "asic.h"1.20 #define MMIO_IMPL1.21 #include "asic.h"1.22 @@ -269,7 +271,7 @@1.23 uint32_t sh4addr = MMIO_READ( EXTDMA, G2DMA0SH4 + offset );1.24 uint32_t length = MMIO_READ( EXTDMA, G2DMA0SIZ + offset ) & 0x1FFFFFFF;1.25 uint32_t dir = MMIO_READ( EXTDMA, G2DMA0DIR + offset );1.26 - uint32_t mode = MMIO_READ( EXTDMA, G2DMA0MOD + offset );1.27 + // uint32_t mode = MMIO_READ( EXTDMA, G2DMA0MOD + offset );1.28 char buf[length];1.29 if( dir == 0 ) { /* SH4 to device */1.30 mem_copy_from_sh4( buf, sh4addr, length );1.31 @@ -294,7 +296,7 @@1.33 uint32_t addr = MMIO_READ( EXTDMA, IDEDMASH4 );1.34 uint32_t length = MMIO_READ( EXTDMA, IDEDMASIZ );1.35 - int dir = MMIO_READ( EXTDMA, IDEDMADIR );1.36 + // int dir = MMIO_READ( EXTDMA, IDEDMADIR );1.38 uint32_t xfer = ide_read_data_dma( addr, length );1.39 MMIO_WRITE( EXTDMA, IDEDMATXSIZ, xfer );
2.1 --- a/src/bios.c Sat Oct 06 08:52:08 2007 +00002.2 +++ b/src/bios.c Sat Oct 06 09:03:24 2007 +00002.3 @@ -1,5 +1,5 @@2.4 /**2.5 - * $Id: bios.c,v 1.2 2006-03-13 12:38:34 nkeynes Exp $2.6 + * $Id: bios.c,v 1.3 2007-10-06 08:59:42 nkeynes Exp $2.7 *2.8 * "Fake" BIOS functions, for operation without the actual BIOS.2.9 *2.10 @@ -19,6 +19,7 @@2.11 #include "dream.h"2.12 #include "mem.h"2.13 #include "syscall.h"2.14 +#include "dreamcast.h"2.15 #include "sh4/sh4core.h"2.17 #define COMMAND_QUEUE_LENGTH 162.18 @@ -150,7 +151,7 @@2.19 sh4r.r[0] = cmd->status;2.20 if( cmd->status == GD_CMD_STATUS_ERROR &&2.21 sh4r.r[5] != 0 ) {2.22 - mem_copy_to_sh4( sh4r.r[5], &cmd->result, sizeof(cmd->result) );2.23 + mem_copy_to_sh4( sh4r.r[5], (char *)&cmd->result, sizeof(cmd->result) );2.24 }2.25 }2.26 break;2.27 @@ -162,7 +163,7 @@2.28 break;2.29 case 4: /* Drive status */2.30 if( sh4r.r[4] != 0 ) {2.31 - mem_copy_to_sh4( sh4r.r[4], &bios_gdrom_status,2.32 + mem_copy_to_sh4( sh4r.r[4], (char *)&bios_gdrom_status,2.33 sizeof(bios_gdrom_status) );2.34 }2.35 sh4r.r[0] = 0;
3.1 --- a/src/bootstrap.c Sat Oct 06 08:52:08 2007 +00003.2 +++ b/src/bootstrap.c Sat Oct 06 09:03:24 2007 +00003.3 @@ -1,5 +1,5 @@3.4 /**3.5 - * $Id: bootstrap.c,v 1.6 2006-06-19 11:00:40 nkeynes Exp $3.6 + * $Id: bootstrap.c,v 1.7 2007-10-06 08:59:42 nkeynes Exp $3.7 *3.8 * CD Bootstrap header parsing. Mostly for informational purposes.3.9 *3.10 @@ -106,7 +106,7 @@3.11 * @param detail true to include a ful information dump, false for just3.12 * the facts, maam.3.13 */3.14 -void bootstrap_dump( char *data, gboolean detail )3.15 +void bootstrap_dump( unsigned char *data, gboolean detail )3.16 {3.17 struct dc_bootstrap_head *head;3.18 int i, got, periph, crc, hcrc;
4.1 --- a/src/bootstrap.h Sat Oct 06 08:52:08 2007 +00004.2 +++ b/src/bootstrap.h Sat Oct 06 09:03:24 2007 +00004.3 @@ -1,5 +1,5 @@4.4 /**4.5 - * $Id: bootstrap.h,v 1.4 2006-06-19 11:00:40 nkeynes Exp $4.6 + * $Id: bootstrap.h,v 1.5 2007-10-06 08:59:42 nkeynes Exp $4.7 *4.8 * CD Bootstrap header parsing. Mostly for informational purposes.4.9 *4.10 @@ -32,7 +32,7 @@4.11 * Dump the bootstrap info to the output log for infomational/debugging4.12 * purposes.4.13 */4.14 -void bootstrap_dump(char *data, gboolean detail);4.15 +void bootstrap_dump(unsigned char *data, gboolean detail);4.17 #ifdef __cplusplus4.18 }
5.1 --- a/src/dcload.c Sat Oct 06 08:52:08 2007 +00005.2 +++ b/src/dcload.c Sat Oct 06 09:03:24 2007 +00005.3 @@ -1,5 +1,5 @@5.4 /**5.5 - * $Id: dcload.c,v 1.6 2006-08-07 13:18:16 nkeynes Exp $5.6 + * $Id: dcload.c,v 1.7 2007-10-06 08:59:42 nkeynes Exp $5.7 *5.8 * DC-load syscall implementation.5.9 *5.10 @@ -17,9 +17,12 @@5.11 */5.13 #include <stdio.h>5.14 +#include <unistd.h>5.15 +#include <fcntl.h>5.16 +5.17 #include "dream.h"5.18 +#include "mem.h"5.19 #include "dreamcast.h"5.20 -#include "mem.h"5.21 #include "syscall.h"5.22 #include "sh4/sh4core.h"5.24 @@ -75,7 +78,7 @@5.26 void dcload_syscall( uint32_t syscall_id )5.27 {5.28 - uint32_t syscall = sh4r.r[4];5.29 + // uint32_t syscall = sh4r.r[4];5.30 int fd;5.31 switch( sh4r.r[4] ) {5.32 case SYS_READ:
6.1 --- a/src/display.h Sat Oct 06 08:52:08 2007 +00006.2 +++ b/src/display.h Sat Oct 06 09:03:24 2007 +00006.3 @@ -1,5 +1,5 @@6.4 /**6.5 - * $Id: display.h,v 1.6 2007-09-08 04:05:35 nkeynes Exp $6.6 + * $Id: display.h,v 1.7 2007-10-06 08:59:42 nkeynes Exp $6.7 *6.8 * The PC side of the video support (responsible for actually displaying /6.9 * rendering frames)6.10 @@ -20,10 +20,10 @@6.11 #ifndef dream_video_H6.12 #define dream_video_H6.14 -#include "mem.h"6.15 #include <stdint.h>6.16 #include <glib.h>6.17 #include <GL/gl.h>6.18 +#include "dream.h"6.20 #ifdef __cplusplus6.21 extern "C" {
7.1 --- a/src/dream.h Sat Oct 06 08:52:08 2007 +00007.2 +++ b/src/dream.h Sat Oct 06 09:03:24 2007 +00007.3 @@ -1,5 +1,5 @@7.4 /**7.5 - * $Id: dream.h,v 1.12 2007-01-06 04:06:36 nkeynes Exp $7.6 + * $Id: dream.h,v 1.13 2007-10-06 08:59:42 nkeynes Exp $7.7 *7.8 * Miscellaneous application-wide declarations (mainly logging atm)7.9 *7.10 @@ -111,12 +111,14 @@7.11 #define DEBUG( ... ) emit( NULL, EMIT_DEBUG, MODULE.name, __VA_ARGS__ )7.12 #define TRACE( ... ) emit( NULL, EMIT_TRACE, MODULE.name, __VA_ARGS__ )7.14 -void fwrite_string( char *s, FILE *f );7.15 +void fwrite_string( const char *s, FILE *f );7.16 int fread_string( char *s, int maxlen, FILE *f );7.17 void fwrite_dump( unsigned char *buf, unsigned int length, FILE *f );7.18 void fwrite_dump32( unsigned int *buf, unsigned int length, FILE *f );7.19 void fwrite_dump32v( unsigned int *buf, unsigned int length, int wordsPerLine, FILE *f );7.21 +typedef uint32_t sh4addr_t;7.22 +7.23 #ifndef max7.24 #define max(a,b) ( (a) > (b) ? (a) : (b) )7.25 #endif
8.1 --- a/src/dreamcast.c Sat Oct 06 08:52:08 2007 +00008.2 +++ b/src/dreamcast.c Sat Oct 06 09:03:24 2007 +00008.3 @@ -1,5 +1,5 @@8.4 /**8.5 - * $Id: dreamcast.c,v 1.22 2007-09-08 04:38:38 nkeynes Exp $8.6 + * $Id: dreamcast.c,v 1.23 2007-10-06 08:59:42 nkeynes Exp $8.7 * Central switchboard for the system. This pulls all the individual modules8.8 * together into some kind of coherent structure. This is also where you'd8.9 * add Naomi support, if I ever get a board to play with...8.10 @@ -36,7 +36,7 @@8.11 #define STATE_STOPPED 38.12 static volatile int dreamcast_state = STATE_UNINIT;8.13 static uint32_t timeslice_length = DEFAULT_TIMESLICE_LENGTH;8.14 -static char *dreamcast_config = "DEFAULT";8.15 +const char *dreamcast_config = "DEFAULT";8.17 #define MAX_MODULES 328.18 static int num_modules = 0;8.19 @@ -87,7 +87,7 @@8.21 void dreamcast_save_flash()8.22 {8.23 - char *file = dreamcast_get_config_value(CONFIG_FLASH_PATH);8.24 + const char *file = dreamcast_get_config_value(CONFIG_FLASH_PATH);8.25 mem_save_block( file, 0x00200000, 0x00020000 );8.26 }8.28 @@ -199,7 +199,6 @@8.29 void dreamcast_shutdown()8.30 {8.31 dreamcast_stop();8.32 - sh4_stop();8.33 dreamcast_save_flash();8.34 }8.36 @@ -272,7 +271,7 @@8.37 gboolean dreamcast_load_config_stream( FILE *f )8.38 {8.40 - char buf[512], *p;8.41 + char buf[512];8.42 int maple_device = -1, maple_subdevice = -1;8.43 struct dreamcast_config_group devgroup;8.44 struct dreamcast_config_group *group = NULL;8.45 @@ -365,6 +364,7 @@8.46 }8.47 result = dreamcast_save_config_stream(f);8.48 fclose(f);8.49 + return TRUE;8.50 }8.52 gboolean dreamcast_save_config_stream( FILE *f )8.53 @@ -416,7 +416,7 @@8.54 int dreamcast_load_state( const gchar *filename )8.55 {8.56 int i,j;8.57 - uint32_t count, len;8.58 + uint32_t len;8.59 int have_read[MAX_MODULES];8.60 char tmp[64];8.61 struct save_state_header header;8.62 @@ -485,6 +485,7 @@8.63 }8.64 fclose(f);8.65 INFO( "Save state read from %s", filename );8.66 + return 0;8.67 }8.69 int dreamcast_save_state( const gchar *filename )8.70 @@ -514,5 +515,6 @@8.71 }8.72 fclose( f );8.73 INFO( "Save state written to %s", filename );8.74 + return 0;8.75 }
9.1 --- a/src/dreamcast.h Sat Oct 06 08:52:08 2007 +00009.2 +++ b/src/dreamcast.h Sat Oct 06 09:03:24 2007 +00009.3 @@ -1,5 +1,5 @@9.4 /**9.5 - * $Id: dreamcast.h,v 1.14 2007-09-08 04:38:38 nkeynes Exp $9.6 + * $Id: dreamcast.h,v 1.15 2007-10-06 08:59:42 nkeynes Exp $9.7 *9.8 * Public interface for dreamcast.c -9.9 * Central switchboard for the system. This pulls all the individual modules9.10 @@ -31,11 +31,10 @@9.12 #define DEFAULT_TIMESLICE_LENGTH 1000000 /* nanoseconds */9.14 -#ifndef MB9.15 #define MB *1024*10249.16 -#endif9.17 +#define KB *10249.19 -#define XLAT_NEW_CACHE_SIZE 8 MB9.20 +#define XLAT_NEW_CACHE_SIZE 32 MB9.21 #define XLAT_TEMP_CACHE_SIZE 2 MB9.22 #define XLAT_OLD_CACHE_SIZE 8 MB9.24 @@ -58,7 +57,8 @@9.25 struct dreamcast_config_entry *params;9.26 } *dreamcast_config_group_t;9.28 -9.29 +void dreamcast_configure(void);9.30 +void dreamcast_configure_aica_only(void);9.31 void dreamcast_init(void);9.32 void dreamcast_reset(void);9.33 void dreamcast_run(void);9.34 @@ -67,6 +67,8 @@9.36 gboolean dreamcast_load_config( const gchar *filename );9.37 gboolean dreamcast_save_config( const gchar *filename );9.38 +gboolean dreamcast_load_config_stream( FILE *f );9.39 +gboolean dreamcast_save_config_stream( FILE *f );9.41 #define DREAMCAST_SAVE_MAGIC "%!-lxDream!Save\0"9.42 #define DREAMCAST_SAVE_VERSION 0x00010000
10.1 --- a/src/eventq.c Sat Oct 06 08:52:08 2007 +000010.2 +++ b/src/eventq.c Sat Oct 06 09:03:24 2007 +000010.3 @@ -1,5 +1,5 @@10.4 /**10.5 - * $Id: eventq.c,v 1.1 2007-01-06 04:06:36 nkeynes Exp $10.6 + * $Id: eventq.c,v 1.2 2007-10-06 08:59:42 nkeynes Exp $10.7 *10.8 * Simple implementation of one-shot timers. Effectively this allows IO10.9 * devices to wait until a particular time before completing. We expect10.10 @@ -22,6 +22,7 @@10.11 #include <assert.h>10.12 #include "dreamcast.h"10.13 #include "eventq.h"10.14 +#include "asic.h"10.15 #include "sh4core.h"10.17 #define LONG_SCAN_PERIOD 1000000000 /* 1 second */10.18 @@ -149,8 +150,6 @@10.20 void event_schedule( int eventid, uint32_t nanosecs )10.21 {10.22 - int i;10.23 -10.24 nanosecs += sh4r.slice_cycle;10.26 event_t event = &events[eventid];
11.1 --- a/src/gdrom/cdi.c Sat Oct 06 08:52:08 2007 +000011.2 +++ b/src/gdrom/cdi.c Sat Oct 06 09:03:24 2007 +000011.3 @@ -1,5 +1,5 @@11.4 /**11.5 - * $Id: cdi.c,v 1.6 2007-02-04 11:30:41 nkeynes Exp $11.6 + * $Id: cdi.c,v 1.7 2007-10-06 08:58:00 nkeynes Exp $11.7 *11.8 * CDI CD-image file support11.9 *11.10 @@ -76,15 +76,13 @@11.11 {11.12 gdrom_disc_t disc = NULL;11.13 gdrom_image_t image;11.14 - int fd = -1, i,j, tmp;11.15 + int i,j;11.16 uint16_t session_count;11.17 uint16_t track_count;11.18 int total_tracks = 0;11.19 - int posn = 0, hdr;11.20 + int posn = 0;11.21 long len;11.22 struct cdi_trailer trail;11.23 - uint32_t new_fmt;11.24 - char tmpc;11.25 char marker[20];11.27 fseek( f, -8, SEEK_END );
12.1 --- a/src/gdrom/gdimage.c Sat Oct 06 08:52:08 2007 +000012.2 +++ b/src/gdrom/gdimage.c Sat Oct 06 09:03:24 2007 +000012.3 @@ -1,5 +1,5 @@12.4 /**12.5 - * $Id: gdimage.c,v 1.1 2007-01-31 10:58:42 nkeynes Exp $12.6 + * $Id: gdimage.c,v 1.2 2007-10-06 08:58:00 nkeynes Exp $12.7 *12.8 * GD-Rom image-file common functions.12.9 *12.10 @@ -16,15 +16,18 @@12.11 * GNU General Public License for more details.12.12 */12.14 +#include <netinet/in.h>12.15 +12.16 #include "gdrom/gdrom.h"12.17 #include "gdrom/packet.h"12.18 +#include "bootstrap.h"12.20 static void gdrom_image_destroy( gdrom_disc_t disc );12.21 static gdrom_error_t gdrom_image_read_sector( gdrom_disc_t disc, uint32_t lba, int mode,12.22 - char *buf, uint32_t *readlength );12.23 -static gdrom_error_t gdrom_image_read_toc( gdrom_disc_t disc, char *buf );12.24 -static gdrom_error_t gdrom_image_read_session( gdrom_disc_t disc, int session, char *buf );12.25 -static gdrom_error_t gdrom_image_read_position( gdrom_disc_t disc, uint32_t lba, char *buf );12.26 + unsigned char *buf, uint32_t *readlength );12.27 +static gdrom_error_t gdrom_image_read_toc( gdrom_disc_t disc, unsigned char *buf );12.28 +static gdrom_error_t gdrom_image_read_session( gdrom_disc_t disc, int session, unsigned char *buf );12.29 +static gdrom_error_t gdrom_image_read_position( gdrom_disc_t disc, uint32_t lba, unsigned char *buf );12.30 static int gdrom_image_drive_status( gdrom_disc_t disc );12.33 @@ -81,10 +84,10 @@12.34 }12.36 static gdrom_error_t gdrom_image_read_sector( gdrom_disc_t disc, uint32_t lba,12.37 - int mode, char *buf, uint32_t *length )12.38 + int mode, unsigned char *buf, uint32_t *length )12.39 {12.40 gdrom_image_t image = (gdrom_image_t)disc;12.41 - int i, file_offset, read_len, track_no;12.42 + int file_offset, read_len, track_no;12.44 track_no = gdrom_image_get_track_by_lba( image, lba );12.45 if( track_no == -1 ) {12.46 @@ -122,7 +125,7 @@12.48 }12.50 -static gdrom_error_t gdrom_image_read_toc( gdrom_disc_t disc, char *buf )12.51 +static gdrom_error_t gdrom_image_read_toc( gdrom_disc_t disc, unsigned char *buf )12.52 {12.53 gdrom_image_t image = (gdrom_image_t)disc;12.54 struct gdrom_toc *toc = (struct gdrom_toc *)buf;12.55 @@ -140,7 +143,7 @@12.56 return PKT_ERR_OK;12.57 }12.59 -static gdrom_error_t gdrom_image_read_session( gdrom_disc_t disc, int session, char *buf )12.60 +static gdrom_error_t gdrom_image_read_session( gdrom_disc_t disc, int session, unsigned char *buf )12.61 {12.62 gdrom_image_t image = (gdrom_image_t)disc;12.63 struct gdrom_track *last_track = &image->track[image->track_count-1];12.64 @@ -170,7 +173,7 @@12.65 }12.66 }12.68 -static gdrom_error_t gdrom_image_read_position( gdrom_disc_t disc, uint32_t lba, char *buf )12.69 +static gdrom_error_t gdrom_image_read_position( gdrom_disc_t disc, uint32_t lba, unsigned char *buf )12.70 {12.71 gdrom_image_t image = (gdrom_image_t)disc;12.72 int track_no = gdrom_image_get_track_by_lba( image, lba );12.73 @@ -190,6 +193,7 @@12.74 buf[11] = (lba >> 16) & 0xFF;12.75 buf[12] = (lba >> 8) & 0xFF;12.76 buf[13] = lba & 0xFF;12.77 + return PKT_ERR_OK;12.78 }12.80 static int gdrom_image_drive_status( gdrom_disc_t disc )12.81 @@ -217,7 +221,7 @@12.82 }12.83 }12.84 if( boot_track != -1 ) {12.85 - char boot_sector[MAX_SECTOR_SIZE];12.86 + unsigned char boot_sector[MAX_SECTOR_SIZE];12.87 uint32_t length = sizeof(boot_sector);12.88 if( d->read_sector( d, disc->track[boot_track].lba, 0x28,12.89 boot_sector, &length ) == PKT_ERR_OK ) {
13.1 --- a/src/gdrom/gdrom.c Sat Oct 06 08:52:08 2007 +000013.2 +++ b/src/gdrom/gdrom.c Sat Oct 06 09:03:24 2007 +000013.3 @@ -1,6 +1,6 @@13.5 /**13.6 - * $Id: gdrom.c,v 1.12 2007-01-31 10:58:42 nkeynes Exp $13.7 + * $Id: gdrom.c,v 1.13 2007-10-06 08:58:00 nkeynes Exp $13.8 *13.9 * GD-Rom access functions.13.10 *13.11 @@ -39,7 +39,7 @@13.13 int fd = open( filename, O_RDONLY | O_NONBLOCK );13.14 FILE *f;13.15 - int i,j;13.16 + int i;13.17 gdrom_image_class_t extclz = NULL;13.19 if( fd == -1 ) {
14.1 --- a/src/gdrom/gdrom.h Sat Oct 06 08:52:08 2007 +000014.2 +++ b/src/gdrom/gdrom.h Sat Oct 06 09:03:24 2007 +000014.3 @@ -1,5 +1,5 @@14.4 /**14.5 - * $Id: gdrom.h,v 1.10 2007-01-31 10:58:42 nkeynes Exp $14.6 + * $Id: gdrom.h,v 1.11 2007-10-06 08:58:00 nkeynes Exp $14.7 *14.8 * This file defines the structures and functions used by the GD-Rom14.9 * disc driver. (ie, the modules that supply a CD image to be used by the14.10 @@ -83,7 +83,7 @@14.11 */14.12 gdrom_error_t (*read_sector)( struct gdrom_disc *disc,14.13 uint32_t lba, int mode,14.14 - char *buf, uint32_t *length );14.15 + unsigned char *buf, uint32_t *length );14.17 /**14.18 * Read the TOC from the disc and write it into the specified buffer.14.19 @@ -92,7 +92,7 @@14.20 * @param disc pointer to the disc structure14.21 * @param buf buffer to receive data (0x198 bytes long)14.22 */14.23 - gdrom_error_t (*read_toc)(struct gdrom_disc *disc, char *buf);14.24 + gdrom_error_t (*read_toc)(struct gdrom_disc *disc, unsigned char *buf);14.26 /**14.27 * Read the information for the specified sector and return it in the14.28 @@ -101,7 +101,7 @@14.29 * @param session of interest. If 0, return end of disc information.14.30 * @param buf buffer to receive data (6 bytes)14.31 */14.32 - gdrom_error_t (*read_session)(struct gdrom_disc *disc, int session, char *buf);14.33 + gdrom_error_t (*read_session)(struct gdrom_disc *disc, int session, unsigned char *buf);14.35 /**14.36 * Read the position information (subchannel) for the specified sector14.37 @@ -111,7 +111,7 @@14.38 * @param lba sector to get position information for14.39 * @param buf buffer to receive data (14 bytes)14.40 */14.41 - gdrom_error_t (*read_position)(struct gdrom_disc *disc, uint32_t lba, char *buf);14.42 + gdrom_error_t (*read_position)(struct gdrom_disc *disc, uint32_t lba, unsigned char *buf);14.44 /**14.45 * Return the current disc status, expressed as a combination of the14.46 @@ -175,17 +175,22 @@14.47 gdrom_disc_t gdrom_image_open( const gchar *filename );14.49 /**14.50 + * Dump image info14.51 + */14.52 +void gdrom_image_dump_info( gdrom_disc_t d );14.53 +14.54 +/**14.55 * Retrieve the disc table of contents, and write it into the buffer in the14.56 * format expected by the DC.14.57 * @return 0 on success, error code on failure (eg no disc mounted)14.58 */14.59 -gdrom_error_t gdrom_get_toc( char *buf );14.60 +gdrom_error_t gdrom_get_toc( unsigned char *buf );14.62 /**14.63 * Retrieve the short (6-byte) session info, and write it into the buffer.14.64 * @return 0 on success, error code on failure.14.65 */14.66 -gdrom_error_t gdrom_get_info( char *buf, int session );14.67 +gdrom_error_t gdrom_get_info( unsigned char *buf, int session );14.69 gdrom_track_t gdrom_get_track( int track_no );14.71 @@ -203,6 +208,6 @@14.72 gboolean gdrom_is_mounted( void );14.74 uint32_t gdrom_read_sectors( uint32_t sector, uint32_t sector_count,14.75 - int mode, char *buf, uint32_t *length );14.76 + int mode, unsigned char *buf, uint32_t *length );14.78 #endif
15.1 --- a/src/gdrom/ide.c Sat Oct 06 08:52:08 2007 +000015.2 +++ b/src/gdrom/ide.c Sat Oct 06 09:03:24 2007 +000015.3 @@ -1,5 +1,5 @@15.4 /**15.5 - * $Id: ide.c,v 1.23 2007-01-31 10:58:42 nkeynes Exp $15.6 + * $Id: ide.c,v 1.24 2007-10-06 08:58:00 nkeynes Exp $15.7 *15.8 * IDE interface implementation15.9 *15.10 @@ -25,6 +25,7 @@15.11 #include <assert.h>15.12 #include <stdlib.h>15.13 #include "dream.h"15.14 +#include "mem.h"15.15 #include "asic.h"15.16 #include "gdrom/ide.h"15.17 #include "gdrom/gdrom.h"15.18 @@ -172,7 +173,6 @@15.20 static int ide_load_state( FILE *f )15.21 {15.22 - uint32_t length;15.23 fread( &idereg, sizeof(idereg), 1, f );15.24 fread( data_buffer, MAX_SECTOR_SIZE, 1, f );15.25 return 0;15.26 @@ -429,7 +429,7 @@15.27 */15.28 static void ide_read_next_sector( void )15.29 {15.30 - int sector_size;15.31 + uint32_t sector_size;15.32 REQUIRE_DISC();15.33 gdrom_error_t status =15.34 gdrom_disc->read_sector( gdrom_disc, idereg.read_lba, idereg.read_mode,15.35 @@ -454,9 +454,8 @@15.36 */15.37 void ide_packet_command( unsigned char *cmd )15.38 {15.39 - uint32_t length, datalen;15.40 + uint32_t length;15.41 uint32_t lba, status;15.42 - int mode;15.44 /* Okay we have the packet in the command buffer */15.45 INFO( "ATAPI packet: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X",
16.1 --- a/src/gdrom/linux.c Sat Oct 06 08:52:08 2007 +000016.2 +++ b/src/gdrom/linux.c Sat Oct 06 09:03:24 2007 +000016.3 @@ -1,5 +1,5 @@16.4 /**16.5 - * $Id: linux.c,v 1.4 2007-02-11 10:11:05 nkeynes Exp $16.6 + * $Id: linux.c,v 1.5 2007-10-06 08:58:00 nkeynes Exp $16.7 *16.8 * Linux cd-rom device driver.16.9 *16.10 @@ -50,8 +50,8 @@16.11 static gdrom_disc_t linux_open_device( const gchar *filename, FILE *f );16.12 static gdrom_error_t linux_read_disc_toc( gdrom_image_t disc );16.13 static gdrom_error_t linux_read_sector( gdrom_disc_t disc, uint32_t sector,16.14 - int mode, char *buf, uint32_t *length );16.15 -static gdrom_error_t linux_send_command( int fd, char *cmd, char *buffer, size_t *buflen,16.16 + int mode, unsigned char *buf, uint32_t *length );16.17 +static gdrom_error_t linux_send_command( int fd, char *cmd, unsigned char *buffer, size_t *buflen,16.18 int direction );16.19 static int linux_drive_status( gdrom_disc_t disc );16.21 @@ -81,7 +81,6 @@16.22 static gdrom_disc_t linux_open_device( const gchar *filename, FILE *f )16.23 {16.24 gdrom_disc_t disc;16.25 - int fd = fileno(f);16.27 disc = gdrom_image_new(f);16.28 if( disc == NULL ) {16.29 @@ -113,7 +112,7 @@16.30 if( status == CDS_DISC_OK ) {16.31 status = ioctl(fd, CDROM_MEDIA_CHANGED, CDSL_CURRENT);16.32 if( status != 0 ) {16.33 - linux_read_disc_toc(disc);16.34 + linux_read_disc_toc( (gdrom_image_t)disc);16.35 }16.36 return ((gdrom_image_t)disc)->disc_type | IDE_DISC_READY;16.37 } else {16.38 @@ -127,7 +126,7 @@16.39 {16.40 int fd = fileno(disc->file);16.41 unsigned char buf[MAXTOCSIZE];16.42 - int buflen = sizeof(buf);16.43 + size_t buflen = sizeof(buf);16.44 char cmd[12] = { 0x43, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0 };16.46 cmd[7] = (sizeof(buf))>>8;16.47 @@ -188,13 +187,12 @@16.48 }16.50 static gdrom_error_t linux_read_sector( gdrom_disc_t disc, uint32_t sector,16.51 - int mode, char *buf, uint32_t *length )16.52 + int mode, unsigned char *buf, uint32_t *length )16.53 {16.54 gdrom_image_t image = (gdrom_image_t)disc;16.55 int fd = fileno(image->file);16.56 uint32_t real_sector = sector - CD_MSF_OFFSET;16.57 uint32_t sector_size = MAX_SECTOR_SIZE;16.58 - int i;16.59 char cmd[12] = { 0xBE, 0x10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };16.61 cmd[1] = (mode & 0x0E) << 1;16.62 @@ -220,7 +218,7 @@16.63 * @return 0 on success, -1 on an operating system error, or a sense error16.64 * code on a device error.16.65 */16.66 -static gdrom_error_t linux_send_command( int fd, char *cmd, char *buffer, size_t *buflen,16.67 +static gdrom_error_t linux_send_command( int fd, char *cmd, unsigned char *buffer, size_t *buflen,16.68 int direction )16.69 {16.70 struct request_sense sense;
17.1 --- a/src/gdrom/nrg.c Sat Oct 06 08:52:08 2007 +000017.2 +++ b/src/gdrom/nrg.c Sat Oct 06 09:03:24 2007 +000017.3 @@ -1,5 +1,5 @@17.4 /**17.5 - * $Id: nrg.c,v 1.4 2007-01-31 10:58:42 nkeynes Exp $17.6 + * $Id: nrg.c,v 1.5 2007-10-06 08:58:00 nkeynes Exp $17.7 *17.8 * Nero (NRG) CD file format. File information stolen shamelessly from17.9 * libcdio.17.10 @@ -20,6 +20,7 @@17.11 #include <assert.h>17.12 #include <stdio.h>17.13 #include <errno.h>17.14 +#include <netinet/in.h>17.15 #include "gdrom/gdrom.h"17.16 #include "dream.h"
18.1 --- a/src/main.c Sat Oct 06 08:52:08 2007 +000018.2 +++ b/src/main.c Sat Oct 06 09:03:24 2007 +000018.3 @@ -1,5 +1,5 @@18.4 /**18.5 - * $Id: main.c,v 1.26 2007-10-03 08:22:27 nkeynes Exp $18.6 + * $Id: main.c,v 1.27 2007-10-06 09:00:10 nkeynes Exp $18.7 *18.8 * Main program, initializes dreamcast and gui, then passes control off to18.9 * the gtk main loop (currently).18.10 @@ -28,10 +28,14 @@18.11 #include "gui/gui.h"18.12 #include "dream.h"18.13 #include "syscall.h"18.14 +#include "mem.h"18.15 #include "dreamcast.h"18.16 +#include "display.h"18.17 +#include "loader.h"18.18 #include "aica/audio.h"18.19 -#include "display.h"18.20 +#include "gdrom/gdrom.h"18.21 #include "maple/maple.h"18.22 +#include "sh4/sh4core.h"18.24 #define S3M_PLAYER "s3mplay.bin"
19.1 --- a/src/mem.c Sat Oct 06 08:52:08 2007 +000019.2 +++ b/src/mem.c Sat Oct 06 09:03:24 2007 +000019.3 @@ -1,5 +1,5 @@19.4 /**19.5 - * $Id: mem.c,v 1.14 2006-07-02 04:59:00 nkeynes Exp $19.6 + * $Id: mem.c,v 1.15 2007-10-06 08:59:42 nkeynes Exp $19.7 * mem.c is responsible for creating and maintaining the overall system memory19.8 * map, as visible from the SH4 processor.19.9 *19.10 @@ -165,7 +165,6 @@19.11 char *region;19.12 int len = 4096, total = 0;19.13 uint32_t addr = start;19.14 - struct stat st;19.15 FILE *f = fopen(file,"w");19.17 if( f == NULL )19.18 @@ -224,7 +223,7 @@19.19 }19.21 struct mem_region *mem_map_region( void *mem, uint32_t base, uint32_t size,19.22 - char *name, int flags, uint32_t repeat_offset,19.23 + const char *name, int flags, uint32_t repeat_offset,19.24 uint32_t repeat_until )19.25 {19.26 int i;19.27 @@ -244,12 +243,12 @@19.28 return &mem_rgn[num_mem_rgns-1];19.29 }19.31 -void *mem_create_ram_region( uint32_t base, uint32_t size, char *name )19.32 +void *mem_create_ram_region( uint32_t base, uint32_t size, const char *name )19.33 {19.34 return mem_create_repeating_ram_region( base, size, name, size, base );19.35 }19.37 -void *mem_create_repeating_ram_region( uint32_t base, uint32_t size, char *name,19.38 +void *mem_create_repeating_ram_region( uint32_t base, uint32_t size, const char *name,19.39 uint32_t repeat_offset, uint32_t repeat_until )19.40 {19.41 char *mem;19.42 @@ -266,7 +265,7 @@19.43 return mem;19.44 }19.46 -void *mem_load_rom( char *file, uint32_t base, uint32_t size, uint32_t crc )19.47 +void *mem_load_rom( const gchar *file, uint32_t base, uint32_t size, uint32_t crc )19.48 {19.49 char *mem;19.50 int fd;19.51 @@ -285,7 +284,7 @@19.52 mem_map_region( mem, base, size, file, MEM_FLAG_ROM, size, base );19.54 /* CRC check */19.55 - calc_crc = crc32(0L, mem, size);19.56 + calc_crc = crc32(0L, (unsigned char *)mem, size);19.57 if( calc_crc != crc ) {19.58 WARN( "Bios CRC Mismatch in %s: %08X (expected %08X)",19.59 file, calc_crc, crc);19.60 @@ -294,7 +293,7 @@19.61 return mem;19.62 }19.64 -char *mem_get_region_by_name( char *name )19.65 +char *mem_get_region_by_name( const char *name )19.66 {19.67 int i;19.68 for( i=0; i<num_mem_rgns; i++ ) {
20.1 --- a/src/mem.h Sat Oct 06 08:52:08 2007 +000020.2 +++ b/src/mem.h Sat Oct 06 09:03:24 2007 +000020.3 @@ -1,5 +1,5 @@20.4 /**20.5 - * $Id: mem.h,v 1.11 2006-12-12 09:18:44 nkeynes Exp $20.6 + * $Id: mem.h,v 1.12 2007-10-06 08:59:42 nkeynes Exp $20.7 *20.8 * mem is responsible for creating and maintaining the overall system memory20.9 * map, as visible from the SH4 processor. (Note the ARM has a different map)20.10 @@ -30,7 +30,7 @@20.11 typedef struct mem_region {20.12 uint32_t base;20.13 uint32_t size;20.14 - char *name;20.15 + const char *name;20.16 char *mem;20.17 int flags;20.18 } *mem_region_t;20.19 @@ -45,16 +45,13 @@20.20 #define MEM_REGION_AUDIO_SCRATCH "Audio Scratch RAM"20.21 #define MEM_REGION_FLASH "System Flash"20.23 -#define MB * (1024 * 1024)20.24 -#define KB * 102420.25 -20.26 -void *mem_create_ram_region( uint32_t base, uint32_t size, char *name );20.27 -void *mem_create_repeating_ram_region( uint32_t base, uint32_t size, char *name,20.28 +void *mem_create_ram_region( uint32_t base, uint32_t size, const char *name );20.29 +void *mem_create_repeating_ram_region( uint32_t base, uint32_t size, const char *name,20.30 uint32_t repeat_offset, uint32_t last_repeat );20.31 -void *mem_load_rom( char *name, uint32_t base, uint32_t size, uint32_t crc );20.32 +void *mem_load_rom( const gchar *name, uint32_t base, uint32_t size, uint32_t crc );20.33 void *mem_alloc_pages( int n );20.34 char *mem_get_region( uint32_t addr );20.35 -char *mem_get_region_by_name( char *name );20.36 +char *mem_get_region_by_name( const char *name );20.37 int mem_has_page( uint32_t addr );20.38 char *mem_get_page( uint32_t addr );20.39 int mem_load_block( const gchar *filename, uint32_t base, uint32_t size );20.40 @@ -62,6 +59,8 @@20.41 void mem_set_trace( uint32_t addr, int flag );20.42 void mem_init( void );20.43 void mem_reset( void );20.44 +void mem_copy_from_sh4( char *dest, sh4addr_t src, size_t count );20.45 +void mem_copy_to_sh4( sh4addr_t dest, char *src, size_t count );20.47 #define ENABLE_DEBUG_MODE 120.49 @@ -90,8 +89,6 @@20.50 void mem_delete_watch( watch_point_t watch );20.51 watch_point_t mem_is_watched( uint32_t addr, int size, int op );20.53 -typedef uint32_t sh4addr_t;20.54 -20.55 extern char **page_map;20.56 #ifdef __cplusplus20.57 }
21.1 --- a/src/sh4/dmac.c Sat Oct 06 08:52:08 2007 +000021.2 +++ b/src/sh4/dmac.c Sat Oct 06 09:03:24 2007 +000021.3 @@ -1,5 +1,5 @@21.4 /**21.5 - * $Id: dmac.c,v 1.1 2006-01-01 08:08:40 nkeynes Exp $21.6 + * $Id: dmac.c,v 1.2 2007-10-06 09:03:24 nkeynes Exp $21.7 *21.8 * SH4 onboard DMA controller (DMAC) peripheral.21.9 *21.10 @@ -109,10 +109,11 @@21.11 * @param channel Channel number (0-3) to run.21.12 * @param run_count number of transfers to execute, or 0 to run to the21.13 * end of the transfer count.21.14 - * @return actual number of transfers run21.15 */21.16 -int DMAC_run_channel( uint32_t channel, uint32_t run_count )21.17 +void DMAC_run_channel( uint32_t channel, uint32_t run_count )21.18 {21.19 +21.20 +#if 0 /* Should really finish this */21.21 char burst[32]; /* Transfer burst */21.22 uint32_t control = DMA_CONTROL(channel);21.24 @@ -158,6 +159,7 @@21.25 count--;21.26 }21.27 }21.28 +#endif21.29 }21.31 /**21.32 @@ -237,7 +239,6 @@21.33 {21.34 uint32_t control = DMA_CONTROL(channel);21.35 uint32_t dest, count, run_count, size, i;21.36 - char tmp[32];21.38 if( !IS_CHANNEL_ENABLED(control) || !IS_DMAC_ENABLED() )21.39 return 0;
22.1 --- a/src/sh4/sh4.c Sat Oct 06 08:52:08 2007 +000022.2 +++ b/src/sh4/sh4.c Sat Oct 06 09:03:24 2007 +000022.3 @@ -1,5 +1,5 @@22.4 /**22.5 - * $Id: sh4.c,v 1.4 2007-10-04 08:47:52 nkeynes Exp $22.6 + * $Id: sh4.c,v 1.5 2007-10-06 09:03:24 nkeynes Exp $22.7 *22.8 * SH4 parent module for all CPU modes and SH4 peripheral22.9 * modules.22.10 @@ -20,9 +20,12 @@22.11 #define MODULE sh4_module22.12 #include <math.h>22.13 #include "dream.h"22.14 +#include "dreamcast.h"22.15 #include "sh4/sh4core.h"22.16 #include "sh4/sh4mmio.h"22.17 #include "sh4/intc.h"22.18 +#include "sh4/xltcache.h"22.19 +#include "sh4/sh4stat.h"22.20 #include "mem.h"22.21 #include "clock.h"22.22 #include "syscall.h"22.23 @@ -32,6 +35,7 @@22.24 #define EXV_INTERRUPT 0x600 /* External interrupt vector */22.26 void sh4_init( void );22.27 +void sh4_x86_init( void );22.28 void sh4_reset( void );22.29 void sh4_start( void );22.30 void sh4_stop( void );
23.1 --- a/src/sh4/sh4core.h Sat Oct 06 08:52:08 2007 +000023.2 +++ b/src/sh4/sh4core.h Sat Oct 06 09:03:24 2007 +000023.3 @@ -1,5 +1,5 @@23.4 /**23.5 - * $Id: sh4core.h,v 1.25 2007-09-20 08:37:19 nkeynes Exp $23.6 + * $Id: sh4core.h,v 1.26 2007-10-06 09:03:24 nkeynes Exp $23.7 *23.8 * This file defines the internal functions exported/used by the SH4 core,23.9 * except for disassembly functions defined in sh4dasm.h23.10 @@ -149,6 +149,7 @@23.11 void MMU_reset( void );23.12 void MMU_save_state( FILE *f );23.13 int MMU_load_state( FILE *f );23.14 +void SCIF_update_line_speed(void);23.16 #define SIGNEXT4(n) ((((int32_t)(n))<<28)>>28)23.17 #define SIGNEXT8(n) ((int32_t)((int8_t)(n)))
24.1 --- a/src/sh4/sh4mem.c Sat Oct 06 08:52:08 2007 +000024.2 +++ b/src/sh4/sh4mem.c Sat Oct 06 09:03:24 2007 +000024.3 @@ -1,5 +1,5 @@24.4 /**24.5 - * $Id: sh4mem.c,v 1.26 2007-10-04 10:49:41 nkeynes Exp $24.6 + * $Id: sh4mem.c,v 1.27 2007-10-06 09:03:24 nkeynes Exp $24.7 * sh4mem.c is responsible for the SH4's access to memory (including memory24.8 * mapped I/O), using the page maps created in mem.c24.9 *24.10 @@ -23,10 +23,12 @@24.11 #include "dream.h"24.12 #include "mem.h"24.13 #include "mmio.h"24.14 -#include "sh4core.h"24.15 -#include "sh4mmio.h"24.16 #include "dreamcast.h"24.17 +#include "sh4/sh4core.h"24.18 +#include "sh4/sh4mmio.h"24.19 +#include "sh4/xltcache.h"24.20 #include "pvr2/pvr2.h"24.21 +#include "asic.h"24.23 #define OC_BASE 0x1C00000024.24 #define OC_TOP 0x2000000024.25 @@ -370,8 +372,6 @@24.26 }24.28 void mem_copy_to_sh4( uint32_t destaddr, char *src, size_t count ) {24.29 - int region;24.30 -24.31 if( destaddr >= 0x10000000 && destaddr < 0x14000000 ) {24.32 pvr2_dma_write( destaddr, src, count );24.33 return;24.34 @@ -396,6 +396,6 @@24.35 int queue = (addr&0x20)>>2;24.36 char *src = (char *)&sh4r.store_queue[queue];24.37 uint32_t hi = (MMIO_READ( MMU, (queue == 0 ? QACR0 : QACR1) ) & 0x1C) << 24;24.38 - uint32_t target = addr&0x03FFFFE0 | hi;24.39 + uint32_t target = (addr&0x03FFFFE0) | hi;24.40 mem_copy_to_sh4( target, src, 32 );24.41 }
25.1 --- a/src/sh4/sh4stat.h Sat Oct 06 08:52:08 2007 +000025.2 +++ b/src/sh4/sh4stat.h Sat Oct 06 09:03:24 2007 +000025.3 @@ -1,5 +1,5 @@25.4 /**25.5 - * $Id: sh4stat.h,v 1.1 2007-09-18 08:58:23 nkeynes Exp $25.6 + * $Id: sh4stat.h,v 1.2 2007-10-06 09:03:24 nkeynes Exp $25.7 *25.8 * Support module for collecting instruction stats25.9 *25.10 @@ -54,3 +54,7 @@25.11 I_UNDEF };25.13 #define SH4_INSTRUCTION_COUNT I_UNDEF25.14 +25.15 +void sh4_stats_reset( void );25.16 +void sh4_stats_print( FILE *out );25.17 +void sh4_stats_add( uint32_t pc );
26.1 --- a/src/sh4/timer.c Sat Oct 06 08:52:08 2007 +000026.2 +++ b/src/sh4/timer.c Sat Oct 06 09:03:24 2007 +000026.3 @@ -1,5 +1,5 @@26.4 /**26.5 - * $Id: timer.c,v 1.8 2007-10-03 08:22:27 nkeynes Exp $26.6 + * $Id: timer.c,v 1.9 2007-10-06 09:03:24 nkeynes Exp $26.7 *26.8 * SH4 Timer/Clock peripheral modules (CPG, TMU, RTC), combined together to26.9 * keep things simple (they intertwine a bit).26.10 @@ -144,7 +144,7 @@26.11 if( (oldtcr & TCR_UNF) == 0 ) {26.12 tcr = tcr & (~TCR_UNF);26.13 } else {26.14 - if( (oldtcr & TCR_UNIE == 0) &&26.15 + if( ((oldtcr & TCR_UNIE) == 0) &&26.16 (tcr & TCR_IRQ_ACTIVE) == TCR_IRQ_ACTIVE ) {26.17 intc_raise_interrupt( INT_TMU_TUNI0 + timer );26.18 } else if( (oldtcr & TCR_UNIE) != 0 &&
27.1 --- a/src/sh4/xltcache.c Sat Oct 06 08:52:08 2007 +000027.2 +++ b/src/sh4/xltcache.c Sat Oct 06 09:03:24 2007 +000027.3 @@ -1,5 +1,5 @@27.4 /**27.5 - * $Id: xltcache.c,v 1.7 2007-09-29 11:06:40 nkeynes Exp $27.6 + * $Id: xltcache.c,v 1.8 2007-10-06 09:03:24 nkeynes Exp $27.7 *27.8 * Translation cache management. This part is architecture independent.27.9 *27.10 @@ -55,7 +55,7 @@27.11 static void ***xlat_lut;27.12 static gboolean xlat_initialized = FALSE;27.14 -void xlat_cache_init()27.15 +void xlat_cache_init(void)27.16 {27.17 if( !xlat_initialized ) {27.18 xlat_initialized = TRUE;
28.1 --- a/src/sh4/xltcache.h Sat Oct 06 08:52:08 2007 +000028.2 +++ b/src/sh4/xltcache.h Sat Oct 06 09:03:24 2007 +000028.3 @@ -1,5 +1,5 @@28.4 /**28.5 - * $Id: xltcache.h,v 1.6 2007-09-29 11:06:40 nkeynes Exp $28.6 + * $Id: xltcache.h,v 1.7 2007-10-06 09:03:24 nkeynes Exp $28.7 *28.8 * Translation cache support (architecture independent)28.9 *28.10 @@ -27,6 +27,11 @@28.11 } *xlat_cache_block_t;28.13 /**28.14 + * Initialize the translation cache28.15 + */28.16 +void xlat_cache_init(void);28.17 +28.18 +/**28.19 * Returns the next block in the new cache list that can be written to by the28.20 * translator.28.21 */
29.1 --- a/src/util.c Sat Oct 06 08:52:08 2007 +000029.2 +++ b/src/util.c Sat Oct 06 09:03:24 2007 +000029.3 @@ -1,5 +1,5 @@29.4 /**29.5 - * $Id: util.c,v 1.6 2006-09-12 08:36:09 nkeynes Exp $29.6 + * $Id: util.c,v 1.7 2007-10-06 08:59:42 nkeynes Exp $29.7 *29.8 * Miscellaneous utility functions.29.9 *29.10 @@ -18,7 +18,7 @@29.12 #include "dream.h"29.14 -void fwrite_string( char *s, FILE *f )29.15 +void fwrite_string( const char *s, FILE *f )29.16 {29.17 uint32_t len = 0;29.18 if( s == NULL ) {
.