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