Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
hwdef-copro.h
Go to the documentation of this file.
1 /*
2  * Co-processor register definitions for PKUnity SoC and UniCore ISA
3  *
4  * Copyright (C) 2001-2012 GUAN Xue-tao
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  */
10 #ifndef __UNICORE_HWDEF_COPRO_H__
11 #define __UNICORE_HWDEF_COPRO_H__
12 
13 /*
14  * Control Register bits (CP#0 CR1)
15  */
16 #define CR_M (1 << 0) /* MMU enable */
17 #define CR_A (1 << 1) /* Alignment abort enable */
18 #define CR_D (1 << 2) /* Dcache enable */
19 #define CR_I (1 << 3) /* Icache enable */
20 #define CR_B (1 << 4) /* Dcache write mechanism: write back */
21 #define CR_T (1 << 5) /* Burst enable */
22 #define CR_V (1 << 13) /* Vectors relocated to 0xffff0000 */
23 
24 #ifndef __ASSEMBLY__
25 
26 #define vectors_high() (cr_alignment & CR_V)
27 
28 extern unsigned long cr_no_alignment; /* defined in entry.S */
29 extern unsigned long cr_alignment; /* defined in entry.S */
30 
31 static inline unsigned int get_cr(void)
32 {
33  unsigned int val;
34  asm("movc %0, p0.c1, #0" : "=r" (val) : : "cc");
35  return val;
36 }
37 
38 static inline void set_cr(unsigned int val)
39 {
40  asm volatile("movc p0.c1, %0, #0" : : "r" (val) : "cc");
41  isb();
42 }
43 
44 extern void adjust_cr(unsigned long mask, unsigned long set);
45 
46 #endif /* __ASSEMBLY__ */
47 
48 #endif /* __UNICORE_HWDEF_COPRO_H__ */