⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 keypad_plat.c

📁 Wince6环境下
💻 C
📖 第 1 页 / 共 2 页
字号:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES OR INDEMNITIES.
//
//
// (C) Copyright 2006 Marvell International Ltd.
// All Rights Reserved
//
/* 
** INTEL CONFIDENTIAL
** Copyright 2000-2006 Intel Corporation All Rights Reserved.
**
** The source code contained or described herein and all documents
** related to the source code (Material) are owned by Intel Corporation
** or its suppliers or licensors.  Title to the Material remains with
** Intel Corporation or its suppliers and licensors. The Material contains
** trade secrets and proprietary and confidential information of Intel
** or its suppliers and licensors. The Material is protected by worldwide
** copyright and trade secret laws and treaty provisions. No part of the
** Material may be used, copied, reproduced, modified, published, uploaded,
** posted, transmitted, distributed, or disclosed in any way without Intel抯
** prior express written permission.
**
** No license under any patent, copyright, trade secret or other intellectual
** property right is granted to or conferred upon you by disclosure or
** delivery of the Materials, either expressly, by implication, inducement,
** estoppel or otherwise. Any license under such intellectual property rights
** must be express and approved by Intel in writing.
*/
/****************************************************************************
**   xllp_keypad.c
**
**   Valid for Littleton Keypad
**
*****************************************************************************/

#include    "xllp_keypad.h"
#include    "xllp_keypad_proc.h"
#include "xllp_mfp.h"
#include "xllp_mfp_plat.h"
#include "xllp_defs.h"

void * memset(void* dest,   int c,  int count );

static XLLP_UINT32_T xllp_keypad_mfp_list []={
    XLLP_MFP_KP_DKIN_0_OFFSET,
    XLLP_MFP_KP_DKIN_1_OFFSET,
    XLLP_MFP_KP_MKIN_0_OFFSET,
    XLLP_MFP_KP_MKIN_1_OFFSET,
    XLLP_MFP_KP_MKIN_2_OFFSET,
    XLLP_MFP_KP_MKIN_3_OFFSET,
    XLLP_MFP_KP_MKIN_4_OFFSET,
    XLLP_MFP_KP_MKIN_5_OFFSET,
    XLLP_MFP_KP_MKOUT_0_OFFSET,
    XLLP_MFP_KP_MKOUT_1_OFFSET,
    XLLP_MFP_KP_MKOUT_2_OFFSET,
    XLLP_MFP_KP_MKOUT_3_OFFSET,
    XLLP_MFP_KP_MKOUT_4_OFFSET,
	XLLP_MFP_KP_DKIN_0_OFFSET,
	XLLP_MFP_KP_DKIN_1_OFFSET,
    XLLP_MFP_PIN_EOLIST_MARKER
};/*end of xllp_keypad_mfp_listtypedef struct*/

static XLLP_MFP_ALT_FN_T xllp_keypad_af_list []={
    XLLP_MFP_KP_DKIN_0_AF,    /*DKIN_0*/
    XLLP_MFP_KP_DKIN_1_AF,    /*DKIN_1*/
    XLLP_MFP_KP_MKIN_0_AF,    /*MKIN_0*/                                            
    XLLP_MFP_KP_MKIN_1_AF,    /*MKIN_1*/
    XLLP_MFP_KP_MKIN_2_AF,    /*MKIN_2*/
    XLLP_MFP_KP_MKIN_3_AF,    /*MKIN_3*/
    XLLP_MFP_KP_MKIN_4_AF,    /*MKIN_4*/
    XLLP_MFP_KP_MKIN_5_AF,    /*MKIN_5*/
    XLLP_MFP_KP_MKOUT_0_AF,   /*MKOUT_0*/
    XLLP_MFP_KP_MKOUT_1_AF,   /*MKOUT_1*/
    XLLP_MFP_KP_MKOUT_2_AF,   /*MKOUT_2*/
    XLLP_MFP_KP_MKOUT_3_AF,   /*MKOUT_3*/
    XLLP_MFP_KP_MKOUT_4_AF,   /*MKOUT_4*/
	XLLP_MFP_KP_DKIN_0_AF,    /*DKIN_0*/
	XLLP_MFP_KP_DKIN_1_AF,    /*DKIN_1*/
};/*end of xllp_keypad_af_list*/

