source: rtems/c/src/lib/libcpu/powerpc/shared/include/cpuIdent.c @ d74fdb5

4.104.114.84.95
Last change on this file since d74fdb5 was eaedd00, checked in by Joel Sherrill <joel.sherrill@…>, on Jul 6, 2000 at 8:40:50 PM

Fixed formatting.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 *  cpuIdent.c -- Cpu identification code
3 *
4 *  Copyright (C) 1999 Eric Valette. valette@crf.canon.fr
5 *
6 *  The license and distribution terms for this file may be
7 *  found in found in the file LICENSE in this distribution or at
8 *  http://www.OARcorp.com/rtems/license.html.
9 *
10 * $Id$
11 *
12 */
13
14#include <libcpu/spr.h>
15
16/*
17 * Generate inline code to read Processor Version Register
18 */
19SPR_RO(PVR)
20
21ppc_cpu_id_t current_ppc_cpu = PPC_UNKNOWN;
22ppc_cpu_revision_t current_ppc_revision = 0xff;
23
24ppc_cpu_id_t get_ppc_cpu_type()
25{
26  unsigned int pvr = (_read_PVR() >> 16);
27
28  current_ppc_cpu = (ppc_cpu_id_t) pvr;
29  switch (pvr) {
30    case PPC_601:
31    case PPC_603:
32    case PPC_604:
33    case PPC_603:
34    case PPC_603ev:
35    case PPC_750:
36    case PPC_604e:
37    case PPC_604r:
38    case PPC_620:
39    case PPC_860:
40      current_ppc_cpu = (ppc_cpu_id_t) pvr;
41      return current_ppc_cpu;
42    default:
43      printk("Unknown PVR value of 0x%x. Please add it to <libcpu/powerpc/shared/cpu.h>\n", pvr );
44    return PPC_UNKNOWN;
45  }
46 
47}
48ppc_cpu_revision_t get_ppc_cpu_revision()
49{
50  ppc_cpu_revision_t rev = (ppc_cpu_revision_t) (_read_PVR() & 0xffff);
51  current_ppc_revision = rev;
52  return rev;
53}
Note: See TracBrowser for help on using the repository browser.