Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1307075
  • 博文数量: 478
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 4833
  • 用 户 组: 普通用户
  • 注册时间: 2014-06-28 11:12
文章分类

全部博文(478)

文章存档

2019年(1)

2018年(27)

2017年(21)

2016年(171)

2015年(258)

我的朋友

分类: Android平台

2015-10-21 20:37:31

[FAQ05811]如何在开机阶段按power key+# key进行开机流程选择
2013-03-14
平台
软件分支...
FAQs 17 of 17

内容

【Description】
在开机按power key的时候,kbd task尚未起来,没有办法调用keypad driver的function获取key的status(press/release)。
 
【Analyse】
既然有压key,状态寄存器是有变化的,可以通过读取寄存器状态,确认key是否被按下。
 
(1)通过codegen.dws获取key的ROW no和COLUMN no。
(2)阅读datasheet keypad scanner章节,keypad matrix获取key number。
(3)获取状态寄存器信息,通过key number确认key的状态寄存器地址:
keypad scanner默认有5个reg:kp+0004h,kp+0008h,kp+000ch,kp+00010h,kp+0014h
KP base请查阅SW reg_base_mt62xx.h文件,#KP_BASE宏定义
【Solution】
举例:
MT6250平台,在开机阶段确认power key+# key都被按下了。
  kal_bool Is_Press_PowerAndPound()
{
    kal_bool pound_key_status ;
 kal_bool power_key_status ;
   
    kal_uint16 kbd_mem1 = *(volatile kal_uint16 *)(0xA00D0004);
    kal_uint16 kbd_mem2 = *(volatile kal_uint16 *)(0xA00D0008);
    kal_uint16 kbd_mem3 = *(volatile kal_uint16 *)(0xA00D000C);
    kal_uint16 kbd_mem4 = *(volatile kal_uint16 *)(0xA00D0010);
    kal_uint16 kbd_mem5 = *(volatile kal_uint16 *)(0xA00D0014);
    kal_uint16 powekey_mem = *(volatile kal_uint16 *)(0xa0730f00);//50 powerkey寄存器较特殊
 
    if( !(kbd_mem4 & 0x0002) )
    {
       dbg_print("pound key is pressed!\r\n");
       pound_key_status = KeyPressed;
    }
    else
   {
       dbg_print("pound key is released!\r\n");
       pound_key_status = KeyReleased;
   }
 
   if (!powekey_mem)
    {
         dbg_print("power key is pressed!\r\n");
         power_key_status = KeyPressed;
    }
    else
    {
          dbg_print("power key is released!\r\n");
          power_key_status = KeyReleased;
    }
    if((!pound_key_status) && (!power_key_status))
 {
  return KAL_TRUE;
 }
 else
 {
  return KAL_FALSE;
 }
}
请将此函数加在application_Initialize函数中systemInitializeResource()之前。
阅读(814) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~