static XLLP_MFP_DRIVE_STRENGTH_T xllp_keypad_ds_list []={
    XLLP_MFP_DEFAULT_DS,   /*DKIN_0*/
    XLLP_MFP_DEFAULT_DS,   /*DKIN_1*/
    XLLP_MFP_DEFAULT_DS,   /*MKIN_0*/
    XLLP_MFP_DEFAULT_DS,   /*MKIN_1*/
    XLLP_MFP_DEFAULT_DS,   /*MKIN_2*/
    XLLP_MFP_DEFAULT_DS,   /*MKIN_3*/
    XLLP_MFP_DEFAULT_DS,   /*MKIN_4*/
    XLLP_MFP_DEFAULT_DS,   /*MKIN_5*/
    XLLP_MFP_DEFAULT_DS,   /*MKOUT_0*/
    XLLP_MFP_DEFAULT_DS,   /*MKOUT_1*/
    XLLP_MFP_DEFAULT_DS,   /*MKOUT_2*/
    XLLP_MFP_DEFAULT_DS,   /*MKOUT_3*/
    XLLP_MFP_DEFAULT_DS,   /*MKOUT_4*/
    XLLP_MFP_DEFAULT_DS,   /*DKIN_0*/
    XLLP_MFP_DEFAULT_DS,   /*DKIN_1*/
};/*end of xllp_keypad-ds_list*/


/*
The Low Power Mode output table

The following table provides this Low Power Mode signal out behavior 
by the keypad MFPs:
DKINs:  Float ("Z").  (They are all pulled low by the platform 
unless driven by the scroll wheel.)
MKINs:  Float ("Z").  (They are all pulled low by the platform unless
driven by connection with an MKOUT due to key press.)
MKOUTs: Driven high output to provide edge triggering 
capability on the MKINs if a matrix key is pressed.
Note that this is desirable only if wakeup from keypress
is intended.  Otherwise, they should probably be pulled 
low so that no power would be wasted if a key is pressed
and a connection is made with an MKIN.
*/
static XLLP_MFP_LPM_OUTPUT_T xllp_keypad_lpm_output_list []={
    XLLP_MFP_KP_DKIN_0_LPM,
    XLLP_MFP_KP_DKIN_1_LPM,
    XLLP_MFP_KP_MKIN_0_LPM,
    XLLP_MFP_KP_MKIN_1_LPM,
    XLLP_MFP_KP_MKIN_2_LPM,
    XLLP_MFP_KP_MKIN_3_LPM,
    XLLP_MFP_KP_MKIN_4_LPM,
    XLLP_MFP_KP_MKIN_5_LPM,
    XLLP_MFP_KP_MKOUT_0_LPM,
    XLLP_MFP_KP_MKOUT_1_LPM,
    XLLP_MFP_KP_MKOUT_2_LPM,
    XLLP_MFP_KP_MKOUT_3_LPM,
    XLLP_MFP_KP_MKOUT_4_LPM,
};/*end of xllp_keypad_lpm_output_list*/

/*
The following tables combine to provide this configuration and 
enabling of wake up from Low Power Modes:

DKINs and MKINs: 
Configured to trigger a first-stage LPM wake up signal on 
either a rising or falling edge on the input of their 
respective MFPs.
All are currently in a separate list of MFPs that can be used  
to both enable and disable clear triggering of a   
first-stage LPM wake up signal.

MKOUTs: Neither configured nor enabled for wake up triggers.
(Note that the Monahans cannot be enabled to wake from transitions
on MFPs assigned by Alternate Function to any MKOUT.)
*/
static XLLP_UINT32_T xllp_keypad_wakeup_pins_candidates_list []={
    XLLP_MFP_KP_DKIN_0_OFFSET,
    XLLP_MFP_KP_DKIN_1_OFFSET,
    XLLP_MFP_KP_MKIN_0_OFFSET,
    XLLP_MFP_KP_MKIN_1_OFFSET,
    XLLP_MFP_KP_MKIN_2_OFFSET,
    XLLP_MFP_KP_MKIN_3_OFFSET,
    XLLP_MFP_KP_MKIN_4_OFFSET,
    XLLP_MFP_KP_MKIN_5_OFFSET,
    XLLP_MFP_PIN_EOLIST_MARKER
};/*end of xllp_keypad_wakeup_pins_candidates_list*/

