]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] m68knommu/5272 check timer irq pending
authorGreg Ungerer <gerg@snapgear.com>
Sun, 25 May 2003 11:41:38 +0000 (04:41 -0700)
committerJaroslav Kysela <perex@suse.cz>
Sun, 25 May 2003 11:41:38 +0000 (04:41 -0700)
Add a function to allow checking if the timer interrupt is pending for
the m68knommu/5272 CPU.  This is used by the architecture timer code for
microsecond accurate time calculations.

arch/m68knommu/platform/5272/config.c

index 839a2e2aa9e7ef6fbf0c5e16b422b7cfc9c40218..78dbaac8c5a396b251835980eb286ea3a8ceecee 100644 (file)
@@ -70,17 +70,24 @@ void mcf_autovector(unsigned int vec)
 void mcf_settimericr(int timer, int level)
 {
        volatile unsigned long *icrp;
-       unsigned int icr;
 
-       switch (timer) {
-       case 2:  icr = MCFSIM_ICR2; break;
-       case 3:  icr = MCFSIM_ICR3; break;
-       case 4:  icr = MCFSIM_ICR4; break;
-       default: icr = MCFSIM_ICR1; break;
+       if ((timer >= 1 ) && (timer <= 4)) {
+               icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
+               *icrp = (0x8 | level) << ((4 - timer) * 4);
        }
+}
+
+/***************************************************************************/
 
-       icrp = (volatile unsigned long *) (MCF_MBAR + icr);
-       *icrp = (0x8 | level) << ((4 - timer) * 4);
+int mcf_timerirqpending(int timer)
+{
+       volatile unsigned long *icrp;
+
+       if ((timer >= 1 ) && (timer <= 4)) {
+               icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
+               return (*icrp & (0x8 << ((4 - timer) * 4)));
+       }
+       return 0;
 }
 
 /***************************************************************************/