1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kernel/eka/include/drivers/pbus.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,809 @@
1.4 +// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// e32\include\drivers\pbus.h
1.18 +//
1.19 +//
1.20 +
1.21 +/**
1.22 + @file
1.23 + @publishedPartner
1.24 + @released
1.25 +*/
1.26 +
1.27 +#ifndef __P32STD_H__
1.28 +#define __P32STD_H__
1.29 +#include <kernel/kpower.h>
1.30 +
1.31 +#ifdef _DEBUG
1.32 +#define __ENABLE_SIMULATED_MEDIA_CHANGE // Enables simulation of media change events using ControlIO
1.33 +#endif
1.34 +
1.35 +/********************************************
1.36 + * Peripheral Bus Definitions
1.37 + ********************************************/
1.38 +
1.39 +/**
1.40 +Defines the maximum number of media change objects.
1.41 +
1.42 +@see DMediaChangeBase
1.43 +*/
1.44 +const TInt KMaxMediaChanges=4;
1.45 +
1.46 +
1.47 +
1.48 +/**
1.49 +Defines the maximum number of power supply unit (PSU) objects.
1.50 +
1.51 +@see DPBusPsuBase
1.52 +*/
1.53 +const TInt KMaxPBusVccs=4;
1.54 +
1.55 +
1.56 +
1.57 +
1.58 +/**
1.59 + Defines the state of the media, i.e. whether the media door is
1.60 + open or closed.
1.61 +
1.62 + A value of this type is returned by DMediaChangeBase::MediaState().
1.63 +
1.64 + @see DMediaChangeBase::MediaState()
1.65 +*/
1.66 +enum TMediaState {
1.67 + /**
1.68 + Indicates that the media door is open.
1.69 + */
1.70 + EDoorOpen,
1.71 +
1.72 + /**
1.73 + Indicates that the media door is closed.
1.74 + */
1.75 + EDoorClosed};
1.76 +
1.77 +
1.78 +
1.79 +
1.80 +enum TPBusType {EPBusTypeNone,EPBusTypePcCard,EPBusTypeMultiMedia,EPBusTypeUSB};
1.81 +
1.82 +
1.83 +
1.84 +
1.85 +enum TPBusState
1.86 + {
1.87 + EPBusCardAbsent=0,
1.88 + EPBusOff=1,
1.89 + EPBusPoweringUp=2,
1.90 + EPBusOn=3,
1.91 + EPBusPsuFault=4,
1.92 + EPBusPowerUpPending=5,
1.93 + };
1.94 +
1.95 +typedef void (*TPBusCallBackFn)(TAny* aPtr, TInt aReason, TAny* a1, TAny* a2);
1.96 +typedef void (*TPBusIsr)(TAny* aPtr, TInt anId);
1.97 +
1.98 +class DPBusSocket;
1.99 +class TPBusCallBack : public SDblQueLink
1.100 + {
1.101 +public:
1.102 + enum TCallBackReason
1.103 + {
1.104 + EPBusStateChange=0,
1.105 + EPBusCustomNotification=1, // Make this the last value
1.106 + };
1.107 +public:
1.108 + IMPORT_C TPBusCallBack();
1.109 + IMPORT_C TPBusCallBack(TPBusCallBackFn aFunction, TAny* aPtr);
1.110 + IMPORT_C TPBusCallBack(TPBusIsr anIsr, TAny* aPtr, TUint anIntMask);
1.111 +public:
1.112 + inline void NotifyPBusStateChange(TInt aState, TInt anError);
1.113 + inline void NotifyCustom(TInt aParam, TInt anError);
1.114 + inline void Isr(TInt anId);
1.115 +public:
1.116 + inline TInt PowerUp();
1.117 + inline TInt PBusState();
1.118 + inline TDfcQue* DfcQ();
1.119 + inline void Add();
1.120 + IMPORT_C void SetSocket(TInt aSocket);
1.121 + IMPORT_C void Remove();
1.122 +public:
1.123 + DPBusSocket* iSocket;
1.124 + TPBusCallBackFn iFunction;
1.125 + TUint iIntMask;
1.126 + TPBusIsr iIsr;
1.127 + TAny* iPtr;
1.128 + };
1.129 +
1.130 +
1.131 +
1.132 +class DMediaChangeBase : public DBase
1.133 +/**
1.134 +Abstract Base class to handle the insertion and removal of removable media.
1.135 +
1.136 +This class is intended for derivation at the media and variant layers,
1.137 +which handles the media/variant specific functionality such as interrupt detection,
1.138 +and passes notifications of media change to the peripheral bus socket layers.
1.139 +
1.140 +@see DMMCMediaChange
1.141 +
1.142 +@publishedPartner
1.143 +@released
1.144 +*/
1.145 + {
1.146 +public:
1.147 + IMPORT_C DMediaChangeBase(TInt aMediaChangeNum);
1.148 + IMPORT_C virtual TInt Create();
1.149 +public:
1.150 + IMPORT_C void DoorOpenService();
1.151 + IMPORT_C void DoorClosedService();
1.152 + void MediaChangeEvent(TBool aDoorOpened);
1.153 + void AcknowledgeEvent(TBool aDoorOpened);
1.154 + static void DoorOpenDfcFn(TAny* aPtr);
1.155 +public:
1.156 + /**
1.157 + * Implemented at the media and variant layers.
1.158 + * Forces a media change, performs actions as if a door open has occurred.
1.159 + * Used for powering down and restarting media.
1.160 + *
1.161 + * @see DMediaChangeBase::DoDoorOpen()
1.162 + */
1.163 + IMPORT_C virtual void ForceMediaChange()=0;
1.164 +
1.165 + /**
1.166 + * Called by DMediaChangeBase::AcknowledgeEvent when the door is opened.
1.167 + * Implemented at the media and variant layer, DoDoorOpen is invoked
1.168 + * in response to the variant calling ::DoDoorOpenService upon detection of
1.169 + * a door open event.
1.170 + *
1.171 + * @see DMediaChangeBase::DoorOpenService()
1.172 + * @see DMediaChangeBase::DoDoorClosed()
1.173 + */
1.174 + IMPORT_C virtual void DoDoorOpen()=0;
1.175 +
1.176 + /**
1.177 + * Called by DMediaChangeBase::AcknowledgeEvent when the door is closed.
1.178 + * Implemented at the media and variant layer, DoDoorClosed is invoked
1.179 + * in response to the variant calling ::DoorOpenService upon detection of
1.180 + * a door closed event.
1.181 + *
1.182 + * @see DMediaChangeBase::DoorOpenService()
1.183 + * @see DMediaChangeBase::DoDoorOpen()
1.184 + */
1.185 + IMPORT_C virtual void DoDoorClosed()=0;
1.186 +
1.187 + /**
1.188 + * Returns the current state of the door.
1.189 + * Implemented at the variant layer to provide information as to the state of the door.
1.190 + *
1.191 + * @return TMediaState enumeration describing the state of door (EDoorOpen, EDoorClosed)
1.192 + */
1.193 + IMPORT_C virtual TMediaState MediaState()=0;
1.194 +public:
1.195 + /** Unique media change ID, identification scheme is defined by derived classes*/
1.196 + TInt iMediaChangeNum;
1.197 +
1.198 + /** Count of media events yet to be acknowledged.*/
1.199 + TInt iReplyCount;
1.200 +
1.201 + /** Door Open DFC queue.*/
1.202 + TDfc iDoorOpenDfc;
1.203 + };
1.204 +
1.205 +
1.206 +
1.207 +
1.208 +/**
1.209 + Defines the required state of the PSU.
1.210 +
1.211 + A value of this type is passed to DPBusPsuBase::DoSetState().
1.212 +
1.213 + @see DPBusPsuBase::DoSetState()
1.214 +*/
1.215 +enum TPBusPsuState {
1.216 + /**
1.217 + Indicates that the PSU is to be turned off.
1.218 + */
1.219 + EPsuOff,
1.220 +
1.221 + /**
1.222 + Indicates that the PSU is to be turned on in current
1.223 + limit mode.
1.224 +
1.225 + Some power supplies can be turned on in a mode that only
1.226 + supplies a limited amount of current to the device.
1.227 + A faulty device drawing excessive current would cause
1.228 + the PSU output voltage to fall, and would be detected
1.229 + by the PSU's voltage checking mechanism. After a brief
1.230 + checking period in current limit mode, the PSU is
1.231 + subsequently turned fully on.
1.232 +
1.233 + For PSU's that don't support current limit mode, this is
1.234 + treated in the same way as EPsuOnFull.
1.235 + */
1.236 + EPsuOnCurLimit,
1.237 +
1.238 + /**
1.239 + Indicates that the PSU is to be turned fully on.
1.240 + */
1.241 + EPsuOnFull
1.242 + };
1.243 +
1.244 +
1.245 +
1.246 +
1.247 +enum TPBusPsuStatus {EPsuStatOff,EPsuStatOn,EPsuStatError};
1.248 +
1.249 +
1.250 +
1.251 +
1.252 +const TInt KPBusPsuTickInterval=1000000; // Units 1uS
1.253 +
1.254 +
1.255 +
1.256 +
1.257 +/**
1.258 + A bit value that is set into the TPBusPsuInfo::iVoltCheckInterval member to
1.259 + indicate that the checking of the PSU voltage level can be performed when
1.260 + the power supply is first turned on.
1.261 +*/
1.262 +const TUint KPsuChkWhileOn=0x00000001;
1.263 +
1.264 +
1.265 +
1.266 +
1.267 +/**
1.268 + A bit value that is set into the TPBusPsuInfo::iVoltCheckInterval member to
1.269 + indicate that the checking of the PSU voltage level can be performed
1.270 + periodically when the power supply is on.
1.271 +*/
1.272 +const TUint KPsuChkOnPwrUp=0x00000002;
1.273 +
1.274 +
1.275 +
1.276 +
1.277 +/**
1.278 + Defines the methods that can be used by the platform hardware for checking
1.279 + the VCC voltage while on.
1.280 +*/
1.281 +enum TPsuVoltChkMethod {
1.282 + /**
1.283 + Indicates a simple good/bad check method normally using
1.284 + a comparator arrangement.
1.285 + */
1.286 + EPsuChkComparator,
1.287 +
1.288 + /**
1.289 + Not implemented.
1.290 + */
1.291 + EPsuChkADCType1,
1.292 +
1.293 + /**
1.294 + Not implemented.
1.295 + */
1.296 + EPsuChkADCType2
1.297 + };
1.298 +
1.299 +
1.300 +
1.301 +
1.302 +/**
1.303 + Encapsulates power supply information.
1.304 +
1.305 + An object of this type is passed to concrete implementations of
1.306 + DPBusPsuBase::PsuInfo(), which are required to fill
1.307 + the data members of the object.
1.308 +*/
1.309 +class TPBusPsuInfo
1.310 + {
1.311 +public:
1.312 + /**
1.313 + Indicates the voltage level, or range of voltages supported .
1.314 +
1.315 + The voltage level, or range of voltages is reported as a bit mask
1.316 + in the same format as defined for the OCR register.
1.317 +
1.318 + If the PSU supports voltage adjustment, rather than a single fixed value,
1.319 + then bit31 should be set to indicate this fact
1.320 + as well as setting the appropriate bits to indicate the adjustable voltage
1.321 + range supported.
1.322 + */
1.323 + TUint iVoltageSupported;
1.324 +
1.325 + /**
1.326 + The maximum current (in microAmps) that the PSU is able to supply.
1.327 + */
1.328 + TInt iMaxCurrentInMicroAmps;
1.329 +
1.330 + /**
1.331 + Indicates whether the platform hardware has support for checking whether
1.332 + the voltage level of the PSU is within its expected voltage limit while turned on.
1.333 +
1.334 + Such a mechanism could detect when a faulty card is drawing excessive current.
1.335 +
1.336 + Set one or both of the bits KPsuChkWhileOn and KPsuChkOnPwrUp,
1.337 + if there is support for voltage checking.
1.338 + Set neither bit if there is no support for voltage checking.
1.339 +
1.340 + @see KPsuChkWhileOn
1.341 + @see KPsuChkOnPwrUp
1.342 + */
1.343 + TUint iVoltCheckInterval;
1.344 +
1.345 + /**
1.346 + Indicates the method used by the platform hardware for checking
1.347 + the VCC voltage while on.
1.348 +
1.349 + The method used is identified using the values of
1.350 + the TPsuVoltChkMethod enum.
1.351 +
1.352 + @see TPsuVoltChkMethod
1.353 + @see DPBusPsuBase::DoCheckVoltage()
1.354 + */
1.355 + TPsuVoltChkMethod iVoltCheckMethod;
1.356 +
1.357 + /**
1.358 + Bus not locked timeout period, in seconds, when no clients are registered.
1.359 +
1.360 + Set to 0 to disable the not locked timer.
1.361 + */
1.362 + TInt iNotLockedTimeOut;
1.363 +
1.364 + /**
1.365 + Bus inactivity timeout period, in seconds, when clients are registered.
1.366 +
1.367 + Set to 0 to disable the inactivity timer.
1.368 + */
1.369 + TInt iInactivityTimeOut;
1.370 + };
1.371 +
1.372 +
1.373 +typedef void (*PsuPwrDownCheckFn)(TAny*);
1.374 +/**
1.375 +Perherpial bus base class to control the power supply.
1.376 +
1.377 +This class is intended for derivation at both the media driver and variant layer,
1.378 +which respectively handle the media/variant specific functionality of the power supply.
1.379 +
1.380 +@see DMMCPsu
1.381 +
1.382 +@publishedPartner
1.383 +@released
1.384 +*/
1.385 +class DPBusPsuBase : public DBase
1.386 + {
1.387 +public:
1.388 + /** Currently not in use. */
1.389 + enum TResetMode {
1.390 + /** Currently not in use.*/
1.391 + ENormalAndRestorable,
1.392 + /** Currently not in use.*/
1.393 + EQuickButRestorable,
1.394 + /** Currently not in use.*/
1.395 + EQuickAndNotRestorable
1.396 + };
1.397 +public:
1.398 + DPBusPsuBase(TInt aPsuNum, TInt aMediaChangeNum);
1.399 + IMPORT_C TInt SetState(TPBusPsuState aState);
1.400 + TPBusPsuStatus Status();
1.401 + TInt CheckVoltage(TUint aCheckStatus);
1.402 + void Reset();
1.403 +public:
1.404 + TInt Create();
1.405 + IMPORT_C virtual TInt DoCreate();
1.406 + IMPORT_C virtual void DoTickService();
1.407 + IMPORT_C virtual TBool IsLocked();
1.408 +public:
1.409 + IMPORT_C virtual void DoSetState(TPBusPsuState aState)=0;
1.410 +
1.411 + /**
1.412 + Base abstract method.
1.413 + Checks the voltage level of the PSU is as expected.
1.414 + The result is returned by a call to DPBusPsuBase::ReceiveVoltageCheckResult(),
1.415 + passing either KErrNone, KErrGeneral to indicate the pass/fail state or
1.416 + KErrNotReady if the voltage check isn't complete.
1.417 +
1.418 + Provided at the variant layer.
1.419 + */
1.420 + IMPORT_C virtual void DoCheckVoltage()=0;
1.421 +
1.422 + /**
1.423 + Fills in the supplied TPBusPsuInfo object with the characteristics of the platform.
1.424 + Provided at the variant layer.
1.425 +
1.426 + @param anInfo A reference to a TPBusPsuInfo to be filled in with the PSU characteristics.
1.427 + */
1.428 + IMPORT_C virtual void PsuInfo(TPBusPsuInfo &anInfo)=0;
1.429 +
1.430 + IMPORT_C virtual void ReceiveVoltageCheckResult(TInt anError);
1.431 +public:
1.432 + inline TUint VoltageSupported();
1.433 + inline void SetCurrLimited();
1.434 + inline TBool IsOff();
1.435 + inline TInt MaxCurrentInMicroAmps();
1.436 + inline void ResetInactivityTimer();
1.437 +public:
1.438 + void PwrDownCheck();
1.439 + static void DoPwrDownCheck(TAny* aPtr);
1.440 +public:
1.441 + /** Unique power supply unit identification number.*/
1.442 + TInt iPsuNum;
1.443 +
1.444 + /** Currently not in use. */
1.445 + TInt iMediaChangeNum;
1.446 +
1.447 + /**
1.448 + Indicates the method used by the platform hardware for checking
1.449 + the VCC voltage while on.
1.450 +
1.451 + The method used is identified using the values of
1.452 + the TPsuVoltChkMethod enum.
1.453 +
1.454 + @see TPsuVoltChkMethod
1.455 + @see DPBusPsuBase::DoCheckVoltage()
1.456 + */
1.457 + TPsuVoltChkMethod iVoltCheckMethod;
1.458 +
1.459 + /**
1.460 + Current PSU State.
1.461 + @see TPBusPsuState
1.462 + */
1.463 + TPBusPsuState iState;
1.464 +
1.465 + /** PSU current is limited to a safe level. */
1.466 + TBool iCurrLimited;
1.467 +
1.468 + /** PSU Tick Timer */
1.469 + TTickLink iTickLink;
1.470 +
1.471 + /**
1.472 + Indicates the voltage level, or range of voltages supported .
1.473 +
1.474 + The voltage level, or range of voltages is reported as a bit mask
1.475 + in the same format as defined for the OCR register.
1.476 +
1.477 + If the PSU supports voltage adjustment, rather than a single fixed value,
1.478 + then bit31 should be set to indicate this fact
1.479 + as well as setting the appropriate bits to indicate the adjustable voltage
1.480 + range supported.
1.481 + */
1.482 + TUint iVoltageSupported;
1.483 +
1.484 + /** The maximum current (in microAmps) that the PSU is able to supply. */
1.485 + TInt iMaxCurrentInMicroAmps;
1.486 +
1.487 + /**
1.488 + Indicates whether the platform hardware has support for checking whether
1.489 + the voltage level of the PSU is within its expected voltage limit while turned on.
1.490 +
1.491 + Such a mechanism could detect when a faulty card is drawing excessive current.
1.492 +
1.493 + Set one or both of the bits KPsuChkWhileOn and KPsuChkOnPwrUp,
1.494 + if there is support for voltage checking.
1.495 + Set neither bit if there is no support for voltage checking.
1.496 +
1.497 + @see KPsuChkWhileOn
1.498 + @see KPsuChkOnPwrUp
1.499 + */
1.500 + TUint iVoltCheckInterval;
1.501 +
1.502 + /** Bus inactivity counter. */
1.503 + TInt iInactivityCount;
1.504 +
1.505 + /** Bus not locked counter. */
1.506 + TInt iNotLockedCount;
1.507 +
1.508 + /** Bus inactivity timeout period, in seconds, when clients are registered. */
1.509 + TInt iInactivityTimeout;
1.510 +
1.511 + /** Bus not locked timeout period, in seconds, when no clients are registered. */
1.512 + TInt iNotLockedTimeout;
1.513 +
1.514 + /** DPBusSocket which the PSU powers. */
1.515 + DPBusSocket* iSocket; // for the moment assume a PSU only powers one socket
1.516 +
1.517 + /**
1.518 + DFC to handle PSU Tick.
1.519 + @see DPBusPsuBase::DoTickService()
1.520 + @see TDfc
1.521 + */
1.522 + TDfc iPsuDfc;
1.523 +
1.524 + /** Power Down Function to be utilised, default is PwrDownCheck */
1.525 + PsuPwrDownCheckFn iPwrDownCheckFn;
1.526 +
1.527 +private:
1.528 + TUint32 reserved[4];
1.529 + };
1.530 +
1.531 +NONSHARABLE_CLASS(DPBusPowerHandler) : public DPowerHandler
1.532 + {
1.533 +public:
1.534 + DPBusPowerHandler(DPBusSocket* aSocket);
1.535 +public: // from DPowerHandler
1.536 + // signals from manager to client
1.537 + void PowerUp();
1.538 + void PowerDown(TPowerState);
1.539 +public:
1.540 + DPBusSocket* iSocket;
1.541 + };
1.542 +
1.543 +/** Abstract base class for a PBUS socket.
1.544 + DPBusSocket derived class object oversees the power supply and media change functionality with the socket.
1.545 +*/
1.546 +NONSHARABLE_CLASS(DPBusSocket) : public DBase
1.547 + {
1.548 +public:
1.549 + /**
1.550 + Panic codes to handle the invalid powerup and powerdown state of the PBUS.
1.551 + @see TPBusState
1.552 + */
1.553 + enum TPanic
1.554 + {
1.555 + /**
1.556 + Indicates the invalid door close state.
1.557 + */
1.558 + EDoorCloseInvalidState=0,
1.559 +
1.560 + /**
1.561 + Indicates the invalid powerup state of PBUS, considered as invalid if iState is other than TPBusState while powering up.
1.562 + */
1.563 + EPowerUpInvalidState=1,
1.564 +
1.565 + /** Indicates invalid handler state corresponding to powerup event */
1.566 + EPowerUpInvalidHandlerState=2,
1.567 +
1.568 + /** Invalid return code corresponding to powerup event */
1.569 + EPowerUpInvalidReturnCode=3,
1.570 +
1.571 + /**
1.572 + Indicates the invalid powerdown state of the media device,
1.573 + considered as invalid if iState is other than TPBusState while powering down.
1.574 + */
1.575 + EEmergencyPowerDownInvalidState=4,
1.576 +
1.577 + /**
1.578 + Indicates the invalid powerup state of the media device,
1.579 + considered as invalid if iState is not in (EPBusCardAbsent,EPBusOff and EPBusPowerUpPending) while on transition from standby.
1.580 + */
1.581 + EMcPowerUpInvalidState=5,
1.582 + };
1.583 +
1.584 + /**
1.585 + The purpose of this enumeration is to handle the postponed events corresponding to media change and power down event.
1.586 + */
1.587 + enum TPostponedEvent
1.588 + {
1.589 + /** Handles the postponed media change event */
1.590 + EMediaChange=1,
1.591 +
1.592 + /** Handles the postponed power down event */
1.593 + EPowerDown=2,
1.594 + };
1.595 +
1.596 + /**
1.597 + Enumeration for handling debug functionality.
1.598 + */
1.599 + enum TPBusDebugFunction
1.600 + {
1.601 + /** Media state used for simulation purposes */
1.602 + EControlMediaState
1.603 + };
1.604 +
1.605 + /**
1.606 + PBUS simulated media states.
1.607 + */
1.608 + enum TPBusSimulateMediaState
1.609 + {
1.610 + /** Normal State */
1.611 + EPeriphBusMediaNormal=0,
1.612 +
1.613 + /** Simulated door open */
1.614 + EPeriphBusDoorOpen=1,
1.615 +
1.616 + /** Simulated door close with media absent */
1.617 + EPeriphBusMediaRemoved=2,
1.618 +
1.619 + /** Simulated door close with media present */
1.620 + EPeriphBusMediaPresent=3,
1.621 +
1.622 + /** Simulate two consecutive door open interrupts */
1.623 + EPeriphBusMediaDoubleDoorOpen=4
1.624 + };
1.625 +
1.626 +public:
1.627 + DPBusSocket(TInt aSocketNumber);
1.628 + IMPORT_C static DPBusSocket* SocketFromId(TInt anId);
1.629 + IMPORT_C static void Panic(DPBusSocket::TPanic aPanic);
1.630 +public:
1.631 + virtual TInt Create(const TDesC* aName);
1.632 + virtual TInt Init();
1.633 +
1.634 + /**
1.635 + Initiates a power up sequence on the stack. This method should be implemented by the derived class.
1.636 + The implementation should call PowerUpSequenceComplete() to notify the status on completion of power up sequence.
1.637 +
1.638 + @see DMMCSocket::InitiatePowerUpSequence()
1.639 + @see DMMCStack::PowerUpStack()
1.640 + */
1.641 + virtual void InitiatePowerUpSequence()=0;
1.642 +
1.643 + /**
1.644 + Indicates the presence of a card. This method should be implemented by the derived class.
1.645 + The implementation should use variant specific implementation of CardDetect() method to detect the card presence.
1.646 +
1.647 + @return ETrue if a card is present, else EFalse
1.648 + @see DMMCStack::CardDetect()
1.649 + */
1.650 + virtual TBool CardIsPresent()=0;
1.651 +
1.652 + /**
1.653 + Resets the socket. This method should be implemented by the derived class.
1.654 + The implementation should cancel powerup timer and DFC queue if any of this request is outstanding,
1.655 + Power down the stack.
1.656 +
1.657 + @see DMMCSocket::Reset1()
1.658 + */
1.659 + virtual void Reset1()=0;
1.660 +
1.661 + /**
1.662 + Resets the socket on media change event.This method should be implemented by the derived class.
1.663 + The implementation should remove any allocated memory following a media change event.
1.664 +
1.665 + */
1.666 + virtual void Reset2()=0;
1.667 +public:
1.668 + inline TInt State();
1.669 + inline TDfcQue* DfcQ();
1.670 + inline TMediaState MediaState();
1.671 +public:
1.672 + IMPORT_C void Add(TPBusCallBack* aCallBack);
1.673 + IMPORT_C TInt PowerUp();
1.674 + IMPORT_C void ForceMediaChange();
1.675 + IMPORT_C TInt InCritical();
1.676 + IMPORT_C void EndInCritical();
1.677 + IMPORT_C void DeltaCurrentConsumption(TInt aDelta);
1.678 + IMPORT_C void PowerUpSequenceComplete(TInt anError);
1.679 + void PsuFault(TInt anError);
1.680 + void PsuTimeout();
1.681 + void ResetSocket(TBool aFullReset);
1.682 + void ChangeState(TInt aState, TInt anError);
1.683 + void MediaChangeEvent(TBool aDoorOpened);
1.684 + void DoorOpenEvent();
1.685 + void DoorCloseEvent();
1.686 + void Isr(TInt anId);
1.687 + void DoPowerUp();
1.688 + void DoPowerDown();
1.689 + IMPORT_C void PowerDownComplete();
1.690 + IMPORT_C void RequestAsyncPowerDown();
1.691 + IMPORT_C virtual TInt ControlIO(TInt aFunction, TAny* aParam1, TAny* aParam2);
1.692 +public:
1.693 + /**
1.694 + Current PBus type.
1.695 + @see TPBusType
1.696 + */
1.697 + TPBusType iType;
1.698 + /**
1.699 + Current socket number.
1.700 + */
1.701 + TInt iSocketNumber;
1.702 + /**
1.703 + Name of the socket.
1.704 + */
1.705 + const TDesC* iName;
1.706 + /**
1.707 + Current state of Peripheral bus controller.
1.708 + @see TPBusState
1.709 + */
1.710 + TInt iState;
1.711 + /**
1.712 + Counter to keep track of postponed events.
1.713 + */
1.714 + TInt iPostponeCount;
1.715 + /**
1.716 + Current postponed events.
1.717 + @see TPostponedEvent
1.718 + */
1.719 + TUint16 iPostponedEvents;
1.720 + /**
1.721 + Current simulated state of the Media.
1.722 + @see TPBusSimulateMediaState
1.723 + */
1.724 + TUint16 iSimulatedMediaState;
1.725 + /**
1.726 + The call back functions queue.
1.727 + @see SDblQue
1.728 + */
1.729 + SDblQue iCallBackQ;
1.730 + /**
1.731 + Pointer to DPBusPowerController object.
1.732 + @see DPBusPowerHandler
1.733 + */
1.734 + DPBusPowerHandler* iPowerHandler;
1.735 +
1.736 + /**
1.737 + Holds media change number.
1.738 + @see MediaChangeFromSocket
1.739 + */
1.740 + TInt iMediaChangeNumber;
1.741 +
1.742 + /**
1.743 + Pointer to DMediaChangeBase object.
1.744 + @see DMediaChangeBase
1.745 + */
1.746 + DMediaChangeBase* iMediaChange;
1.747 +
1.748 + /**
1.749 + Holds the state of media door.
1.750 + Updated when there is change in media event corresponing to Door open.
1.751 + @see DMediaChangeBase::DoorOpenService()
1.752 + @see TMediaState
1.753 + */
1.754 + TBool iDoorOpened;
1.755 +
1.756 + /**
1.757 + Pointer to DPBusPsuBase object.
1.758 + @see DPBusPsuBase
1.759 + */
1.760 + DPBusPsuBase* iVcc;
1.761 +
1.762 + /**
1.763 + Indicates the device is in standby state (i.e. Sets to ETrue when the device is in standby state).
1.764 + */
1.765 + TBool iStandby;
1.766 +
1.767 + /**
1.768 + DFC to handle media change events like (DoorOpen,DoorClose).
1.769 + @see DMediaChangeBase::AcknowledgeEvent
1.770 + @see TDfc
1.771 + */
1.772 + TDfc iMediaChangeDfc;
1.773 +
1.774 + /**
1.775 + DFC to handle powering up of the device.
1.776 + @see TDfc
1.777 + */
1.778 + TDfc iPowerUpDfc;
1.779 +
1.780 + /**
1.781 + DFC to handle powerdown state of the device.
1.782 +
1.783 + @see TDfc
1.784 + */
1.785 + TDfc iPowerDownDfc;
1.786 +
1.787 + /**
1.788 + DFC to handle PSU Tick.
1.789 + @see DPBusPsuBase::DoTickService()
1.790 + @see TDfc
1.791 + */
1.792 + TDfc iPsuDfc;
1.793 +
1.794 + /**
1.795 + The DFC queue used for driver functions.
1.796 + @see TDfcQue
1.797 + */
1.798 + TDfcQue iDfcQ;
1.799 +
1.800 + /**
1.801 + Used when there is request for power down of the device from client.
1.802 + */
1.803 + TInt iRequestPowerDownCount;
1.804 + };
1.805 +
1.806 +GLREF_D DMediaChangeBase* TheMediaChanges[KMaxMediaChanges];
1.807 +GLREF_D DPBusSocket* TheSockets[KMaxPBusSockets];
1.808 +GLREF_D DPBusPsuBase* TheVccs[KMaxPBusVccs];
1.809 +GLREF_D DPBusPsuBase* TheVccCores[KMaxPBusVccs];
1.810 +
1.811 +#include <drivers/pbus.inl>
1.812 +#endif