kernel/eka/include/drivers/pccd_ifc.h
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // e32\include\drivers\pccd_ifc.h
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @publishedPartner
       
    21  @released
       
    22 */
       
    23 
       
    24 #ifndef __PCCD_IFC_H__
       
    25 #define __PCCD_IFC_H__
       
    26 #include <pccard.h>
       
    27 #include <drivers/locmedia.h>
       
    28 #include <platform.h>
       
    29 #include <assp.h>
       
    30 
       
    31 #define __PCCD_MACHINE_CODED__
       
    32 
       
    33 const TInt KMemConfigByteAccess=1;
       
    34 
       
    35 class PccdIfc
       
    36 	{
       
    37 public:
       
    38 	static DPcCardSocket* NewSocket(TInt aSocketNum);
       
    39 	static DPcCardMediaChange* NewMediaChange(TInt aMcId);
       
    40 	static DPcCardVcc* NewVcc(TInt aVccNum, TInt aMcId);
       
    41 	static DPccdChunkBase* NewChunk(TPccdMemType aType);
       
    42 	};
       
    43 
       
    44 	/**
       
    45 	 A base class that defines a Pc Card controller interface.
       
    46 	 
       
    47 	 @publishedPartner
       
    48 	 @released
       
    49 	 */
       
    50 class TPcCardControllerInterface
       
    51 	{
       
    52 public:
       
    53 	/**
       
    54 	 Allocate any resources. Only done once on kernel initialization so don't worry about cleanup if it fails.
       
    55      
       
    56 	 @return KErrNone if successful in allocating memory for the Pc Card. otherwise return KErrNoMemory.
       
    57 	 */
       
    58 	IMPORT_C TInt Create();
       
    59 public:
       
    60     /**
       
    61  	 Gets the physical address of Pc Card memory.
       
    62      
       
    63 	 @param aCard  A Pc Card whose physical address to be returned.
       
    64      
       
    65 	 @param aType  Memory type  of the Pc Card whose physical address to be returned.
       
    66      
       
    67 	 @return Physical address of Pc Card for the given memory type.
       
    68 	 
       
    69 	 @see TPccdMemType
       
    70 	 */    
       
    71 	virtual TUint32 MemPhysicalAddress(TInt aCard,TPccdMemType aType)=0;
       
    72 	/** 
       
    73 	 Sets the Pc Card controller h/w.
       
    74 	 
       
    75 	 Initialise the Pc Card Controller h/w.
       
    76 	 
       
    77 	 @return KErrNone if Pc Card contorller h/w is initialised.
       
    78      */
       
    79 	virtual TInt Init()=0;
       
    80     /**
       
    81 	 Gets the current settings for the Pc Card.
       
    82      
       
    83 	 @param aCard  A Pc Card whose signals to be indicated.
       
    84      
       
    85 	 @param anInd  Has current settings for the PC Card indicator signals into 'anInd' for the specified aCard.
       
    86    	 
       
    87 	 @return KErrNone if successful.
       
    88 	 
       
    89 	 @see TSocketIndicators.
       
    90 	 */
       
    91 	virtual TInt Indicators(TInt aCard,TSocketIndicators &anInd)=0;
       
    92     /**
       
    93  	 Enables the Pc Card Interface.
       
    94      
       
    95 	 @param aCard  A Pc Card whose interface to be enabled.
       
    96 	 */
       
    97 	virtual void InterfaceOn(TInt aCard)=0;
       
    98 	/**
       
    99  	 Disables the Pc Card Interface.
       
   100      
       
   101 	 @param aCard  A PC Card whose interface to be disabled.
       
   102 	 */
       
   103 	virtual void InterfaceOff(TInt aCard)=0;
       
   104 	/**
       
   105  	 To Apply/remove h/w reset.
       
   106 
       
   107      @param aCard  A Pc Card which has to be h/w reseted.
       
   108 
       
   109      @param anAssert To make the h/w reset guarented.
       
   110 	 */
       
   111     virtual void CardReset(TInt aCard,TBool anAssert)=0;
       
   112 	/**
       
   113  	 Gets Pc Card Rdy/Bsy status.
       
   114 
       
   115      @param aCard  Pc Card whose status to be returned.
       
   116 
       
   117 	 @return True if the card is ready.
       
   118 	 */
       
   119     virtual TBool CardReady(TInt aCard)=0;
       
   120 	/** 
       
   121 	 Configure memory configuration options.
       
   122 
       
   123      @param aCard   Pc Card whose memory to be configured.
       
   124      
       
   125 	 @param aMemType  Type of memory to be configured.
       
   126 
       
   127      @param aSpeed    Access speed of the memory involved.
       
   128 	 
       
   129 	 @param aWaitSig  This WaitSig should never checked since repeated accesses to MECR seem to crash the system
       
   130 	  in mysterious ways.
       
   131 
       
   132 	 @param aFlag    To modify the memory configuration attributes by ORing with memory chunk setup flags pKPccdBusWidth32 and KPccdDisableWaitStateCntrl  ,
       
   133 
       
   134 	 @return KErrNone if successful, KErrNotSupported if unsuccessful.
       
   135 
       
   136 	 @see TPccdMemType.
       
   137 
       
   138 	 @see TPccdAccessSpeed.
       
   139      */
       
   140 	virtual TInt MemConfig(TInt aCard,TPccdMemType aMemType,TPccdAccessSpeed aSpeed,TBool aWaitSig,TUint aFlag)=0;
       
   141     /**
       
   142      Gets the information of the socket.
       
   143 
       
   144      @param aSocket  Socket whose information to be retrieved.
       
   145 
       
   146      @param anInfo  Gets the socket information in anInfo.
       
   147      
       
   148 	 @see TPcCardSocketInfo.
       
   149 	 */
       
   150     virtual void SocketInfo(TSocket aSocket,TPcCardSocketInfo& anInfo)=0;
       
   151 	/**
       
   152      Checks the specified socket contains a card (and the media door for the socket is closed).
       
   153 
       
   154   	 @param anInfo  Has the socket information.
       
   155 
       
   156      @param aCard  Socket for which a card presence is checked.
       
   157 
       
   158 	 @return True if the socket contians a card (and the media door for the socket is closed).
       
   159 	 */
       
   160 	virtual TBool CardIsPresent(TInt aCard)=0;
       
   161     /**
       
   162   	 Gets the changed state  of the specified media (ex,removed,inserted..)
       
   163      
       
   164      @param aMediaChangeId  stores the state of the specified media change
       
   165 
       
   166 	 @return Mediastate when change to media takes place.
       
   167 
       
   168 	 @see TMediaState.
       
   169 	 */   
       
   170 	virtual TMediaState MediaState(TInt aMediaChangeId)=0;
       
   171     // Pc Card PSUs
       
   172 	/**
       
   173   	 Sets Vcc information for the Pc Card.
       
   174 
       
   175      @param aPsu    Power supply unit value supplied for the Pc Card.
       
   176 
       
   177      @param aninfo  Object of TPBusPsuInfo type passed to store the PSU information.
       
   178 
       
   179 	 @see TPBusPsuInfo.
       
   180 	 */
       
   181 	virtual void VccInfo(TInt aPsu,TPBusPsuInfo &aninfo)=0;
       
   182 	/**
       
   183      Sets Pc Card Vcc power supply OFF.
       
   184 
       
   185      @param aPsu  Power supply unit  for the Pc Card.
       
   186 	 */
       
   187     virtual void VccOff(TInt aPsu)=0;
       
   188 	/**
       
   189   	 Sets Pc Card Vcc power supply ON.
       
   190 
       
   191      @param aPsu  Power supply unit  for the Pc Card.
       
   192 
       
   193      @param aVoltageSetting  A voltage to power on Pc Card which is defined in enum TPccdSocketVcc.
       
   194 
       
   195 	 @see TPccdSocketVcc
       
   196 	 */
       
   197     virtual void VccOnFull(TInt aPsu,TPccdSocketVcc aVoltageSetting)=0;
       
   198     /**
       
   199 	 Sets Pc Card Vcc power supply ON with current limit.
       
   200 
       
   201 	 @param aPsu  Power supply unit  for the Pc Card.
       
   202 
       
   203  	 @param aVoltageSetting  A voltage of current limt to power on Pc Card which is defined in enum TPccdSocketVcc.
       
   204 
       
   205 	 @see TPccdSocketVcc
       
   206 	 */
       
   207     virtual void VccOnCurrentLimit(TInt aPsu,TPccdSocketVcc aVoltageSetting)=0;
       
   208     /**
       
   209 	 Sets Pc Card Vcc level (normally ADC reading). Return KErrNotReady if the voltage check isn't complete.
       
   210 
       
   211 	 @param aPsu  Power supply unit  for the Pc Card.
       
   212   	 */
       
   213     virtual TInt VccInMilliVolts(TInt aPsu)=0;
       
   214 	/*
       
   215 	 Gets Pc Card Vcc voltage status. 
       
   216 
       
   217 	 An alternative to using ADC, when voltage checking is performed using a comparator arrangement. 
       
   218 
       
   219 	 @param aPsu Power supply unit for the Pc Card.
       
   220 
       
   221 	 @return KErrNone if successful, KErrGeneral if failed.
       
   222 	 */
       
   223 	virtual TInt VccVoltCheck(TInt aPsu)=0;
       
   224 	// interrupts
       
   225 	/** 
       
   226 	 Gets a interrupt Id for Pc card.
       
   227 
       
   228 	 @param aCard  Pc Card to which interrupts Id is requested.
       
   229 
       
   230 	 @return InterruptId of the Pc Card.
       
   231      */
       
   232 	virtual TInt IntIdIReq(TInt aCard)=0;
       
   233     /**
       
   234      Gets ready interrupt Id when ready signal is asserted  on Pc Card.
       
   235 	 
       
   236      @param aCard  Pc Card which is interrupted through a ready signal.
       
   237 
       
   238 	 @return Ready interrupt Id for the Pc Card.
       
   239      */
       
   240 	virtual TInt IntIdRdyC(TInt aCard)=0;
       
   241     /**
       
   242      Gets interrupt status Id when status of Pc Card changes.
       
   243      
       
   244 	 @param aCard  Pc Card which is interrupted through a change in state.
       
   245 
       
   246 	 @return Interrupt status Id, for the Pc Card.
       
   247      */
       
   248 	virtual TInt IntIdStsC(TInt aCard)=0;
       
   249     /**
       
   250      Gets Mediachange interrupt Id when media changes, i,e  when media door is Opend/Closed.
       
   251 
       
   252      @param aMediaChangeId  An  media chagne Id which tells whether media door is closed / Opened.
       
   253 
       
   254 	 @return Media change interrupt id, when a change in media takes place.
       
   255      */
       
   256 	virtual TInt IntIdMediaChange(TInt aMediaChangeId)=0;
       
   257 	/**
       
   258      Acknowledge the media change interrupt.
       
   259 
       
   260      @param aMediaChangeId  An  media change Id which tells whether a door is closed / Opened.
       
   261 	 */
       
   262 	virtual void ClearMediaChange(TInt aMediaChangeId)=0;
       
   263 	// machine configuration
       
   264 	/**
       
   265      @param aSocket the socket ID.
       
   266 
       
   267 	 @param aMediaDeviceInfo , Media information of the scoket which has to be checked.
       
   268 
       
   269 	 @return True if Pc Card is present in the secified socket.
       
   270 	 */
       
   271 	virtual TBool IsPcCardSocket(TInt aSocket,SMediaDeviceInfo& aMediaDeviceInfo)=0;
       
   272 	/**  
       
   273 	 Gets information about from which socket does the media change took place.
       
   274 	 
       
   275 	 @param aSocket the socket ID.
       
   276 
       
   277 	 @return socket from which socket does the media change took place.
       
   278 	 */
       
   279 	virtual TInt MediaChangeFromSocket(TInt aSocket)=0;
       
   280 	/**
       
   281 	 Gets from which socket does the Vcc signal is generated.
       
   282 
       
   283 	 @param aSocket the socket ID.
       
   284 
       
   285 	 @return socket Id from which Vcc signal is generated.
       
   286 	 */
       
   287 	virtual TInt VccFromSocket(TInt aSocket)=0;
       
   288     };
       
   289 
       
   290 GLREF_D TPcCardControllerInterface* ThePccdCntrlInterface;
       
   291 
       
   292 #endif
       
   293 
       
   294