navienginebsp/naviengine_assp/navi_i2s.h
changeset 0 5de814552237
equal deleted inserted replaced
-1:000000000000 0:5de814552237
       
     1 /*
       
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 * bsp\hwip_nec_navienegine\navienegine_assp\i2s.h
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #include <e32cmn.h>
       
    22 #include <e32def.h>
       
    23 #include <naviengine_priv.h>
       
    24 #include <i2s.h>
       
    25 
       
    26 
       
    27 //
       
    28 // each channel should implemment the platform specific interface 
       
    29 
       
    30 class DI2sChannelBase
       
    31 	{
       
    32 public:
       
    33 	static TInt CreateChannels(DI2sChannelBase*& aChannel, TInt aInterfaceId);   
       
    34 	
       
    35 	virtual TInt ConfigureInterface(TDes8* aConfig) = 0;
       
    36 	virtual TInt GetInterfaceConfiguration(TDes8& aConfig) = 0;
       
    37 	virtual TInt SetSamplingRate(TInt aSamplingRate) = 0;
       
    38 	virtual TInt GetSamplingRate(TInt& aSamplingRate) = 0;
       
    39 	virtual TInt SetFrameLengthAndFormat(TInt aFrameLength, TInt aLeftFramePhaseLength) = 0;
       
    40 	virtual TInt GetFrameFormat(TInt& aLeftFramePhaseLength, TInt& aRightFramePhaseLength) = 0;
       
    41 	virtual TInt SetSampleLength(TInt aFramePhase, TInt aSampleLength) = 0;
       
    42 	virtual TInt GetSampleLength(TInt aFramePhase, TInt& aSampleLength) = 0;
       
    43 	virtual TInt SetDelayCycles(TInt aFramePhase, TInt aDelayCycles) = 0;
       
    44 	virtual TInt GetDelayCycles(TInt aFramePhase, TInt& aDelayCycles) = 0;
       
    45 	virtual TInt ReadReceiveRegister(TInt aFramePhase, TInt& aData) = 0;
       
    46 	virtual TInt WriteTransmitRegister(TInt aFramePhase, TInt aData) = 0;
       
    47 	virtual TInt ReadTransmitRegister(TInt aFramePhase, TInt& aData) = 0;
       
    48 	virtual TInt ReadRegisterModeStatus(TInt aFramePhase, TInt& aFlags) = 0;
       
    49 	virtual TInt EnableRegisterInterrupts(TInt aFramePhase, TInt aInterrupt) = 0;
       
    50 	virtual TInt DisableRegisterInterrupts(TInt aFramePhase, TInt aInterrupt) = 0;
       
    51 	virtual TInt IsRegisterInterruptEnabled(TInt aFramePhase, TInt& aEnabled) = 0;
       
    52 	virtual TInt EnableFIFO(TInt aFramePhase, TInt aFifoMask) = 0;
       
    53 	virtual TInt DisableFIFO(TInt aFramePhase, TInt aFifoMask) = 0;
       
    54 	virtual TInt IsFIFOEnabled(TInt aFramePhase, TInt& aEnabled) = 0;
       
    55 	virtual TInt SetFIFOThreshold(TInt aFramePhase, TInt aDirection, TInt aThreshold) = 0;
       
    56 	virtual TInt ReadFIFOModeStatus(TInt aFramePhase, TInt& aFlags) = 0;
       
    57 	virtual TInt EnableFIFOInterrupts(TInt aFramePhase, TInt aInterrupt) = 0;
       
    58 	virtual TInt DisableFIFOInterrupts(TInt aFramePhase, TInt aInterrupt) = 0;
       
    59 	virtual TInt IsFIFOInterruptEnabled(TInt aFramePhase, TInt& aEnabled) = 0;
       
    60 	virtual TInt ReadFIFOLevel(TInt aFramePhase, TInt aDirection, TInt& aLevel) = 0;
       
    61 	virtual TInt EnableDMA(TInt aFifoMask) = 0;
       
    62 	virtual TInt DisableDMA(TInt aFifoMask) = 0;
       
    63 	virtual TInt IsDMAEnabled(TInt& aEnabled) = 0;
       
    64 	virtual TInt Start(TInt aDirection) = 0;
       
    65 	virtual TInt Stop(TInt aDirection) = 0;
       
    66 	virtual TInt IsStarted(TInt aDirection, TBool& aStarted) = 0;	
       
    67 	
       
    68 protected:
       
    69 	TInt iInterfaceId;
       
    70 	TI2sConfigV01 iConfig;
       
    71 	};
       
    72 
       
    73 /**
       
    74 The management class for all I2S channels
       
    75 */
       
    76 class TI2sManager
       
    77 	{
       
    78 public:
       
    79 	// initialisation
       
    80 	TInt DoCreate();
       
    81 public:
       
    82 	static DI2sChannelBase **iChannels;	// array of pointers to channels (populated in DoCreate); indexed by the channel number portion of interface ID (bottom 16 bits)
       
    83 	static TInt iChannelsNum; 			// to store number of channels present on the system (obtained from ConfRep and set in DoCreate)
       
    84 	};
       
    85