我们从2011年坚守至今,只想做存粹的技术论坛。  由于网站在外面,点击附件后要很长世间才弹出下载,请耐心等待,勿重复点击不要用Edge和IE浏览器下载,否则提示不安全下载不了

 找回密码
 立即注册
搜索
查看: 897|回复: 2

RK3288  默认的 NFC代码 配置已弄好

[复制链接]

该用户从未签到

812

主题

399

回帖

499

积分

二级逆天

积分
499

社区居民社区明星忠实会员宣传大使奖终身成就奖特殊贡献奖

QQ
发表于 2015-6-26 21:15:53 | 显示全部楼层 |阅读模式
ernel driver for the NXP Semiconductors PN544 Near Field
Communication chip

Author: Jari Vanhala
Contact: Matti Aaltonen (matti.j.aaltonen at nokia.com)

General
-------

The PN544 is an integrated transmission module for contactless
communication. The driver goes under drives/nfc/ and is compiled as a
module named "pn544". It registers a misc device and creates a device
file named "/dev/pn544".

Host Interfaces: I2C, SPI and HSU, this driver supports currently only I2C.

The Interface
-------------

The driver offers a sysfs interface for a hardware test and an IOCTL
interface for selecting between two operating modes. There are read,
write and poll functions for transferring messages. The two operating
modes are the normal (HCI) mode and the firmware update mode.

PN544 is controlled by sending messages from the userspace to the
chip. The main function of the driver is just to pass those messages
without caring about the message content.


Protocols
---------

In the normal (HCI) mode and in the firmware update mode read and
write functions behave a bit differently because the message formats
or the protocols are different.

In the normal (HCI) mode the protocol used is derived from the ETSI
HCI specification. The firmware is updated using a specific protocol,
which is different from HCI.

HCI messages consist of an eight bit header and the message body. The
header contains the message length. Maximum size for an HCI message is
33. In HCI mode sent messages are tested for a correct
checksum. Firmware update messages have the length in the second (MSB)
and third (LSB) bytes of the message. The maximum FW message length is
1024 bytes.

For the ETSI HCI specification see
http://www.etsi.org/WebSite/Tech ... lSpecification.aspx

The Hardware Test
-----------------

The idea of the test is that it can performed by reading from the
corresponding sysfs file. The test is implemented in the board file
and it should test that PN544 can be put into the firmware update
mode. If the test is not implemented the sysfs file does not get
created.

Example:
> cat /sys/module/pn544/drivers/i2c\:pn544/3-002b/nfc_test
1

Normal Operation
----------------

PN544 is powered up when the device file is opened, otherwise it's
turned off. Only one instance can use the device at a time.

Userspace applications control PN544 with HCI messages. The hardware
sends an interrupt when data is available for reading. Data is
physically read when the read function is called by a userspace
application. Poll() checks the read interrupt state. Configuration and
self testing are also done from the userspace using read and write.

Example platform data:

static int rx71_pn544_nfc_request_resources(struct i2c_client *client)
{
    /* Get and setup the HW resources for the device */
}

static void rx71_pn544_nfc_free_resources(void)
{
    /* Release the HW resources */
}

static void rx71_pn544_nfc_enable(int fw)
{
    /* Turn the device on */
}

static int rx71_pn544_nfc_test(void)
{
    /*
     * Put the device into the FW update mode
     * and then back to the normal mode.
     * Check the behavior and return one on success,
     * zero on failure.
     */
}

static void rx71_pn544_nfc_disable(void)
{
    /* turn the power off */
}

static struct pn544_nfc_platform_data rx71_nfc_data = {
    .request_resources = rx71_pn544_nfc_request_resources,
    .free_resources = rx71_pn544_nfc_free_resources,
    .enable = rx71_pn544_nfc_enable,
    .test = rx71_pn544_nfc_test,
    .disable = rx71_pn544_nfc_disable,
};
回复

使用道具 举报

  • TA的每日心情
    开心
    昨天 13:10
  • 签到天数: 101 天

    [LV.6]常住居民II

    49

    主题

    1万

    回帖

    7万

    积分

    三级逆天

    积分
    73174

    终身成就奖特殊贡献奖原创先锋奖社区居民忠实会员社区劳模最爱沙发社区明星原创达人优秀斑竹奖宣传大使奖

    QQ
    发表于 2015-6-27 00:08:03 | 显示全部楼层
    回复

    使用道具 举报

  • TA的每日心情
    开心
    昨天 08:32
  • 签到天数: 57 天

    [LV.5]常住居民I

    210

    主题

    6919

    回帖

    4万

    积分

    百元学习allegro

    积分
    47734

    终身成就奖特殊贡献奖社区居民忠实会员社区劳模最爱沙发社区明星优秀斑竹奖宣传大使奖

    QQ
    发表于 2015-6-27 06:03:33 | 显示全部楼层
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    论坛开启做任务可以
    额外奖励金币快速赚
    积分升级了


    Copyright ©2011-2024 NTpcb.com All Right Reserved.  Powered by Discuz! (NTpcb)

    本站信息均由会员发表,不代表NTpcb立场,如侵犯了您的权利请发帖投诉

    平平安安
    TOP
    快速回复 返回顶部 返回列表