equal
deleted
inserted
replaced
321 |
321 |
322 private: |
322 private: |
323 static void UartIsr( TAny* aParam ); |
323 static void UartIsr( TAny* aParam ); |
324 static void AddKeyDfc( TAny* aParam ); |
324 static void AddKeyDfc( TAny* aParam ); |
325 void AddKey( TUint aKey ); |
325 void AddKey( TUint aKey ); |
326 |
326 |
327 |
327 |
328 private: |
328 private: |
329 enum TState |
329 enum TState |
330 { |
330 { |
331 ENormal, |
331 ENormal, |
375 { |
375 { |
376 Kern::Printf("TSerialKeyboard Bind r=%d", r); |
376 Kern::Printf("TSerialKeyboard Bind r=%d", r); |
377 return r; |
377 return r; |
378 } |
378 } |
379 |
379 |
380 Kern::Printf("+TSerialKeyboard::Create bound to interrupt" ); |
|
381 |
|
382 #ifdef USE_SYMBIAN_PRM |
380 #ifdef USE_SYMBIAN_PRM |
383 // Ask power resource manager to turn on clocks to the UART |
381 // Ask power resource manager to turn on clocks to the UART |
384 // (this could take some time but we're not in any hurry) |
382 // (this could take some time but we're not in any hurry) |
385 r = PowerResourceManager::ChangeResourceState( iPrmClientId, iUart.PrmFunctionClk(), Prcm::EClkOn ); |
383 r = PowerResourceManager::ChangeResourceState( iPrmClientId, iUart.PrmFunctionClk(), Prcm::EClkOn ); |
386 if( r == KErrNone ) |
384 if( r == KErrNone ) |
405 } |
403 } |
406 |
404 |
407 void TSerialKeyboard::UartIsr( TAny* aParam ) |
405 void TSerialKeyboard::UartIsr( TAny* aParam ) |
408 { |
406 { |
409 TSerialKeyboard* self = reinterpret_cast<TSerialKeyboard*>( aParam ); |
407 TSerialKeyboard* self = reinterpret_cast<TSerialKeyboard*>( aParam ); |
410 |
408 |
411 const TUint iir = Omap3530Uart::IIR::iMem.Read( self->iUart ); |
409 const TUint iir = Omap3530Uart::IIR::iMem.Read( self->iUart ); |
412 |
410 |
413 if ( 0 == (iir bitand Omap3530Uart::IIR::IT_PENDING::KMask) ) |
411 if ( 0 == (iir bitand Omap3530Uart::IIR::IT_PENDING::KMask) ) |
414 { |
412 { |
415 const TUint pending = iir bitand Omap3530Uart::IIR::IT_TYPE::KFieldMask; |
413 const TUint pending = iir bitand Omap3530Uart::IIR::IT_TYPE::KFieldMask; |
417 // Although the TI datasheet descrivwed IT_TYPE as being an enumerated priority-decoded interrupt |
415 // Although the TI datasheet descrivwed IT_TYPE as being an enumerated priority-decoded interrupt |
418 // it appears to actually be a bitmask of active interrupt sources |
416 // it appears to actually be a bitmask of active interrupt sources |
419 if ( (pending bitand Omap3530Uart::IIR::IT_TYPE::ERHR) || (pending bitand Omap3530Uart::IIR::IT_TYPE::ERxLineStatus) ) |
417 if ( (pending bitand Omap3530Uart::IIR::IT_TYPE::ERHR) || (pending bitand Omap3530Uart::IIR::IT_TYPE::ERxLineStatus) ) |
420 { |
418 { |
421 TUint byte = self->iUart.Read(); |
419 TUint byte = self->iUart.Read(); |
422 |
420 |
423 if( KMagicCrashValue == byte ) |
421 if( KMagicCrashValue == byte ) |
424 { |
422 { |
425 Kern::Fault( "SERKEY-FORCED", 0 ); |
423 Kern::Fault( "SERKEY-FORCED", 0 ); |
426 } |
424 } |
427 else |
425 else |
465 break; |
463 break; |
466 |
464 |
467 case EEscaping2: |
465 case EEscaping2: |
468 { |
466 { |
469 TInt index = self->iKey - KEscapeBase; |
467 TInt index = self->iKey - KEscapeBase; |
470 |
468 |
471 if ( (index >= 0) && (index < KEscapeCount) ) |
469 if ( (index >= 0) && (index < KEscapeCount) ) |
472 { |
470 { |
473 self->AddKey( KEscapedScanCode[ index ] ); |
471 self->AddKey( KEscapedScanCode[ index ] ); |
474 } |
472 } |
475 else |
473 else |
496 const TBool func = ISFUNC(aKey); |
494 const TBool func = ISFUNC(aKey); |
497 const TUint8 stdKey = STDKEY(aKey); |
495 const TUint8 stdKey = STDKEY(aKey); |
498 |
496 |
499 TRawEvent e; |
497 TRawEvent e; |
500 |
498 |
501 |
499 |
502 if ( func ) |
500 if ( func ) |
503 { |
501 { |
504 e.Set( TRawEvent::EKeyDown, EStdKeyRightFunc, 0 ); |
502 e.Set( TRawEvent::EKeyDown, EStdKeyRightFunc, 0 ); |
505 Kern::AddEvent( e ); |
503 Kern::AddEvent( e ); |
506 } |
504 } |
507 |
505 |
508 if ( ctrl ) |
506 if ( ctrl ) |
509 { |
507 { |
510 e.Set( TRawEvent::EKeyDown, EStdKeyRightCtrl, 0 ); |
508 e.Set( TRawEvent::EKeyDown, EStdKeyRightCtrl, 0 ); |
511 Kern::AddEvent( e ); |
509 Kern::AddEvent( e ); |
512 } |
510 } |