epoc32/include/assp/omap3530_shared/tps65950.h
branchSymbian3
changeset 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/assp/omap3530_shared/tps65950.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -0,0 +1,246 @@
     1.4 +// Copyright (c) 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 +//
    1.18 +
    1.19 +#ifndef TPS65950_H
    1.20 +#define TPS65950_H
    1.21 +
    1.22 +#include <e32cmn.h>
    1.23 +#include <nklib.h>
    1.24 +#include <assp/omap3530_assp/omap3530_irqmap.h>
    1.25 +#include <assp/omap3530_shared/tps65950_registers.h>
    1.26 +
    1.27 +// Trace - 191 = 0x00000000 0x00000000 0x00000000 0x00000000 0x0000000 0x0000000 0x80000000 0x00000000 0x00000000
    1.28 +#define KTPS65950		191
    1.29 +
    1.30 +
    1.31 +
    1.32 +namespace TPS65950
    1.33 +{
    1.34 +
    1.35 +/** Structure used for issuing an asynchronous request
    1.36 + * You must set iDfc to point to a TDfc object which will
    1.37 + * be queued on completion
    1.38 + */
    1.39 +struct TReq
    1.40 +	{
    1.41 +	enum TAction
    1.42 +		{
    1.43 +		ERead,
    1.44 +		EWrite,
    1.45 +		EClearSet,
    1.46 +		EDisableProtect,
    1.47 +		ERestoreProtect
    1.48 +		};
    1.49 +
    1.50 +
    1.51 +	TUint16	iRegister;		///< Register to be accessed
    1.52 +	TAction	iAction : 8;	///< type of request, read, write or clearset
    1.53 +	TUint8	iReadValue;		///< Returned value from a read, original value for a ClearSet, unused for write
    1.54 +	union
    1.55 +		{
    1.56 +		TUint8	iWriteValue;	///< Value to write into register for a write
    1.57 +		TUint8	iSetMask;		///< Bits to set in a ClearSet
    1.58 +		};
    1.59 +	TUint8	iClearMask;		///< Bits to clear in a ClearSet
    1.60 +	TDfc*	iCompletionDfc;	///< Pointer to DFC to be called on completion (for multi-phase only the last TReq causes a completion)
    1.61 +	TInt	iResult;		///< KErrNone on success, else error code
    1.62 +	TReq*	iNextPhase;		///< set to NULL if this is a single request, for a multi-phase request set this to point to next TReq
    1.63 +	SDblQueLink	iLink;		///< Used internally to maintain linked list of requests
    1.64 +	};
    1.65 +
    1.66 +struct TRtcTime
    1.67 +	{
    1.68 +	TUint8	iSecond;
    1.69 +	TUint8	iMinute;
    1.70 +	TUint8	iHour;
    1.71 +	TUint8	iDay;
    1.72 +	TUint8	iMonth;
    1.73 +	TUint8	iYear;
    1.74 +	};
    1.75 +
    1.76 +/** Test whether this driver has been initialized
    1.77 + * Use this in code which is expected to run early during boot
    1.78 + * to prevent it trying to access this driver before it is ready
    1.79 + *
    1.80 + * @return	ETrue if initialized, EFalse if not
    1.81 + */
    1.82 +IMPORT_C TBool Initialized();
    1.83 +
    1.84 +/** Execute a request asynchronously
    1.85 + *
    1.86 + * @param	aRequest	Request object to executed, must stay valid until request completes
    1.87 + */
    1.88 +IMPORT_C void ExecAsync( TReq& aRequest );
    1.89 +
    1.90 +/** Execute a write synchronously
    1.91 + * @param	aRegister	Register to write to - this must be one of the 
    1.92 + *					register enumerations from tps65950_register.h
    1.93 + *					or the value of a register Addr property
    1.94 + *
    1.95 + * @param	aValue	Value to write to register
    1.96 + * @return	KErrNone on success, else standard error code
    1.97 + */
    1.98 +IMPORT_C TInt WriteSync( TUint16 aRegister, TUint8 aValue );
    1.99 +
   1.100 +/** Execute a read synchronously
   1.101 + * @param	aRegister	Register to write to - this must be one of the 
   1.102 + *					register enumerations from tps65950_register.h
   1.103 + *					or the value of a register Addr property
   1.104 + *
   1.105 + * @param	aValue	Value read will be written to here
   1.106 + * @return	KErrNone on success, else standard error code
   1.107 + */
   1.108 +IMPORT_C TInt ReadSync( TUint16 aRegister, TUint8& aValue );
   1.109 +
   1.110 +/** Execute a bit clear/set synchronously
   1.111 + * @param	aRegister	Register to write to - this must be one of the 
   1.112 + *					register enumerations from tps65950_register.h
   1.113 + *					or the value of a register Addr property
   1.114 + *
   1.115 + * @param	aClearMask	Each '1' clear the corresponding bit in the register
   1.116 + * @param	aSetMask	Each '1' sets the corresponding bit in the register
   1.117 + * @return	KErrNone on success, else standard error code
   1.118 + */
   1.119 +IMPORT_C TInt ClearSetSync( TUint16 aRegister, TUint8 aClearMask, TUint8 aSetMask );
   1.120 +
   1.121 +/** Disable protection of voltage control registers
   1.122 + * Call RestoreProtect() to re-enable protection
   1.123 + *
   1.124 + * Note - calls to DisableProtect and RestoreProtect() are
   1.125 + * reference-counted, so you must call RestoreProtect() the same
   1.126 + * number of times you called DisableProtect(). This is to allow
   1.127 + * multiple clients to disable and restore protection so that
   1.128 + * protection will only be re-enabled when the last client has
   1.129 + * restored it.
   1.130 + */
   1.131 +IMPORT_C TInt DisableProtect();
   1.132 +
   1.133 +/** Restore protection after a DisableProtect().
   1.134 + * If other clients have called DisableProtect(), or this client
   1.135 + * has other DisableProtect() calls still not balanced by a 
   1.136 + * RestoreProtect() then the protection will remain disabled
   1.137 + */
   1.138 +IMPORT_C TInt RestoreProtect();
   1.139 +
   1.140 +/** Read the current RTC time */
   1.141 +IMPORT_C TInt GetRtcData( TRtcTime& aTime );
   1.142 +
   1.143 +/** Set the RTC time */
   1.144 +IMPORT_C TInt SetRtcData( const TRtcTime& aTime );
   1.145 +
   1.146 +enum TPanic
   1.147 +	{
   1.148 +	EBadAction,			///< illegal value in TReq::iAction
   1.149 +	ENoDfc,				///< iCompletionDFC is NULL
   1.150 +	EBadGroup			///< Group component of iRegister is invalid
   1.151 +	};
   1.152 +
   1.153 +
   1.154 +enum TInterruptId 
   1.155 +	{
   1.156 +	KTPS65950IrqFirst= (EIrqRangeBasePsu << KIrqRangeIndexShift),
   1.157 +	
   1.158 +	ETPS65950_IRQ_PWR_SC_DETECT = KTPS65950IrqFirst,
   1.159 +	ETPS65950_IRQ_PWR_MBCHG,
   1.160 +	ETPS65950_IRQ_PWR_PWROK_TIMEOUT,
   1.161 +	ETPS65950_IRQ_PWR_HOT_DIE,	
   1.162 +	ETPS65950_IRQ_PWR_RTC_IT,
   1.163 +	ETPS65950_IRQ_PWR_USB_PRES,
   1.164 +	ETPS65950_IRQ_PWR_CHG_PRES,
   1.165 +	ETPS65950_IRQ_PWR_CHG_PWRONS,
   1.166 +	
   1.167 +	ETPS65950_IRQ_MADC_USB_ISR1,
   1.168 +	ETPS65950_IRQ_MADC_SW2_ISR1,
   1.169 +	ETPS65950_IRQ_MADC_SW1_ISR1,
   1.170 +	ETPS65950_IRQ_MADC_RT_ISR1,
   1.171 +	
   1.172 +	ETPS65950_IRQ_GPIO_0ISR1,
   1.173 +	ETPS65950_IRQ_GPIO_1ISR1,	
   1.174 +	ETPS65950_IRQ_GPIO_2ISR1,
   1.175 +	ETPS65950_IRQ_GPIO_3ISR1,
   1.176 +	ETPS65950_IRQ_GPIO_4ISR1,
   1.177 +	ETPS65950_IRQ_GPIO_5ISR1,
   1.178 +	ETPS65950_IRQ_GPIO_6ISR1,
   1.179 +	ETPS65950_IRQ_GPIO_7ISR2,
   1.180 +	
   1.181 +	ETPS65950_IRQ_GPIO_8ISR2,
   1.182 +	ETPS65950_IRQ_GPIO_9ISR2,
   1.183 +	ETPS65950_IRQ_GPIO_10ISR2,
   1.184 +	ETPS65950_IRQ_GPIO_11ISR2,
   1.185 +	ETPS65950_IRQ_GPIO_12ISR2,
   1.186 +	ETPS65950_IRQ_GPIO_13ISR2,
   1.187 +	ETPS65950_IRQ_GPIO_14ISR2,
   1.188 +	ETPS65950_IRQ_GPIO_15ISR2,
   1.189 +	
   1.190 +	ETPS65950_IRQ_GPIO16ISR3,
   1.191 +	ETPS65950_IRQ_GPIO17ISR3,
   1.192 +	
   1.193 +	ETPS65950_IRQ_BCI_BATSTS_ISR1,
   1.194 +	ETPS65950_IRQ_BCI_TBATOR1_ISR1,
   1.195 +	ETPS65950_IRQ_BCI_TBATOR2_ISR1,
   1.196 +	ETPS65950_IRQ_BCI_ICHGEOC_ISR1,
   1.197 +	ETPS65950_IRQ_BCI_ICHGLOW_ISR1ASTO,
   1.198 +	ETPS65950_IRQ_BCI_IICHGHIGH_ISR1,
   1.199 +	ETPS65950_IRQ_BCI_TMOVF_ISR1,
   1.200 +	ETPS65950_IRQ_BCI_WOVF_ISR1,
   1.201 +	
   1.202 +	ETPS65950_IRQ_BCI_ACCHGOV_ISR1,
   1.203 +	ETPS65950_IRQ_BCI_VBUSOV_ISR1,
   1.204 +	ETPS65950_IRQ_BCI_VBATOV_ISR1,
   1.205 +	ETPS65950_IRQ_BCI_VBATLVL_ISR1,
   1.206 +	
   1.207 +	ETPS65950_IRQ_KEYP_ITMISR1,
   1.208 +	ETPS65950_IRQ_KEYP_ITTOISR1,
   1.209 +	ETPS65950_IRQ_KEYP_ITLKISR1,
   1.210 +	ETPS65950_IRQ_KEYP_ITKPISR1,
   1.211 +	
   1.212 +	ETPS65950_IRQ_USB_INTSTS_IDGND, 
   1.213 +	ETPS65950_IRQ_USB_INTSTS_SESSEND,
   1.214 +	ETPS65950_IRQ_USB_INTSTS_SESSVALID,
   1.215 +	ETPS65950_IRQ_USB_INTSTS_VBUSVALID,	
   1.216 +	ETPS65950_IRQ_USB_INTSTS_HOSTDISCONNECT,
   1.217 +	ETPS65950_IRQ_USB_CARKIT_CARDP,
   1.218 +	ETPS65950_IRQ_USB_CARKIT_CARINTDET,
   1.219 +	ETPS65950_IRQ_USB_CARKIT_IDFLOAT,
   1.220 +	ETPS65950_IRQ_USB_OTHER_INT_VB_SESS_VLD,
   1.221 +	ETPS65950_IRQ_USB_OTHER_INT_DM_HI,
   1.222 +	ETPS65950_IRQ_USB_OTHER_INT_DP_HI,
   1.223 +	ETPS65950_IRQ_USB_OTHER_INT_MANU,
   1.224 +	ETPS65950_IRQ_USB_OTHER_INT_ABNORMAL_STRESS,
   1.225 +	ETPS65950_IRQ_USB_ID_INT_ID_RES_FLOAT,
   1.226 +	ETPS65950_IRQ_USB_ID_INT_ID_RES_440K,
   1.227 +	ETPS65950_IRQ_USB_ID_INT_ID_RES_200K,
   1.228 +	ETPS65950_IRQ_USB_ID_INT_ID_RES_102K,
   1.229 +	ETPS65950_IRQ_USB_CARKIT_SM_1_PSM_ERROR,	
   1.230 +	ETPS65950_IRQ_USB_CARKIT_SM_1_PH_ACC,
   1.231 +	ETPS65950_IRQ_USB_CARKIT_SM_1_CHARGER,
   1.232 +	ETPS65950_IRQ_USB_CARKIT_SM_1_USB_HOST,
   1.233 +	ETPS65950_IRQ_USB_CARKIT_SM_1_USB_OTG_B,
   1.234 +	ETPS65950_IRQ_USB_CARKIT_SM_1_CARKIT,
   1.235 +	ETPS65950_IRQ_USB_CARKIT_SM_1_DISCONNECTED,
   1.236 +	ETPS65950_IRQ_USB_CARKIT_SM_2_STOP_PLS_MISS,
   1.237 +	ETPS65950_IRQ_USB_CARKIT_SM_2_STEREO_TO_MONO,
   1.238 +	ETPS65950_IRQ_USB_CARKIT_SM_2_PHONE_UART,
   1.239 +	ETPS65950_IRQ_USB_CARKIT_SM_2_PH_NO_ACK,
   1.240 +	
   1.241 +	KTPS65950IrqLast,
   1.242 +	};
   1.243 +
   1.244 +const TInt KNumTPSInts = (KTPS65950IrqLast - KTPS65950IrqFirst);
   1.245 +
   1.246 +} // namespace TPS65950
   1.247 +
   1.248 +
   1.249 +#endif //tps65950