Update contrib.
1 // Copyright (c) 1995-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32\drivers\pbus\pccard\epoc\pccd_init.cpp
19 #include "pbusmedia.h"
21 GLDEF_D TPcCardControllerInterface* ThePccdCntrlInterface=NULL;
23 EXPORT_C TInt TPcCardControllerInterface::Create()
25 // Allocate any resources. Only done once on kernel initialization so don't
26 // worry about cleanup if it fails.
29 __KTRACE_OPT(KPBUS1,Kern::Printf(">TPcCardControllerInterface::Create"));
30 ThePccdCntrlInterface=this;
35 for (i=0; i<KMaxPBusSockets && r==KErrNone; i++)
37 if (IsPcCardSocket(i,mdi))
39 __KTRACE_OPT(KPBUS1,Kern::Printf("Socket %d is PC card",i));
40 DPcCardSocket* pS=PccdIfc::NewSocket(i);
47 TInt mcid=MediaChangeFromSocket(i);
48 __KTRACE_OPT(KPBUS1,Kern::Printf("Socket %d Media Change %d",i,mcid));
49 DPcCardMediaChange* pM=(DPcCardMediaChange*)TheMediaChanges[mcid];
52 __KTRACE_OPT(KPBUS1,Kern::Printf("New Media Change"));
53 pM=PccdIfc::NewMediaChange(mcid);
59 TheMediaChanges[mcid]=pM;
60 __KTRACE_OPT(KPBUS1,Kern::Printf("Media Change %d at %08x",mcid,pM));
67 __KTRACE_OPT(KPBUS1,Kern::Printf("Media Change %d already exists at %08x",mcid,pM));
70 TInt vcc=VccFromSocket(i);
71 __KTRACE_OPT(KPBUS1,Kern::Printf("Socket %d Vcc %d",i,vcc));
72 DPcCardVcc* pV=(DPcCardVcc*)TheVccs[vcc];
75 __KTRACE_OPT(KPBUS1,Kern::Printf("New Vcc"));
76 pV=PccdIfc::NewVcc(vcc,mcid);
83 __KTRACE_OPT(KPBUS1,Kern::Printf("Vcc %d at %08x",vcc,pV));
90 __KTRACE_OPT(KPBUS1,Kern::Printf("Vcc %d already exists at %08x, mcid=%d",vcc,pV,pV->iMediaChangeNum));
91 // DISALLOW SHARED PSUs UNTIL SOMEONE NEEDS THEM
92 // if (pV->iMediaChangeNum!=mcid)
98 r=pS->Create(mdi.iDeviceName);
101 pS->iMediaChangeNumber=mcid;
110 __KTRACE_OPT(KPBUS1,Kern::Printf("Socket %d Created OK",i));
113 __KTRACE_OPT(KPBUS1,Kern::Printf("Socket %d not PC card",i));
116 for (i=0; i<KMaxPBusSockets && r==KErrNone; i++)
118 if (IsPcCardSocket(i,mdi))
120 DPBusSocket* pS=TheSockets[i];
121 DPBusPrimaryMedia* pM=new DPBusPrimaryMedia(pS);
124 r=LocDrv::RegisterMediaDevice(mdi.iDevice,mdi.iDriveCount,mdi.iDriveList,pM,mdi.iNumMedia,*mdi.iDeviceName);
125 __KTRACE_OPT(KPBUS1,Kern::Printf("Registering PcCard device %lS (socket %d) for %d drives returns %d",mdi.iDeviceName,pM->iSocket->iSocketNumber,mdi.iDriveCount,r));
130 __KTRACE_OPT(KPBUS1,Kern::Printf("<TPcCardControllerInterface::Create, ret %d",r));