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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [or1ksim/] [pm/] [pm.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 102 lampret
/* pm.c -- Simulation of OpenRISC 1000 power management
2 1748 jeremybenn
 
3 102 lampret
   Copyright (C) 1999 Damjan Lampret, lampret@opencores.org
4 1748 jeremybenn
   Copyright (C) 2008 Embecosm Limited
5
 
6
   Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
7
 
8
   This file is part of OpenRISC 1000 Architectural Simulator.
9
 
10
   This program is free software; you can redistribute it and/or modify it
11
   under the terms of the GNU General Public License as published by the Free
12
   Software Foundation; either version 3 of the License, or (at your option)
13
   any later version.
14
 
15
   This program is distributed in the hope that it will be useful, but WITHOUT
16
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
18
   more details.
19
 
20
   You should have received a copy of the GNU General Public License along
21
   with this program.  If not, see <http://www.gnu.org/licenses/>. */
22 102 lampret
 
23 1748 jeremybenn
/* This program is commented throughout in a fashion suitable for processing
24
   with Doxygen. */
25 102 lampret
 
26
 
27 1748 jeremybenn
/* Autoconf and/or portability configuration */
28
#include "config.h"
29 102 lampret
 
30 1748 jeremybenn
/* Package includes */
31
#include "spr-defs.h"
32
#include "execute.h"
33
#include "sim-config.h"
34 102 lampret
 
35
 
36 1748 jeremybenn
/*---------------------------------------------------------------------------*/
37
/*!Reset power management
38 102 lampret
 
39 1748 jeremybenn
   Initializes PMR register by clearing it.                                  */
40
/*---------------------------------------------------------------------------*/
41
void
42
pm_reset ()
43
{
44
  if (config.sim.verbose)
45
    {
46
      PRINTF ("Resetting Power Management.\n");
47
    }
48 1350 nogj
 
49 1748 jeremybenn
  cpu_state.sprs[SPR_PMR] = 0;
50 1350 nogj
 
51 1748 jeremybenn
}                               /* pm_reset() */
52 102 lampret
 
53 1748 jeremybenn
 
54
/*---------------------------------------------------------------------------*/
55
/*!Enable or disable power management
56
 
57
   Set the corresponding field in the UPR
58
 
59
   @param[in] val  The value to use
60
   @param[in] dat  The config data structure (not used here)                 */
61
/*---------------------------------------------------------------------------*/
62
static void
63
pm_enabled (union param_val val, void *dat)
64 102 lampret
{
65 1748 jeremybenn
  if (val.int_val)
66
    {
67
      cpu_state.sprs[SPR_UPR] |= SPR_UPR_PMP;
68
    }
69
  else
70
    {
71
      cpu_state.sprs[SPR_UPR] &= ~SPR_UPR_PMP;
72
    }
73 1358 nogj
 
74
  config.pm.enabled = val.int_val;
75
 
76 1748 jeremybenn
}                               /* pm_enabled() */
77
 
78
 
79
/*---------------------------------------------------------------------------*/
80
/*!Set up a new power management configuration section                       */
81
/*---------------------------------------------------------------------------*/
82
void
83
reg_pm_sec ()
84 1358 nogj
{
85 1748 jeremybenn
  struct config_section *sec = reg_config_sec ("pm", NULL, NULL);
86 1358 nogj
 
87 1748 jeremybenn
  reg_config_param (sec, "enabled", paramt_int, pm_enabled);
88
 
89
}                               /* reg_pm_sec() */

powered by: WebSVN 2.1.0

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