summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Tomas <dtomas.nxp@gmail.com>2011-07-28 12:40:33 -0700
committerMartijn Coenen <maco@google.com>2011-08-24 19:08:34 -0700
commit868cc2d7e3a1efdf52ecc758bedffc5fd9c78e1e (patch)
tree374b76918e8803fd942a698f9cf970811acb5e3c /src
parente13ca0d66e4682aafb2c031b45a953b1aa153a4b (diff)
downloadexternal_libnfc-nxp-868cc2d7e3a1efdf52ecc758bedffc5fd9c78e1e.zip
external_libnfc-nxp-868cc2d7e3a1efdf52ecc758bedffc5fd9c78e1e.tar.gz
external_libnfc-nxp-868cc2d7e3a1efdf52ecc758bedffc5fd9c78e1e.tar.bz2
Add the NXP_EVT_SE_SWITCH_MODE event support in the libnfc.
This event is used in the SE SetMode API to be able to enable/disable card emulation with not writting the EEPROM area. Change-Id: I80047d678f683c4dd364544c690440eb8d807793
Diffstat (limited to 'src')
-rw-r--r--src/phLibNfc.h5
-rw-r--r--src/phLibNfc_SE.c64
2 files changed, 67 insertions, 2 deletions
diff --git a/src/phLibNfc.h b/src/phLibNfc.h
index c2cb6dd..9e4aff1 100644
--- a/src/phLibNfc.h
+++ b/src/phLibNfc.h
@@ -129,7 +129,10 @@ typedef enum
This can be applied to UICC as well as SmartMX*/
phLibNfc_SE_ActModeVirtual=0x02, /**< Enables Virtual Mode communication.
This can be applied to UICC as well as SmartMX*/
- phLibNfc_SE_ActModeOff =0x03 /**< Inactivate SE.This means,put SE in in-active state */
+ phLibNfc_SE_ActModeOff =0x03, /**< Inactivate SE.This means,put SE in in-active state
+ This can be applied to UICC as well as SmartMX*/
+ phLibNfc_SE_ActModeVirtualVolatile = 0x04 /**< Enabled virtual mode communication for SE through an event
+ This can be applied to UICC as well as SmartMX*/
}phLibNfc_eSE_ActivationMode;
diff --git a/src/phLibNfc_SE.c b/src/phLibNfc_SE.c
index 3c271f3..968c239 100644
--- a/src/phLibNfc_SE.c
+++ b/src/phLibNfc_SE.c
@@ -473,7 +473,6 @@ NFCSTATUS phLibNfc_SE_SetMode ( phLibNfc_Handle hSE_Handle,
switch(eActivation_mode)
{
case phLibNfc_SE_ActModeVirtual:
- case phLibNfc_SE_ActModeDefault:
{
if(hSE_Handle == sSecuredElementInfo[LIBNFC_SE_UICC_INDEX].hSecureElement)
{
@@ -507,6 +506,69 @@ NFCSTATUS phLibNfc_SE_SetMode ( phLibNfc_Handle hSE_Handle,
}
}
break;
+ case phLibNfc_SE_ActModeVirtualVolatile:
+ {
+ if(hSE_Handle == sSecuredElementInfo[LIBNFC_SE_SMARTMX_INDEX].hSecureElement)
+ {
+ eEmulationType = NFC_SMARTMX_EMULATION;
+ /*Enable the SMX -External reader can see it*/
+ pLibContext->sCardEmulCfg.config.smartMxCfg.enableEmulation = TRUE;
+ pLibContext->sSeContext.eActivatedMode = phLibNfc_SE_ActModeVirtualVolatile;
+
+ Status = phHal4Nfc_Switch_SMX_Mode(
+ pLibContext->psHwReference,
+ eSmartMx_Virtual,
+ phLibNfc_SE_SetMode_cb,
+ pLibContext
+ );
+ }
+ else if(hSE_Handle == sSecuredElementInfo[LIBNFC_SE_UICC_INDEX].hSecureElement)
+ {
+ eEmulationType = NFC_UICC_EMULATION;
+ /*Enable the UICC -External reader can see it*/
+ pLibContext->sCardEmulCfg.config.uiccEmuCfg.enableUicc = TRUE;
+ pLibContext->sSeContext.eActivatedMode = phLibNfc_SE_ActModeVirtualVolatile;
+
+ Status = phHal4Nfc_Switch_Swp_Mode(
+ pLibContext->psHwReference,
+ eSWP_Switch_On,
+ phLibNfc_SE_SetMode_cb,
+ pLibContext
+ );
+ }
+ else
+ {
+ Status = NFCSTATUS_INVALID_HANDLE;
+ }
+ }
+ break;
+ case phLibNfc_SE_ActModeDefault:
+ {
+ if(hSE_Handle == sSecuredElementInfo[LIBNFC_SE_SMARTMX_INDEX].hSecureElement)
+ {
+ Status = phHal4Nfc_Switch_SMX_Mode(
+ pLibContext->psHwReference,
+ eSmartMx_Default,
+ phLibNfc_SE_SetMode_cb,
+ pLibContext
+ );
+ }
+ else if(hSE_Handle == sSecuredElementInfo[LIBNFC_SE_UICC_INDEX].hSecureElement)
+ {
+ Status = phHal4Nfc_Switch_Swp_Mode(
+ pLibContext->psHwReference,
+ eSWP_Switch_Default,
+ phLibNfc_SE_SetMode_cb,
+ pLibContext
+ );
+ }
+ else
+ {
+ Status = NFCSTATUS_INVALID_HANDLE;
+ }
+ }
+ break;
+
case phLibNfc_SE_ActModeWired:
{
if(hSE_Handle == sSecuredElementInfo[LIBNFC_SE_SMARTMX_INDEX].hSecureElement)