source: svn/trunk/newcon3bcm2_21bu/dta/src/bcm_mips_defs.h @ 2

Last change on this file since 2 was 2, checked in by phkim, 11 years ago

1.phkim

  1. revision copy newcon3sk r27
  • Property svn:executable set to *
File size: 1.9 KB
Line 
1/***************************************************************
2**
3** Broadcom Corp. Confidential
4** Copyright 1998-2000 Broadcom Corp. All Rights Reserved.
5**
6** THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED
7** SOFTWARE LICENSE AGREEMENT BETWEEN THE USER AND BROADCOM.
8** YOU HAVE NO RIGHT TO USE OR EXPLOIT THIS MATERIAL EXCEPT
9** SUBJECT TO THE TERMS OF SUCH AN AGREEMENT.
10**
11** File:                bcm_mips_defs.h
12** Description:  MIPS definitions.
13**
14****************************************************************/
15#ifndef __BCM_MIPS_DEFS__
16#define __BCM_MIPS_DEFS__
17
18#define BCM_PHYS_TO_KSEG1(x)    ((unsigned int)(x) | 0xA0000000)
19#define BCM_CPU_TO_PHYS(x)      ((unsigned int)(x) & ~0xA0000000)
20#define BCM_PHYS_TO_KSEG0(x)    ((unsigned int)(x) | 0x80000000)
21/***************************************************************************
22Summary:
23        Macro to write a cp0 register.
24       
25Description:
26        asm macro to write a cp0 register given the register, select and value. (MIPS32)
27               
28See Also:
29        bcm_read_cp0
30***************************************************************************/
31#define bcm_write_cp0(reg, sel, value)                                  \
32{               __asm__ __volatile__(".set\tpush\n\t"                   \
33                        ".set\tmips32\n\t"                                                      \
34                        "mtc0\t%z0, " #reg ", " #sel "\n\t"     \
35                        ".set\tpop\n\t"                                                 \
36                        : /* none */                                                            \
37                        : "r" ((unsigned int)value));                           \
38}
39
40/***************************************************************************
41Summary:
42        Macro to read a cp0 register.
43       
44Description:
45        asm macro to read a cp0 register given the register and select. (MIPS32)
46               
47See Also:
48        bcm_read_cp0
49***************************************************************************/
50#define bcm_read_cp0(reg, sel)                                                  \
51({ unsigned int bcm_read_cp0_res;                                               \
52                __asm__ __volatile__(   ".set\tpush\n\t"                \
53                        ".set\tmips32\n\t"                                                      \
54                        "mfc0\t%0, " #reg ", " #sel "\n\t"                      \
55                        ".set\tpop\n\t"                                                 \
56                        : "=r" (bcm_read_cp0_res));                                     \
57        bcm_read_cp0_res;                                                                       \
58})
59
60
61#endif /* __BCM_MIPS_DEFS__ */
62
Note: See TracBrowser for help on using the repository browser.