예제 #1
0
VOID
WinNtGopSimpleTextInTimerHandler (
  IN EFI_EVENT  Event,
  IN VOID       *Context
  )
{
  GOP_PRIVATE_DATA  *Private;
  EFI_KEY_DATA      KeyData;

  Private = (GOP_PRIVATE_DATA *)Context;
  while (GopPrivateDeleteQ (Private, &Private->QueueForNotify, &KeyData) == EFI_SUCCESS) {
    GopPrivateInvokeRegisteredFunction (Private, &KeyData);
  }
}
예제 #2
0
파일: WinNtGopInput.c 프로젝트: Kohrara/edk
STATIC
EFI_STATUS
GopPrivateReadKeyStrokeWorker (
  IN GOP_PRIVATE_DATA                   *Private,
  OUT EFI_KEY_DATA                      *KeyData
  )
/*++

  Routine Description:
    Reads the next keystroke from the input device. The WaitForKey Event can 
    be used to test for existance of a keystroke via WaitForEvent () call.

  Arguments:
    Private    - The private structure of WinNt Gop device.
    KeyData    - A pointer to a buffer that is filled in with the keystroke 
                 state data for the key that was pressed.

  Returns:
    EFI_SUCCESS           - The keystroke information was returned.
    EFI_NOT_READY         - There was no keystroke data availiable.
    EFI_DEVICE_ERROR      - The keystroke information was not returned due to 
                            hardware errors.
    EFI_INVALID_PARAMETER - KeyData is NULL.                        

--*/
{
  EFI_STATUS                      Status;
  EFI_TPL                         OldTpl;  

  if (KeyData == NULL) {
    return EFI_INVALID_PARAMETER;
  }

  //
  // Enter critical section
  //
  OldTpl  = gBS->RaiseTPL (EFI_TPL_NOTIFY);

  Status  = GopPrivateCheckQ (Private);
  if (!EFI_ERROR (Status)) {
    //
    // If a Key press exists try and read it.
    //
    Status = GopPrivateDeleteQ (Private, &KeyData->Key);
#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)     
    if (!EFI_ERROR (Status)) {
      //
      // Record Key shift state and toggle state
      //      
      if (Private->LeftCtrl) {
        Private->KeyState.KeyShiftState  |= EFI_LEFT_CONTROL_PRESSED;
      }                                    
      if (Private->RightCtrl) {
        Private->KeyState.KeyShiftState  |= EFI_RIGHT_CONTROL_PRESSED;
      }                                    
      if (Private->LeftAlt) {                
        Private->KeyState.KeyShiftState  |= EFI_LEFT_ALT_PRESSED;
      }                                    
      if (Private->RightAlt) {                
        Private->KeyState.KeyShiftState  |= EFI_RIGHT_ALT_PRESSED;
      }                                      
      if (Private->LeftShift) {          
        Private->KeyState.KeyShiftState  |= EFI_LEFT_SHIFT_PRESSED;
      }                                    
      if (Private->RightShift) {         
        Private->KeyState.KeyShiftState  |= EFI_RIGHT_SHIFT_PRESSED;
      }                                    
      if (Private->LeftLogo) {           
        Private->KeyState.KeyShiftState  |= EFI_LEFT_LOGO_PRESSED;
      }                                    
      if (Private->RightLogo) {          
        Private->KeyState.KeyShiftState  |= EFI_RIGHT_LOGO_PRESSED;
      }                                    
      if (Private->Menu) {               
        Private->KeyState.KeyShiftState  |= EFI_MENU_KEY_PRESSED;
      }                                    
      if (Private->SysReq) {             
        Private->KeyState.KeyShiftState  |= EFI_SYS_REQ_PRESSED;
      }  
      if (Private->CapsLock) {
        Private->KeyState.KeyToggleState |= EFI_CAPS_LOCK_ACTIVE;
      }
      if (Private->NumLock) {
        Private->KeyState.KeyToggleState |= EFI_NUM_LOCK_ACTIVE;
      }
      if (Private->ScrollLock) {
        Private->KeyState.KeyToggleState |= EFI_SCROLL_LOCK_ACTIVE;
      }
      
      KeyData->KeyState.KeyShiftState  = Private->KeyState.KeyShiftState;
      KeyData->KeyState.KeyToggleState = Private->KeyState.KeyToggleState;
      
      Private->KeyState.KeyShiftState  = EFI_SHIFT_STATE_VALID;
      Private->KeyState.KeyToggleState = EFI_TOGGLE_STATE_VALID;
  
      //
      // Leave critical section and return
      //
      gBS->RestoreTPL (OldTpl);
      
      GopPrivateInvokeRegisteredFunction (Private, KeyData);
      
      return EFI_SUCCESS;
    }
#endif    
  }

  //
  // Leave critical section and return
  //
  gBS->RestoreTPL (OldTpl);

  return Status;

}