Nx32926 命令关机
一. poweroff关机命令
~ # poweroff
~ # baud=, quot=
w-config: 8bits/char
umount: devtmpfs busy - remounted read-only
Cannot open value file.
umount: can't remount rootfs reabaud=115200, quot=102
w-config: 8bits/char
d-only
cannot run '/sbin/swapoff': No such file or dirRTL871X: rtw_cmd_thread(wlan0) _rtw_down_sema(&pcmdpriv->cmd_queue_sema) return _FAIL, break
ectory
The system is going down NOW!
Sent SIGTERM to all processes
videoin_close
Sensor power down
Sensor power down
I2C removed
Sent SIGKILL toPower down.
enter to w55fa92_poweroff()
二、内核代码
void w55fa92_poweroff(void)
{
unsigned long volatile flags;
#if defined(CONFIG_RTC_DRV_W55FA92)
int rtc_time_out;
#endif printk("enter to w55fa92_poweroff()\n");
msleep(); // disable LVR
__raw_writel(__raw_readl(REG_MISCR) & ~(LVR_RDY | LVR_EN), REG_MISCR); // turn off speaker
#if defined(CONFIG_GIANTPLUS_GPM1006D0_320X240)
__raw_writel(__raw_readl(REG_GPIOE_OMD) | ( << ), REG_GPIOE_OMD);
__raw_writel(__raw_readl(REG_GPIOE_DOUT) & ~( << ), REG_GPIOE_DOUT);
#endif // turn off video out
__raw_writel((__raw_readl(REG_LCM_TVCtl) & ~TVCtl_LCDSrc) | 0x800, REG_LCM_TVCtl); // disable system interrupts
local_irq_save(flags); #if defined(CONFIG_RTC_DRV_W55FA92)
__raw_writel(__raw_readl(REG_APBCLK) | RTC_CKE, REG_APBCLK);
while () {
rtc_time_out = ;
// enable long time press power disable
if ((__raw_readl(REG_RTC_AER) & 0x10000) == 0x0) {
// set RTC register access enable password
__raw_writel(0xA965, REG_RTC_AER);
// make sure RTC register read/write enable
while ((__raw_readl(REG_RTC_AER) & 0x10000) == 0x0) {
rtc_time_out++;
if (rtc_time_out > 0xFFFFFF) {
printk("RTC Access Eanble Fail\n");
break;
}
} rtc_wait_ready(); if ((__raw_readl(REG_RTC_AER) & 0x10000) == 0x10000)
break;
}
else
break;
} // RTC will power off
__raw_writel((__raw_readl(REG_RTC_PWRON) & ~0x5) | 0x2, REG_RTC_PWRON);
#else
// turn off power
__raw_writel(__raw_readl(REG_GPIOE_OMD) | (<<), REG_GPIOE_OMD);
__raw_writel(__raw_readl(REG_GPIOE_DOUT) & ~(<<), REG_GPIOE_DOUT);
#endif // enable system interrupts
local_irq_restore(flags); // stop CPU clock
//__raw_writel(__raw_readl(REG_AHBCLK) & ~CPU_CKE, REG_AHBCLK);
// fix RTC may wakeup fail issue
__raw_writel(0x0, REG_AHBCLK); // wait system enter power off
while () ;
} void w55fa92_reboot(void)
{
unsigned long volatile flags; local_irq_save(flags);
printk("enter to w55fa92_reboot()\n"); // turn off speaker
#if defined(CONFIG_GIANTPLUS_GPM1006D0_320X240)
__raw_writel(__raw_readl(REG_GPIOE_OMD) | ( << ), REG_GPIOE_OMD);
__raw_writel(__raw_readl(REG_GPIOE_DOUT) & ~( << ), REG_GPIOE_DOUT);
#endif // turn off video out
__raw_writel((__raw_readl(REG_LCM_TVCtl) & ~TVCtl_LCDSrc) | 0x800, REG_LCM_TVCtl); // close NAND and SIC engine clock
__raw_writel(__raw_readl(REG_AHBCLK) & ~(NAND_CKE|SIC_CKE), REG_AHBCLK); // watchdog reset
__raw_writel((__raw_readl(REG_WTCR) & ~(<<|<<))|0x2C2, REG_WTCR); // wait system enter power off
while () ;
local_irq_restore(flags);
} static ssize_t
write_clk(struct device *dev, struct device_attribute *attr,
const char *buffer, size_t count)
{
int i; // power down mode
if (buffer[] == 'p' && buffer[] == 'd') {
w55fa92_pm_suspend();
} #if 0
// idle mode or memory idle mode
else if ((buffer[] == 'i' && buffer[] == 'd') || (buffer[] == 'm' && buffer[] == 'i')) {
w55fa92_pm_idle();
}
#endif #if defined(CONFIG_RTC_DRV_W55FA92)
// RTC power off mode
else if (buffer[] == 'r' && buffer[] == 'p' && buffer[] == 'o') {
w55fa92_poweroff();
}
#else
// power off mode
else if (buffer[] == 'p' && buffer[] == 'o') {
w55fa92_poweroff();
}
#endif // power reset mode
else if (buffer[] == 'p' && buffer[] == 'r') {
w55fa92_reboot();
} // CPU:PLL clock change
else {
u32 pll_clock, sys_clock, cpu_clock, apb_clock, vpost_clock;
u8 vpost_div_N0, vpost_div_N1;
char clock_buf[];
char *clock1, *clock2, *next; strncpy(clock_buf, buffer, count);
next = &clock_buf[];
pll_clock = w55fa92_upll_clock;
clock1 = strsep(&next, ":");
//printk("clock1 = %s\n", clock1);
cpu_clock = simple_strtol(clock1, NULL, ) * ;
if (cpu_clock == ) {
printk("Command \"%s\" does not support !!\n", clock1);
return -;
}
if (next) {
clock2 = strsep(&next, ":");
//printk("clock2 = %s\n", clock2);
pll_clock = simple_strtol(clock2, NULL, ) * ;
if (pll_clock == ) {
printk("Command \"%s\" does not support !!\n", clock2);
return -;
}
} if (pll_clock % cpu_clock) {
printk("UPLL clock(%d) is not a multiple of CPU clock(%d) !!\n",
pll_clock, cpu_clock);
return -;
} #if defined(CONFIG_FB_W55FA92)
vpost_div_N0 = (__raw_readl(REG_CLKDIV1) & VPOST_N0) + ;
vpost_div_N1 = ((__raw_readl(REG_CLKDIV1) & VPOST_N1) >> ) + ;
vpost_clock = pll_clock / (vpost_div_N0 * vpost_div_N1);
if (cpu_clock > vpost_clock*) {
sys_clock = cpu_clock;
} else {
for (i = ; ; i++) {
sys_clock = cpu_clock * i * ;
if ((i > ) || (sys_clock > pll_clock)) {
printk("Cannot get valid System clock !!\n");
return -;
}
if ((sys_clock>(vpost_clock*)) && ((pll_clock%sys_clock)==))
break;
}
}
#else
sys_clock = cpu_clock;
#endif
apb_clock = (cpu_clock == sys_clock) ? cpu_clock/ : cpu_clock/;
#if CPU_DEBUG
printk("vpost_clock = %d\n", vpost_clock);
printk("pll_clock = %d\n", pll_clock);
printk("sys_clock = %d\n", sys_clock);
printk("cpu_clock = %d\n", cpu_clock);
printk("apb_clock = %d\n", apb_clock);
#endif // PLL:SYS:CPU:AHB:APB = pll_clock:sys_clock:cpu_clock:sys_clock/2:apb_clock
set_system_clocks(pll_clock, sys_clock, cpu_clock, apb_clock);
} return count;
} /* Attach the sysfs write method */
DEVICE_ATTR(clock, , read_clk, write_clk); /* Attribute Descriptor */
static struct attribute *clk_attrs[] = {
&dev_attr_clock.attr,
NULL
}; /* Attribute group */
static struct attribute_group clk_attr_group = {
.attrs = clk_attrs,
}; static int __init w55fa92_system_clock_init(void)
{
/* Register a platform device */
printk("register clock device\n");
///sys/devices/w55fa92-clk
sys_clk = platform_device_register_simple("w55fa92-clk", -, NULL, );
if (sys_clk == NULL)
printk("register failed\n");
sysfs_create_group(&sys_clk->dev.kobj, &clk_attr_group);
sram_vaddr = ioremap(0xFF000000, *); return ;
} module_init(w55fa92_system_clock_init);
Nx32926 命令关机的更多相关文章
- windows命令关机
不知道为啥,远程连接的window服务器没有关机命令,感觉是不是管理员权限导致的,所以找了下用命令关机,如下 shutdown -s -t #5秒内关机 shutdown -r -t #5秒内重启
- Linux常用命令——关机重启命令
Linux常用命令--关机重启命令 Linux shutdown 语法:shutdown [选项] 时间 -c 取消前一个关机命令 -h 关机 -r 重启 示例:shutdown -r now 其它 ...
- Linux学习笔记(六)Linux常用命令:关机、重启以及系统运行级别
一.shutdown命令 shutdown [选项] [时间] 常用选项 -c 取消前一个关机命令 -h 关机 -r 重启 shutdown命令关机或重启会保存当前系统正在使用的资源,因此关机或重启最 ...
- linux常用命令-关机、重启
常用命令-关机.重启 命令 含义 reboot 重新启动操作系 shutdown –r now 重新启动操作系统,shutdown会给别的用户提示 shutdown -h now 立刻关机,其中now ...
- linux笔记:linux常用命令-关机重启命令
关机重启命令:shutdown(关机或者重启) 其他关机命令: 其他重启命令: 系统运行级别: 修改系统默认运行级别和查询系统运行级别: 退出登录命令:logout(退出登录)
- WIN7 shutdown 定时/倒计时 命令关机
解决方案: 一.可以通过DOS命令shutdown来解决 在 Win7 中,shutdown实现自动关机的方法如下: 开始->运行->cmd 运行"shutdown -s -t ...
- Linux命令-关机命令详解
关机命令:1.halt 立刻关机 2.poweroff 立刻关机 3.shutdown -h now 立刻关机(root用户使用) 4.shutdown -h 10 10分钟后自动关机 如果是通过sh ...
- Linux命令-关机命令:shutdown
shutdown -h now 现在马上关机 shutdown -h : 晚上8:30定时关机shutdown -r now 现在马上重起shutdown -r 20:30 晚上8:30定时重起 ca ...
- Linux常用命令——关机与重启命令
1.shutdown命令 shutdown [选项] 时间 --使用shutdown进行关机或重启会正确保存正在使用的服务,其他命令有一定的危险性,建议最好使用shutdown命令进行关机重启 选项: ...
随机推荐
- WPF与输入法冲突研究之二:汉字输入法会导致WPF程序的崩溃!
如果是输入非汉字的数据信息,可以添加一下内容: xmlns:input="clr-namespace:System.Windows.Input;assembly=PresentationCo ...
- java自定义随机数(实例)
import java.util.Random; /** * * @author mengzw * @since 3.0 2014-5-22 */ public class RandomTest { ...
- 批量SSH操作工具---OmniTTY安装
安装rote # pwd /tmp/rote-0.2.8 # ./configure # make # make install ...... mkdir -p /usr/local/include/ ...
- py爬取英文文档学习单词
最近开始看一些整本整本的英文典籍,虽然能看个大概,但是作为四级都没过的我来说还是有些吃力,总还有一部分很关键的单词影响我对句子的理解,因为看的是纸质的,所以查询也很不方便,于是想来个突击,我想把程序单 ...
- AVD启动不了 ANDROID_SDK_HOME is defined but could not find *.ini
报错提示______________________________________________________________________ Starting emulator for AVD ...
- jquery easyui-datagrid 如何清空数据
//清空原有数据 方法1: var item = $('#filegrid').datagrid('getRows'); if (item) { ; i >= ; i--) { var in ...
- Android-图标
首先需要申明一点,系统图标并不存在于项目资源中,而是存在于设备中. 这就带来一个大问题,界面风格的控制权交到了不同的设备手中.这是我们不愿意看到的. 如何解决这个问题?有两种方法: 1.创建自己的图标 ...
- .net 将xml转换成DateSet
/// <summary> /// 将XML字符串转换成DATASET /// </summary> /// <param name="xmlStr" ...
- JSP 实现 之 调用java方法实现MySQL数据库备份和恢复
package cn.qm.db; import java.io.BufferedReader; import java.io.DataInputStream; import java.io.IOEx ...
- C++的this指针
这篇博客主要内容翻译自国外著名程序员网站:geekersforgeekers,经过作者小幅度整理,水平有限,敬请指正. 关于this指针的粗浅认识 (一) this指针: 在对象的任意非static类 ...