bsptemplate/asspandvariant/template_assp/i2spsl.cpp
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 2008-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 // template\template_assp\i2spsl.cpp
       
    15 // 
       
    16 //
       
    17 
       
    18 #include <kernel/kernel.h>
       
    19 #include <drivers/i2s.h>
       
    20 
       
    21 // TO DO: (mandatory)
       
    22 // If your ASIC supports multiple I2S interfaces you need to design the most appropriate way of handling that:
       
    23 //	- it is possible that a common register per function is used on some of the functions, e.g. a single Control
       
    24 //	  Register is used to select Master/Slave roles, Transmitter/Receiver/Bidirectional/Controller mode, word 
       
    25 //	  length etc for all interfaces supported. In this case handling the interface Id typically involves the use
       
    26 //	  of shifts and masks;
       
    27 //	- some functions can never be covered by a single register common to all interfaces (e.g. the transmit/receive 
       
    28 //	  registers). Even if it was possible to use single registers to cover a number of interfaces the ASIC designer
       
    29 //	  may decide to have separate registers for each interface. In this case each of the below APIs could be implemented
       
    30 //	  as a switch(interface)-case and then use different sets of register addresses for each interface. This model makes
       
    31 //	  sense when a single developer is responsible for implementing all interfaces (typically in a single source file).
       
    32 //	- when each interface is implemented independently it makes sense to separate the implementation into a interface 
       
    33 //	  independent layer and a specific layer and redirect each call from the interface independent layer into the relavant
       
    34 //	  interface. This is exemplified with the NAVIENGINE implementation.
       
    35 //
       
    36 
       
    37 enum TIs2Panic
       
    38 	{
       
    39 	ECalledFromIsr
       
    40 	};
       
    41 
       
    42 EXPORT_C TInt I2s::ConfigureInterface(TInt aInterfaceId, TDes8* aConfig)
       
    43 //
       
    44 // Configures the interface: its type (Transmitter/Receiver/Bidirectional/Controller) and the role played by it (Master/Slave).
       
    45 //
       
    46 	{
       
    47 	__ASSERT_DEBUG(NKern::CurrentContext() == NKern::EThread, Kern::Fault("I2s Interface", ECalledFromIsr));
       
    48 	// TO DO: (mandatory)
       
    49 	//
       
    50 	// Extracts the configuration information from aConfig and programs the relevant registers for the interface identified by aInterfaceId.
       
    51 	//
       
    52 	return KErrNone;
       
    53 	}
       
    54 
       
    55 EXPORT_C TInt I2s::GetInterfaceConfiguration(TInt aInterfaceId, TDes8& aConfig)
       
    56 //
       
    57 // Reads the current configuration.
       
    58 //
       
    59 	{
       
    60 	__ASSERT_DEBUG(NKern::CurrentContext() == NKern::EThread, Kern::Fault("I2s Interface", ECalledFromIsr));
       
    61 	// TO DO: (optional)
       
    62 	//
       
    63 	// Reads the relevant registers and assembles configuration information to be returned in aConfig.
       
    64 	//
       
    65 	return KErrNotSupported;
       
    66 	}
       
    67 
       
    68 EXPORT_C TInt I2s::SetSamplingRate(TInt aInterfaceId, TI2sSamplingRate aSamplingRate)
       
    69 //
       
    70 // Sets the sampling rate.
       
    71 //
       
    72 	{
       
    73 	__ASSERT_DEBUG(NKern::CurrentContext() == NKern::EThread, Kern::Fault("I2s Interface", ECalledFromIsr));
       
    74 	// TO DO: (mandatory)
       
    75 	//
       
    76 	// Programs the required sampling rate onto the relevant registers for the interface identified by aInterfaceId .
       
    77 	//
       
    78 	return KErrNone;
       
    79 	}
       
    80 
       
    81 EXPORT_C TInt I2s::GetSamplingRate(TInt aInterfaceId, TInt& aSamplingRate)
       
    82 //
       
    83 // Reads the sampling rate.
       
    84 //
       
    85 	{
       
    86 	__ASSERT_DEBUG(NKern::CurrentContext() == NKern::EThread, Kern::Fault("I2s Interface", ECalledFromIsr));
       
    87 	// TO DO: (optional)
       
    88 	//
       
    89 	// Reads the relevant registers to obtain the currently programmed sampling rate to be returned in aSamplingRate.
       
    90 	//
       
    91 	return KErrNotSupported;
       
    92 	}
       
    93 
       
    94 EXPORT_C TInt I2s::SetFrameLengthAndFormat(TInt aInterfaceId, TI2sFrameLength aFrameLength, TInt aLeftFramePhaseLength)
       
    95 //
       
    96 // Sets the frame format.
       
    97 //
       
    98 	{
       
    99 	__ASSERT_DEBUG(NKern::CurrentContext() == NKern::EThread, Kern::Fault("I2s Interface", ECalledFromIsr));
       
   100 	// TO DO: (mandatory)
       
   101 	//
       
   102 	// If the interface only allows symmetrical frame lengths this function programs the required
       
   103 	// overall frame length onto the relevant registers for the interface identified by aInterfaceId.
       
   104 	// In this case aLeftFramePhaseLength can be ignored.
       
   105 	// If the interface supports asymmetrical frame lengths, calculates the righ frame length as
       
   106 	// (aFrameLength-aLeftFramePhaseLength) and programs both the left and right frame lengths onto
       
   107 	// the relevant registers for the interface identified by aInterfaceId.
       
   108 	//
       
   109 	return KErrNone;
       
   110 	}
       
   111 
       
   112 EXPORT_C TInt I2s::GetFrameFormat(TInt aInterfaceId, TInt& aLeftFramePhaseLength, TInt& aRightFramePhaseLength)
       
   113 //
       
   114 // Reads the frame format.
       
   115 //
       
   116 	{
       
   117 	__ASSERT_DEBUG(NKern::CurrentContext() == NKern::EThread, Kern::Fault("I2s Interface", ECalledFromIsr));
       
   118 	// TO DO: (optional)
       
   119 	//
       
   120 	// If the interface only supports symmetrical frame lengths this function reads the relevant registers to obtain 
       
   121 	// the currently programmed overall frame length for the interface identified by aInterfaceId: it returns the same
       
   122 	// value in both aLeftFramePhaseLength and aRightFramePhaseLength (that is overal frame length/2).
       
   123 	// If the interface supports asymmetrical frame lngths, reads the appropriate registers to obtain the left and right
       
   124 	// frame lengths to be returned in aLeftFramePhaseLength and aRightFramePhaseLength.
       
   125 	//
       
   126 	return KErrNotSupported;
       
   127 	}
       
   128 
       
   129 EXPORT_C TInt I2s::SetSampleLength(TInt aInterfaceId, TI2sFramePhase aFramePhase, TI2sSampleLength aSampleLength)
       
   130 //
       
   131 // Sets the sample length for a frame phase.
       
   132 //
       
   133 	{
       
   134 	__ASSERT_DEBUG(NKern::CurrentContext() == NKern::EThread, Kern::Fault("I2s Interface", ECalledFromIsr));
       
   135 	// TO DO: (mandatory)
       
   136 	//
       
   137 	// Programs the required sample length for the frame phase specified (left or right) onto the relevant registers for the interface identified by aInterfaceId .
       
   138 	//
       
   139 	return KErrNone;
       
   140 	}
       
   141 
       
   142 EXPORT_C TInt I2s::GetSampleLength(TInt aInterfaceId, TI2sFramePhase aFramePhase, TInt& aSampleLength)
       
   143 //
       
   144 // Reads the sample length for a frame phase.
       
   145 //
       
   146 	{
       
   147 	__ASSERT_DEBUG(NKern::CurrentContext() == NKern::EThread, Kern::Fault("I2s Interface", ECalledFromIsr));
       
   148 	// TO DO: (optional)
       
   149 	//
       
   150 	// Reads the relevant registers to obtain the sample length for the frame phase specified (left or right) to be returned in aSampleLength.
       
   151 	//
       
   152 	return KErrNotSupported;
       
   153 	}
       
   154 
       
   155 EXPORT_C TInt I2s::SetDelayCycles(TInt aInterfaceId, TI2sFramePhase aFramePhase, TInt aDelayCycles)
       
   156 //
       
   157 // Sets the number of delay cycles for a frame phase.
       
   158 //
       
   159 	{
       
   160 	__ASSERT_DEBUG(NKern::CurrentContext() == NKern::EThread, Kern::Fault("I2s Interface", ECalledFromIsr));
       
   161 	// TO DO: (optional)
       
   162 	//
       
   163 	// If the interface supports delaying the start of a frame by a specified number of bit clock cycles this function programs the required
       
   164 	// delay cycles for the frame phase specified (left or right) onto the relevant registers for the interface identified by aInterfaceId .
       
   165 	//
       
   166 	return KErrNotSupported;
       
   167 	}
       
   168 
       
   169 EXPORT_C TInt I2s::GetDelayCycles(TInt aInterfaceId, TI2sFramePhase aFramePhase, TInt& aDelayCycles)
       
   170 //
       
   171 // Reads the sample length for a frame phase.
       
   172 //
       
   173 	{
       
   174 	__ASSERT_DEBUG(NKern::CurrentContext() == NKern::EThread, Kern::Fault("I2s Interface", ECalledFromIsr));
       
   175 	// TO DO: (optional)
       
   176 	//
       
   177 	// If the interface supports delaying the start of a frame by a specified number of bit clock cycles this function reads the relevant
       
   178 	// registers to obtain the number of delay cycles for the frame phase specified (left or right) to be returned in aSampleLength.
       
   179 	//
       
   180 	return KErrNotSupported;
       
   181 	}
       
   182 
       
   183 EXPORT_C TInt I2s::ReadReceiveRegister(TInt aInterfaceId, TI2sFramePhase aFramePhase, TInt& aData)
       
   184 //
       
   185 // Reads the receive data register for a frame phase.
       
   186 //
       
   187 	{
       
   188 	// TO DO: (mandatory)
       
   189 	//
       
   190 	// Reads the contents of the receive register to obtain the data for the frame phase specified (left or right) to be returned in aData.
       
   191 	// If the implementation only supports a single receive register for both frame phases, the aFramePhase argument can be ignored and the 
       
   192 	// function returns the contents of the single register.
       
   193 	//
       
   194 	return KErrNone;
       
   195 	}
       
   196 
       
   197 EXPORT_C TInt I2s::WriteTransmitRegister(TInt aInterfaceId, TI2sFramePhase aFramePhase, TInt aData)
       
   198 //
       
   199 // Writes to the transmit data register for a frame phase.
       
   200 //
       
   201 	{
       
   202 	// TO DO: (mandatory)
       
   203 	//
       
   204 	// Writes the Audio data passed in aData to the transmit register for the frame phase specified (left or right) for the interface identified
       
   205 	// by aInterfaceId.
       
   206 	// If the implementation only supports a single transmit register for both frame phases, the aFramePhase argument can be ignored and the 
       
   207 	// function writes to the single register.
       
   208 	//
       
   209 	return KErrNone;
       
   210 	}
       
   211 
       
   212 EXPORT_C TInt I2s::ReadTransmitRegister(TInt aInterfaceId, TI2sFramePhase aFramePhase, TInt& aData)
       
   213 //
       
   214 // Reads the transmit data register for a frame phase.
       
   215 //
       
   216 	{
       
   217 	// TO DO: (optional)
       
   218 	//
       
   219 	// Reads the contents of the transmit register to obtain the data for the frame phase specified (left or right) to be returned in aData.
       
   220 	// If the implementation only supports a single receive register for both frame phases, the aFramePhase argument can be ignored and the 
       
   221 	// function returns the contents of the single transmit register.
       
   222 	// If the implementation does not support reading the transmit register simply return KErrNotSupported.
       
   223 	//
       
   224 	return KErrNotSupported;
       
   225 	}
       
   226 
       
   227 EXPORT_C TInt I2s::ReadRegisterModeStatus(TInt aInterfaceId, TI2sFramePhase aFramePhase, TInt& aFlags)
       
   228 //
       
   229 // Reads the Register PIO access mode status flags for a frame phase.
       
   230 //
       
   231 	{
       
   232 	// TO DO: (optional)
       
   233 	//
       
   234 	// If the implementation supports Register PIO mode this function reads the contents of the Register PIO mode status register to obtain
       
   235 	// the status flags  for the frame phase specified (left or right) to be returned in aFlags. The mode flags are described in TI2sFlags.
       
   236 	// If the implementation does not support Register PIO mode  simply return KErrNotSupported.
       
   237 	//
       
   238 	return KErrNotSupported;
       
   239 	}
       
   240 
       
   241 EXPORT_C TInt I2s::EnableRegisterInterrupts(TInt aInterfaceId, TI2sFramePhase aFramePhase, TInt aInterrupt)
       
   242 //
       
   243 // Enables Register PIO access mode related interrupts for a frame phase.
       
   244 //
       
   245 	{
       
   246 	__ASSERT_DEBUG(NKern::CurrentContext() == NKern::EThread, Kern::Fault("I2s Interface", ECalledFromIsr));
       
   247 	// TO DO: (optional)
       
   248 	//
       
   249 	// If the implementation supports Register PIO mode this function enables the mode interrupts specified by the bitmask aInterrupt
       
   250 	// for the frame phase specified (left or right). The mode interrupts are described in TI2sFlags. Bits set to "1" enable the 
       
   251 	// corresponding interrupts
       
   252 	// If the implementation only supports a single transmit register for both frame phases, the aFramePhase argument can be ignored.
       
   253 	// If the implementation does not support Register PIO mode  simply return KErrNotSupported.
       
   254 	//
       
   255 	return KErrNotSupported;
       
   256 	}
       
   257 
       
   258 EXPORT_C TInt I2s::DisableRegisterInterrupts(TInt aInterfaceId, TI2sFramePhase aFramePhase, TInt aInterrupt)
       
   259 //
       
   260 // Disables Register PIO access mode related interrupts for a frame phase.
       
   261 //
       
   262 	{
       
   263 	__ASSERT_DEBUG(NKern::CurrentContext() == NKern::EThread, Kern::Fault("I2s Interface", ECalledFromIsr));
       
   264 	// TO DO: (optional)
       
   265 	//
       
   266 	// If the implementation supports Register PIO mode this function disables the mode interrupts specified by the bitmask aInterrupt
       
   267 	// for the frame phase specified (left or right). The mode interrupts are described in TI2sFlags. Bits set to "1" disable the 
       
   268 	// corresponding interrupts
       
   269 	// If the implementation only supports a single transmit register for both frame phases, the aFramePhase argument can be ignored.
       
   270 	// If the implementation does not support Register PIO mode  simply return KErrNotSupported.
       
   271 	//
       
   272 	return KErrNotSupported;
       
   273 	}
       
   274 
       
   275 EXPORT_C TInt I2s::IsRegisterInterruptEnabled(TInt aInterfaceId, TI2sFramePhase aFramePhase, TInt& aEnabled)
       
   276 //
       
   277 // Reads the Register PIO access mode interrupt mask for a frame phase.
       
   278 //
       
   279 	{
       
   280 	// TO DO: (optional)
       
   281 	//
       
   282 	// If the implementation supports Register PIO mode this function reads the relevant registers to find out which mode interrupts 
       
   283 	// are enabled for the frame phase specified (left or right), and returns a bitmask of enabled interrupts in aEnabled.
       
   284 	// The mode interrupts are described in TI2sFlags. A bit set to "1" indicates the corresponding interrupt is enabled 
       
   285 	// If the implementation only supports a single transmit register for both frame phases, the aFramePhase argument can be ignored.
       
   286 	// If the implementation does not support Register PIO mode  simply return KErrNotSupported.
       
   287 	//
       
   288 	return KErrNotSupported;
       
   289 	}
       
   290 
       
   291 EXPORT_C TInt I2s::EnableFIFO(TInt aInterfaceId, TI2sFramePhase aFramePhase, TInt aFifoMask)
       
   292 //
       
   293 // Enables receive and/or transmit FIFO on a per frame phase basis.
       
   294 //
       
   295 	{
       
   296 	__ASSERT_DEBUG(NKern::CurrentContext() == NKern::EThread, Kern::Fault("I2s Interface", ECalledFromIsr));
       
   297 	// TO DO: (optional)
       
   298 	//
       
   299 	// If the implementation supports FIFO mode this function enables the FIFOs for the directions specified in the bitmask aFifoMask
       
   300 	// (Transmit and/or Receive) for the frame phase specified (left or right). Bits set to "1" enable the corresponding FIFO.
       
   301 	// If the implementation has a combined receive/transmit FIFO - half duplex operation only - then aFifoMask can be ignored.
       
   302 	// If the implementation only supports a single FIFO for both frame phases then aFramePhase can be ignored.
       
   303 	//
       
   304 	return KErrNotSupported;
       
   305 	}
       
   306 
       
   307 EXPORT_C TInt I2s::DisableFIFO(TInt aInterfaceId, TI2sFramePhase aFramePhase, TInt aFifoMask)
       
   308 //
       
   309 // Disables receive and/or transmit FIFO on a per frame phase basis.
       
   310 //
       
   311 	{
       
   312 	__ASSERT_DEBUG(NKern::CurrentContext() == NKern::EThread, Kern::Fault("I2s Interface", ECalledFromIsr));
       
   313 	// TO DO: (optional)
       
   314 	//
       
   315 	// If the implementation supports FIFO mode this function disables the FIFOs for the directions specified in the bitmask aFifoMask
       
   316 	// (Transmit and/or Receive) for the frame phase specified (left or right). Bits set to "1" disable the corresponding FIFO.
       
   317 	// If the implementation has a combined receive/transmit FIFO - half duplex operation only - then aFifoMask can be ignored.
       
   318 	// If the implementation only supports a single FIFO for both frame phases then aFramePhase can be ignored.
       
   319 	//
       
   320 	return KErrNotSupported;
       
   321 	}
       
   322 
       
   323 EXPORT_C TInt I2s::IsFIFOEnabled(TInt aInterfaceId, TI2sFramePhase aFramePhase, TInt& aEnabled)
       
   324 //
       
   325 // Reads the enabled state of a frame phase's FIFOs.
       
   326 //
       
   327 	{
       
   328 	__ASSERT_DEBUG(NKern::CurrentContext() == NKern::EThread, Kern::Fault("I2s Interface", ECalledFromIsr));
       
   329 	// TO DO: (optional)
       
   330 	//
       
   331 	// If the implementation supports FIFO mode this function reads the relevant registers to find out which FIFOs 
       
   332 	// are enabled (Transmit and/or Receive FIFO) for the frame phase specified (left or right), and returns a bitmask of enabled FIFOs in aEnabled.
       
   333 	// The mode interrupts are described in TI2sFlags. A bit set to "1" indicates the corresponding interrupt is enabled 
       
   334 	// If the implementation has a combined receive/transmit FIFO then aEnabled should have both Rx and Tx bits set when the FIFO is enabled.
       
   335 	// If the implementation only supports a single FIFO for both frame phases then aFramePhase is ignore.
       
   336 	//
       
   337 	return KErrNotSupported;
       
   338 	}
       
   339 
       
   340 EXPORT_C TInt I2s::SetFIFOThreshold(TInt aInterfaceId, TI2sFramePhase aFramePhase, TI2sDirection aDirection, TInt aThreshold)
       
   341 //
       
   342 // Sets the receive or transmit FIFO threshold on a per frame phase basis.
       
   343 //
       
   344 	{
       
   345 	__ASSERT_DEBUG(NKern::CurrentContext() == NKern::EThread, Kern::Fault("I2s Interface", ECalledFromIsr));
       
   346 	// TO DO: (optional)
       
   347 	//
       
   348 	// If the implementation supports FIFO mode this function sets the FIFO threshold for the direction specified in aDirection
       
   349 	// (Transmit or Receive) for the frame phase specified (left or right).
       
   350 	// If the implementation has a combined receive/transmit FIFO - half duplex operation only - then aDirection can be ignored.
       
   351 	// If the implementation only supports a single FIFO for both frame phases then aFramePhase can be ignored.
       
   352 	//
       
   353 	return KErrNotSupported;
       
   354 	}
       
   355 
       
   356 EXPORT_C TInt I2s::ReadFIFOModeStatus(TInt aInterfaceId, TI2sFramePhase aFramePhase, TInt& aFlags)
       
   357 //
       
   358 // Reads the FIFO PIO access mode status flags for a frame phase.
       
   359 //
       
   360 	{
       
   361 	// TO DO: (optional)
       
   362 	//
       
   363 	// If the implementation supports FIFO mode this function reads the contents of the FIFO mode status register to obtain
       
   364 	// the status flags for the frame phase specified (left or right) to be returned in aFlags. The mode flags are described in TI2sFlags.
       
   365 	// A bit set to "1" indicates the condition described by the corresponding flag is occurring.
       
   366 	// If the implementation has a combined receive/transmit FIFO then aFlags should be set according to which operation (receive/transmit) is 
       
   367 	// currently undergoing.
       
   368 	// If the implementation only supports a single FIFO for both frame phases then aFramePhase is ignored.
       
   369 	//
       
   370 	return KErrNotSupported;
       
   371 	}
       
   372 
       
   373 EXPORT_C TInt I2s::EnableFIFOInterrupts(TInt aInterfaceId, TI2sFramePhase aFramePhase, TInt aInterrupt)
       
   374 //
       
   375 // Enables FIFO related interrupts for a frame phase.
       
   376 //
       
   377 	{
       
   378 	__ASSERT_DEBUG(NKern::CurrentContext() == NKern::EThread, Kern::Fault("I2s Interface", ECalledFromIsr));
       
   379 	// TO DO: (optional)
       
   380 	//
       
   381 	// If the implementation supports FIFO mode this function enables the mode interrupts specified by the bitmask aInterrupt
       
   382 	// for the frame phase specified (left or right). The mode interrupts are described in TI2sFlags. Bits set to "1" enable the 
       
   383 	// corresponding interrupts
       
   384 	// If the implementation only supports a single transmit FIFO for both frame phases, the aFramePhase argument can be ignored.
       
   385 	//
       
   386 	return KErrNotSupported;
       
   387 	}
       
   388 
       
   389 EXPORT_C TInt I2s::DisableFIFOInterrupts(TInt aInterfaceId, TI2sFramePhase aFramePhase, TInt aInterrupt)
       
   390 //
       
   391 // Disables FIFO related interrupts for a frame phase.
       
   392 //
       
   393 	{
       
   394 	__ASSERT_DEBUG(NKern::CurrentContext() == NKern::EThread, Kern::Fault("I2s Interface", ECalledFromIsr));
       
   395 	// TO DO: (optional)
       
   396 	//
       
   397 	// If the implementation supports FIFO mode this function disables the mode interrupts specified by the bitmask aInterrupt
       
   398 	// for the frame phase specified (left or right). The mode interrupts are described in TI2sFlags. Bits set to "1" disable the 
       
   399 	// corresponding interrupts
       
   400 	// If the implementation only supports a single transmit FIFO for both frame phases, the aFramePhase argument can be ignored.
       
   401 	//
       
   402 	return KErrNotSupported;
       
   403 	}
       
   404 
       
   405 EXPORT_C TInt I2s::IsFIFOInterruptEnabled(TInt aInterfaceId, TI2sFramePhase aFramePhase, TInt& aEnabled)
       
   406 //
       
   407 // Reads the FIFO interrupt masks for a frame phase.
       
   408 //
       
   409 	{
       
   410 	// TO DO: (optional)
       
   411 	//
       
   412 	// If the implementation supports FIFO mode this function reads the relevant registers to find out which mode interrupts 
       
   413 	// are enabled for the frame phase specified (left or right), and returns a bitmask of enabled interrupts in aEnabled.
       
   414 	// The mode interrupts are described in TI2sFlags. A bit set to "1" indicates the corresponding interrupt is enabled 
       
   415 	// If the implementation only supports a single transmit FIFO for both frame phases, the aFramePhase argument can be ignored.
       
   416 	//
       
   417 	return KErrNotSupported;
       
   418 	}
       
   419 
       
   420 EXPORT_C TInt I2s::ReadFIFOLevel(TInt aInterfaceId, TI2sFramePhase aFramePhase, TI2sDirection aDirection, TInt& aLevel)
       
   421 //
       
   422 // Reads the receive or transmit FIFO current level on a per frame phase basis.
       
   423 //
       
   424 	{
       
   425 	__ASSERT_DEBUG(NKern::CurrentContext() == NKern::EThread, Kern::Fault("I2s Interface", ECalledFromIsr));
       
   426 	// TO DO: (optional)
       
   427 	//
       
   428 	// If the implementation supports FIFO mode this function reads the relevant registers to find out the current FIFO level 
       
   429 	// for the direction specified and for the frame phase specified (left or right), and returns it in aLevel.
       
   430 	// If the implementation has a combined receive/transmit FIFO then aDirection is ignored.
       
   431 	// If the implementation only supports a single transmit FIFO for both frame phases, the aFramePhase argument can be ignored.
       
   432 	//
       
   433 	return KErrNotSupported;
       
   434 	}
       
   435 
       
   436 EXPORT_C TInt I2s::EnableDMA(TInt aInterfaceId, TInt aFifoMask)
       
   437 //
       
   438 // Enables receive and/or transmit DMA.
       
   439 //
       
   440 	{
       
   441 	__ASSERT_DEBUG(NKern::CurrentContext() == NKern::EThread, Kern::Fault("I2s Interface", ECalledFromIsr));
       
   442 	// TO DO: (optional)
       
   443 	//
       
   444 	// If the implementation supports FIFO DMA mode this function enables DMA in the directions (Transmit and/or Receive) specified
       
   445 	// by the bitmask aFifoMask for the frame phase specified (left or right). Bits set to "1" enable DMA.
       
   446 	// If the implementation has a combined receive/transmit FIFO then aFifoMask can be ignored.
       
   447 	//
       
   448 	return KErrNotSupported;
       
   449 	}
       
   450 
       
   451 EXPORT_C TInt I2s::DisableDMA(TInt aInterfaceId, TInt aFifoMask)
       
   452 //
       
   453 // Disables receive and/or transmit DMA.
       
   454 //
       
   455 	{
       
   456 	__ASSERT_DEBUG(NKern::CurrentContext() == NKern::EThread, Kern::Fault("I2s Interface", ECalledFromIsr));
       
   457 	// TO DO: (optional)
       
   458 	//
       
   459 	// If the implementation supports FIFO DMA mode this function disables DMA in the directions (Transmit and/or Receive) specified
       
   460 	// by the bitmask aFifoMask for the frame phase specified (left or right). Bits set to "1" disable DMA.
       
   461 	// If the implementation has a combined receive/transmit FIFO then aFifoMask can be ignored.
       
   462 	//
       
   463 	return KErrNotSupported;
       
   464 	}
       
   465 
       
   466 EXPORT_C TInt I2s::IsDMAEnabled(TInt aInterfaceId, TInt& aEnabled)
       
   467 //
       
   468 // Reads the enabled state of DMA.
       
   469 //
       
   470 	{
       
   471 	__ASSERT_DEBUG(NKern::CurrentContext() == NKern::EThread, Kern::Fault("I2s Interface", ECalledFromIsr));
       
   472 	// TO DO: (optional)
       
   473 	//
       
   474 	// If the implementation supports FIFO DMA mode this function reads the relevant registers to find out which directions 
       
   475 	// (Transmit and/or Receive) DMA is  enabled for the frame phase specified (left or right), and returns a bitmask of enabled 
       
   476 	// directions in aEnabled. A bit set to "1" indicates DMA is enabled for the corresponding direction.
       
   477 	// If the implementation has a combined receive/transmit FIFO then aEnabled should have both Rx and Tx bits set when the DMA is enabled.
       
   478 	//
       
   479 	return KErrNotSupported;
       
   480 	}
       
   481 
       
   482 EXPORT_C TInt I2s::Start(TInt aInterfaceId, TInt aDirection)
       
   483 //
       
   484 // Starts data transmission and/or data reception unless interface is a Controller;
       
   485 // if the device is also a Master, starts generation of data synchronisation signals.
       
   486 //
       
   487 	{
       
   488 	__ASSERT_DEBUG(NKern::CurrentContext() == NKern::EThread, Kern::Fault("I2s Interface", ECalledFromIsr));
       
   489 	// TO DO: (optional)
       
   490 	//
       
   491 	// Programs the appropriate registers to start operation in the direction specified by aDirection.
       
   492 	// Should check if the interface has been configured coherently.
       
   493 	//
       
   494 	return KErrNotSupported;
       
   495 	}
       
   496 
       
   497 EXPORT_C TInt I2s::Stop(TInt aInterfaceId, TInt aDirection)
       
   498 //
       
   499 // Stops data transmission and/or data reception;
       
   500 // if device is also a Master, stops generation of data synchronisation signals.
       
   501 //
       
   502 	{
       
   503 	__ASSERT_DEBUG(NKern::CurrentContext() == NKern::EThread, Kern::Fault("I2s Interface", ECalledFromIsr));
       
   504 	// TO DO: (optional)
       
   505 	//
       
   506 	// If the interface has been started, programs the appropriate registers to stop operation in the direction specified by aDirection.
       
   507 	//
       
   508 	return KErrNotSupported;
       
   509 	}
       
   510 
       
   511 EXPORT_C TInt I2s::IsStarted(TInt aInterfaceId, TI2sDirection aDirection, TBool& aStarted)
       
   512 //
       
   513 // Checks if a transmission or a reception is underway.
       
   514 //
       
   515 	{
       
   516 	// TO DO: (optional)
       
   517 	//
       
   518 	// Reads the appropriate registers to check if the interface speficied by aInterfaceId is started in the direction
       
   519 	// specified by aDirection. Returns teh result (as TRUE or FALSE) in aStarted.
       
   520 	// If the interface is a Controller and a bus operation is underway, ETrue should be returned regardless of aDirection.
       
   521 	//
       
   522 	return KErrNotSupported;
       
   523 	}
       
   524 
       
   525 // dll entry point..
       
   526 DECLARE_STANDARD_EXTENSION()
       
   527 	{
       
   528 	// TO DO: (optional)
       
   529 	//
       
   530 	// The Kernel extension entry point: if your interface requires any early intialisation do it here.
       
   531 	//
       
   532 	return KErrNone;
       
   533 	}