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

📄 plat_pmckeybd.cpp

📁 Freescale ARM11系列CPU MX31的WINCE 5.0下的BSP
💻 CPP
字号:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
// plat_pmckeybd.cpp
//
//
// Description: Platform-specific code for the PMC keyboard driver
//
//------------------------------------------------------------------------------
//
//  Copyright (C) 2006, Freescale Semiconductor, Inc. All Rights Reserved.
//  THIS SOURCE CODE, AND ITS USE AND DISTRIBUTION, IS SUBJECT TO THE TERMS
//  AND CONDITIONS OF THE APPLICABLE LICENSE AGREEMENT
//
//------------------------------------------------------------------------------

#include "bsp.h"
#include <pmcuser.h>
#include <pmc_keybd.h>

extern UINT8 ScanCodeToVKeyTable[];

//------------------------------------------------------------------------------
// External Functions
extern void BSPKppRegInit();
extern UINT BSPKPPGetScanCodes(UINT32 rguiScanCode[16], BOOL rgfKeyUp[16]);
extern BOOL BSPKppPowerOn();
extern BOOL BSPKppPowerOff();
extern BOOL BSPKppSetClockGatingMode(BOOL);

//------------------------------------------------------------------------------
// Global variables.
PCSP_KPP_REGS g_pKPP = NULL; // Pointer to regs used by Keypad library.

//------------------------------------------------------------------------------

UINT plat_pmckeybd_getvkeys(PVOID pPmcKeybdRegs, UINT8 rgVKey[16], BOOL rgfPress[16])
{
    UINT32 rguiScanCode[16];
    BOOL rgfKeyUp[16];
    UINT uiNumKeys = BSPKPPGetScanCodes(rguiScanCode, rgfKeyUp);

    for (UINT uiKey=0; uiKey<uiNumKeys; uiKey++)
    {
        rgVKey[uiKey] = ScanCodeToVKeyTable[rguiScanCode[uiKey]];
        rgfPress[uiKey] = ! rgfKeyUp[uiKey];
    }

    return uiNumKeys;
}

//------------------------------------------------------------------------------

BOOL plat_pmckeybd_init(PVOID pPmcKeybdRegs)
{
    g_pKPP = (PCSP_KPP_REGS) pPmcKeybdRegs;

    // Enable clocks to the KPP
    if (!BSPKppSetClockGatingMode(TRUE))
    {
        DEBUGMSG(ZONE_ERROR, 
            (TEXT("%s: Error setting KPP clock mode.\r\n"), __WFUNCTION__));
        return FALSE;
    }

    BSPKppRegInit();    

    return TRUE;
}

//------------------------------------------------------------------------------

BOOL plat_pmckeybd_deinit(PVOID pPmcKeybdRegs)
{
    return TRUE;
}

//------------------------------------------------------------------------------

BOOL plat_pmckeybd_powerup(PVOID pPmcKeybdRegs)
{
    return BSPKppPowerOn();
}

//------------------------------------------------------------------------------

BOOL plat_pmckeybd_powerdown(PVOID pPmcKeybdRegs)
{
    return BSPKppPowerOff();
}

⌨️ 快捷键说明

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