From 062f55ca3ea77ebcace83aab4772c9cd3f28ec34 Mon Sep 17 00:00:00 2001 From: henryk Date: Fri, 23 Nov 2007 10:30:50 +0000 Subject: Commit status quo (pending cleanup of the debug and experimental code that I added during the last week) Change freertos code to not mask FIQ, this finally makes the FIQ working (with approx 700ns +/- 100ns latency; yeah!) and therefore reception starts working Change to two times oversampling (keep four times oversampling code ifdef'd, extract all the magical values to a header file) because at four times oversampling every other sample is very close to a possible data edge and therefore not reliable git-svn-id: https://svn.openpcd.org:2342/trunk@347 6dc7ffe9-61d6-0310-9af1-9938baff3ed1 --- openpicc/application/ssc_picc.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'openpicc/application/ssc_picc.c') diff --git a/openpicc/application/ssc_picc.c b/openpicc/application/ssc_picc.c index 3dbc246..acdf9ae 100644 --- a/openpicc/application/ssc_picc.c +++ b/openpicc/application/ssc_picc.c @@ -45,13 +45,10 @@ #include "tc_fdt.h" #include "usb_print.h" +#include "iso14443_layer3a.h" //#define DEBUG_SSC_REFILL -/* definitions for four-times oversampling */ -#define REQA 0x10410441 -#define WUPA 0x04041041 - static const AT91PS_SSC ssc = AT91C_BASE_SSC; static AT91PS_PDC rx_pdc; @@ -91,10 +88,6 @@ static const u_int16_t ssc_dmasize[] = { [SSC_MODE_CONTINUOUS] = 511, /* 2044 bytes */ }; -/* This is for four-times oversampling */ -#define ISO14443A_SOF_SAMPLE 0x01 -#define ISO14443A_SOF_LEN 4 - #define SSC_RX_IRQ_MASK (AT91C_SSC_RXRDY | \ AT91C_SSC_OVRUN | \ AT91C_SSC_ENDRX | \ @@ -109,6 +102,9 @@ static const u_int16_t ssc_dmasize[] = { AT91C_SSC_TXBUFE | \ AT91C_SSC_TXSYN) +/* This stores the value that SSC_RCMR should be set to when a frame start is detected. + * Will be used in my_fiq_handler in os/boot/boot.s */ +u_int32_t ssc_rcmr_on_start = 0; void ssc_rx_mode_set(enum ssc_mode ssc_mode) { u_int8_t data_len=0, num_data=0, sync_len=0; @@ -123,7 +119,7 @@ void ssc_rx_mode_set(enum ssc_mode ssc_mode) start_cond = AT91C_SSC_START_0; sync_len = ISO14443A_SOF_LEN; ssc->SSC_RC0R = ISO14443A_SOF_SAMPLE; - data_len = 32; + data_len = ISO14443A_SHORT_LEN; num_data = 16; break; case SSC_MODE_14443A_STANDARD: @@ -283,9 +279,6 @@ static int __ramfunc __ssc_rx_refill(int secondary) return 0; } -#define ISO14443A_FDT_SHORT_1 1236 -#define ISO14443A_FDT_SHORT_0 1172 - static void __ramfunc ssc_irq_short_inner(void) __attribute__ ((naked)); static void __ramfunc ssc_irq_short_inner(void) { @@ -458,7 +451,11 @@ static void __ramfunc ssc_irq(void) if (ssc_sr & AT91C_SSC_RXSYN) DEBUGP("RXSYN "); if (ssc_sr & AT91C_SSC_RXRDY) { - u_int32_t sample = ssc->SSC_RHR; + u_int32_t sample = ssc->SSC_RHR; + int i = usb_print_set_default_flush(0); + DumpUIntToUSB(sample); + DumpStringToUSB("\n\r"); + usb_print_set_default_flush(i); DEBUGP("RXRDY=0x%08x ", sample); /* Try to set FDT compare register ASAP */ if (sample == REQA) { -- cgit v1.2.3