i80321_timer.c (197733) | i80321_timer.c (236987) |
---|---|
1/* $NetBSD: i80321_timer.c,v 1.7 2003/07/27 04:52:28 thorpej Exp $ */ 2 3/*- 4 * Copyright (c) 2001, 2002 Wasabi Systems, Inc. 5 * All rights reserved. 6 * 7 * Written by Jason R. Thorpe for Wasabi Systems, Inc. 8 * --- 26 unchanged lines hidden (view full) --- 35 * POSSIBILITY OF SUCH DAMAGE. 36 */ 37 38/* 39 * Timer/clock support for the Intel i80321 I/O processor. 40 */ 41 42#include <sys/cdefs.h> | 1/* $NetBSD: i80321_timer.c,v 1.7 2003/07/27 04:52:28 thorpej Exp $ */ 2 3/*- 4 * Copyright (c) 2001, 2002 Wasabi Systems, Inc. 5 * All rights reserved. 6 * 7 * Written by Jason R. Thorpe for Wasabi Systems, Inc. 8 * --- 26 unchanged lines hidden (view full) --- 35 * POSSIBILITY OF SUCH DAMAGE. 36 */ 37 38/* 39 * Timer/clock support for the Intel i80321 I/O processor. 40 */ 41 42#include <sys/cdefs.h> |
43__FBSDID("$FreeBSD: head/sys/arm/xscale/i80321/i80321_timer.c 197733 2009-10-03 13:59:15Z rpaulo $"); | 43__FBSDID("$FreeBSD: head/sys/arm/xscale/i80321/i80321_timer.c 236987 2012-06-13 04:38:09Z imp $"); |
44 45#include <sys/param.h> 46#include <sys/systm.h> 47#include <sys/kernel.h> 48#include <sys/module.h> 49#include <sys/time.h> 50#include <sys/bus.h> 51#include <sys/resource.h> --- 5 unchanged lines hidden (view full) --- 57#include <machine/cpufunc.h> 58#include <machine/frame.h> 59#include <machine/resource.h> 60#include <machine/intr.h> 61#include <arm/xscale/i80321/i80321reg.h> 62#include <arm/xscale/i80321/i80321var.h> 63 64#ifdef CPU_XSCALE_81342 | 44 45#include <sys/param.h> 46#include <sys/systm.h> 47#include <sys/kernel.h> 48#include <sys/module.h> 49#include <sys/time.h> 50#include <sys/bus.h> 51#include <sys/resource.h> --- 5 unchanged lines hidden (view full) --- 57#include <machine/cpufunc.h> 58#include <machine/frame.h> 59#include <machine/resource.h> 60#include <machine/intr.h> 61#include <arm/xscale/i80321/i80321reg.h> 62#include <arm/xscale/i80321/i80321var.h> 63 64#ifdef CPU_XSCALE_81342 |
65#define ICU_INT_TIMER0 (8) /* XXX: Can't include i81342reg.h because | 65#define ICU_INT_TIMER0 (8) /* XXX: Can't include i81342reg.h because |
66 definitions overrides the ones from i80321reg.h 67 */ 68#endif 69#include "opt_timer.h" 70 71void (*i80321_hardclock_hook)(void) = NULL; 72struct i80321_timer_softc { 73 device_t dev; 74} timer_softc; 75 76 77static unsigned i80321_timer_get_timecount(struct timecounter *tc); 78 79 80static uint32_t counts_per_hz; 81 | 66 definitions overrides the ones from i80321reg.h 67 */ 68#endif 69#include "opt_timer.h" 70 71void (*i80321_hardclock_hook)(void) = NULL; 72struct i80321_timer_softc { 73 device_t dev; 74} timer_softc; 75 76 77static unsigned i80321_timer_get_timecount(struct timecounter *tc); 78 79 80static uint32_t counts_per_hz; 81 |
82#if defined(XSCALE_DISABLE_CCNT) || defined(CPU_XSCALE_81342) | 82#if defined(XSCALE_DISABLE_CCNT) || defined(CPU_XSCALE_81342) |
83static uint32_t offset; 84static uint32_t last = -1; 85#endif 86 87static int ticked = 0; 88 89#ifndef COUNTS_PER_SEC 90#define COUNTS_PER_SEC 200000000 /* 200MHz */ --- 287 unchanged lines hidden (view full) --- 378 if (profhz != 0) 379 printf("Cannot get %d Hz profclock\n", profhz); 380 profhz = 0; 381 382 /* Report the clock frequency. */ 383 384 oldirqstate = disable_interrupts(I32_bit); 385 | 83static uint32_t offset; 84static uint32_t last = -1; 85#endif 86 87static int ticked = 0; 88 89#ifndef COUNTS_PER_SEC 90#define COUNTS_PER_SEC 200000000 /* 200MHz */ --- 287 unchanged lines hidden (view full) --- 378 if (profhz != 0) 379 printf("Cannot get %d Hz profclock\n", profhz); 380 profhz = 0; 381 382 /* Report the clock frequency. */ 383 384 oldirqstate = disable_interrupts(I32_bit); 385 |
386 irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, | 386 irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, |
387#ifdef CPU_XSCALE_81342 388 ICU_INT_TIMER0, ICU_INT_TIMER0, 389#else | 387#ifdef CPU_XSCALE_81342 388 ICU_INT_TIMER0, ICU_INT_TIMER0, 389#else |
390 ICU_INT_TMR0, ICU_INT_TMR0, | 390 ICU_INT_TMR0, ICU_INT_TMR0, |
391#endif 392 1, RF_ACTIVE); 393 if (!irq) 394 panic("Unable to setup the clock irq handler.\n"); 395 else | 391#endif 392 1, RF_ACTIVE); 393 if (!irq) 394 panic("Unable to setup the clock irq handler.\n"); 395 else |
396 bus_setup_intr(dev, irq, INTR_TYPE_CLK, clockhandler, NULL, | 396 bus_setup_intr(dev, irq, INTR_TYPE_CLK, clockhandler, NULL, |
397 NULL, &ihl); 398 tmr0_write(0); /* stop timer */ 399 tisr_write(TISR_TMR0); /* clear interrupt */ 400 401 counts_per_hz = COUNTS_PER_SEC / hz; 402 403 trr0_write(counts_per_hz); /* reload value */ 404 tcr0_write(counts_per_hz); /* current value */ --- 80 unchanged lines hidden --- | 397 NULL, &ihl); 398 tmr0_write(0); /* stop timer */ 399 tisr_write(TISR_TMR0); /* clear interrupt */ 400 401 counts_per_hz = COUNTS_PER_SEC / hz; 402 403 trr0_write(counts_per_hz); /* reload value */ 404 tcr0_write(counts_per_hz); /* current value */ --- 80 unchanged lines hidden --- |