OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [lib/] [libcpu/] [powerpc/] [shared/] [cpuIdent.c] - Blame information for rev 173

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
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: cpuIdent.c,v 1.2 2001-09-27 12:01:30 chris Exp $
11
 *
12
 */
13
 
14
#include <libcpu/spr.h>
15
 
16
/*
17
 * Generate inline code to read Processor Version Register
18
 */
19
SPR_RO(PVR)
20
 
21
ppc_cpu_id_t current_ppc_cpu = PPC_UNKNOWN;
22
ppc_cpu_revision_t current_ppc_revision = 0xff;
23
 
24
ppc_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_603e :
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. Please add it to <libcpu/powerpc/shared/cpu.h> \n");
44
    return PPC_UNKNOWN;
45
  }
46
 
47
}
48
ppc_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
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.