1 /* |
1 /* |
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
2 * This component and the accompanying materials are made available |
5 * under the terms of the License "Eclipse Public License v1.0" |
3 * under the terms of the License "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
4 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
5 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
8 * |
6 * |
9 * Initial Contributors: |
7 * Initial Contributors: |
10 * Nokia Corporation - initial contribution. |
8 * Nokia Corporation - initial contribution. |
11 * |
9 * |
12 * Contributors: |
10 * Contributors: |
|
11 * Accenture Ltd |
13 * |
12 * |
14 * Description: |
13 * Description: This file is a part of sound driver for Syborg adaptation. |
15 * |
14 * |
16 */ |
15 */ |
17 |
16 |
18 #include "variant_sound.h" |
17 #include "variant_sound.h" |
|
18 #include "virtio_iohandler.h" |
|
19 #include "../specific/syborg.h" |
19 |
20 |
20 _LIT(KSoundScPddName, "SoundSc.Syborg"); |
21 _LIT(KSoundScPddName, "SoundSc.Syborg"); |
21 |
22 |
22 |
|
23 DECLARE_STANDARD_PDD() |
23 DECLARE_STANDARD_PDD() |
24 { |
24 { |
|
25 SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPddFactory created\n"); |
25 return new DDriverSyborgSoundScPddFactory; |
26 return new DDriverSyborgSoundScPddFactory; |
26 } |
27 } |
27 |
28 |
28 |
29 |
29 DDriverSyborgSoundScPddFactory::DDriverSyborgSoundScPddFactory() |
30 DDriverSyborgSoundScPddFactory::DDriverSyborgSoundScPddFactory() |
30 { |
31 { |
31 |
|
32 iUnitsMask = ((1 << KSoundScTxUnit0) | (1 << KSoundScRxUnit0)); |
32 iUnitsMask = ((1 << KSoundScTxUnit0) | (1 << KSoundScRxUnit0)); |
33 |
33 |
34 iVersion = RSoundSc::VersionRequired(); |
34 iVersion = RSoundSc::VersionRequired(); |
35 } |
35 } |
36 |
36 |
37 |
37 |
38 TInt DDriverSyborgSoundScPddFactory::Install() |
38 TInt DDriverSyborgSoundScPddFactory::Install() |
39 { |
39 { |
40 _LIT(KAudioDFC, "AUDIO DFC"); |
40 _LIT(KAudioDFC, "AUDIO DFC"); |
41 // Get a pointer to the the McBSP's DFC Queue so that handling of both McBSP callbacks and requests |
41 |
42 // made to the LDD from user mode can be processed in the same thread, to avoid the use of semaphores |
42 // LDD driver is going to use the same queue. |
43 TInt r = Kern::DfcQCreate(iDfcQ, 26, &KAudioDFC); |
43 TInt r = Kern::DynamicDfcQCreate(iDfcQ, KAudioDfcQueuePriority, KAudioDFC); |
44 |
44 |
45 SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPddFactory::PDD install"); |
45 SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPddFactory::PDD install"); |
46 |
46 |
47 if(r==KErrNone) |
47 if(r!=KErrNone) |
48 { |
48 { |
49 // All PDD factories must have a unique name |
49 SYBORG_SOUND_DEBUG("Creating audio DFC failed %d",r); |
50 TInt r = SetName(&KSoundScPddName); |
50 return r; |
51 } |
51 } |
52 |
52 // All PDD factories must have a unique name |
|
53 r = SetName(&KSoundScPddName); |
|
54 if (r!=KErrNone) |
|
55 { |
|
56 SYBORG_SOUND_DEBUG("Setting name %x",r); |
|
57 return r; |
|
58 } |
|
59 iIoHandler = new VirtIo::DIoHandler( |
|
60 (TAny*)KHwSVPAudioDevice, |
|
61 EIntAudio0, |
|
62 iDfcQ ); |
|
63 |
|
64 if (iIoHandler == NULL) |
|
65 { |
|
66 iDfcQ->Destroy(); |
|
67 return KErrNoMemory; |
|
68 } |
|
69 |
|
70 SYBORG_SOUND_DEBUG("Constructing IoHandler"); |
|
71 |
|
72 r = iIoHandler->Construct(); |
|
73 |
|
74 if ( r != KErrNone) |
|
75 { |
|
76 iDfcQ->Destroy(); |
|
77 delete iIoHandler; |
|
78 } |
|
79 |
|
80 SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPddFactory::PDD installed"); |
|
81 |
53 return r; |
82 return r; |
54 } |
83 } |
|
84 |
|
85 DDriverSyborgSoundScPddFactory::~DDriverSyborgSoundScPddFactory() |
|
86 { |
|
87 if (iIoHandler) |
|
88 { |
|
89 delete iIoHandler; |
|
90 iIoHandler = NULL; |
|
91 } |
|
92 if (iDfcQ) |
|
93 iDfcQ->Destroy(); |
|
94 } |
|
95 |
55 |
96 |
56 void DDriverSyborgSoundScPddFactory::GetCaps(TDes8& /*aDes*/) const |
97 void DDriverSyborgSoundScPddFactory::GetCaps(TDes8& /*aDes*/) const |
57 { |
98 { |
58 } |
99 } |
59 |
100 |
79 } |
120 } |
80 |
121 |
81 TInt DDriverSyborgSoundScPddFactory::Create(DBase*& aChannel, TInt aUnit, const TDesC8* /*aInfo*/, const TVersion& /*aVer*/) |
122 TInt DDriverSyborgSoundScPddFactory::Create(DBase*& aChannel, TInt aUnit, const TDesC8* /*aInfo*/, const TVersion& /*aVer*/) |
82 { |
123 { |
83 |
124 |
84 DSoundScPdd* pD = NULL; |
|
85 |
|
86 SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPddFactory::PDD create aUnit %d TxUnitId %d", aUnit, KSoundScTxUnit0); |
125 SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPddFactory::PDD create aUnit %d TxUnitId %d", aUnit, KSoundScTxUnit0); |
87 |
126 |
88 // Assume failure |
127 // Assume failure |
89 TInt r = KErrNoMemory; |
128 TInt r = KErrNoMemory; |
90 aChannel = NULL; |
129 aChannel = NULL; |
91 |
130 |
92 |
131 |
93 DDriverSyborgSoundScPdd* pTxD = new DDriverSyborgSoundScPdd; |
132 DDriverSyborgSoundScPdd* pTxD = new DDriverSyborgSoundScPdd( this, aUnit, |
|
133 iIoHandler, aUnit == KSoundScTxUnit0?1:2 ); |
94 |
134 |
95 SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPddFactory::TxPdd %d", pTxD); |
135 SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPddFactory::TxPdd %x", pTxD); |
96 |
136 |
97 if (pTxD) |
137 if (pTxD) |
98 { |
138 { |
99 pD = pTxD; |
139 SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPddFactory::TxPdd2 %x", pTxD); |
100 |
|
101 // Save a pointer to the factory so that it is accessible by the PDD and call the PDD's |
|
102 // second stage constructor |
|
103 pTxD->iPhysicalDevice = this; |
|
104 |
|
105 pTxD->iUnitType = aUnit; // Either KSoundScTxUnit0 or KSoundScRxUnit0 (play or record) |
|
106 |
|
107 SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPddFactory::TxPdd2 %d", pTxD); |
|
108 |
140 |
109 r = pTxD->DoCreate(); |
141 r = pTxD->DoCreate(); |
110 |
142 |
111 SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPddFactory::Create ret %d", r); |
143 SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPddFactory::Create ret %d", r); |
112 |
144 |