diff options
author | Tormod Volden <debian.tormod@gmail.com> | 2011-12-11 21:40:09 +0100 |
---|---|---|
committer | Tormod Volden <debian.tormod@gmail.com> | 2012-02-17 00:53:40 +0100 |
commit | cabd47d1df24a9fded365e14320bf54de5bedcf7 (patch) | |
tree | 0bc4a7495b832d8d984d77416c8df22569330dc6 | |
parent | 9f88745ed1f3dde5440d412468c5aaa09e353bbe (diff) |
Add "regdump" command for printing card register contents
For debugging use only.
The output format is similar to the (unused) SavagePrintRegs() in
the savage xorg DDX.
Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
-rw-r--r-- | s3switch.c | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -411,6 +411,31 @@ set_new_tvstate( int tvstate ) return; } +void +dump_regs() +{ + int i; + + // Print out sequential registers + printf( "\nSR x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF" ); + for ( i = 0; i < 0x70; i++ ) { + if ( !(i % 16) ) + printf( "\nSR%xx ", i >> 4 ); + outb( i, 0x3c4 ); + printf( " %02x", inb( 0x3c5 ) ); + } + printf( "\n" ); + + // Print out CRT controller registers + printf( "\nCR x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF" ); + for ( i = 0; i < 0xb7; i++ ) { + if ( !(i % 16) ) + printf( "\nCR%xx ", i >> 4 ); + outb( i, 0x3d4 ); + printf( " %02x", inb( 0x3d5 ) ); + } + printf( "\n" ); +} int main( int argc, char ** argv ) @@ -418,6 +443,7 @@ main( int argc, char ** argv ) int quiet = 0; int newstate = 0; int newtv = 0; + int regdump = 0; // Scan through the argument list. We do very primitive checking here. @@ -441,6 +467,8 @@ main( int argc, char ** argv ) newtv = TV_FORMAT_NTSC; else if( strcasecmp( *argv, "pal" ) == 0 ) newtv = TV_FORMAT_PAL; + else if( strcasecmp( *argv, "regdump" ) == 0) + regdump = 1; else if( strcmp( *argv, "-V" ) == 0 ) { printf("s3switch " S3SWITCH_VERSION_STRING "\n"); @@ -478,6 +506,9 @@ main( int argc, char ** argv ) if( !quiet ) print_current_state( ); + if( regdump ) + dump_regs( ); + IOAccess( 0 ); return 0; |