351 TInt TSerialKeyboard::Create() |
351 TInt TSerialKeyboard::Create() |
352 { |
352 { |
353 TInt r = KErrNone; |
353 TInt r = KErrNone; |
354 |
354 |
355 const Omap3530Uart::TUartNumber portNumber( Omap3530Assp::DebugPortNumber() ); |
355 const Omap3530Uart::TUartNumber portNumber( Omap3530Assp::DebugPortNumber() ); |
356 |
356 |
357 if( portNumber >= 0 ) |
357 if( portNumber >= 0 ) |
358 { |
358 { |
|
359 #ifdef USE_SYMBIAN_PRM |
359 // Register with the power resource manager |
360 // Register with the power resource manager |
360 _LIT( KName, "serkey" ); |
361 _LIT( KName, "serkey" ); |
361 /*r = PowerResourceManager::RegisterClient( iPrmClientId, KName ); |
362 r = PowerResourceManager::RegisterClient( iPrmClientId, KName ); |
|
363 __KTRACE_OPT(KBOOT,Kern::Printf("+TSerialKeyboardl::Create:PRM client ID=%x, err=%d", iPrmClientId, r)); |
362 if( r != KErrNone ) |
364 if( r != KErrNone ) |
363 { |
365 { |
364 return r; |
366 return r; |
365 }*/ |
367 } |
366 |
368 #endif |
367 __KTRACE_OPT(KBOOT,Kern::Printf("+TSerialKeyboardl::Create:PRM client ID=%x", iPrmClientId )) ; |
|
368 Kern::Printf("+TSerialKeyboardl::Create:PRM client ID=%x", iPrmClientId ); |
|
369 |
369 |
370 Prcm::SetClockState(iUart.PrcmInterfaceClk(), Prcm::EClkOn); |
370 Prcm::SetClockState(iUart.PrcmInterfaceClk(), Prcm::EClkOn); |
371 Prcm::SetClockState(iUart.PrcmFunctionClk(), Prcm::EClkOn); |
371 Prcm::SetClockState(iUart.PrcmFunctionClk(), Prcm::EClkOn); |
372 |
372 |
373 r = Interrupt::Bind( iUart.InterruptId(), UartIsr, this ); |
373 r = Interrupt::Bind( iUart.InterruptId(), UartIsr, this ); |
374 if ( r < 0 ) |
374 if ( r < 0 ) |
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" ); |
380 Kern::Printf("+TSerialKeyboard::Create bound to interrupt" ); |
381 |
381 |
|
382 #ifdef USE_SYMBIAN_PRM |
382 // Ask power resource manager to turn on clocks to the UART |
383 // Ask power resource manager to turn on clocks to the UART |
383 // (this could take some time but we're not in any hurry) |
384 // (this could take some time but we're not in any hurry) |
384 /*r = PowerResourceManager::ChangeResourceState( iPrmClientId, iUart.PrmFunctionClk(), Prcm::EClkOn ); |
385 r = PowerResourceManager::ChangeResourceState( iPrmClientId, iUart.PrmFunctionClk(), Prcm::EClkOn ); |
385 if( KErrNone != r ) |
386 if( r == KErrNone ) |
386 { |
387 { |
|
388 r = PowerResourceManager::ChangeResourceState( iPrmClientId, iUart.PrmInterfaceClk(), Prcm::EClkOn ); |
|
389 } |
|
390 |
|
391 if( r != KErrNone ) |
|
392 { |
|
393 __KTRACE_OPT(KBOOT, Kern::Printf("+TSerialKeyboardl:PRM ChangeResourceState(clock(s)) failed, client ID=%x, err=%d", iPrmClientId, r)); |
387 return r; |
394 return r; |
388 }*/ |
395 } |
389 |
396 #endif |
390 /*r = PowerResourceManager::ChangeResourceState( iPrmClientId, iUart.PrmInterfaceClk(), Prcm::EClkOn ); |
|
391 if( KErrNone != r ) |
|
392 { |
|
393 return r; |
|
394 }*/ |
|
395 |
|
396 // We can assume that the debug output code has already initialized the UART, we just need to prepare it for RX |
397 // We can assume that the debug output code has already initialized the UART, we just need to prepare it for RX |
397 iUart.EnableFifo( Omap3530Uart::TUart::EEnabled, Omap3530Uart::TUart::ETriggerUnchanged, Omap3530Uart::TUart::ETrigger8 ); |
398 iUart.EnableFifo( Omap3530Uart::TUart::EEnabled, Omap3530Uart::TUart::ETriggerUnchanged, Omap3530Uart::TUart::ETrigger8 ); |
398 iUart.EnableInterrupt( Omap3530Uart::TUart::EIntRhr ); |
399 iUart.EnableInterrupt( Omap3530Uart::TUart::EIntRhr ); |
399 |
400 |
400 Interrupt::Enable( iUart.InterruptId() ); |
401 Interrupt::Enable( iUart.InterruptId() ); |