From 29ea5bbf5b9c3b3679aa40e4ee7029284cb424c6 Mon Sep 17 00:00:00 2001 From: henryk Date: Sat, 24 Nov 2007 07:59:42 +0000 Subject: Add load modulation and encoding/decoding code from harald git-svn-id: https://svn.openpcd.org:2342/trunk@351 6dc7ffe9-61d6-0310-9af1-9938baff3ed1 --- openpicc/application/iso14443_layer3a.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'openpicc/application/iso14443_layer3a.c') diff --git a/openpicc/application/iso14443_layer3a.c b/openpicc/application/iso14443_layer3a.c index 8dd9cd2..841ad14 100644 --- a/openpicc/application/iso14443_layer3a.c +++ b/openpicc/application/iso14443_layer3a.c @@ -130,17 +130,26 @@ void iso14443_layer3a_state_machine (void *pvParameters) portENTER_CRITICAL(); buffer->state = PROCESSING; portEXIT_CRITICAL(); + u_int32_t first_sample = *(u_int32_t*)buffer->data; DumpStringToUSB("Frame: "); - DumpUIntToUSB(*(u_int32_t*)buffer->data); + DumpUIntToUSB(first_sample); DumpStringToUSB(" "); main_help_print_buffer(buffer, &pktcount); switch(state) { case IDLE: case HALT: - ssc_rx_mode_set(SSC_MODE_14443A_SHORT); - ssc_rx_start(); + if(first_sample == WUPA || (state==IDLE && first_sample==REQA)) { + /* Need to transmit ATQA */ + LAYER3_DEBUG("Received "); + LAYER3_DEBUG(first_sample == WUPA ? "WUPA" : "REQA"); + LAYER3_DEBUG(" waking up to send ATQA\n\r"); + } else { + /* Wait for another frame */ + ssc_rx_mode_set(SSC_MODE_14443A_SHORT); + ssc_rx_start(); + } break; default: break; -- cgit v1.2.3