Files
OpenCellular/include/timer.h
Randall Spangler 1aa57e140e Watchdog fixes
1) When frequency changes, reload the watchdog timer right away, or it
may expire before the next reload.  (Only matters when re-enabling the
PLL.)

2) Split out the timer/task debug output used by the watchdog into
their own routines, instead of assuming it's safe to call the command
handlers.  Also make the flushes in those print routines safe to call
from interrupt level.

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

BUG=none
TEST=waitms 1500; should print task dump again

Change-Id: I07e0ed24a526ae499566dab0bbeb0f5755cd5be6
2012-04-25 14:49:49 -07:00

52 lines
1.4 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.
*/
/* Timer module for Chrome EC operating system */
#ifndef __CROS_EC_TIMER_H
#define __CROS_EC_TIMER_H
#include "common.h"
#include "task_id.h"
/* Microsecond timestamp. */
typedef union {
uint64_t val;
struct {
uint32_t lo;
uint32_t hi;
} le /* little endian words */;
} timestamp_t;
/* Initializes the Timer module. */
int timer_init(void);
/* Launch a one-shot timer for task <tskid> which expires at timestamp
* <tstamp>. */
int timer_arm(timestamp_t tstamp, task_id_t tskid);
/* Cancel a running timer for the specified task id. */
int timer_cancel(task_id_t tskid);
/* Busy-wait the selected number of microseconds. Note that calling this
* with us>1000 may impact system performance; use usleep for longer delays. */
void udelay(unsigned us);
/* Sleep during the selected number of microseconds. The current task will be
* de-scheduled until the delay expires.
*
* Note: if an event happens before the end of sleep, the function will return.
*/
void usleep(unsigned us);
/* Get the current timestamp from the system timer. */
timestamp_t get_time(void);
/* Print the current timer information using the command output channel. This
* may be called from interrupt level. */
void timer_print_info(void);
#endif /* __CROS_EC_TIMER_H */