summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--inc/phNfcConfig.h1
-rw-r--r--inc/phNfcTypes.h1
-rw-r--r--src/phHciNfc_NfcIPMgmt.c27
-rw-r--r--src/phHciNfc_Sequence.c7
4 files changed, 33 insertions, 3 deletions
diff --git a/inc/phNfcConfig.h b/inc/phNfcConfig.h
index cced2ca..6bc050c 100644
--- a/inc/phNfcConfig.h
+++ b/inc/phNfcConfig.h
@@ -518,6 +518,7 @@
* speed during Discovery configuration
*/
#define INITIATOR_SPEED
+#define TARGET_SPEED
/**/
diff --git a/inc/phNfcTypes.h b/inc/phNfcTypes.h
index 1f0fe1c..914ae07 100644
--- a/inc/phNfcTypes.h
+++ b/inc/phNfcTypes.h
@@ -1098,6 +1098,7 @@ typedef struct phNfc_sADD_Cfg_t
This is used to enable NFC-IP Discovery
The related Reader Type will be implicitly
selected */
+ uint8_t NfcIP_Target_Mode ;
uint8_t NfcIP_Tgt_Disable; /**< Flag to
disable the NFCIP1 TARGET */
} phNfc_sADD_Cfg_t;
diff --git a/src/phHciNfc_NfcIPMgmt.c b/src/phHciNfc_NfcIPMgmt.c
index ed26ba3..68449be 100644
--- a/src/phHciNfc_NfcIPMgmt.c
+++ b/src/phHciNfc_NfcIPMgmt.c
@@ -1160,7 +1160,6 @@ phHciNfc_NfcIP_Info_Sequence (
rem_nfcipinfo->NfcIP_Info.Nfcip_Active =
p_nfcipinfo->activation_mode;
-
if (NFCIP_INITIATOR == p_nfcipinfo->nfcip_type)
{
phNfc_sCompletionInfo_t CompInfo;
@@ -1403,8 +1402,34 @@ phHciNfc_NfcIP_InfoUpdate(
p_nfcipinfo->initiator_speed = (phHciNfc_eP2PSpeed_t)
((*reg_value >> NFCIP_COMM_INITIATOR_SHIFT)
& NFCIP_COMM_FACTOR);
+ if (p_nfcipinfo->nfcip_type == NFCIP_INITIATOR) {
+ switch(p_nfcipinfo->initiator_speed) {
+ case phNfc_eDataRate_106:
+ ALOGI("I'm P2P %s Initiator @ 106 kb/s", p_nfcipinfo->activation_mode ? "Active" : "Passive");
+ break;
+ case phNfc_eDataRate_212:
+ ALOGI("I'm P2P %s Initiator @ 212 kb/s", p_nfcipinfo->activation_mode ? "Active" : "Passive");
+ break;
+ case phNfc_eDataRate_424:
+ ALOGI("I'm P2P %s Initiator @ 424 kb/s", p_nfcipinfo->activation_mode ? "Active" : "Passive");
+ break;
+ }
+ }
p_nfcipinfo->target_speed = (phHciNfc_eP2PSpeed_t)
(*reg_value & NFCIP_COMM_FACTOR);
+ if (p_nfcipinfo->nfcip_type == NFCIP_TARGET) {
+ switch(p_nfcipinfo->target_speed) {
+ case phNfc_eDataRate_106:
+ ALOGI("I'm P2P %s Target @ 106 kb/s", p_nfcipinfo->activation_mode ? "Active" : "Passive");
+ break;
+ case phNfc_eDataRate_212:
+ ALOGI("I'm P2P %s Target @ 212 kb/s", p_nfcipinfo->activation_mode ? "Active" : "Passive");
+ break;
+ case phNfc_eDataRate_424:
+ ALOGI("I'm P2P %s Target @ 424 kb/s", p_nfcipinfo->activation_mode ? "Active" : "Passive");
+ break;
+ }
+ }
p_nfcipinfo->max_frame_len = NFCIP_DATA_RATE_CALC(*reg_value);
if (p_nfcipinfo->max_frame_len > NFCIP_MAX_DEP_REQ_HDR_LEN)
diff --git a/src/phHciNfc_Sequence.c b/src/phHciNfc_Sequence.c
index 1926c6c..400fa7a 100644
--- a/src/phHciNfc_Sequence.c
+++ b/src/phHciNfc_Sequence.c
@@ -1636,6 +1636,8 @@ phHciNfc_PollLoop_Sequence(
{
uint8_t speed =
p_poll_config->NfcIP_Mode;
+ uint8_t targetSpeed =
+ p_poll_config->NfcIP_Target_Mode;
switch(psHciContext->hci_seq)
{
case PL_DURATION_SEQ:
@@ -1663,8 +1665,8 @@ phHciNfc_PollLoop_Sequence(
{
#define NFCIP_ACTIVE_SHIFT 0x03U
#define NFCIP_PASSIVE_MASK 0x07U
- uint8_t mode = ( NXP_NFCIP_ACTIVE_DEFAULT << NFCIP_ACTIVE_SHIFT ) |
- ( DEFAULT_NFCIP_TARGET_MODE_SUPPORT & NFCIP_PASSIVE_MASK );
+ uint8_t mode = targetSpeed;
+ ALOGE("Setting target mode to 0x%02X", mode);
status =
phHciNfc_NfcIP_SetMode( psHciContext, pHwRef, NFCIP_TARGET,
(uint8_t) mode );
@@ -1685,6 +1687,7 @@ phHciNfc_PollLoop_Sequence(
#if defined (ENABLE_P2P) && defined (INITIATOR_SPEED)
case INITIATOR_SPEED_SEQ:
{
+ ALOGE("Setting initiator mode to 0x%02X", speed);
status =
phHciNfc_NfcIP_SetMode( psHciContext, pHwRef, NFCIP_INITIATOR,
(uint8_t) (speed & DEFAULT_NFCIP_INITIATOR_MODE_SUPPORT));