Search
lxdream.org :: lxdream/src/mem.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/mem.c
changeset 562:e598411b640b
prev561:533f6b478071
next568:61e7bb716644
author nkeynes
date Tue Jan 01 05:48:06 2008 +0000 (11 years ago)
branchlxdream-mmu
permissions -rw-r--r--
last change Add configure and command-line parameters to perform IO tracing
file annotate diff log raw
1.1 --- a/src/mem.c Tue Jan 01 05:08:38 2008 +0000
1.2 +++ b/src/mem.c Tue Jan 01 05:48:06 2008 +0000
1.3 @@ -20,6 +20,7 @@
1.4 #include <sys/types.h>
1.5 #include <sys/mman.h>
1.6 #include <sys/stat.h>
1.7 +#include <glib/gstrfuncs.h>
1.8 #include <assert.h>
1.9 #include <stdint.h>
1.10 #include <stdlib.h>
1.11 @@ -377,10 +378,39 @@
1.12 }
1.13 }
1.14
1.15 -void mem_set_trace( uint32_t addr, int flag )
1.16 +struct mmio_region *mem_get_io_region_by_name( const gchar *name )
1.17 {
1.18 - struct mmio_region *region = mem_get_io_region(addr);
1.19 - if( region != NULL )
1.20 - region->trace_flag = flag;
1.21 + int i;
1.22 + for( i=0; i<num_io_rgns; i++ ) {
1.23 + if( strcasecmp(io_rgn[i]->id, name) == 0 ) {
1.24 + return io_rgn[i];
1.25 + }
1.26 + }
1.27 + return NULL;
1.28 }
1.29
1.30 +void mem_set_trace( const gchar *tracelist, gboolean flag )
1.31 +{
1.32 + if( tracelist != NULL ) {
1.33 + gchar ** tracev = g_strsplit_set( tracelist, ",:; \t\r\n", 0 );
1.34 + int i;
1.35 + for( i=0; tracev[i] != NULL; i++ ) {
1.36 + // Special case "all" - trace everything
1.37 + if( strcasecmp(tracev[i], "all") == 0 ) {
1.38 + int j;
1.39 + for( j=0; j<num_io_rgns; j++ ) {
1.40 + io_rgn[j]->trace_flag = flag ? 1 : 0;
1.41 + }
1.42 + break;
1.43 + }
1.44 + struct mmio_region *region = mem_get_io_region_by_name( tracev[i] );
1.45 + if( region == NULL ) {
1.46 + WARN( "Unknown IO region '%s'", tracev[i] );
1.47 + } else {
1.48 + region->trace_flag = flag ? 1 : 0;
1.49 + }
1.50 + }
1.51 + g_strfreev( tracev );
1.52 + }
1.53 +}
1.54 +
.