diff options
author | daniel_Tomas <daniel.tomas@trusted-logic.com> | 2010-12-09 10:46:12 -0800 |
---|---|---|
committer | Nick Pelly <npelly@google.com> | 2010-12-09 12:41:48 -0800 |
commit | 5e97605ca8d83414b122bae72e65ea388b66718a (patch) | |
tree | e3398ab19408f0ce0dd67c23569a8bce60d4d341 /Linux_x86 | |
parent | ea7a513aa8474d6b26716b23555f4d77bc030d0e (diff) | |
download | external_libnfc-nxp-5e97605ca8d83414b122bae72e65ea388b66718a.zip external_libnfc-nxp-5e97605ca8d83414b122bae72e65ea388b66718a.tar.gz external_libnfc-nxp-5e97605ca8d83414b122bae72e65ea388b66718a.tar.bz2 |
Download feature added in the libnfc
Change-Id: Idfed8c90453a0acc7fa632f62a1e20617b4ae7f6
Diffstat (limited to 'Linux_x86')
-rw-r--r-- | Linux_x86/phDal4Nfc.c | 33 | ||||
-rw-r--r-- | Linux_x86/phDal4Nfc_i2c.c | 19 | ||||
-rw-r--r-- | Linux_x86/phDal4Nfc_i2c.h | 1 | ||||
-rw-r--r-- | Linux_x86/phDal4Nfc_link.h | 2 |
4 files changed, 17 insertions, 38 deletions
diff --git a/Linux_x86/phDal4Nfc.c b/Linux_x86/phDal4Nfc.c index 4cc2470..1222525 100644 --- a/Linux_x86/phDal4Nfc.c +++ b/Linux_x86/phDal4Nfc.c @@ -289,18 +289,16 @@ NFCSTATUS phDal4Nfc_ConfigRelease( void *pHwRef) DAL_PRINT("phDal4Nfc_ConfigRelease "); - /* Shutdown NFC Chip */ - phDal4Nfc_Reset(0); - if (gDalContext.hw_valid == TRUE) { - /* Kill the read and write threads */ - gReadWriteContext.nReadThreadAlive = 0; - gReadWriteContext.nWriteThreadAlive = 0; - DAL_PRINT("Release Read Semaphore"); sem_post(&nfc_read_sem); + /* Kill the read and write threads */ + DAL_PRINT("Stop Reader Thread"); + gReadWriteContext.nReadThreadAlive = 0; + gReadWriteContext.nWriteThreadAlive = 0; + if (pthread_join(gReadWriteContext.nReadThread, &pThreadReturn) != 0) { result = PHNFCSTVAL(CID_NFC_DAL, NFCSTATUS_FAILED); @@ -312,6 +310,9 @@ NFCSTATUS phDal4Nfc_ConfigRelease( void *pHwRef) mq_close(nDeferedCallMessageQueueId); #endif + /* Shutdown NFC Chip */ + phDal4Nfc_Reset(0); + /* Close the link */ gLinkFunc.close(); @@ -325,6 +326,7 @@ NFCSTATUS phDal4Nfc_ConfigRelease( void *pHwRef) DAL_DEBUG("phDal4Nfc_ConfigRelease(): %04x\n", result); + return result; } @@ -483,9 +485,6 @@ NFCSTATUS phDal4Nfc_ReadWaitCancel( void *pContext, void *pHwRef) /* unlock read semaphore */ sem_post(&nfc_read_sem); - /* Stop the reader thread */ - gReadWriteContext.nReadThreadAlive = 0; - return 0; } @@ -526,8 +525,8 @@ NFCSTATUS phDal4Nfc_Config(pphDal4Nfc_sConfig_t config,void **phwref) gLinkFunc.open_and_configure = phDal4Nfc_uart_open_and_configure; gLinkFunc.read = phDal4Nfc_uart_read; gLinkFunc.write = phDal4Nfc_uart_write; - gLinkFunc.download = phDal4Nfc_uart_download; - gLinkFunc.reset = phDal4Nfc_uart_reset; + gLinkFunc.download = phDal4Nfc_uart_download; + gLinkFunc.reset = phDal4Nfc_uart_reset; } break; @@ -543,8 +542,7 @@ NFCSTATUS phDal4Nfc_Config(pphDal4Nfc_sConfig_t config,void **phwref) gLinkFunc.open_and_configure = phDal4Nfc_i2c_open_and_configure; gLinkFunc.read = phDal4Nfc_i2c_read; gLinkFunc.write = phDal4Nfc_i2c_write; - gLinkFunc.download = phDal4Nfc_i2c_download; - gLinkFunc.reset = phDal4Nfc_i2c_reset; + gLinkFunc.reset = phDal4Nfc_i2c_reset; break; } @@ -615,13 +613,14 @@ FUNCTION: phDal4Nfc_Download PURPOSE: Put the PN544 in download mode, using the GPIO4 pin -----------------------------------------------------------------------------*/ -NFCSTATUS phDal4Nfc_Download(long level) +NFCSTATUS phDal4Nfc_Download() { NFCSTATUS retstatus = NFCSTATUS_SUCCESS; - DAL_DEBUG("phDal4Nfc_Download: GPIO4 to %d",level); + DAL_DEBUG("phDal4Nfc_Download: GPIO4 to %d",1); - retstatus = gLinkFunc.download(level); + usleep(10000); + retstatus = phDal4Nfc_Reset(2); return retstatus; } diff --git a/Linux_x86/phDal4Nfc_i2c.c b/Linux_x86/phDal4Nfc_i2c.c index 667c1a0..2d0e113 100644 --- a/Linux_x86/phDal4Nfc_i2c.c +++ b/Linux_x86/phDal4Nfc_i2c.c @@ -260,25 +260,6 @@ int phDal4Nfc_i2c_reset(long level) return ret; } -/*----------------------------------------------------------------------------- - -FUNCTION: phDal4Nfc_i2c_write - -PURPOSE: Put the PN544 in download mode, using the GPIO4 pin - ------------------------------------------------------------------------------*/ -int phDal4Nfc_i2c_download(long level) -{ - int ret = NFCSTATUS_SUCCESS; - - DAL_DEBUG("phDal4Nfc_i2c_download, GPIO4 level = %ld",level); - - /* TODO: implement firmware download */ abort(); - /* ret = ioctl(gI2cPortContext.nHandle, PN544_DOWNLOAD_CMD, level); */ - - return ret; -} - diff --git a/Linux_x86/phDal4Nfc_i2c.h b/Linux_x86/phDal4Nfc_i2c.h index f9dda6a..dce4995 100644 --- a/Linux_x86/phDal4Nfc_i2c.h +++ b/Linux_x86/phDal4Nfc_i2c.h @@ -37,4 +37,3 @@ NFCSTATUS phDal4Nfc_i2c_open_and_configure(pphDal4Nfc_sConfig_t pConfig, void ** int phDal4Nfc_i2c_read(uint8_t * pBuffer, int nNbBytesToRead); int phDal4Nfc_i2c_write(uint8_t * pBuffer, int nNbBytesToWrite); int phDal4Nfc_i2c_reset(long level); -int phDal4Nfc_i2c_download(long level); diff --git a/Linux_x86/phDal4Nfc_link.h b/Linux_x86/phDal4Nfc_link.h index 89dec1c..8c8cf8b 100644 --- a/Linux_x86/phDal4Nfc_link.h +++ b/Linux_x86/phDal4Nfc_link.h @@ -54,7 +54,7 @@ typedef struct phDal4Nfc_link_open_and_configure_CB_t open_and_configure; phDal4Nfc_link_read_CB_t read; phDal4Nfc_link_write_CB_t write; - phDal4Nfc_link_download_CB_t download; + phDal4Nfc_link_download_CB_t download; phDal4Nfc_link_reset_CB_t reset; } phDal4Nfc_link_cbk_interface_t; |