Android-TimedBootDriver
Introduction: Android timed boot and hardware watchdog driver.
Tags:
此方案用于实现 Android 主板的定时开机与 Watchdog 功能,应用于一些特殊产品,如:广告机、自动售货机等。
框图
原理图
说明
- Watch Dog
Watch Dog 功能默认关闭,直到 Android 发送命令打开 Watch Dog 功能。如果 Watch Dog 功处于打开状态,Android 系统会在小于 Watch Dog 超时时长内定时发送心跳数据给 MCU,如果 Watch Dog 超时时长到,仍未收到心跳数据,则拉低 RESET 引脚 10ms,使 CPU 复位重启。 - 定时开机
当 MCU 收到数据后启动计时,时间到拉低 POWER 引脚 10ms,使 CPU 开机,同时清除本次定时任务,直到下次 CPU 重新下发新的定时任务。
协议
通信接口为 I2C,从机地址:0x61
功能 | 命令 | 数据 | R/W |
---|---|---|---|
心跳 | 0x01 | 0x55 | W |
定时开机 | 0x02 | 4bytes (倒计时,单位:秒,最大值为 1 年的秒数:31536000,大端模式高位在前) 0x00:取消定时开机 | W |
开关 Watch Dog | 0x03 | 0x01:打开 0x02:关闭 默认:关闭 | W |
设置 Watch Dog 超时时长 | 0x04 | 2bytes (倒计时,单位:秒,最大值:65535,大端模式高位在前) 默认:180 秒(3 分钟) | W |
使用
- 复制 n76e003 到 kernel/drivers/misc/ 目录下.
- 修改 kernel/drivers/misc/Kconfig:
source "drivers/misc/n76e003/Kconfig"
- 修改 kernel/drivers/misc/Makefile:
obj-$(CONFIG_N76E003_DRIVER) += n76e003/
- 修改 dts
&i2c2 { status = "okay"; n76e003@61 { compatible = "nuvoton,n76e003"; reg = <0x61>; status = "okay"; }; };
- 移植 frameworks.patch
开发者
- ayst.shen@foxmail.com
License
Copyright (C) 2016 - 2017 Topband. Ltd.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be a reference
to you, when you are integrating the nuvoTon's N76E003 IC into your system,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.