PFN_KEYBD_PDD_POWER_HANDLER
9/8/2008
Essa função lida com estado de energia sistema alterações. É chamado, a camada superior.
Syntax
typedef void (*PFN_KEYBD_PDD_POWER_HANDLER)(
UINT uiPddId,
BOOL fTurnOff
);
Parameters
- uiPddId
[no] Índice da PDD.
- fTurnOff
[no] TRUE indica que o sistema está desligando para baixo. FALSE indica que o sistema está desligando o backup.
Return Value
Nenhum.
Remarks
Essa função é executado no contexto kernel e pressupõe que as interrupções estão desativadas porque ele funciona diretamente com registradores de microprocessador. Ele não faz qualquer sistema chamadas ou causar tarefas para ser reagendada. Essa função é restrito a leitura e gravação para memória pré-distribuída. Qualquer sub-rotinas chamado desta função deve seguir essa restrição.
Em receber um evento Power-DOWN, o driver exemplo esvazia reserva dados do Controlador de 8042-Keyboard. O seguinte exemplo de código mostra uma implementação das PFN_KEYBD_PDD_POWER_HANDLER função para controle, na verdade, a capacidade do dispositivo de teclado; Esta função funciona em conjunto com PFN_KEYBD_DRIVER_POWER_HANDLER.
void
WINAPI
KeybdPdd_PowerHandler(
BOOL bOff
)
{
extern DWORD gdwIoBase;
if ( bOff )
{
if ( KeyStateFlags == KeyStateDownFlag )
{
UCHAR ucKbdStatus, ucKbdData;
// Because this function is invoked right after a key is pressed, the output buffer of
// the keyboard must be cleaned until the corresponding key is released. Otherwise the
// data in that buffer will prevent subsequent keystrokes from generating interrupts,
// which might cause the keyboard to stop responding.
if(gdwIoBase != 0) {
do
{
ucKbdData = READ_PORT_UCHAR((PUCHAR)(gdwIoBase + 0x00));
} while ( !(ucKbdData & scKeyUpMask) );
}
KeyStateFlags = 0;
if(gdwIoBase != 0) {
ucKbdStatus = READ_PORT_UCHAR((PUCHAR)(gdwIoBase + 0x04));
while ( (ucKbdStatus & 0x21) == 0x01 )
{
ucKbdData = READ_PORT_UCHAR((PUCHAR)(gdwIoBase + 0x00));
ucKbdStatus = READ_PORT_UCHAR((PUCHAR)(gdwIoBase + 0x04));
}
}
}
}
return;
}
Requirements
Header | keybdpdd.h |
Windows Embedded CE | Windows CE 1.0 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |