filename | test/sh4/mmummio.c |
changeset | 976:e57a25d9eb7d |
author | nkeynes |
date | Mon Feb 14 08:12:41 2011 +1000 (13 years ago) |
permissions | -rw-r--r-- |
last change | Add default read/write burst methods for IO regions. (There's almost certainly a bug somewhere if these are actually invoked, but try to do the right thing anyway rather than crashing) |
view | annotate | diff | log | raw |
1 #include <assert.h>
2 #include <stdio.h>
3 #include "../lib.h"
5 #define PTEH 0xFF000000
6 #define PTEL 0xFF000004
7 #define TTB 0xFF000008
8 #define TEA 0xFF00000C
9 #define MMUCR 0xFF000010
10 #define PTEA 0xFF000034
12 #define ITLB_ADDR(entry) (0xF2000000 + (entry<<8))
13 #define ITLB_DATA(entry) (0xF3000000 + (entry<<8))
14 #define UTLB_ADDR(entry) (0xF6000000 + (entry<<8))
15 #define UTLB_DATA1(entry) (0xF7000000 + (entry<<8))
16 #define UTLB_DATA2(entry) (0xF7800000 + (entry<<8))
18 /* Bang on the mmio side of the TLBs to make sure the bits
19 * respond appropriately (with AT disabled so we don't risk
20 * doing a hard crash) */
21 void test_tlb_mmio()
22 {
23 int entry;
24 for( entry=0; entry<64; entry++ ) {
25 long_write( UTLB_DATA1(entry), 0 );
26 long_write( UTLB_ADDR(entry), 0xFFFFFFFF );
27 assert( long_read( UTLB_ADDR(entry) ) == 0xFFFFFFFF );
28 assert( long_read( UTLB_DATA1(entry) ) == 0x00000104 );
29 long_write( UTLB_ADDR(entry), 0x00000000 );
30 assert( long_read( UTLB_ADDR(entry) ) == 0x00000000 );
31 assert( long_read( UTLB_DATA1(entry) ) == 0x00000000 );
32 long_write( UTLB_DATA1(entry), 0xFFFFFFFF );
33 assert( long_read( UTLB_DATA1(entry) ) == 0x1FFFFDFF );
34 assert( long_read( UTLB_ADDR(entry) ) == 0x00000300 );
35 long_write( UTLB_DATA1(entry), 0x00000000 );
36 assert( long_read( UTLB_DATA1(entry) ) == 0x00000000 );
37 assert( long_read( UTLB_ADDR(entry) ) == 0x00000000 );
38 long_write( UTLB_DATA2(entry), 0xFFFFFFFF );
39 assert( long_read( UTLB_DATA2(entry) ) == 0x0000000F );
40 long_write( UTLB_DATA2(entry), 0x00000000 );
41 assert( long_read( UTLB_DATA2(entry) ) == 0x00000000 );
42 }
44 for( entry=0; entry<4; entry++ ) {
45 long_write( ITLB_DATA(entry), 0 );
46 long_write( ITLB_ADDR(entry), 0xFFFFFFFF );
47 assert( long_read( ITLB_ADDR(entry) ) == 0xFFFFFDFF );
48 assert( long_read( ITLB_DATA(entry) ) == 0x00000100 );
49 long_write( ITLB_ADDR(entry), 0x00000000 );
50 assert( long_read( ITLB_ADDR(entry) ) == 0x00000000 );
51 assert( long_read( ITLB_DATA(entry) ) == 0x00000000 );
52 long_write( ITLB_DATA(entry), 0xFFFFFFFF );
53 assert( long_read( ITLB_DATA(entry) ) == 0x1FFFFDDA );
54 assert( long_read( ITLB_ADDR(entry) ) == 0x00000100 );
55 long_write( ITLB_DATA(entry), 0x00000000 );
56 assert( long_read( ITLB_DATA(entry) ) == 0x00000000 );
57 assert( long_read( ITLB_ADDR(entry) ) == 0x00000000 );
59 }
60 }
.