os/kernelhwsrv/kernel/eka/include/drivers/pccd_ifc.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kernel/eka/include/drivers/pccd_ifc.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,294 @@
     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\pccd_ifc.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 __PCCD_IFC_H__
    1.28 +#define __PCCD_IFC_H__
    1.29 +#include <pccard.h>
    1.30 +#include <drivers/locmedia.h>
    1.31 +#include <platform.h>
    1.32 +#include <assp.h>
    1.33 +
    1.34 +#define __PCCD_MACHINE_CODED__
    1.35 +
    1.36 +const TInt KMemConfigByteAccess=1;
    1.37 +
    1.38 +class PccdIfc
    1.39 +	{
    1.40 +public:
    1.41 +	static DPcCardSocket* NewSocket(TInt aSocketNum);
    1.42 +	static DPcCardMediaChange* NewMediaChange(TInt aMcId);
    1.43 +	static DPcCardVcc* NewVcc(TInt aVccNum, TInt aMcId);
    1.44 +	static DPccdChunkBase* NewChunk(TPccdMemType aType);
    1.45 +	};
    1.46 +
    1.47 +	/**
    1.48 +	 A base class that defines a Pc Card controller interface.
    1.49 +	 
    1.50 +	 @publishedPartner
    1.51 +	 @released
    1.52 +	 */
    1.53 +class TPcCardControllerInterface
    1.54 +	{
    1.55 +public:
    1.56 +	/**
    1.57 +	 Allocate any resources. Only done once on kernel initialization so don't worry about cleanup if it fails.
    1.58 +     
    1.59 +	 @return KErrNone if successful in allocating memory for the Pc Card. otherwise return KErrNoMemory.
    1.60 +	 */
    1.61 +	IMPORT_C TInt Create();
    1.62 +public:
    1.63 +    /**
    1.64 + 	 Gets the physical address of Pc Card memory.
    1.65 +     
    1.66 +	 @param aCard  A Pc Card whose physical address to be returned.
    1.67 +     
    1.68 +	 @param aType  Memory type  of the Pc Card whose physical address to be returned.
    1.69 +     
    1.70 +	 @return Physical address of Pc Card for the given memory type.
    1.71 +	 
    1.72 +	 @see TPccdMemType
    1.73 +	 */    
    1.74 +	virtual TUint32 MemPhysicalAddress(TInt aCard,TPccdMemType aType)=0;
    1.75 +	/** 
    1.76 +	 Sets the Pc Card controller h/w.
    1.77 +	 
    1.78 +	 Initialise the Pc Card Controller h/w.
    1.79 +	 
    1.80 +	 @return KErrNone if Pc Card contorller h/w is initialised.
    1.81 +     */
    1.82 +	virtual TInt Init()=0;
    1.83 +    /**
    1.84 +	 Gets the current settings for the Pc Card.
    1.85 +     
    1.86 +	 @param aCard  A Pc Card whose signals to be indicated.
    1.87 +     
    1.88 +	 @param anInd  Has current settings for the PC Card indicator signals into 'anInd' for the specified aCard.
    1.89 +   	 
    1.90 +	 @return KErrNone if successful.
    1.91 +	 
    1.92 +	 @see TSocketIndicators.
    1.93 +	 */
    1.94 +	virtual TInt Indicators(TInt aCard,TSocketIndicators &anInd)=0;
    1.95 +    /**
    1.96 + 	 Enables the Pc Card Interface.
    1.97 +     
    1.98 +	 @param aCard  A Pc Card whose interface to be enabled.
    1.99 +	 */
   1.100 +	virtual void InterfaceOn(TInt aCard)=0;
   1.101 +	/**
   1.102 + 	 Disables the Pc Card Interface.
   1.103 +     
   1.104 +	 @param aCard  A PC Card whose interface to be disabled.
   1.105 +	 */
   1.106 +	virtual void InterfaceOff(TInt aCard)=0;
   1.107 +	/**
   1.108 + 	 To Apply/remove h/w reset.
   1.109 +
   1.110 +     @param aCard  A Pc Card which has to be h/w reseted.
   1.111 +
   1.112 +     @param anAssert To make the h/w reset guarented.
   1.113 +	 */
   1.114 +    virtual void CardReset(TInt aCard,TBool anAssert)=0;
   1.115 +	/**
   1.116 + 	 Gets Pc Card Rdy/Bsy status.
   1.117 +
   1.118 +     @param aCard  Pc Card whose status to be returned.
   1.119 +
   1.120 +	 @return True if the card is ready.
   1.121 +	 */
   1.122 +    virtual TBool CardReady(TInt aCard)=0;
   1.123 +	/** 
   1.124 +	 Configure memory configuration options.
   1.125 +
   1.126 +     @param aCard   Pc Card whose memory to be configured.
   1.127 +     
   1.128 +	 @param aMemType  Type of memory to be configured.
   1.129 +
   1.130 +     @param aSpeed    Access speed of the memory involved.
   1.131 +	 
   1.132 +	 @param aWaitSig  This WaitSig should never checked since repeated accesses to MECR seem to crash the system
   1.133 +	  in mysterious ways.
   1.134 +
   1.135 +	 @param aFlag    To modify the memory configuration attributes by ORing with memory chunk setup flags pKPccdBusWidth32 and KPccdDisableWaitStateCntrl  ,
   1.136 +
   1.137 +	 @return KErrNone if successful, KErrNotSupported if unsuccessful.
   1.138 +
   1.139 +	 @see TPccdMemType.
   1.140 +
   1.141 +	 @see TPccdAccessSpeed.
   1.142 +     */
   1.143 +	virtual TInt MemConfig(TInt aCard,TPccdMemType aMemType,TPccdAccessSpeed aSpeed,TBool aWaitSig,TUint aFlag)=0;
   1.144 +    /**
   1.145 +     Gets the information of the socket.
   1.146 +
   1.147 +     @param aSocket  Socket whose information to be retrieved.
   1.148 +
   1.149 +     @param anInfo  Gets the socket information in anInfo.
   1.150 +     
   1.151 +	 @see TPcCardSocketInfo.
   1.152 +	 */
   1.153 +    virtual void SocketInfo(TSocket aSocket,TPcCardSocketInfo& anInfo)=0;
   1.154 +	/**
   1.155 +     Checks the specified socket contains a card (and the media door for the socket is closed).
   1.156 +
   1.157 +  	 @param anInfo  Has the socket information.
   1.158 +
   1.159 +     @param aCard  Socket for which a card presence is checked.
   1.160 +
   1.161 +	 @return True if the socket contians a card (and the media door for the socket is closed).
   1.162 +	 */
   1.163 +	virtual TBool CardIsPresent(TInt aCard)=0;
   1.164 +    /**
   1.165 +  	 Gets the changed state  of the specified media (ex,removed,inserted..)
   1.166 +     
   1.167 +     @param aMediaChangeId  stores the state of the specified media change
   1.168 +
   1.169 +	 @return Mediastate when change to media takes place.
   1.170 +
   1.171 +	 @see TMediaState.
   1.172 +	 */   
   1.173 +	virtual TMediaState MediaState(TInt aMediaChangeId)=0;
   1.174 +    // Pc Card PSUs
   1.175 +	/**
   1.176 +  	 Sets Vcc information for the Pc Card.
   1.177 +
   1.178 +     @param aPsu    Power supply unit value supplied for the Pc Card.
   1.179 +
   1.180 +     @param aninfo  Object of TPBusPsuInfo type passed to store the PSU information.
   1.181 +
   1.182 +	 @see TPBusPsuInfo.
   1.183 +	 */
   1.184 +	virtual void VccInfo(TInt aPsu,TPBusPsuInfo &aninfo)=0;
   1.185 +	/**
   1.186 +     Sets Pc Card Vcc power supply OFF.
   1.187 +
   1.188 +     @param aPsu  Power supply unit  for the Pc Card.
   1.189 +	 */
   1.190 +    virtual void VccOff(TInt aPsu)=0;
   1.191 +	/**
   1.192 +  	 Sets Pc Card Vcc power supply ON.
   1.193 +
   1.194 +     @param aPsu  Power supply unit  for the Pc Card.
   1.195 +
   1.196 +     @param aVoltageSetting  A voltage to power on Pc Card which is defined in enum TPccdSocketVcc.
   1.197 +
   1.198 +	 @see TPccdSocketVcc
   1.199 +	 */
   1.200 +    virtual void VccOnFull(TInt aPsu,TPccdSocketVcc aVoltageSetting)=0;
   1.201 +    /**
   1.202 +	 Sets Pc Card Vcc power supply ON with current limit.
   1.203 +
   1.204 +	 @param aPsu  Power supply unit  for the Pc Card.
   1.205 +
   1.206 + 	 @param aVoltageSetting  A voltage of current limt to power on Pc Card which is defined in enum TPccdSocketVcc.
   1.207 +
   1.208 +	 @see TPccdSocketVcc
   1.209 +	 */
   1.210 +    virtual void VccOnCurrentLimit(TInt aPsu,TPccdSocketVcc aVoltageSetting)=0;
   1.211 +    /**
   1.212 +	 Sets Pc Card Vcc level (normally ADC reading). Return KErrNotReady if the voltage check isn't complete.
   1.213 +
   1.214 +	 @param aPsu  Power supply unit  for the Pc Card.
   1.215 +  	 */
   1.216 +    virtual TInt VccInMilliVolts(TInt aPsu)=0;
   1.217 +	/*
   1.218 +	 Gets Pc Card Vcc voltage status. 
   1.219 +
   1.220 +	 An alternative to using ADC, when voltage checking is performed using a comparator arrangement. 
   1.221 +
   1.222 +	 @param aPsu Power supply unit for the Pc Card.
   1.223 +
   1.224 +	 @return KErrNone if successful, KErrGeneral if failed.
   1.225 +	 */
   1.226 +	virtual TInt VccVoltCheck(TInt aPsu)=0;
   1.227 +	// interrupts
   1.228 +	/** 
   1.229 +	 Gets a interrupt Id for Pc card.
   1.230 +
   1.231 +	 @param aCard  Pc Card to which interrupts Id is requested.
   1.232 +
   1.233 +	 @return InterruptId of the Pc Card.
   1.234 +     */
   1.235 +	virtual TInt IntIdIReq(TInt aCard)=0;
   1.236 +    /**
   1.237 +     Gets ready interrupt Id when ready signal is asserted  on Pc Card.
   1.238 +	 
   1.239 +     @param aCard  Pc Card which is interrupted through a ready signal.
   1.240 +
   1.241 +	 @return Ready interrupt Id for the Pc Card.
   1.242 +     */
   1.243 +	virtual TInt IntIdRdyC(TInt aCard)=0;
   1.244 +    /**
   1.245 +     Gets interrupt status Id when status of Pc Card changes.
   1.246 +     
   1.247 +	 @param aCard  Pc Card which is interrupted through a change in state.
   1.248 +
   1.249 +	 @return Interrupt status Id, for the Pc Card.
   1.250 +     */
   1.251 +	virtual TInt IntIdStsC(TInt aCard)=0;
   1.252 +    /**
   1.253 +     Gets Mediachange interrupt Id when media changes, i,e  when media door is Opend/Closed.
   1.254 +
   1.255 +     @param aMediaChangeId  An  media chagne Id which tells whether media door is closed / Opened.
   1.256 +
   1.257 +	 @return Media change interrupt id, when a change in media takes place.
   1.258 +     */
   1.259 +	virtual TInt IntIdMediaChange(TInt aMediaChangeId)=0;
   1.260 +	/**
   1.261 +     Acknowledge the media change interrupt.
   1.262 +
   1.263 +     @param aMediaChangeId  An  media change Id which tells whether a door is closed / Opened.
   1.264 +	 */
   1.265 +	virtual void ClearMediaChange(TInt aMediaChangeId)=0;
   1.266 +	// machine configuration
   1.267 +	/**
   1.268 +     @param aSocket the socket ID.
   1.269 +
   1.270 +	 @param aMediaDeviceInfo , Media information of the scoket which has to be checked.
   1.271 +
   1.272 +	 @return True if Pc Card is present in the secified socket.
   1.273 +	 */
   1.274 +	virtual TBool IsPcCardSocket(TInt aSocket,SMediaDeviceInfo& aMediaDeviceInfo)=0;
   1.275 +	/**  
   1.276 +	 Gets information about from which socket does the media change took place.
   1.277 +	 
   1.278 +	 @param aSocket the socket ID.
   1.279 +
   1.280 +	 @return socket from which socket does the media change took place.
   1.281 +	 */
   1.282 +	virtual TInt MediaChangeFromSocket(TInt aSocket)=0;
   1.283 +	/**
   1.284 +	 Gets from which socket does the Vcc signal is generated.
   1.285 +
   1.286 +	 @param aSocket the socket ID.
   1.287 +
   1.288 +	 @return socket Id from which Vcc signal is generated.
   1.289 +	 */
   1.290 +	virtual TInt VccFromSocket(TInt aSocket)=0;
   1.291 +    };
   1.292 +
   1.293 +GLREF_D TPcCardControllerInterface* ThePccdCntrlInterface;
   1.294 +
   1.295 +#endif
   1.296 +
   1.297 +