here is the function I used to read the iClass card with my library functions. I do not use the discovery loop as I foud it a bit cumbersome.
For the function you can get pHal by:
/* Set the generic pointer */
void *pHal = phNfcLib_GetDataParams(PH_COMP_HAL);
/*==============================================================================================
* FUNCTION: DetectTagIclass
*
* Description:
*
---------------------------------------------------------------------------------------------*/
static uint8_t DetectTagiClass(void *pHal)
{
uint8_t rt = false;
phStatus_t status;
uint8_t bMask[PHPAL_SLI15693_UID_LENGTH];
uint8_t Dsfid;
uint8_t bUid[10];
uint8_t bMoreCardsAvailable;
uint8_t bLength;
phpaliClass_Sw_DataParams_t paliClass;
/* init. 15693 pal */
PH_CHECK_SUCCESS_FCT(status, phpaliClass_Sw_Init(&paliClass,
sizeof(phpaliClass_Sw_DataParams_t), pHal));
/* Apply the 15693 protocol settings */
PH_CHECK_SUCCESS_FCT(status, phhalHw_ApplyProtocolSettings(pHal,
PHHAL_HW_CARDTYPE_ICLASS));
/* Activate 15693 tags */
memset(bMask, 0, sizeof(bMask));
status = phpaliClass_Sw_ActivateCard(&paliClass,
PHPAL_ICLASS_ACTIVATE_DEFAULT,
(PHPAL_ICLASS_FLAG_NBSLOTS | PHPAL_ICLASS_FLAG_DATA_RATE),
0,
bMask,
0,
&Dsfid, bUid, &bMoreCardsAvailable);
if (PH_ERR_SUCCESS == status)
{
#if 0
if(compatabilityMode)
{
status = phpaliClass_GetAcNo (&paliClass, bUid, &bLength);
}
else
#endif
{
status = phpaliClass_GetSerialNo (&paliClass, bUid, &bLength);
}
debug_printf("ICLASS tag detected : ");
if(bLength > 0)
{
int i;
debug_printf("Length %d : ", bLength);
if(bLength > 10)
bLength = 10;
for (i=0; i< bLength; i++)
debug_printf("%02X ", bUid[i]);
debug_printf("\r\n");
//RC663ReadTxAmp();
}
rt = true;
}
return rt;
}