static XLLP_MFP_EDGE_T xllp_keypad_configure_wakeup_edges_list []={
    XLLP_MFP_RISING_FALLING_EDGES,  /*DKIN_0*/
    XLLP_MFP_RISING_FALLING_EDGES,  /*DKIN_1*/
    XLLP_MFP_RISING_FALLING_EDGES,  /*MKIN_0*/
    XLLP_MFP_RISING_FALLING_EDGES,  /*MKIN_1*/
    XLLP_MFP_RISING_FALLING_EDGES,  /*MKIN_2*/
    XLLP_MFP_RISING_FALLING_EDGES,  /*MKIN_3*/
    XLLP_MFP_RISING_FALLING_EDGES,  /*MKIN_4*/
    XLLP_MFP_RISING_FALLING_EDGES,  /*MKIN_5*/
};/*end of xllp_keypad_configure_wakeup_edges_list*/

/*
It is useful for the keypad module to maintain a separate list of actual 
wake up trigger MFPs in the event that the scroll wheel unit will not 
be powered during low power modes.  In that case, it would be undesirable 
to arm the wake up trigger for the DKINs in case a transition occurs on 
entry to the LPM as power is removed.
This list is used to disable/clear the wake up triggers on the included
MFPs and also to enable / arm the wake up triggers on them.
*/

static XLLP_UINT32_T xllp_keypad_wakeup_pins_list []={
    XLLP_MFP_KP_DKIN_0_OFFSET,
    XLLP_MFP_KP_DKIN_1_OFFSET,
    XLLP_MFP_KP_MKIN_0_OFFSET,
    XLLP_MFP_KP_MKIN_1_OFFSET,
    XLLP_MFP_KP_MKIN_2_OFFSET,
    XLLP_MFP_KP_MKIN_3_OFFSET,
    XLLP_MFP_KP_MKIN_4_OFFSET,
    XLLP_MFP_KP_MKIN_5_OFFSET,
    XLLP_MFP_PIN_EOLIST_MARKER
};/*end of xllp_keypad_wakeup_pins_list*/


/*
For the sake of speed and simplicity, this table is configured so that the  
single-closure matrix scan codes are placed using an MK_INn (row) by 
MK_OUTm (column) format.  That will permit direct use of the KPAS  
register's lower 8 bits, which yield that indexing. 
Multiclosure (chorded) scan codes are processed in-line by the multipress parser
*/
/* 
 Note: Littleton-specific
 Unassigned cells filled with 0xFE (XLLP_KP_SC_INVALID_KEY)
 */
#define XLLP_KP_MAX_SINGLE_SCAN_CODES 35

/*
we treat 
key CONTACT as XLLP_KP_SC_AUX1; 
key CALENDAR as XLLP_KP_SC_AUX2; 
key EMAIL as XLLP_KP_SC_AUX3
*/
static XLLP_UINT8_T xllpKpScanCodeLut[XLLP_KP_MAX_SINGLE_SCAN_CODES] = 
{
        /*IN0*/ 
/*OUT0 */XLLP_KP_SC_1,    
/*OUT1 */XLLP_KP_SC_4,    
/*OUT2 */XLLP_KP_SC_7,    
/*OUT3 */XLLP_KP_SC_STAR, 
/*OUT4 */XLLP_KP_SC_NO_KEY,  

        /*IN1*/ 
/*OUT0 */XLLP_KP_SC_2,    
/*OUT1 */XLLP_KP_SC_5,    
/*OUT2 */XLLP_KP_SC_8,    
/*OUT3 */XLLP_KP_SC_0,    
/*OUT4 */XLLP_KP_SC_NO_KEY,     

        /*IN2*/ 
/*OUT0 */XLLP_KP_SC_3,    
/*OUT1 */XLLP_KP_SC_6,    
/*OUT2 */XLLP_KP_SC_9,    
/*OUT3 */XLLP_KP_SC_POUND,
/*OUT4 */XLLP_KP_SC_NO_KEY,     

        /*IN3*/ 
/*OUT0 */XLLP_KP_SC_SOFT1, 
/*OUT1 */XLLP_KP_SC_SOFT2, 
/*OUT2 */XLLP_KP_SC_SEND,  
/*OUT3 */XLLP_KP_SC_END,  
/*OUT4 */XLLP_KP_SC_NO_KEY,     

        /*IN4*/ 
/*OUT0 */XLLP_KP_SC_HOME,  
/*OUT1 */XLLP_KP_SC_DELETE,   
/*OUT2 */XLLP_KP_SC_VOL_UP,
/*OUT3 */XLLP_KP_SC_VOL_DN, 
/*OUT4*/XLLP_KP_SC_NO_KEY,   

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -