diff options
author | Yerriswamy <yerriswamy.kurubathayanna@nxp.com> | 2017-10-24 19:39:27 +0530 |
---|---|---|
committer | nxpandroid <srikrishna.pramoda@nxp.com> | 2017-11-16 09:36:20 +0530 |
commit | 093b983fe1f92736fe140f07701877713d491741 (patch) | |
tree | 537998ae90189d9fbceec93528549ce0a8d5c1d4 | |
parent | c60a9acc4d3a05723aeb8a3831c77de1fe70769f (diff) | |
download | android_vendor_nxp_opensource_packages_apps_Nfc-093b983fe1f92736fe140f07701877713d491741.tar.gz android_vendor_nxp_opensource_packages_apps_Nfc-093b983fe1f92736fe140f07701877713d491741.tar.bz2 android_vendor_nxp_opensource_packages_apps_Nfc-093b983fe1f92736fe140f07701877713d491741.zip |
p61-jcop-kit library dynamic loading improvements
-rw-r--r-- | nci/jni/AlaLib.h | 107 | ||||
-rw-r--r-- | nci/jni/IChannel.h | 87 | ||||
-rw-r--r-- | nci/jni/JcDnld.h | 78 | ||||
-rw-r--r-- | nci/jni/JcopManager.cpp | 4 | ||||
-rw-r--r-- | nci/jni/JcopManager.h | 20 |
5 files changed, 16 insertions, 280 deletions
diff --git a/nci/jni/AlaLib.h b/nci/jni/AlaLib.h deleted file mode 100644 index 0ad3b417..00000000 --- a/nci/jni/AlaLib.h +++ /dev/null @@ -1,107 +0,0 @@ - /* - * Copyright (C) 2015 NXP Semiconductors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifdef __cplusplus - -extern "C" { - -#endif - - -#ifndef ALALIB_H_ -#define ALALIB_H_ - -#include <stdio.h> -#include <stdint.h> -#include <stdbool.h> -#include "IChannel.h" - -/******************************************************************************* -** -** Function: ALA_Init -** -** Description: Initializes the ALA library and opens the DWP communication channel -** -** Returns: SUCCESS if ok. -** -*******************************************************************************/ -unsigned char ALA_Init(IChannel *channel); - -/******************************************************************************* -** -** Function: ALA_Start -** -** Description: Starts the ALA over DWP -** -** Returns: SUCCESS if ok. -** -*******************************************************************************/ -#if(NXP_LDR_SVC_VER_2 == TRUE) -unsigned char ALA_Start(const char *name, const char *dest, uint8_t *pdata, uint16_t len, uint8_t *respSW); -#else -unsigned char ALA_Start(const char *name, uint8_t *pdata, uint16_t len); -#endif - -/******************************************************************************* -** -** Function: ALA_DeInit -** -** Description: Deinitializes the ALA Lib -** -** Returns: true if ok. -** -*******************************************************************************/ -bool ALA_DeInit(); - -#if(NXP_LDR_SVC_VER_2 == TRUE) -/******************************************************************************* -** -** Function: ALA_lsGetVersion -** -** Description: Get the Loader service Applet and cleint version -** -** Returns: byte[] array. -** -*******************************************************************************/ -unsigned char ALA_lsGetVersion(uint8_t *pVersion); -unsigned char ALA_lsGetStatus(uint8_t *pVersion); -unsigned char ALA_lsGetAppletStatus(uint8_t *pVersion); -#else -void ALA_GetlistofApplets(char *list[], uint8_t* num); -unsigned char ALA_GetCertificateKey(uint8_t *pKey, int32_t *pKeylen); -#endif - -inline int FSCANF_BYTE(FILE *stream, const char *format, void* pVal) -{ - int Result = 0; - - if((NULL != stream) && (NULL != format) && (NULL != pVal)) - { - unsigned int dwVal; - unsigned char* pTmp = (unsigned char*)pVal; - Result = fscanf(stream, format, &dwVal); - - (*pTmp) = (unsigned char)(dwVal & 0x000000FF); - } - return Result; -} - -#endif /* ALALIB_H_ */ - -#ifdef __cplusplus - -} - -#endif diff --git a/nci/jni/IChannel.h b/nci/jni/IChannel.h deleted file mode 100644 index 4e42242e..00000000 --- a/nci/jni/IChannel.h +++ /dev/null @@ -1,87 +0,0 @@ - /* - * Copyright (C) 2015 NXP Semiconductors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ICHANNEL_H_ -#define ICHANNEL_H_ - -typedef struct IChannel -{ -/******************************************************************************* -** -** Function: Open -** -** Description: Initialize the channel. -** -** Returns: True if ok. -** -*******************************************************************************/ -int16_t (*open)(); -/******************************************************************************* -** -** Function: close -** -** Description: Close the channel. -** -** Returns: True if ok. -** -*******************************************************************************/ -bool (*close)(int16_t mHandle); - -/******************************************************************************* -** -** Function: transceive -** -** Description: Send data to the secure element; read it's response. -** xmitBuffer: Data to transmit. -** xmitBufferSize: Length of data. -** recvBuffer: Buffer to receive response. -** recvBufferMaxSize: Maximum size of buffer. -** recvBufferActualSize: Actual length of response. -** timeoutMillisec: timeout in millisecond -** -** Returns: True if ok. -** -*******************************************************************************/ -bool (*transceive) (uint8_t* xmitBuffer, int32_t xmitBufferSize, uint8_t* recvBuffer, - int32_t recvBufferMaxSize, int32_t& recvBufferActualSize, int32_t timeoutMillisec); - -/******************************************************************************* -** -** Function: doeSE_Reset -** -** Description: Power OFF and ON to eSE -** -** Returns: None. -** -*******************************************************************************/ - -void (*doeSE_Reset)(); -/******************************************************************************* -** -** Function: doeSE_JcopDownLoadReset -** -** Description: Power OFF and ON to eSE during JCOP Update -** -** Returns: None. -** -*******************************************************************************/ - -void (*doeSE_JcopDownLoadReset)(); - -}IChannel_t; - - -#endif /* ICHANNEL_H_ */ diff --git a/nci/jni/JcDnld.h b/nci/jni/JcDnld.h deleted file mode 100644 index 630dd7d8..00000000 --- a/nci/jni/JcDnld.h +++ /dev/null @@ -1,78 +0,0 @@ - /* - * Copyright (C) 2015 NXP Semiconductors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifdef __cplusplus - -extern "C" { - -#endif - - -#ifndef JCDNLD_H_ -#define JCDNLD_H_ - -#include "IChannel.h" -/******************************************************************************* -** -** Function: JCDNLD_Init -** -** Description: Initializes the JCOP library and opens the DWP communication channel -** -** Returns: SUCCESS if ok. -** -*******************************************************************************/ -unsigned char JCDNLD_Init(IChannel *channel); - -/******************************************************************************* -** -** Function: JCDNLD_StartDownload -** -** Description: Starts the JCOP update -** -** Returns: SUCCESS if ok. -** -*******************************************************************************/ -unsigned char JCDNLD_StartDownload(); - -/******************************************************************************* -** -** Function: JCDNLD_DeInit -** -** Description: Deinitializes the JCOP Lib -** -** Returns: true if ok. -** -*******************************************************************************/ -bool JCDNLD_DeInit(); - -/******************************************************************************* -** -** Function: JCDNLD_CheckVersion -** -** Description: Check the existing JCOP OS version -** -** Returns: true if ok. -** -*******************************************************************************/ -bool JCDNLD_CheckVersion(); - - -#endif /* JCDNLD_H_ */ - -#ifdef __cplusplus - -} - -#endif diff --git a/nci/jni/JcopManager.cpp b/nci/jni/JcopManager.cpp index 336fbcf8..e5ddb7d5 100644 --- a/nci/jni/JcopManager.cpp +++ b/nci/jni/JcopManager.cpp @@ -199,7 +199,7 @@ tNFA_STATUS JcopManager::JcopDeInitialize () ** STATUS_FAILED if unSuccessfull ** *******************************************************************************/ -tNFC_JBL_STATUS JcopManager::AlaInitialize (IChannel *channel) +tNFC_JBL_STATUS JcopManager::AlaInitialize (IChannel_t *channel) { if(channel == NULL) { @@ -353,7 +353,7 @@ tNFC_JBL_STATUS JcopManager::AlaLsGetStatus (uint8_t *pVersion) ** STATUS_FAILED if unSuccessfull ** *******************************************************************************/ -tNFC_JBL_STATUS JcopManager::JCDnldInit (IChannel *channel) +tNFC_JBL_STATUS JcopManager::JCDnldInit (IChannel_t *channel) { if(!channel){ ALOGE("%s: Invalid Params !!", __func__); diff --git a/nci/jni/JcopManager.h b/nci/jni/JcopManager.h index 609a17d2..8947f3b9 100644 --- a/nci/jni/JcopManager.h +++ b/nci/jni/JcopManager.h @@ -41,13 +41,21 @@ extern "C"{ #include "nfa_api.h" -#include "AlaLib.h" -#include "JcDnld.h" -#include "IChannel.h" } +typedef struct IChannel +{ + int16_t (*open)(); /* Initialize the channel. */ + bool (*close)(int16_t mHandle); /* Close the channel. */ + bool (*transceive) (uint8_t* xmitBuffer, int32_t xmitBufferSize, uint8_t* recvBuffer, + int32_t recvBufferMaxSize, int32_t& recvBufferActualSize, int32_t timeoutMillisec); /* Send/receive data to the secure element*/ + void (*doeSE_Reset)(); /* Power OFF and ON to eSE */ + void (*doeSE_JcopDownLoadReset)(); /* Power OFF and ON to eSE during JCOP Update */ +}IChannel_t; + + #define pJcopMgr (JcopManager::getInstance ()) -typedef unsigned char (tJCOP_INIT_CBACK)(IChannel *channel); +typedef unsigned char (tJCOP_INIT_CBACK)(IChannel_t *channel); #if (NXP_LDR_SVC_VER_2 == TRUE) typedef unsigned char (tALA_START_CBACK)(const char *name, const char *dest, uint8_t *pdata, uint16_t len, uint8_t *respSW); #else @@ -160,7 +168,7 @@ public: ** STATUS_FAILED if unSuccessfull ** *******************************************************************************/ - tNFC_JBL_STATUS AlaInitialize (IChannel *channel); + tNFC_JBL_STATUS AlaInitialize (IChannel_t *channel); /******************************************************************************* ** @@ -261,7 +269,7 @@ public: ** STATUS_FAILED if unSuccessfull ** *******************************************************************************/ - tNFC_JBL_STATUS JCDnldInit (IChannel *channel); + tNFC_JBL_STATUS JCDnldInit (IChannel_t *channel); /******************************************************************************* ** |