Files
OpenCellular/include/hwtimer.h
Randall Spangler e9328ac4f6 Support dynamically changing the system clock
Add nopll command to turn off the PLL, reducing the system clock to 16Mhz.

Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8798
TEST=manual

boot system
press power button to boot x86
temps   // should print all temperatures
timerinfo
timerinfo
timerinfo  // convince yourself this is counting up at about 1MHz
nopll  // this drops the system clock to 16MHz
temps   // should still print all temperatures
timerinfo
timerinfo
timerinfo  // should still be counting up at about 1MHz

Change-Id: Ie29ceb17af348148bffadf63d60c1b731f4c3f6d
2012-04-09 10:33:35 -07:00

47 lines
1.3 KiB
C

/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* Hardware timer driver API */
#ifndef __EC_HWTIMER_H
#define __EC_HWTIMER_H
/**
* Programs when the next timer should fire an interrupt.
* deadline: timestamp of the event.
*/
void __hw_clock_event_set(uint32_t deadline);
/* Returns the timestamp of the next programed event */
uint32_t __hw_clock_event_get(void);
/* Cancel the next event programed by __hw_clock_event_set */
void __hw_clock_event_clear(void);
/* Returns the value of the free-running counter used as clock. */
uint32_t __hw_clock_source_read(void);
/**
* Initializes the hardware timer used to provide clock services.
*
* It returns the IRQ number of the timer routine.
*/
int __hw_clock_source_init(void);
/* Notifies the module the system clock frequency has changed to <freq>. */
void hwtimer_clock_changed(int freq);
/**
* Searches the next deadline and program it in the timer hardware.
*
* overflow: if true, the 32-bit counter as overflowed since the last call.
*
* This function is exported from the common timers code as an helper for the
* hardware timer interrupt routine.
*/
void process_timers(int overflow);
#endif /* __EC_HWTIMER_H */