From 7c88fc27b547c82d10008c41a5d5511ba11e4078 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Thu, 9 Jun 2011 08:59:06 +0000 Subject: [PATCH] RC-S360, work-in-progress --- libnfc/chips/pn53x-internal.h | 25 +++++++++++++------------ libnfc/chips/pn53x.c | 4 ++-- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/libnfc/chips/pn53x-internal.h b/libnfc/chips/pn53x-internal.h index f8d7c0c..ec729cc 100644 --- a/libnfc/chips/pn53x-internal.h +++ b/libnfc/chips/pn53x-internal.h @@ -38,6 +38,7 @@ #define SAMConfiguration 0x14 #define PowerDown 0x16 #define AlparCommandForTDA 0x18 +// RC-S360 has another command 0x18 for reset &..? // RF communication #define RFConfiguration 0x32 @@ -141,34 +142,34 @@ typedef enum { static const pn53x_command pn53x_commands[] = { // Miscellaneous - PNCMD( Diagnose, PN531|PN532|PN533 ), + PNCMD( Diagnose, PN531|PN532|PN533|RCS360 ), PNCMD( GetFirmwareVersion, PN531|PN532|PN533|RCS360 ), - PNCMD( GetGeneralStatus, PN531|PN532|PN533 ), - PNCMD( ReadRegister, PN531|PN532|PN533 ), - PNCMD( WriteRegister, PN531|PN532|PN533 ), + PNCMD( GetGeneralStatus, PN531|PN532|PN533|RCS360 ), + PNCMD( ReadRegister, PN531|PN532|PN533|RCS360 ), + PNCMD( WriteRegister, PN531|PN532|PN533|RCS360 ), PNCMD( ReadGPIO, PN531|PN532|PN533 ), PNCMD( WriteGPIO, PN531|PN532|PN533 ), PNCMD( SetSerialBaudRate, PN531|PN532|PN533 ), - PNCMD( SetParameters, PN531|PN532|PN533 ), + PNCMD( SetParameters, PN531|PN532|PN533|RCS360 ), PNCMD( SAMConfiguration, PN531|PN532 ), PNCMD( PowerDown, PN531|PN532 ), - PNCMD( AlparCommandForTDA, PN533 ), + PNCMD( AlparCommandForTDA, PN533|RCS360 ), // Has another usage on RC-S360... // RF communication - PNCMD( RFConfiguration, PN531|PN532|PN533 ), + PNCMD( RFConfiguration, PN531|PN532|PN533|RCS360 ), PNCMD( RFRegulationTest, PN531|PN532|PN533 ), // Initiator - PNCMD( InJumpForDEP, PN531|PN532|PN533 ), + PNCMD( InJumpForDEP, PN531|PN532|PN533|RCS360 ), PNCMD( InJumpForPSL, PN531|PN532|PN533 ), - PNCMD( InListPassiveTarget, PN531|PN532|PN533 ), + PNCMD( InListPassiveTarget, PN531|PN532|PN533|RCS360 ), PNCMD( InATR, PN531|PN532|PN533 ), PNCMD( InPSL, PN531|PN532|PN533 ), PNCMD( InDataExchange, PN531|PN532|PN533 ), - PNCMD( InCommunicateThru, PN531|PN532|PN533 ), + PNCMD( InCommunicateThru, PN531|PN532|PN533|RCS360 ), PNCMD( InQuartetByteExchange, PN533 ), - PNCMD( InDeselect, PN531|PN532|PN533 ), - PNCMD( InRelease, PN531|PN532|PN533 ), + PNCMD( InDeselect, PN531|PN532|PN533|RCS360 ), + PNCMD( InRelease, PN531|PN532|PN533|RCS360 ), PNCMD( InSelect, PN531|PN532|PN533 ), PNCMD( InAutoPoll, PN532 ), PNCMD( InActivateDeactivatePaypass, PN533 ), diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index 68bdc4f..4c76775 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -2199,7 +2199,7 @@ pn53x_TgInitAsTarget (nfc_device_t * pnd, pn53x_target_mode_t ptm, memcpy(abtCmd+26, pbtNFCID3t, 10); } // General Bytes (ISO/IEC 18092) - if (CHIP_DATA(pnd)->type == PN531) { + if ((CHIP_DATA(pnd)->type == PN531) || (CHIP_DATA(pnd)->type == RCS360)) { if (szGBt) { memcpy (abtCmd+36, pbtGBt, szGBt); szOptionalBytes = szGBt; @@ -2212,7 +2212,7 @@ pn53x_TgInitAsTarget (nfc_device_t * pnd, pn53x_target_mode_t ptm, szOptionalBytes = szGBt + 1; } // Historical bytes (ISO/IEC 14443-4) - if (CHIP_DATA(pnd)->type != PN531) { // PN531 does not handle Historical Bytes + if ((CHIP_DATA(pnd)->type != PN531) && (CHIP_DATA(pnd)->type != RCS360)) { // PN531 does not handle Historical Bytes abtCmd[36+szOptionalBytes] = (byte_t)(szTkt); if (szTkt) { memcpy (abtCmd+37+szOptionalBytes, pbtTkt, szTkt);