/* * Print contents of ARM system control register * * Martin Guy */ #include #include #include /* Contents of Maverick Crunch DSPSC register in little-endian mode. * See ARM Architecture Reference Manual, Part B, section 2.4 */ struct CP15R1 { #define u unsigned u M:1; u A:1; u C:1; u W:1; u P:1; u D:1; u L:1; u B:1; u S:1; u R:1; u F:1; u Z:1; u I:1; u V:1; u RR:1; u L4:1; u UNP:16; #undef u } cp15r1; static void read_cp15r1(void); static void print_cp15r1(void); main(int argc, char **argv) { read_cp15r1(); print_cp15r1(); exit(0); } /* Print the contents of the structure in human-readable form */ static void print_cp15r1() { #define c cp15r1 printf("M=%d A=%d C=%d W=%d P=%d D=%d L=%d B=%d\n", c.M, c.A, c.C, c.W, c.P, c.D, c.L, c.B); printf("S=%d R=%d F=%d Z=%d I=%d V=%d RR=%d L4=%d\n", c.S, c.R, c.F, c.Z, c.I, c.V, c.RR, c.L4); #undef d } /* Copy register contents into our structure */ static void read_cp15r1() { /* If you put the ldr after the cfmv32sc, you can * (Tested on Rev E1 hardware). * ldr rN, foo; cfstr64 mvdX, [rN] corrupts memory at random. / (Tested on Rev E1 hardware). */ asm("ldr r3, =cp15r1"); /* Get address of dspsc */ asm("stc p15, cr1, [r3] "); /* Store CP15R1 in cp15r1 */ }