summaryrefslogtreecommitdiff
path: root/openpicc/application
diff options
context:
space:
mode:
Diffstat (limited to 'openpicc/application')
-rw-r--r--openpicc/application/ssc_picc.c17
-rw-r--r--openpicc/application/ssc_picc.h1
-rw-r--r--openpicc/application/tc_fdt.c18
3 files changed, 10 insertions, 26 deletions
diff --git a/openpicc/application/ssc_picc.c b/openpicc/application/ssc_picc.c
index 02d87d1..99a4a2f 100644
--- a/openpicc/application/ssc_picc.c
+++ b/openpicc/application/ssc_picc.c
@@ -59,9 +59,6 @@ xQueueHandle ssc_rx_queue = NULL;
ssc_dma_tx_buffer_t ssc_tx_buffer;
-#define TEST_WHETHER_NOT_ENABLING_IT_HELPS
-#define TEST_WHETHER_THIS_INTERRUPT_WORKS_AT_ALL
-
static ssc_dma_rx_buffer_t* __ramfunc ssc_find_dma_buffer(ssc_dma_buffer_state_t oldstate,
ssc_dma_buffer_state_t newstate)
{
@@ -162,11 +159,9 @@ void ssc_rx_mode_set(enum ssc_mode ssc_mode)
AT91F_PDC_EnableRx(rx_pdc);
/* Enable RX interrupts */
-#ifdef TEST_WHETHER_NOT_ENABLING_IT_HELPS
/*
AT91F_SSC_EnableIt(ssc, AT91C_SSC_OVRUN | AT91C_SSC_CP0 |
AT91C_SSC_ENDRX | AT91C_SSC_RXBUFF);*/
-#endif
out_set_mode:
ssc_state.mode = ssc_mode;
}
@@ -207,9 +202,7 @@ void ssc_tx_start(ssc_dma_tx_buffer_t *buf)
AT91F_PDC_SetTx(tx_pdc, buf->data, num_data);
buf->state = PENDING;
-#ifdef TEST_WHETHER_NOT_ENABLING_IT_HELPS
AT91F_SSC_EnableIt(ssc, AT91C_SSC_TXSYN | AT91C_SSC_ENDTX | AT91C_SSC_TXBUFE);
-#endif
/* Enable DMA */
AT91F_PDC_EnableTx(tx_pdc);
/* Start Transmission */
@@ -304,6 +297,10 @@ static int __ramfunc __ssc_rx_refill(int secondary)
return 0;
}
+void __ramfunc ssc_rx_stop_frame_ended(void)
+{
+}
+
static void __ramfunc ssc_irq(void) __attribute__ ((naked));
static void __ramfunc ssc_irq(void)
{
@@ -311,7 +308,6 @@ static void __ramfunc ssc_irq(void)
vLedSetRed(1);
portBASE_TYPE task_woken = pdFALSE;
-#ifdef TEST_WHETHER_THIS_INTERRUPT_WORKS_AT_ALL
u_int32_t ssc_sr = ssc->SSC_SR;
int i, emptyframe = 0;
u_int32_t *tmp;
@@ -413,7 +409,6 @@ static void __ramfunc ssc_irq(void)
irq_extension(ssc_sr, ssc_state.mode, inbuf?inbuf->data:NULL);
-#endif
DEBUGPCR("I");
AT91F_AIC_ClearIt(AT91C_ID_SSC);
AT91F_AIC_AcknowledgeIt();
@@ -433,10 +428,8 @@ void ssc_print(void)
void ssc_rx_unthrottle(void)
{
-#ifdef TEST_WHETHER_NOT_ENABLING_IT_HELPS
AT91F_SSC_EnableIt(ssc, AT91C_SSC_ENDRX | AT91C_SSC_CP0 |
AT91C_SSC_RXBUFF | AT91C_SSC_OVRUN);
-#endif
}
void ssc_rx_start(void)
@@ -447,10 +440,8 @@ void ssc_rx_start(void)
if(ssc_state.mode != SSC_MODE_14443A_SHORT) __ssc_rx_refill(1);
/* Enable Reception */
-#ifdef TEST_WHETHER_NOT_ENABLING_IT_HELPS
AT91F_SSC_EnableIt(ssc, AT91C_SSC_ENDRX | AT91C_SSC_CP0 |
AT91C_SSC_RXBUFF | AT91C_SSC_OVRUN);
-#endif
AT91F_SSC_EnableRx(AT91C_BASE_SSC);
/* Clear the flipflop */
diff --git a/openpicc/application/ssc_picc.h b/openpicc/application/ssc_picc.h
index 671de7c..bd08a73 100644
--- a/openpicc/application/ssc_picc.h
+++ b/openpicc/application/ssc_picc.h
@@ -14,6 +14,7 @@ extern void ssc_rx_init(void);
extern void ssc_fini(void);
extern void ssc_rx_stop(void);
extern void ssc_rx_unthrottle(void);
+extern void __ramfunc ssc_rx_stop_frame_ended(void);
enum ssc_mode {
diff --git a/openpicc/application/tc_fdt.c b/openpicc/application/tc_fdt.c
index 57036e5..03ef5a4 100644
--- a/openpicc/application/tc_fdt.c
+++ b/openpicc/application/tc_fdt.c
@@ -40,6 +40,7 @@
#include "tc_cdiv.h"
#include "tc_fdt.h"
#include "usb_print.h"
+#include "ssc_picc.h"
static AT91PS_TC tcfdt = AT91C_BASE_TC2;
@@ -56,8 +57,8 @@ void tc_frame_end_set(u_int16_t count)
tcfdt->TC_RB = count;
}
-static void tc_fdt_irq(void) __attribute__ ((naked));
-static void tc_fdt_irq(void)
+static void __ramfunc tc_fdt_irq(void) __attribute__ ((naked));
+static void __ramfunc tc_fdt_irq(void)
{
portSAVE_CONTEXT();
//vLedSetGreen(1);
@@ -66,25 +67,17 @@ static void tc_fdt_irq(void)
sr, tcfdt->TC_CV);
if (sr & AT91C_TC_ETRGS) {
- usb_print_string_f("tc_etrgs ", 0);
DEBUGP("Ext_trigger ");
}
if (sr & AT91C_TC_CPAS) {
- usb_print_string_f("tc_cpas ", 0);
DEBUGP("FDT_expired ");
- /* FIXME: if we are in anticol / sync mode,
- * we could do software triggering of SSC TX,
- * but IIRC the hardware does this by TF */
}
if (sr & AT91C_TC_CPBS) {
usb_print_string_f("tc_cpbs ", 0);
DEBUGP("Frame_end ");
- /* FIXME: stop ssc (in continuous mode),
- * take care of preparing synchronous response if
- * we operate in anticol mode.*/
+ ssc_rx_stop_frame_ended();
}
if (sr & AT91C_TC_CPCS) {
- usb_print_string_f("tc_cpcs ", 0);
DEBUGP("Compare_C ");
}
DEBUGPCR("");
@@ -131,9 +124,8 @@ void tc_fdt_init(void)
AT91F_AIC_ConfigureIt(AT91C_ID_TC2,
OPENPCD_IRQ_PRIO_TC_FDT,
- AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL, &tc_fdt_irq);
+ AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL, (THandler)&tc_fdt_irq);
AT91F_AIC_EnableIt(AT91C_ID_TC2);
- (void)tc_fdt_irq;// FIXME NO IRQ
tcfdt->TC_IER = AT91C_TC_CPAS | AT91C_TC_CPBS | AT91C_TC_CPCS |
AT91C_TC_ETRGS;
personal git repositories of Harald Welte. Your mileage may vary