summaryrefslogtreecommitdiff
path: root/openpicc/application/tc_cdiv_sync.c
diff options
context:
space:
mode:
authorhenryk <henryk@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2007-11-13 00:47:14 +0000
committerhenryk <henryk@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2007-11-13 00:47:14 +0000
commit3d0a9bd40be2d014e0877eb623042c899d8cbe66 (patch)
tree16afede5c836924716cbd916ad1d63e5cc1be7c5 /openpicc/application/tc_cdiv_sync.c
parent1dfa375abb95c59830c38697c53fa9a6794a9fb9 (diff)
Add PIO IRQ counter (and print it in 'c' command)
Make tc_cdiv_sync interrupt working Add 'p' command to print some PIO inputs Add 'z' command to enable/disable tc_cdiv_sync git-svn-id: https://svn.openpcd.org:2342/trunk@324 6dc7ffe9-61d6-0310-9af1-9938baff3ed1
Diffstat (limited to 'openpicc/application/tc_cdiv_sync.c')
-rw-r--r--openpicc/application/tc_cdiv_sync.c47
1 files changed, 8 insertions, 39 deletions
diff --git a/openpicc/application/tc_cdiv_sync.c b/openpicc/application/tc_cdiv_sync.c
index 486e93b..45c65b6 100644
--- a/openpicc/application/tc_cdiv_sync.c
+++ b/openpicc/application/tc_cdiv_sync.c
@@ -5,12 +5,12 @@
#include "dbgu.h"
#include "pio_irq.h"
#include "openpicc.h"
+#include "led.h"
#define USE_IRQ
static u_int8_t enabled;
-#if 0
static void pio_data_change(u_int32_t pio)
{
(void)pio;
@@ -24,29 +24,9 @@ static void pio_data_change(u_int32_t pio)
*AT91C_TC0_CV);
} else
DEBUGPCR("");
+ vLedSetGreen(0);
}
-#else
-
-static void __ramfunc cdsync_cb(void)
-{
- DEBUGP("PIO_IRQ: ");
- if (*AT91C_PIOA_ISR & OPENPICC_PIO_FRAME) {
- DEBUGP("PIO_FRAME_IRQ: ");
- /* we get one interrupt for each change. If now, after the
- * change the level is high, then it must have been a rising
- * edge */
- if (*AT91C_PIOA_PDSR & OPENPICC_PIO_FRAME) {
- *AT91C_TC0_CCR = AT91C_TC_SWTRG;
- DEBUGPCR("CDIV_SYNC_FLIP SWTRG CV=0x%08x",
- *AT91C_TC0_CV);
- } else
- DEBUGPCR("");
- } else
- DEBUGPCR("");
-}
-#endif
-
void tc_cdiv_sync_reset(void)
{
if (enabled) {
@@ -54,6 +34,7 @@ void tc_cdiv_sync_reset(void)
(void)tmp;
volatile int i;
DEBUGPCRF("CDIV_SYNC_FLOP");
+ vLedSetGreen(1);
/* reset the hardware flipflop */
AT91F_PIO_ClearOutput(AT91C_BASE_PIOA,
@@ -87,24 +68,12 @@ void tc_cdiv_sync_init(void)
enabled = 0;
AT91F_PIOA_CfgPMC();
-
-#ifdef USE_IRQ
- /* Configure IRQ */
- AT91F_AIC_ConfigureIt(AT91C_ID_PIOA,
- AT91C_AIC_PRIOR_HIGHEST,
- AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL, (THandler)&cdsync_cb);
-#else
- /* Configure FIQ */
- AT91F_AIC_ConfigureIt(AT91C_ID_FIQ,
- //0, AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL, &cdsync_cb);
- 0, AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL, (THandler)&fiq_handler);
- /* enable fast forcing for PIOA interrupt */
- *AT91C_AIC_FFER = (1 << AT91C_ID_PIOA);
-
- /* register pio irq handler */
+
+ AT91F_PIO_CfgOutput(AT91C_BASE_PIOA, OPENPICC_PIO_SSC_DATA_CONTROL);
+
pio_irq_register(OPENPICC_PIO_FRAME, &pio_data_change);
-#endif
AT91F_AIC_EnableIt(AT91C_ID_PIOA);
-
+
+ vLedSetGreen(0);
tc_cdiv_sync_disable();
}
personal git repositories of Harald Welte. Your mileage may vary