2007-12-06 Till Straumann <strauman@slac.stanford.edu>

* shared/openpic/openpic.c, shared/openpic/openpic.h:
	added routines to set timer period and interupt mask
	and to read current count.
This commit is contained in:
Till Straumann
2007-12-07 09:10:55 +00:00
parent 8272b10998
commit 2a90ae7522
3 changed files with 30 additions and 0 deletions

View File

@@ -1,3 +1,9 @@
2007-12-06 Till Straumann <strauman@slac.stanford.edu>
* shared/openpic/openpic.c, shared/openpic/openpic.h:
added routines to set timer period and interupt mask
and to read current count.
2007-12-06 Till Straumann <strauman@slac.stanford.edu>
* virtex/irq/irq_init.c: use new ASM_xxx_VECTOR names.

View File

@@ -492,6 +492,28 @@ void openpic_maptimer(unsigned int timer, unsigned int cpumask)
openpic_write(&OpenPIC->Global.Timer[timer].Destination, cpumask);
}
/*
* Set base count and / or enable / disable interrupt.
*/
void openpic_settimer(unsigned int timer, unsigned int base_count, int irq_enable)
{
check_arg_timer(timer);
if ( base_count )
openpic_write(&OpenPIC->Global.Timer[timer].Base_Count, base_count);
if ( irq_enable )
openpic_clearfield(&OpenPIC->Global.Timer[timer].Vector_Priority, OPENPIC_MASK);
else
openpic_setfield(&OpenPIC->Global.Timer[timer].Vector_Priority, OPENPIC_MASK);
}
unsigned int openpic_gettimer(unsigned int timer)
{
check_arg_timer(timer);
return (openpic_read(&OpenPIC->Global.Timer[timer]) & ~OPENPIC_MASK);
}
/* -------- Interrupt Sources ---------------------------------------------- */
/*

View File

@@ -363,6 +363,8 @@ extern void openpic_cause_IPI(unsigned int cpu, unsigned int ipi, unsigned int c
/* Timer Interrupts */
extern void openpic_inittimer(unsigned int timer, unsigned int pri, unsigned int vector);
extern void openpic_settimer(unsigned int timer, unsigned int base_count, int irq_enable);
extern unsigned int openpic_gettimer(unsigned int timer);
extern void openpic_maptimer(unsigned int timer, unsigned int cpumask);
/* Interrupt Sources */