1 /* 2 * Copyright (C) 2010-2014 NXP Semiconductors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 /* 18 * TML I2C port implementation for linux 19 */ 20 /*#ifndef PHTMLNFCI2C_H 21 #define PHTMLNFCI2C_H*/ 22 /* Basic type definitions */ 23 #include <phNfcTypes.h> 24 #include <phTmlNfc.h> 25 26 #define PN544_MAGIC 0xE9 27 28 /* Function declarations */ 29 void phTmlNfc_i2c_close(void* pDevHandle); 30 NFCSTATUS phTmlNfc_i2c_open_and_configure(pphTmlNfc_Config_t pConfig, 31 void** pLinkHandle); 32 int phTmlNfc_i2c_read(void* pDevHandle, uint8_t* pBuffer, int nNbBytesToRead); 33 int phTmlNfc_i2c_write(void* pDevHandle, uint8_t* pBuffer, int nNbBytesToWrite); 34 int phTmlNfc_i2c_reset(void* pDevHandle, long level); 35 bool_t getDownloadFlag(void); 36 extern phTmlNfc_i2cfragmentation_t fragmentation_enabled; 37 38 /* 39 * PN544 power control via ioctl 40 * PN544_SET_PWR(0): power off 41 * PN544_SET_PWR(1): power on 42 * PN544_SET_PWR(2): reset and power on with firmware download enabled 43 */ 44 #define PN544_SET_PWR _IOW(PN544_MAGIC, 0x01, unsigned int) 45 46 NFCSTATUS phTmlNfc_i2c_get_p61_power_state(void* pDevHandle); 47 NFCSTATUS phTmlNfc_i2c_set_p61_power_state(void* pDevHandle, long arg); 48 NFCSTATUS phTmlNfc_set_pid(void* pDevHandle, long pid); 49 NFCSTATUS phTmlNfc_set_power_scheme(void* pDevHandle, long id); 50 NFCSTATUS phTmlNfc_get_ese_access(void* pDevHandle, long timeout); 51 NFCSTATUS phTmlNfc_i2c_set_Jcop_dwnld_state(void* pDevHandle, long level); 52 NFCSTATUS phTmlNfc_i2c_set_spm_state(void* pa_data, void* pDevHandle); 53 NFCSTATUS phTmlNfc_i2c_reset_spm_state(void* pa_data, void* pDevHandle); 54 NFCSTATUS phTmlNfc_rel_svdd_wait(void* pDevHandle); 55 NFCSTATUS phTmlNfc_rel_dwpOnOff_wait(void* pDevHandle); 56 /* 57 * SPI Request NFCC to enable p61 power, only in param 58 * Only for SPI 59 * level 1 = Enable power 60 * level 0 = Disable power 61 */ 62 #define P61_SET_SPI_PWR _IOW(PN544_MAGIC, 0x02, unsigned int) 63 64 /* SPI or DWP can call this ioctl to get the current 65 * power state of P61 66 * 67 */ 68 #define P61_GET_PWR_STATUS _IOR(PN544_MAGIC, 0x03, unsigned int) 69 70 /* DWP side this ioctl will be called 71 * level 1 = Wired access is enabled/ongoing 72 * level 0 = Wired access is disalbed/stopped 73 */ 74 #define P61_SET_WIRED_ACCESS _IOW(PN544_MAGIC, 0x04, unsigned int) 75 76 /* 77 NFC Init will call the ioctl to register the PID with the i2c driver 78 */ 79 #define P544_SET_NFC_SERVICE_PID _IOW(PN544_MAGIC, 0x05, unsigned int) 80 81 /* 82 NFC and SPI will call the ioctl to get the i2c/spi bus access 83 */ 84 #define P544_GET_ESE_ACCESS _IOW(PN544_MAGIC, 0x06, unsigned int) 85 86 /* 87 NFC and SPI will call the ioctl to update the power scheme 88 */ 89 #define P544_SET_POWER_SCHEME _IOW(PN544_MAGIC, 0x07, unsigned int) 90 /* 91 NFC will call the ioctl to release the svdd protection 92 */ 93 #define P544_REL_SVDD_WAIT _IOW(PN544_MAGIC, 0x08, unsigned int) 94 /* SPI or DWP can call this ioctl to set the JCOP download 95 * state of P61 96 * 97 */ 98 #define P544_SECURE_TIMER_SESSION _IOW(PN544_MAGIC, 0x0A, unsigned int) 99 100 #define PN544_SET_DWNLD_STATUS _IOW(PN544_MAGIC, 0x09, unsigned int) 101 /* 102 * NFC will call the ioctlto release the dwp on/off protection 103 */ 104 #define P544_REL_DWPONOFF_WAIT _IOW(PN544_MAGIC, 0x0A, unsigned int) 105 //#endif 106