forked from CyanogenMod/android_device_samsung_i9300
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
225 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright (C) 2011 The Android Open Source Project | ||
# | ||
# 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. | ||
|
||
LOCAL_PATH := $(call my-dir) | ||
|
||
include $(CLEAR_VARS) | ||
|
||
LOCAL_MODULE := nfc.$(TARGET_BOARD_PLATFORM) | ||
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw | ||
LOCAL_SRC_FILES := nfc_hw.c | ||
LOCAL_SHARED_LIBRARIES := liblog libcutils | ||
LOCAL_MODULE_TAGS := optional | ||
|
||
include $(BUILD_SHARED_LIBRARY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
/* | ||
* Copyright (C) 2011 The Android Open Source Project | ||
* | ||
* 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. | ||
*/ | ||
#include <errno.h> | ||
#include <string.h> | ||
|
||
#include <hardware/hardware.h> | ||
#include <hardware/nfc.h> | ||
|
||
static uint8_t pn544_eedata_settings[][4] = { | ||
// DIFFERENTIAL_ANTENNA | ||
|
||
// RF Settings | ||
{0x00,0x9B,0xD1,0x0D} // Tx consumption higher than 0x0D (average 50mA) | ||
,{0x00,0x9B,0xD2,0x24} // GSP setting for this threshold | ||
,{0x00,0x9B,0xD3,0x0A} // Tx consumption higher than 0x0A (average 40mA) | ||
,{0x00,0x9B,0xD4,0x22} // GSP setting for this threshold | ||
,{0x00,0x9B,0xD5,0x08} // Tx consumption higher than 0x08 (average 30mA) | ||
,{0x00,0x9B,0xD6,0x1E} // GSP setting for this threshold | ||
,{0x00,0x9B,0xDD,0x1C} // GSP setting for this threshold | ||
,{0x00,0x9B,0x84,0x13} // ANACM2 setting | ||
,{0x00,0x99,0x81,0x7F} // ANAVMID setting PCD | ||
,{0x00,0x99,0x31,0x70} // ANAVMID setting PICC | ||
|
||
// Enable PBTF | ||
,{0x00,0x98,0x00,0x3F} // SECURE_ELEMENT_CONFIGURATION - No Secure Element | ||
,{0x00,0x9F,0x09,0x00} // SWP_PBTF_RFU | ||
,{0x00,0x9F,0x0A,0x05} // SWP_PBTF_RFLD --> RFLEVEL Detector for PBTF | ||
,{0x00,0x9E,0xD1,0xA1} // | ||
|
||
// Change RF Level Detector ANARFLDWU | ||
,{0x00,0x99,0x23,0x00} // Default Value is 0x01 | ||
|
||
// Low-power polling | ||
,{0x00,0x9E,0x74,0xB0} // Default Value is 0x00, bits 0->2: sensitivity (0==max, 6==min), | ||
// bit 3: RFU, | ||
// bits 4,5 hybrid low-power: # of low-power polls per regular poll | ||
// bit 6: RFU | ||
// bit 7: (0 -> disabled, 1 -> enabled) | ||
,{0x00,0x9E,0x7D,0xB0} // bits 0->3: RFU, | ||
// bits 4,5: # retries after low power detection | ||
// 0=1 retry, 1=2 retry, 2=3 retry, 3=4 retry | ||
// bit 6: RFU, | ||
// bit 7: Enable or disable retry mechanism (0: disable, 1: enable) | ||
,{0x00,0x9F,0x28,0x01} // bits 0->7: # of measurements per low-power poll | ||
|
||
//LLC Timer | ||
,{0x00,0x9C,0x31,0x00} // Guard host time-out in ms (MSB) | ||
,{0x00,0x9C,0x32,0xC8} // Guard host time-out in ms (LSB) | ||
,{0x00,0x9C,0x19,0x40} // Max RX retry (PN544=>host?) | ||
,{0x00,0x9C,0x1A,0x40} // Max TX retry (PN544=>host?) | ||
|
||
,{0x00,0x9C,0x0C,0x00} // | ||
,{0x00,0x9C,0x0D,0x00} // | ||
,{0x00,0x9C,0x12,0x00} // | ||
,{0x00,0x9C,0x13,0x00} // | ||
|
||
//WTX for LLCP communication | ||
,{0x00,0x98,0xA2,0x0E} // Max value: 14 (default value: 09) | ||
|
||
//SE GPIO | ||
,{0x00, 0x98, 0x93, 0x40} | ||
|
||
// Set NFCT ATQA | ||
,{0x00, 0x98, 0x7D, 0x02} | ||
,{0x00, 0x98, 0x7E, 0x00} | ||
|
||
// Enable CEA detection mechanism | ||
,{0x00, 0x9F, 0xC8, 0x01} | ||
// Set NFC-F poll RC=0x00 | ||
,{0x00, 0x9F, 0x9A, 0x00} | ||
// Setting for EMD support for ISO 14443-4 Reader | ||
,{0x00,0x9F,0x09,0x00} // 0x00 - Disable EMD support, 0x01 - Enable EMD support | ||
}; | ||
|
||
static int pn544_close(hw_device_t *dev) { | ||
free(dev); | ||
|
||
return 0; | ||
} | ||
|
||
/* | ||
* Generic device handling | ||
*/ | ||
|
||
static int nfc_open(const hw_module_t* module, const char* name, | ||
hw_device_t** device) { | ||
if (strcmp(name, NFC_PN544_CONTROLLER) == 0) { | ||
nfc_pn544_device_t *dev = calloc(1, sizeof(nfc_pn544_device_t)); | ||
|
||
dev->common.tag = HARDWARE_DEVICE_TAG; | ||
dev->common.version = 0; | ||
dev->common.module = (struct hw_module_t*) module; | ||
dev->common.close = pn544_close; | ||
|
||
dev->num_eeprom_settings = sizeof(pn544_eedata_settings) / 4; | ||
dev->eeprom_settings = (uint8_t*)pn544_eedata_settings; | ||
dev->linktype = PN544_LINK_TYPE_I2C; | ||
dev->device_node = "/dev/pn544"; | ||
dev->enable_i2c_workaround = 1; | ||
*device = (hw_device_t*) dev; | ||
return 0; | ||
} else { | ||
return -EINVAL; | ||
} | ||
} | ||
|
||
static struct hw_module_methods_t nfc_module_methods = { | ||
.open = nfc_open, | ||
}; | ||
|
||
struct nfc_module_t HAL_MODULE_INFO_SYM = { | ||
.common = { | ||
.tag = HARDWARE_MODULE_TAG, | ||
.version_major = 1, | ||
.version_minor = 0, | ||
.id = NFC_HARDWARE_MODULE_ID, | ||
.name = "Herring NFC HW HAL", | ||
.author = "The Android Open Source Project", | ||
.methods = &nfc_module_methods, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> | ||
<!-- Applications granted NFCEE access on user builds | ||
See packages/apps/Nfc/etc/sample_nfcee_access.xml for full documentation. | ||
--> | ||
|
||
<!-- Google wallet release signature --> | ||
<signer android:signature="3082044c30820334a003020102020900a8cd17c93da5d990300d06092a864886f70d01010505003077310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f6964311330110603550403130a476f6f676c65204e4643301e170d3131303332343031303635335a170d3338303830393031303635335a3077310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f6964311330110603550403130a476f6f676c65204e464330820120300d06092a864886f70d01010105000382010d00308201080282010100c30f88add9b492096a2c586a5a9a80356bfa026958f8ff0c5dfaf59f49268ad870dee821a53e1f5b170fc96245a3c982a7cb4527053be35e34f396d24b2291ec0c528d6e26927465e06875ea621f7ff98c40e3345b204907cc9354743acdaace65565f48ba74cd4121cdc876df3522badb095c20d934c56a3e5c393ee5f0e02f8fe0621f918d1f35a82489252c6fa6b63392a7686b3e48612d06a9cf6f49bff11d5d96289c9dfe14ac5762439697dd29eafdb9810de3263513a905ac8e8eaf20907e46750a5ab7bf9a77262f47b03f5a3c6e6d7b51343f69c7f725f70bcc1b4ad592250b705a86e6e83ee2ae37fe5701bcbdb26feefdfff60f6a5bdfb5b64793020103a381dc3081d9301d0603551d0e041604141ccece0eea4dc1121fc7515f0d0a0c72e08cc96d3081a90603551d230481a130819e80141ccece0eea4dc1121fc7515f0d0a0c72e08cc96da17ba4793077310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f6964311330110603550403130a476f6f676c65204e4643820900a8cd17c93da5d990300c0603551d13040530030101ff300d06092a864886f70d01010505000382010100a470c728e1d31b06d9af6ae768b565046c57806b9843724931d75d4ca10c321520d33ccfed2aa65462234c9ef9b6f910cc676b99cb7f9895d6c06763574fbb78331275dc5cf38fbaa918d7938c051ffba2ade8f303cde8d9e68a048d1fdb9e7c9f2a49b222c68fff422bf15569b85eeeedb04aa30873dbe64b9c9e74f8f2c2f6c40124aaa8d1780d18512b540add28b3e9581971a4170dd868cf5f31e44712b2c23bb51037d7ef9f87a6e5bdb35e2ceb6bb022636c17a56a96bc7a50258c0bd2ed7b31555a18452e17321a0d52838c82f63f742d74ff79586a5cbb7faf7198a84bcf744310e9e927597f00a23dd00660800c2238d90b2fb372dfdbba75bd852e" /> | ||
|
||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> | ||
<!-- Applications granted NFCEE access on userdebug/eng builds | ||
See packages/apps/Nfc/etc/sample_nfcee_access.xml for full documentation. | ||
--> | ||
|
||
<!-- Google Wallet dev signature --> | ||
<signer android:signature="3082044c30820334a003020102020900de7695041d7650c0300d06092a864886f70d01010505003077310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f6964311330110603550403130a476f6f676c65204e4643301e170d3131303332343031303332345a170d3338303830393031303332345a3077310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f6964311330110603550403130a476f6f676c65204e464330820120300d06092a864886f70d01010105000382010d00308201080282010100e6ff3defe92aa10d71eb0fa6408bc036b7e243eeed68a6a4763dc7a52a31757cdac61fe510bb73c716e4000104265b347fcecef4c42bf1e1379dd0a876f028227fbbc1f9bdd5d713b2f6a935a379d2cba9c96f92d2d0787c11f1eb19548008a6a072b34b91836cfa0ae1276780e9007530166986a11c9cef46cef7c704806dde9431fb60284d120ab0e7de1d633f07687d468c51139afffdc6bc9a207ca904b8be1da0aa7b4e97756f43606488be5cae3c68e8bb7942cdf51607c930a2fcda655b75d0759cba89ad06e739bd0ba29b1f404296c2c0a85a847f5ab0d067c6c3ec9c49212042ac63a7e53b546c65b46080b4e3e680e23e1f77cfe7f6de744b1a65020103a381dc3081d9301d0603551d0e04160414a2e89064b05d08865c34db930a9d840050117aec3081a90603551d230481a130819e8014a2e89064b05d08865c34db930a9d840050117aeca17ba4793077310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f6964311330110603550403130a476f6f676c65204e4643820900de7695041d7650c0300c0603551d13040530030101ff300d06092a864886f70d010105050003820101003771870ce87c3c52ea84899230c6e962d94b4d5f1293c25d88261541fd90b5555d1285cef3b8312c3f5df691a8aae04cb981b305e427fd1d2d9e1987e1d29078f13c8452990f1821980263d8d4bd36519348d8d8ba26d8b99fbf09f5fd3ebb0ea3c2f0c9376f1e1fca76f3a6a405429d081b752a7a90b756e9ab44da41abc8e1e8f88ac2758da743fb73e650719a57840ccb6b7add21b99fc681e456e1872c223d5c074adf55f6abda268c2d8b64ea0a8845eecd968f92b493127e75c753c3ff30cbc678b51c9f52961472f17da20a0dc6274aa2463434c1a9b614df697d8ff5ca8101e7a25c7db3fb055d65569c04b01d389cabba57b3a1703ec2e74a88d334" /> | ||
|
||
<!-- Google wallet release signature --> | ||
<signer android:signature="3082044c30820334a003020102020900a8cd17c93da5d990300d06092a864886f70d01010505003077310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f6964311330110603550403130a476f6f676c65204e4643301e170d3131303332343031303635335a170d3338303830393031303635335a3077310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f6964311330110603550403130a476f6f676c65204e464330820120300d06092a864886f70d01010105000382010d00308201080282010100c30f88add9b492096a2c586a5a9a80356bfa026958f8ff0c5dfaf59f49268ad870dee821a53e1f5b170fc96245a3c982a7cb4527053be35e34f396d24b2291ec0c528d6e26927465e06875ea621f7ff98c40e3345b204907cc9354743acdaace65565f48ba74cd4121cdc876df3522badb095c20d934c56a3e5c393ee5f0e02f8fe0621f918d1f35a82489252c6fa6b63392a7686b3e48612d06a9cf6f49bff11d5d96289c9dfe14ac5762439697dd29eafdb9810de3263513a905ac8e8eaf20907e46750a5ab7bf9a77262f47b03f5a3c6e6d7b51343f69c7f725f70bcc1b4ad592250b705a86e6e83ee2ae37fe5701bcbdb26feefdfff60f6a5bdfb5b64793020103a381dc3081d9301d0603551d0e041604141ccece0eea4dc1121fc7515f0d0a0c72e08cc96d3081a90603551d230481a130819e80141ccece0eea4dc1121fc7515f0d0a0c72e08cc96da17ba4793077310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f6964311330110603550403130a476f6f676c65204e4643820900a8cd17c93da5d990300c0603551d13040530030101ff300d06092a864886f70d01010505000382010100a470c728e1d31b06d9af6ae768b565046c57806b9843724931d75d4ca10c321520d33ccfed2aa65462234c9ef9b6f910cc676b99cb7f9895d6c06763574fbb78331275dc5cf38fbaa918d7938c051ffba2ade8f303cde8d9e68a048d1fdb9e7c9f2a49b222c68fff422bf15569b85eeeedb04aa30873dbe64b9c9e74f8f2c2f6c40124aaa8d1780d18512b540add28b3e9581971a4170dd868cf5f31e44712b2c23bb51037d7ef9f87a6e5bdb35e2ceb6bb022636c17a56a96bc7a50258c0bd2ed7b31555a18452e17321a0d52838c82f63f742d74ff79586a5cbb7faf7198a84bcf744310e9e927597f00a23dd00660800c2238d90b2fb372dfdbba75bd852e" /> | ||
|
||
<!-- Platform dev-keys signature --> | ||
<signer android:signature="308204a830820390a003020102020900bcdfe81405d5c69e300d06092a864886f70d0101050500308194310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e20566965773110300e060355040a1307416e64726f69643110300e060355040b1307416e64726f69643110300e06035504031307416e64726f69643122302006092a864886f70d0109011613616e64726f696440616e64726f69642e636f6d301e170d3131303931393230303634325a170d3339303230343230303634325a308194310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e20566965773110300e060355040a1307416e64726f69643110300e060355040b1307416e64726f69643110300e06035504031307416e64726f69643122302006092a864886f70d0109011613616e64726f696440616e64726f69642e636f6d30820120300d06092a864886f70d01010105000382010d00308201080282010100ef7a8a34d8151d0479a239903261fe5026c520d5d88cd65920c98e096d2770f49636da9ffc4e80c472b05bd62a435f8266912aa2a34a18f6f4856f9ef52c10b88c267627136726823e8f3389b051ba92920e10bbaae0e38879efbe681b05863b655d81a6f3b75a85eb230b38b23ea4ef56f2161ff01652ae2049881adbe60d3bf8b5386a81f7404c0cf0c111c0a35ab0a9760426e4af12add73327ec433e047e3517f47a2d3674c2b819354d56eb7fd6c9aa67dd05b4bb1ca8a7e1946c2494e9364ea677a25481ac81f434bff3dd56e93e59fccef0e24a753461cd1cf15f22b62251d07416057ac5ca3e03a24f7f4eca876bacc5a1828acbde04c5cfdb608c47020103a381fc3081f9301d0603551d0e0416041402f997668541fa74693bea699a5766893a362a5d3081c90603551d230481c13081be801402f997668541fa74693bea699a5766893a362a5da1819aa48197308194310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e20566965773110300e060355040a1307416e64726f69643110300e060355040b1307416e64726f69643110300e06035504031307416e64726f69643122302006092a864886f70d0109011613616e64726f696440616e64726f69642e636f6d820900bcdfe81405d5c69e300c0603551d13040530030101ff300d06092a864886f70d0101050500038201010047d6fb32cadeae4444c379b3441ff9ba10990c23d10472c54fb7ebd9c33b2a173836337e1c175c980847a8894f6a99782e9c2e2133629254295fe52749f93ec1e39d213dd06d0ba99de3b6b5d4d856fafe74e08113b7b23a1b56f4918ed41218a03b9564456480b665200267d3770a9463db413c6a47bd81d725cb7d39c9d0941693c59cbe727d40415f0815c3c8363fb8fa2e028ceeb3bbfbc6b119db5b72f0edb0bb417bfcbf74d9fa069de22afe56a50bcde7ea1078749bb9ec0adc0e6de045641ee3a82c576645160b4ab9710d3cb3201f23957da8de9084c0bec93ad1c8c2054195f13c926db07c8bdf15673acf6d791ec1d3a0d7e1b3470447acd95873" /> | ||
|
||
</resources> |