at91_st.c (156827) | at91_st.c (158531) |
---|---|
1/*- 2 * Copyright (c) 2005 Olivier Houchard. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 9 unchanged lines hidden (view full) --- 18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 */ 24 25#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2005 Olivier Houchard. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 9 unchanged lines hidden (view full) --- 18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 */ 24 25#include <sys/cdefs.h> |
26__FBSDID("$FreeBSD: head/sys/arm/at91/at91_st.c 156827 2006-03-18 01:30:31Z imp $"); | 26__FBSDID("$FreeBSD: head/sys/arm/at91/at91_st.c 158531 2006-05-13 23:41:16Z cognet $"); |
27 28#include <sys/param.h> 29#include <sys/systm.h> 30#include <sys/kernel.h> 31#include <sys/module.h> 32#include <sys/time.h> 33#include <sys/bus.h> 34#include <sys/resource.h> --- 32 unchanged lines hidden (view full) --- 67 return (cur1); 68} 69 70static unsigned at91st_get_timecount(struct timecounter *tc); 71 72static struct timecounter at91st_timecounter = { 73 at91st_get_timecount, /* get_timecount */ 74 NULL, /* no poll_pps */ | 27 28#include <sys/param.h> 29#include <sys/systm.h> 30#include <sys/kernel.h> 31#include <sys/module.h> 32#include <sys/time.h> 33#include <sys/bus.h> 34#include <sys/resource.h> --- 32 unchanged lines hidden (view full) --- 67 return (cur1); 68} 69 70static unsigned at91st_get_timecount(struct timecounter *tc); 71 72static struct timecounter at91st_timecounter = { 73 at91st_get_timecount, /* get_timecount */ 74 NULL, /* no poll_pps */ |
75#ifdef SKYEYE_WORKAROUNDS 76 0xffffffffu, /* counter_mask */ 77#else |
|
75 0xfffffu, /* counter_mask */ | 78 0xfffffu, /* counter_mask */ |
79#endif |
|
76 32768, /* frequency */ 77 "AT91RM9200 timer", /* name */ 78 0 /* quality */ 79}; 80 81static int 82at91st_probe(device_t dev) 83{ --- 33 unchanged lines hidden (view full) --- 117 "at91_st", 118 at91st_methods, 119 sizeof(struct at91st_softc), 120}; 121static devclass_t at91st_devclass; 122 123DRIVER_MODULE(at91_st, atmelarm, at91st_driver, at91st_devclass, 0, 0); 124 | 80 32768, /* frequency */ 81 "AT91RM9200 timer", /* name */ 82 0 /* quality */ 83}; 84 85static int 86at91st_probe(device_t dev) 87{ --- 33 unchanged lines hidden (view full) --- 121 "at91_st", 122 at91st_methods, 123 sizeof(struct at91st_softc), 124}; 125static devclass_t at91st_devclass; 126 127DRIVER_MODULE(at91_st, atmelarm, at91st_driver, at91st_devclass, 0, 0); 128 |
129#ifdef SKYEYE_WORKAROUNDS 130static unsigned long tot_count = 0; 131#endif 132 |
|
125static unsigned 126at91st_get_timecount(struct timecounter *tc) 127{ | 133static unsigned 134at91st_get_timecount(struct timecounter *tc) 135{ |
136#ifdef SKYEYE_WORKAROUNDS 137 return (tot_count); 138#else |
|
128 return (st_crtr()); | 139 return (st_crtr()); |
140#endif |
|
129} 130 131static void 132clock_intr(void *arg) 133{ 134 struct trapframe *fp = arg; 135 136 /* The interrupt is shared, so we have to make sure it's for us. */ | 141} 142 143static void 144clock_intr(void *arg) 145{ 146 struct trapframe *fp = arg; 147 148 /* The interrupt is shared, so we have to make sure it's for us. */ |
137 if (RD4(ST_SR) & ST_SR_PITS) | 149 if (RD4(ST_SR) & ST_SR_PITS) { 150#ifdef SKYEYE_WORKAROUNDS 151 tot_count += 32768 / hz; 152#endif |
138 hardclock(TRAPF_USERMODE(fp), TRAPF_PC(fp)); | 153 hardclock(TRAPF_USERMODE(fp), TRAPF_PC(fp)); |
154 } |
|
139} 140 141void 142cpu_initclocks(void) 143{ 144 int rel_value; 145 struct resource *irq; 146 int rid = 0; --- 70 unchanged lines hidden --- | 155} 156 157void 158cpu_initclocks(void) 159{ 160 int rel_value; 161 struct resource *irq; 162 int rid = 0; --- 70 unchanged lines hidden --- |