bthci/hci2implementations/initialisors/brcm/src/ControllerInitialisationPluginImpl.cpp
author Christophe Porcel <christophe.porcel@broadcom.com>
Wed, 28 Jul 2010 17:24:32 +0100
branchbroadcom_h4
changeset 37 f53839ff73b7
permissions -rw-r--r--
Broadcom H4 contribution
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
37
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
     1
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
     2
// All rights reserved.
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
     3
// This component and the accompanying materials are made available
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
     4
// under the terms of "Eclipse Public License v1.0"
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
     5
// which accompanies this distribution, and is available
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
     7
//
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
     8
// Initial Contributors:
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    10
//
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    11
// Contributors:
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    12
//
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    13
// Description:
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    14
//
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    15
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    16
/**
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    17
 @file
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    18
 @internalComponent
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    19
*/
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    20
#include <bluetooth/hcicommandQueue.h>
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    21
#include "broadcomcontrollerinitialisor.h"
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    22
#include "controllerinitialisationpluginimpl.h"
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    23
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    24
#include <bluetooth/hci/vendordebugcommand.h>
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    25
#include <bluetooth/hci/controllerinitialisationobserver.h>
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    26
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    27
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    28
#include <bluetooth/hci/commandcompleteevent.h>
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    29
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    30
#include <bluetooth/hci/vendordebugcompleteevent.h>
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    31
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    32
#include <bluetooth/hci/hctlinterface.h>
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    33
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    34
#include <bluetooth/hci/corehci.h>
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    35
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    36
#include <bluetooth/logger.h>
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    37
#include <e32debug.h>
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    38
#include <CIniData.h>
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    39
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    40
#define INITIALISOR_BCM_LOGGER
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    41
#define BCM_TRANSPORT
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    42
#define UPDATEBAUDRATE_AFTER_PRD
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    43
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    44
#ifdef INITIALISOR_BCM_LOGGER
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    45
#define INITIALISOR_BCM_LOG(A)		RDebug::Print(A);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    46
#define INITIALISOR_BCM_LOG2(A,B)	RDebug::Print(A,B);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    47
#define INITIALISOR_BCM_LOG3(A,B,C)		RDebug::Print(A,B,C);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    48
#else
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    49
#define INITIALISOR_BCM_LOG(A)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    50
#define INITIALISOR_BCM_LOG2(A,B)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    51
#define INITIALISOR_BCM_LOG3(A,B,C)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    52
#define INITIALISOR_BCM_LOG4(A,B,C,D)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    53
#endif
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    54
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    55
const TUint32 BCM2048_RAM_LOCATION = 0x00085D00;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    56
const TUint32 BCM4325_RAM_LOCATION = 0x00086800;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    57
const TUint32 BCM2046_RAM_LOCATION = 0x00086800 ; //0x00087AC8;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    58
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    59
TUint32 KDestRamLocation = BCM2048_RAM_LOCATION;	// by default this location is for BCM2048
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    60
// 50 mstimer.
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    61
const TInt KMiniDriverToPatchRamTimerDuration = 50000;		// 50000;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    62
const TInt KEndDelayTimerDuration = 750000;		//250000;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    63
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    64
#define BAUDRATE_921600		921600
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    65
#define BAUDRATE_115200		115200
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    66
#define BAUDRATE_57600		BAUDRATE_921600		// for now we map the BR 57600 to 921600
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    67
#define UART_24MHZ_CLOCK	24000000
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    68
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    69
TInt iBaudRate = BAUDRATE_115200;		// default baudrate
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    70
TInt iBaudRateAfter = BAUDRATE_115200;		// default baudrate
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    71
TInt iUartClock = UART_24MHZ_CLOCK;		// default baudrate
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    72
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    73
#ifdef BCM_TRANSPORT
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    74
_LIT(KDefaultIniFileName, "hctl_broadcom.ini");
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    75
#else
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    76
_LIT(KDefaultIniFileName, "hctl_uart_original.ini");
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    77
#endif
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    78
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    79
_LIT(KConfigFileFileFormat, "%S%S");
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    80
#if 0
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    81
_LIT(KDefaultConfigFileFileFormat, "%S%S.bin");
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    82
#else
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    83
_LIT(KDefaultConfigFileFileFormat, "%S%S.hcd");
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    84
#endif
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    85
_LIT(KDefaultConfigFileName, "BCM2046B1");
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    86
_LIT(KDefaultConfigFilePath, "z:\\private\\101f7989\\Bluetooth\\");
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    87
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    88
_LIT(KGlobalReadySemName, "BCM_BT_READY_010155");
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    89
//RSemaphore BCM_DriverReadySem;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    90
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    91
#ifdef __FLOG_ACTIVE
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    92
_LIT8(KLogComponent, LOG_COMPONENT_INITIALISOR_BROADCOM);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    93
//_LIT8(KLogComponent, "InitBRCM");
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    94
#endif
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    95
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    96
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    97
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    98
/*static*/ CControllerInitialisationPluginImpl* CControllerInitialisationPluginImpl::NewL()
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    99
	{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   100
	LOG_STATIC_FUNC
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   101
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   102
	CControllerInitialisationPluginImpl* self = new (ELeave) CControllerInitialisationPluginImpl();
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   103
	CleanupStack::PushL(self);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   104
	self->ConstructL();
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   105
	CleanupStack::Pop(self);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   106
	return self;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   107
	}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   108
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   109
CControllerInitialisationPluginImpl::~CControllerInitialisationPluginImpl()
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   110
	{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   111
	LOG_FUNC
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   112
	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   113
	// Delete async CallBacks.	If running, these should be cancelled by the
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   114
	// d'tor of CAsyncOneShot.
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   115
	delete iAsyncCallBackForPostReset;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   116
	delete iCConfigFileDownload;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   117
	delete iMiniDrive2ConfigFileTimer;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   118
	}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   119
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   120
void CControllerInitialisationPluginImpl::ConstructL()
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   121
	{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   122
	LOG_FUNC
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   123
	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   124
	// Add Async Callbacks	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   125
	TCallBack postResetCallBack(AsyncCallBackForPostReset, this);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   126
	iAsyncCallBackForPostReset = new (ELeave)CAsyncCallBack(postResetCallBack, CActive::EPriorityStandard); 
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   127
	iMiniDrive2ConfigFileTimer = CConfigFileTimer::NewL(*this);	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   128
	}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   129
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   130
// Protected constructor.
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   131
CControllerInitialisationPluginImpl::CControllerInitialisationPluginImpl()
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   132
	{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   133
	LOG_FUNC
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   134
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   135
	}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   136
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   137
/*virtual*/ void CControllerInitialisationPluginImpl::MciiPreResetCommand()
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   138
	{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   139
	LOG_FUNC
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   140
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   141
	__ASSERT_DEBUG(iControllerInitialisationObserver, PANIC(KBroadcomControllerInitialisorPanic, ENullInitialisationObserver));
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   142
	// Do any pre-reset initialisation...
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   143
#ifndef __WINSCW__
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   144
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   145
	INITIALISOR_BCM_LOG2(_L("Initialisor_Broadcom : Set Initial BaudRate to %d before reset"), iBaudRate)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   146
    
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   147
	MHctlBcmConfigInterface* hctlConfigInterface = static_cast<MHctlBcmConfigInterface*>(iCoreHci->MchHctlPluginInterface(TUid::Uid(KHctlBcmConfigInterfaceUid)));	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   148
	__ASSERT_DEBUG(hctlConfigInterface, PANIC(KBroadcomControllerInitialisorPanic, EConfigInterfaceNull));			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   149
	hctlConfigInterface->MhciUpdateBaudRate(iBaudRate);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   150
#endif
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   151
	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   152
	INITIALISOR_BCM_LOG(_L("Initialisor_Broadcom : call McioPreResetCommandComplete(KErrNone)"))
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   153
	// Inform stack that we have finished
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   154
	iControllerInitialisationObserver->McioPreResetCommandComplete(KErrNone);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   155
	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   156
	}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   157
/*virtual*/ TAny* CControllerInitialisationPluginImpl::Interface(TUid aUid)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   158
	{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   159
	LOG_FUNC
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   160
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   161
	TAny* ret = NULL;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   162
	switch(aUid.iUid)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   163
		{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   164
		case KControllerInitialisationInterfaceUid:
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   165
			ret = reinterpret_cast<TAny*>(static_cast<MControllerInitialisationInterface*>(this));
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   166
			break;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   167
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   168
		default:
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   169
			break;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   170
		};
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   171
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   172
	return ret;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   173
	}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   174
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   175
/*static*/ TInt CControllerInitialisationPluginImpl::AsyncCallBackForPostReset(TAny* aInitPlugin)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   176
	{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   177
	LOG_STATIC_FUNC
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   178
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   179
	INITIALISOR_BCM_LOG(_L("Initialisor_Broadcom : CControllerInitialisationPluginImpl::AsyncCallBackForPostReset(TAny* aInitPlugin)"))
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   180
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   181
	CControllerInitialisationPluginImpl* initPlugin = static_cast<CControllerInitialisationPluginImpl*>(aInitPlugin);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   182
	initPlugin->DoPostReset();
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   183
	return EFalse;	// Don't call back any more.
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   184
	}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   185
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   186
void CControllerInitialisationPluginImpl::InitialiseAndLoadMiniDriver()
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   187
	{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   188
	LOG_FUNC
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   189
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   190
	CVendorDebugCommand* cmd = NULL;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   191
	TInt err = KErrNone;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   192
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   193
	INITIALISOR_BCM_LOG(_L("Initialisor_Broadcom : InitialiseAndLoadMiniDriver()"))
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   194
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   195
	// Chinda - Check for specific patch ram file in patch_ram section in hctl_bcm.ini file
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   196
	TFileName fileName;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   197
	CIniData* pIniFile = NULL;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   198
	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   199
	TName name;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   200
	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   201
	name.Copy(KDefaultConfigFilePath);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   202
	name.Append(KDefaultIniFileName);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   203
	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   204
	_LIT(KFileHcdExtension,"*.hcd");
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   205
	_LIT(KFileBinExtension,"*.bin");
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   206
	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   207
	_LIT(KPatchramSection, "patch_ram");
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   208
	_LIT(KPatchramPath, "path");
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   209
	_LIT(KPatchramFile, "file");
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   210
	_LIT(KPatchramLocation, "location");
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   211
	TInt iRamLocation;	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   212
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   213
	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   214
	TRAP(err, pIniFile = CIniData::NewL(name));
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   215
	if (err != KErrNone)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   216
		{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   217
		// Attempt to open the config file.
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   218
		fileName.Format(KDefaultConfigFileFileFormat,&KDefaultConfigFilePath, &KDefaultConfigFileName);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   219
		iBaudRate = BAUDRATE_115200;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   220
		iBaudRateAfter = BAUDRATE_115200;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   221
		} 
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   222
	else
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   223
		{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   224
		// First read COM port and baudrate
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   225
		if (pIniFile)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   226
			{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   227
			_LIT(KCOMPortSection, "hctl");
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   228
			_LIT(KCOMBaudRate, "baud_rate");
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   229
			_LIT(KCOMBaudRateAfter, "functional_baud_rate");
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   230
			_LIT(KCOMUARTClock, "uart_clock");
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   231
			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   232
			if (!pIniFile->FindVar(KCOMPortSection, KCOMBaudRate, iBaudRate))
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   233
				{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   234
				iBaudRate = BAUDRATE_115200;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   235
				}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   236
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   237
			if (!pIniFile->FindVar(KCOMPortSection, KCOMBaudRateAfter, iBaudRateAfter))
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   238
				{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   239
					iBaudRateAfter = BAUDRATE_115200;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   240
				}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   241
			if (!pIniFile->FindVar(KCOMPortSection, KCOMUARTClock, iUartClock))
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   242
				{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   243
					iUartClock = UART_24MHZ_CLOCK;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   244
				}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   245
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   246
			TPtrC PathText;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   247
			TPtrC FileText;			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   248
		
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   249
			//TBufC8<256> strFileExtension;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   250
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   251
			if (!pIniFile->FindVar(KPatchramSection, KPatchramPath, PathText))
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   252
				{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   253
				PathText.Set(KDefaultConfigFilePath);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   254
				}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   255
#if 1
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   256
			if (!pIniFile->FindVar(KPatchramSection, KPatchramFile, FileText))
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   257
				{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   258
				FileText.Set(KDefaultConfigFileName);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   259
				fileName.Format(KDefaultConfigFileFileFormat,&PathText, &FileText);					
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   260
				}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   261
			else
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   262
				{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   263
				fileName.Format(KConfigFileFileFormat,&PathText, &FileText);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   264
				}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   265
			}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   266
		else
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   267
			{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   268
			//FileText.Set(KDefaultConfigFileName);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   269
			fileName.Format(KDefaultConfigFileFileFormat,&KDefaultConfigFilePath, &KDefaultConfigFileName);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   270
			// ADD EXTENSION CHECK HERE
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   271
			}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   272
		
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   273
		// Check if we have an hcd file to download
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   274
		if(fileName.Match(KFileHcdExtension) != KErrNotFound)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   275
			{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   276
			iFileFormat = EHcdFileFormat;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   277
			delete pIniFile;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   278
			}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   279
		else
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   280
			{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   281
			// Check if we have a binary file to download
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   282
			if(fileName.Match(KFileBinExtension) != KErrNotFound)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   283
				{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   284
				iFileFormat = EBinFileFormat;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   285
				// check for ram location in ini file
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   286
				if (pIniFile->FindVar(KPatchramSection, KPatchramLocation, iRamLocation) != EFalse)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   287
					KDestRamLocation = iRamLocation;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   288
				else if (fileName.Find(_L("2048")) != KErrNotFound)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   289
					KDestRamLocation = BCM2048_RAM_LOCATION;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   290
				else if (fileName.Find(_L("4325")) != KErrNotFound)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   291
					KDestRamLocation = BCM4325_RAM_LOCATION;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   292
				else if (fileName.Find(_L("2046")) != KErrNotFound)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   293
					KDestRamLocation = BCM2046_RAM_LOCATION;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   294
				delete pIniFile;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   295
				}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   296
			else	//Unknown file type SHOULD NEVER FALL IN THIS CONDITION
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   297
				{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   298
					iInitState = EIdle;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   299
					MHctlBcmConfigInterface* hctlConfigInterface = static_cast<MHctlBcmConfigInterface*>(iCoreHci->MchHctlPluginInterface(TUid::Uid(KHctlBcmConfigInterfaceUid)));	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   300
					__ASSERT_DEBUG(hctlConfigInterface, PANIC(KBroadcomControllerInitialisorPanic, EConfigInterfaceNull));			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   301
					hctlConfigInterface->MhciSetInitPluginState(EIdle);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   302
					
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   303
					iFileFormat = EUnknownFileFormat;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   304
					delete pIniFile;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   305
					return;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   306
				}			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   307
			}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   308
		}			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   309
			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   310
#else
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   311
		
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   312
		if (!pIniFile->FindVar(KPatchramSection, KPatchramFile, FileText))
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   313
			{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   314
			FileText.Set(KDefaultConfigFileName);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   315
			fileName.Format(KDefaultConfigFileFileFormat,&PathText, &FileText);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   316
			}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   317
		else
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   318
			{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   319
			fileName.Format(KConfigFileFileFormat,&PathText, &FileText);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   320
			}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   321
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   322
		// check for ram location in ini file
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   323
		if (pIniFile->FindVar(KPatchramSection, KPatchramLocation, iRamLocation) != EFalse)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   324
			KDestRamLocation = iRamLocation;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   325
		else if (fileName.Find(_L("2048")) != KErrNotFound)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   326
			KDestRamLocation = BCM2048_RAM_LOCATION;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   327
		else if (fileName.Find(_L("4325")) != KErrNotFound)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   328
			KDestRamLocation = BCM4325_RAM_LOCATION;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   329
		else if (fileName.Find(_L("2046")) != KErrNotFound)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   330
			KDestRamLocation = BCM2046_RAM_LOCATION;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   331
		delete pIniFile;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   332
		}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   333
	else
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   334
		{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   335
		fileName.Format(KDefaultConfigFileFileFormat,&KDefaultConfigFilePath, &KDefaultConfigFileName);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   336
		}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   337
	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   338
	}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   339
		
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   340
			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   341
#endif
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   342
			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   343
				
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   344
	// Open the config file 
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   345
	TRAP(err, iCConfigFileDownload = CConfigFileDownload::NewL(fileName));
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   346
	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   347
	if (err != KErrNone)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   348
		{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   349
		iControllerInitialisationObserver->McioPostResetCommandComplete(err);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   350
		iInitState = EIdle;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   351
		MHctlBcmConfigInterface* hctlConfigInterface = static_cast<MHctlBcmConfigInterface*>(iCoreHci->MchHctlPluginInterface(TUid::Uid(KHctlBcmConfigInterfaceUid)));	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   352
		__ASSERT_DEBUG(hctlConfigInterface, PANIC(KBroadcomControllerInitialisorPanic, EConfigInterfaceNull));			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   353
		hctlConfigInterface->MhciSetInitPluginState(EIdle);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   354
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   355
		
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   356
		}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   357
	else
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   358
		{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   359
		// initiate Dwl config file
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   360
		TRAP(err, cmd = CVendorDebugCommand::NewL(KHciVSDownloadMiniDriver));
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   361
		if (err == KErrNone)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   362
			{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   363
			TRAP(err, iHCICommandQueue->MhcqAddInitCommandL(cmd, *this));
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   364
			if(err != KErrNone)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   365
				{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   366
				// Inform the stack of the initialisation status.
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   367
				iControllerInitialisationObserver->McioPostResetCommandComplete(err);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   368
				iInitState = EIdle;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   369
				MHctlBcmConfigInterface* hctlConfigInterface = static_cast<MHctlBcmConfigInterface*>(iCoreHci->MchHctlPluginInterface(TUid::Uid(KHctlBcmConfigInterfaceUid)));	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   370
				__ASSERT_DEBUG(hctlConfigInterface, PANIC(KBroadcomControllerInitialisorPanic, EConfigInterfaceNull));			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   371
				hctlConfigInterface->MhciSetInitPluginState(EIdle);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   372
				}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   373
			else
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   374
				{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   375
				if(iFileFormat == EBinFileFormat)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   376
					{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   377
					iDestRam = KDestRamLocation;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   378
					iTxPatchLength = 0;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   379
					}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   380
				iInitState = EloadingMiniDriver;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   381
				MHctlBcmConfigInterface* hctlConfigInterface = static_cast<MHctlBcmConfigInterface*>(iCoreHci->MchHctlPluginInterface(TUid::Uid(KHctlBcmConfigInterfaceUid)));	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   382
				__ASSERT_DEBUG(hctlConfigInterface, PANIC(KBroadcomControllerInitialisorPanic, EConfigInterfaceNull));			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   383
				hctlConfigInterface->MhciSetInitPluginState(EloadingMiniDriver);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   384
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   385
				}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   386
			}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   387
		else
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   388
			{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   389
			iControllerInitialisationObserver->McioPostResetCommandComplete(err);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   390
			iInitState = EIdle;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   391
			MHctlBcmConfigInterface* hctlConfigInterface = static_cast<MHctlBcmConfigInterface*>(iCoreHci->MchHctlPluginInterface(TUid::Uid(KHctlBcmConfigInterfaceUid)));	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   392
			__ASSERT_DEBUG(hctlConfigInterface, PANIC(KBroadcomControllerInitialisorPanic, EConfigInterfaceNull));			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   393
			hctlConfigInterface->MhciSetInitPluginState(EIdle);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   394
			}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   395
		}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   396
	}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   397
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   398
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   399
void CControllerInitialisationPluginImpl::DoPostReset()
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   400
	{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   401
	LOG_FUNC
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   402
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   403
	INITIALISOR_BCM_LOG(_L("Initialisor_Broadcom : CControllerInitialisationPluginImpl::DoPostReset()"))
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   404
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   405
	InitialiseAndLoadMiniDriver();
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   406
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   407
	}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   408
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   409
/*virtual*/ void CControllerInitialisationPluginImpl::MciiPostResetCommand()
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   410
	{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   411
	LOG_FUNC
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   412
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   413
	__ASSERT_DEBUG(iControllerInitialisationObserver, PANIC(KBroadcomControllerInitialisorPanic, ENullInitialisationObserver));
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   414
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   415
	// Use async callback
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   416
	iAsyncCallBackForPostReset->CallBack();
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   417
	}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   418
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   419
void CControllerInitialisationPluginImpl::HandleVendorSpecificCompleteEvent(const TVendorDebugCompleteEvent& aEvent)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   420
	{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   421
	LOG_FUNC
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   422
	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   423
	CVendorDebugCommand* cmd = NULL;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   424
	TInt err = KErrNone;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   425
	THCIErrorCode hcierr = EOK;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   426
	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   427
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   428
	switch(iInitState)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   429
		{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   430
		
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   431
		case EloadingMiniDriver:
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   432
			{	    			    	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   433
			if (aEvent.CommandOpcode() == KHciVSDownloadMiniDriver )
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   434
				{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   435
				INITIALISOR_BCM_LOG2(_L("Initialisor_Broadcom : HCI VSC Download Mini Driver event (%04x)"), aEvent.CommandOpcode())
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   436
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   437
				hcierr = aEvent.ErrorCode();
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   438
				if (hcierr == EOK)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   439
					{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   440
				   	// Delay before actual patch ram download
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   441
				   	iMiniDrive2ConfigFileTimer->Start(KMiniDriverToPatchRamTimerDuration);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   442
				   	if(iFileFormat == EBinFileFormat)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   443
				   		{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   444
						iInitState = EMiniDrvToBinConfigFileDelay;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   445
						MHctlBcmConfigInterface* hctlConfigInterface = static_cast<MHctlBcmConfigInterface*>(iCoreHci->MchHctlPluginInterface(TUid::Uid(KHctlBcmConfigInterfaceUid)));	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   446
						__ASSERT_DEBUG(hctlConfigInterface, PANIC(KBroadcomControllerInitialisorPanic, EConfigInterfaceNull));			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   447
						hctlConfigInterface->MhciSetInitPluginState(EMiniDrvToBinConfigFileDelay);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   448
				   		}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   449
				   	else if(iFileFormat == EHcdFileFormat)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   450
				   		{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   451
						iInitState = EMiniDrvToHcdConfigFileDelay;	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   452
						MHctlBcmConfigInterface* hctlConfigInterface = static_cast<MHctlBcmConfigInterface*>(iCoreHci->MchHctlPluginInterface(TUid::Uid(KHctlBcmConfigInterfaceUid)));	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   453
						__ASSERT_DEBUG(hctlConfigInterface, PANIC(KBroadcomControllerInitialisorPanic, EConfigInterfaceNull));			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   454
						hctlConfigInterface->MhciSetInitPluginState(EMiniDrvToHcdConfigFileDelay);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   455
				   		}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   456
					}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   457
				}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   458
			}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   459
			break;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   460
			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   461
		case ELoadingHcdConfigFileData:
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   462
			{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   463
			INITIALISOR_BCM_LOG(_L("WRITE RAM COMPLETE EVENT"))
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   464
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   465
			if (aEvent.CommandOpcode() == KHciVSWriteRam )
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   466
				{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   467
				hcierr = aEvent.ErrorCode();
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   468
				if (hcierr == EOK)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   469
					{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   470
					THCIOpcode CommandOpcode;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   471
					TUint8 DataChunkLen = 0;			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   472
				
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   473
					iCConfigFileDownload->ReadCommandOpcode(CommandOpcode);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   474
				
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   475
					TRAP(err, cmd = CVendorDebugCommand::NewL(CommandOpcode));
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   476
					if (err == KErrNone)	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   477
						{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   478
						TDes8& cmdData = cmd->Command();
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   479
				
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   480
						iCConfigFileDownload->ReadDataChunkLen(DataChunkLen);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   481
										
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   482
						if(DataChunkLen != 0)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   483
							{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   484
							TBuf8<4> AddressBuf;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   485
							TBuf8<KHcdConfigFileChunkSize> patchRamData;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   486
							if(CommandOpcode == KHciVSLaunchRam)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   487
								{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   488
								
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   489
								err = iCConfigFileDownload->ConfigFileSendData(patchRamData,DataChunkLen);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   490
								if (KErrNone == err)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   491
									{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   492
									cmd->Reset(KHciVSLaunchRam);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   493
									cmdData.Append(patchRamData);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   494
									INITIALISOR_BCM_LOG(_L("LAUNCH RAM"))
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   495
									iInitState = ELoadingconfigFileDataDone;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   496
									TRAP(err, iHCICommandQueue->MhcqAddInitCommandL(cmd, *this));
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   497
									
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   498
									MHctlBcmConfigInterface* hctlConfigInterface = static_cast<MHctlBcmConfigInterface*>(iCoreHci->MchHctlPluginInterface(TUid::Uid(KHctlBcmConfigInterfaceUid)));	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   499
									__ASSERT_DEBUG(hctlConfigInterface, PANIC(KBroadcomControllerInitialisorPanic, EConfigInterfaceNull));			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   500
									hctlConfigInterface->MhciSetInitPluginState(ELoadingconfigFileDataDone);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   501
									}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   502
								}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   503
							else
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   504
								{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   505
								err = iCConfigFileDownload->SetDataChunkAddress(AddressBuf);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   506
					
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   507
								if (KErrNone == err)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   508
									{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   509
									cmdData.FillZ(4);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   510
									cmdData[0] = AddressBuf[0];
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   511
									cmdData[1] = AddressBuf[1];
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   512
									cmdData[2] = AddressBuf[2];
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   513
									cmdData[3] = AddressBuf[3];
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   514
																
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   515
									err = iCConfigFileDownload->ConfigFileSendData(patchRamData,(DataChunkLen-4));
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   516
									
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   517
									if (KErrNone == err)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   518
										{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   519
										cmdData.Append(patchRamData);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   520
										TRAP(err, iHCICommandQueue->MhcqAddInitCommandL(cmd, *this));
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   521
										INITIALISOR_BCM_LOG(_L("WRITE RAM"))						
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   522
										}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   523
									}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   524
								}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   525
							}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   526
						}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   527
						
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   528
					if(KErrNone != err)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   529
						{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   530
							// something went wrong during the file read
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   531
							delete cmd; //command was not sent due to read file error
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   532
							
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   533
							// Inform the stack of the initialisation status.
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   534
							iControllerInitialisationObserver->McioPostResetCommandComplete(err);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   535
							iInitState = EIdle;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   536
							MHctlBcmConfigInterface* hctlConfigInterface = static_cast<MHctlBcmConfigInterface*>(iCoreHci->MchHctlPluginInterface(TUid::Uid(KHctlBcmConfigInterfaceUid)));	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   537
							__ASSERT_DEBUG(hctlConfigInterface, PANIC(KBroadcomControllerInitialisorPanic, EConfigInterfaceNull));			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   538
							hctlConfigInterface->MhciSetInitPluginState(EIdle);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   539
						}					
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   540
					}//hcierr == EOK
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   541
				}//aEvent.CommandOpcode() == KHciVSWriteRam
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   542
			else
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   543
				{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   544
				err = KErrGeneral; //complete event is not the expected one
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   545
				}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   546
			}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   547
			break;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   548
			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   549
		case ELoadingBinConfigFileData:
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   550
			{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   551
			if (aEvent.CommandOpcode() == KHciVSWriteRam )
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   552
				{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   553
				hcierr = aEvent.ErrorCode();
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   554
				if (hcierr == EOK)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   555
				    {
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   556
		    	    //Update the Destination Ram address
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   557
		    		iDestRam = iDestRam + iTxPatchLength;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   558
		    		
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   559
				    TRAP(err, cmd = CVendorDebugCommand::NewL(KHciVSWriteRam));
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   560
					if (err == KErrNone)	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   561
						{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   562
						TBuf8<KConfigFileChunkSize> patchRamData;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   563
						
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   564
						// Try to read config file data
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   565
						err = iCConfigFileDownload->ConfigFileSendDataChunk(patchRamData);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   566
						if (KErrEof == err)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   567
							{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   568
							// EOF reached
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   569
							iInitState = ELoadingconfigFileDataDone;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   570
							
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   571
							MHctlBcmConfigInterface* hctlConfigInterface = static_cast<MHctlBcmConfigInterface*>(iCoreHci->MchHctlPluginInterface(TUid::Uid(KHctlBcmConfigInterfaceUid)));	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   572
							__ASSERT_DEBUG(hctlConfigInterface, PANIC(KBroadcomControllerInitialisorPanic, EConfigInterfaceNull));			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   573
							hctlConfigInterface->MhciSetInitPluginState(ELoadingconfigFileDataDone);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   574
							
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   575
							// Launch Patch ram
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   576
							cmd->Reset(KHciVSLaunchRam); 
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   577
							// reuse allocated cmd
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   578
							
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   579
							TDes8& cmdData = cmd->Command();
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   580
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   581
							cmdData.FillZ(4);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   582
							cmdData[0] = 0xFF;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   583
							cmdData[1] = 0xFF;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   584
							cmdData[2] = 0xFF;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   585
							cmdData[3] = 0xFF;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   586
							
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   587
							TRAP(err, iHCICommandQueue->MhcqAddInitCommandL(cmd, *this));
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   588
							// Wait for the launch config file complete event 
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   589
							
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   590
							}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   591
					    else if (KErrNone == err) 
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   592
					    	{					    										
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   593
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   594
					    		TDes8& cmdData = cmd->Command();
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   595
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   596
								INITIALISOR_BCM_LOG2(_L("Initialisor_Broadcom : HCI VSC Write RAM event (%04x)"), aEvent.CommandOpcode())
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   597
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   598
								cmdData.FillZ(4);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   599
								cmdData[0] =  (iDestRam)        & 0xFF;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   600
								cmdData[1] = ((iDestRam) >>  8) & 0xFF;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   601
								cmdData[2] = ((iDestRam) >> 16) & 0xFF;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   602
								cmdData[3] = ((iDestRam) >> 24) & 0xFF;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   603
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   604
								cmdData.Append(patchRamData);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   605
								
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   606
					    		// 	Send another chunk of config file data
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   607
								TRAP(err, iHCICommandQueue->MhcqAddInitCommandL(cmd, *this));
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   608
								if (KErrNone == err)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   609
									{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   610
									// Update length of Tx'd data
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   611
									iTxPatchLength = patchRamData.Length();
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   612
									iInitState = ELoadingBinConfigFileData;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   613
									
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   614
									MHctlBcmConfigInterface* hctlConfigInterface = static_cast<MHctlBcmConfigInterface*>(iCoreHci->MchHctlPluginInterface(TUid::Uid(KHctlBcmConfigInterfaceUid)));	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   615
									__ASSERT_DEBUG(hctlConfigInterface, PANIC(KBroadcomControllerInitialisorPanic, EConfigInterfaceNull));			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   616
									hctlConfigInterface->MhciSetInitPluginState(ELoadingBinConfigFileData);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   617
									// Wait for the VSC complete event
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   618
									}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   619
					    	}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   620
					    else if (KErrNone != err)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   621
					    	{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   622
					    	// something went wrong during the file read
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   623
					    	delete cmd; //command was not sent due to read file error
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   624
					    	}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   625
						}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   626
				    }
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   627
				else
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   628
					{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   629
					err = KErrGeneral; //complete event is not the expected one
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   630
					}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   631
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   632
				if (err != KErrNone)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   633
					{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   634
					iControllerInitialisationObserver->McioPostResetCommandComplete(err);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   635
					iInitState = EIdle;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   636
					MHctlBcmConfigInterface* hctlConfigInterface = static_cast<MHctlBcmConfigInterface*>(iCoreHci->MchHctlPluginInterface(TUid::Uid(KHctlBcmConfigInterfaceUid)));	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   637
					__ASSERT_DEBUG(hctlConfigInterface, PANIC(KBroadcomControllerInitialisorPanic, EConfigInterfaceNull));			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   638
					hctlConfigInterface->MhciSetInitPluginState(EIdle);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   639
					}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   640
				}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   641
			}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   642
			break;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   643
			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   644
		case ELoadingconfigFileDataDone:
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   645
			{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   646
			INITIALISOR_BCM_LOG(_L("LAUNCH RAM COMPLETE EVENT"))
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   647
			if (aEvent.CommandOpcode() == KHciVSLaunchRam)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   648
				{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   649
				INITIALISOR_BCM_LOG2(_L("Initialisor_Broadcom : HCI VSC Launch RAM event (%04x)"), aEvent.CommandOpcode())
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   650
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   651
				hcierr = aEvent.ErrorCode();
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   652
				if (hcierr == EOK)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   653
					{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   654
				    iMiniDrive2ConfigFileTimer->Start(KEndDelayTimerDuration);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   655
				    iInitState = EWaitEndDelay;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   656
				    
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   657
					MHctlBcmConfigInterface* hctlConfigInterface = static_cast<MHctlBcmConfigInterface*>(iCoreHci->MchHctlPluginInterface(TUid::Uid(KHctlBcmConfigInterfaceUid)));	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   658
					__ASSERT_DEBUG(hctlConfigInterface, PANIC(KBroadcomControllerInitialisorPanic, EConfigInterfaceNull));			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   659
					hctlConfigInterface->MhciSetInitPluginState(EWaitEndDelay);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   660
					}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   661
				}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   662
			}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   663
			break;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   664
			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   665
			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   666
		case EWaitUpdateBaudRateAfterPrm:
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   667
			{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   668
#ifdef UPDATEBAUDRATE_AFTER_PRD
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   669
			INITIALISOR_BCM_LOG2(_L("Initialisor_Broadcom : VSC Update BaudRate event (%04x)"), aEvent.CommandOpcode())
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   670
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   671
			MHctlBcmConfigInterface* hctlConfigInterface = static_cast<MHctlBcmConfigInterface*>(iCoreHci->MchHctlPluginInterface(TUid::Uid(KHctlBcmConfigInterfaceUid)));	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   672
			if (aEvent.CommandOpcode() == KHciVSUpdateUartHCIBaudRate)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   673
				{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   674
				hcierr = aEvent.ErrorCode();
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   675
				if (hcierr == EOK)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   676
					{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   677
					INITIALISOR_BCM_LOG2(_L("Initialisor_Broadcom : Change UART BaudRate to %d bps after launching RAM"), iBaudRateAfter)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   678
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   679
					err = hctlConfigInterface->MhciUpdateBaudRate(iBaudRateAfter);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   680
					}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   681
				else
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   682
					{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   683
					err = KErrGeneral;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   684
					}		
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   685
				}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   686
			else			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   687
				{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   688
				err = KErrGeneral;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   689
				}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   690
#else
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   691
			err = KErrNone;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   692
#endif			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   693
			// BCM initialisation is completed- resume generic init
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   694
			iControllerInitialisationObserver->McioPostResetCommandComplete(err);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   695
			iInitState = EIdle;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   696
			hctlConfigInterface->MhciSetInitPluginState(EIdle);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   697
			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   698
			//iInitState = EReset;	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   699
			// Signal to everyone that we are ready 
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   700
			//BCM_DriverReadySem.CreateGlobal(KGlobalReadySemName,1,EOwnerProcess);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   701
			}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   702
			break;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   703
			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   704
		default:
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   705
		INITIALISOR_BCM_LOG2(_L("Broadcom: CControllerInitialisationPluginImpl::HandleVendorSpecificCompleteEvent - Default state (%d)"),iInitState)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   706
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   707
			break;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   708
	    }
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   709
	}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   710
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   711
/*virtual*/ void CControllerInitialisationPluginImpl::ConfigFileTimerExpired()
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   712
	{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   713
	LOG_FUNC
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   714
	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   715
	TInt err = KErrNone;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   716
	CVendorDebugCommand* cmd = NULL;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   717
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   718
	switch(iInitState)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   719
		{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   720
		case EMiniDrvToHcdConfigFileDelay:
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   721
			{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   722
			THCIOpcode CommandOpcode;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   723
			TUint8 DataChunkLen = 0;			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   724
			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   725
			INITIALISOR_BCM_LOG(_L("Initialisor_Broadcom : Start patch ram download"))
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   726
			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   727
			iCConfigFileDownload->ReadCommandOpcode(CommandOpcode);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   728
			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   729
			TRAP(err, cmd = CVendorDebugCommand::NewL(CommandOpcode));
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   730
			TDes8& cmdData = cmd->Command();
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   731
			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   732
			iCConfigFileDownload->ReadDataChunkLen(DataChunkLen);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   733
									
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   734
			if(DataChunkLen != 0)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   735
				{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   736
				//TBuf8<4> AddressBuf;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   737
				TBuf8<4> AddressBuf;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   738
				
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   739
				err = iCConfigFileDownload->SetDataChunkAddress(AddressBuf);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   740
				if (KErrNone == err)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   741
					{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   742
					cmdData.FillZ(4);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   743
					cmdData[0] = AddressBuf[0];
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   744
					cmdData[1] = AddressBuf[1];
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   745
					cmdData[2] = AddressBuf[2];
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   746
					cmdData[3] = AddressBuf[3];
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   747
				
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   748
					TBuf8<KHcdConfigFileChunkSize> HcdpatchRamData;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   749
					
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   750
					// Substract 4 from DataChunkLen for download address
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   751
					err = iCConfigFileDownload->ConfigFileSendData(HcdpatchRamData,(DataChunkLen-4));
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   752
					if (KErrNone == err)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   753
						{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   754
						cmdData.Append(HcdpatchRamData);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   755
						TRAP(err, iHCICommandQueue->MhcqAddInitCommandL(cmd, *this));
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   756
						INITIALISOR_BCM_LOG(_L("FIRST WRITE RAM"))
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   757
						if (KErrNone == err)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   758
							{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   759
							iInitState = ELoadingHcdConfigFileData;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   760
							
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   761
							MHctlBcmConfigInterface* hctlConfigInterface = static_cast<MHctlBcmConfigInterface*>(iCoreHci->MchHctlPluginInterface(TUid::Uid(KHctlBcmConfigInterfaceUid)));	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   762
							__ASSERT_DEBUG(hctlConfigInterface, PANIC(KBroadcomControllerInitialisorPanic, EConfigInterfaceNull));			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   763
							hctlConfigInterface->MhciSetInitPluginState(ELoadingHcdConfigFileData);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   764
							}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   765
						}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   766
					}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   767
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   768
				if(KErrNone != err)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   769
					{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   770
					// something went wrong during the file read
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   771
					delete cmd; //command was not sent due to read file error
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   772
						
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   773
					// Inform the stack of the initialisation status.
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   774
					iControllerInitialisationObserver->McioPostResetCommandComplete(err);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   775
					iInitState = EIdle;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   776
					MHctlBcmConfigInterface* hctlConfigInterface = static_cast<MHctlBcmConfigInterface*>(iCoreHci->MchHctlPluginInterface(TUid::Uid(KHctlBcmConfigInterfaceUid)));	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   777
					__ASSERT_DEBUG(hctlConfigInterface, PANIC(KBroadcomControllerInitialisorPanic, EConfigInterfaceNull));			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   778
					hctlConfigInterface->MhciSetInitPluginState(EIdle);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   779
					}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   780
				
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   781
				}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   782
			}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   783
			break;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   784
			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   785
		case EMiniDrvToBinConfigFileDelay:
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   786
			{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   787
			INITIALISOR_BCM_LOG(_L("Initialisor_Broadcom : Waiting for Mini download Driver"))
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   788
			// initiate actual downloading of the Config file
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   789
		    TRAP(err, cmd = CVendorDebugCommand::NewL(KHciVSWriteRam));
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   790
			if (err == KErrNone)	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   791
				{				
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   792
				TBuf8<KConfigFileChunkSize> patchRamData;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   793
				TDes8& cmdData = cmd->Command();
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   794
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   795
				err = iCConfigFileDownload->ConfigFileSendDataChunk(patchRamData);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   796
				
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   797
				// Start sending config file data
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   798
				if (KErrNone == err)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   799
					{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   800
					cmdData.FillZ(4);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   801
					cmdData[0] =  (KDestRamLocation)        & 0xFF;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   802
					cmdData[1] = ((KDestRamLocation) >>  8) & 0xFF;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   803
					cmdData[2] = ((KDestRamLocation) >> 16) & 0xFF;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   804
					cmdData[3] = ((KDestRamLocation) >> 24) & 0xFF;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   805
					
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   806
					cmdData.Append(patchRamData);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   807
					TRAP(err, iHCICommandQueue->MhcqAddInitCommandL(cmd, *this));
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   808
					if (KErrNone == err)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   809
						{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   810
						// Update length of Tx'd data
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   811
						iTxPatchLength = iTxPatchLength + patchRamData.Length();
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   812
						iInitState = ELoadingBinConfigFileData;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   813
						
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   814
						MHctlBcmConfigInterface* hctlConfigInterface = static_cast<MHctlBcmConfigInterface*>(iCoreHci->MchHctlPluginInterface(TUid::Uid(KHctlBcmConfigInterfaceUid)));	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   815
						__ASSERT_DEBUG(hctlConfigInterface, PANIC(KBroadcomControllerInitialisorPanic, EConfigInterfaceNull));			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   816
						hctlConfigInterface->MhciSetInitPluginState(ELoadingBinConfigFileData);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   817
						// Wait for the VSC complete event
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   818
						}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   819
					}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   820
				else
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   821
					{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   822
			    	// something went wrong during the file read
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   823
			    	delete cmd; //command was not sent due to read file error
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   824
					}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   825
				}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   826
			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   827
				
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   828
				if (KErrNone != err)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   829
					{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   830
					// Inform the stack of the initialisation status.
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   831
					iControllerInitialisationObserver->McioPostResetCommandComplete(err);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   832
					iInitState = EIdle;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   833
					
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   834
					MHctlBcmConfigInterface* hctlConfigInterface = static_cast<MHctlBcmConfigInterface*>(iCoreHci->MchHctlPluginInterface(TUid::Uid(KHctlBcmConfigInterfaceUid)));	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   835
					__ASSERT_DEBUG(hctlConfigInterface, PANIC(KBroadcomControllerInitialisorPanic, EConfigInterfaceNull));			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   836
					hctlConfigInterface->MhciSetInitPluginState(EIdle);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   837
					}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   838
				}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   839
			break;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   840
			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   841
		case EWaitEndDelay:
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   842
			{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   843
#ifdef UPDATEBAUDRATE_AFTER_PRD			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   844
			// BCM initialisation is completed- resume generic init
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   845
			INITIALISOR_BCM_LOG(_L("Initialisor_Broadcom : END Initialisation steps (PatchRAM downloaded OK))"))
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   846
			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   847
			// Request baud rate update.
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   848
			CVendorDebugCommand* cmd = NULL;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   849
			TRAP(err, cmd = CVendorDebugCommand::NewL(KHciVSUpdateUartHCIBaudRate));
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   850
			TDes8& cmdData = cmd->Command();
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   851
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   852
			if(err == KErrNone)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   853
			{	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   854
				INITIALISOR_BCM_LOG2(_L("Initialisor_Broadcom : Change BaudRate to %d bps after launchRAM"), iBaudRateAfter)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   855
				INITIALISOR_BCM_LOG2(_L("Initialisor_Broadcom : UART Clock is %d"), iUartClock)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   856
				cmdData.FillZ(6);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   857
				cmdData[2] = iBaudRateAfter 		& 0xFF;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   858
				cmdData[3] = (iBaudRateAfter >> 8)	& 0xFF;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   859
				cmdData[4] = (iBaudRateAfter >> 16)	& 0xFF;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   860
				cmdData[5] = (iBaudRateAfter >> 24)	& 0xFF;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   861
				
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   862
				TRAP(err, iHCICommandQueue->MhcqAddInitCommandL(cmd, *this));
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   863
				// error handling if the method above fails is handled in at the end of the function
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   864
//				INITIALISOR_BCM_LOG2(_L("Initialisor_Broadcom : Send %x %x %x %x %x %x after launchRAM OK"), iBaudRateAfter)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   865
				RDebug::Print(_L("Initialisor_Broadcom : Send %x %x %x %x %x %x after launchRAM OK"), 
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   866
						cmdData[0],
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   867
						cmdData[1],
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   868
						cmdData[2],
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   869
						cmdData[3],
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   870
						cmdData[4],
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   871
						cmdData[5]);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   872
				iInitState = EWaitUpdateBaudRateAfterPrm;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   873
				
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   874
				MHctlBcmConfigInterface* hctlConfigInterface = static_cast<MHctlBcmConfigInterface*>(iCoreHci->MchHctlPluginInterface(TUid::Uid(KHctlBcmConfigInterfaceUid)));	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   875
				__ASSERT_DEBUG(hctlConfigInterface, PANIC(KBroadcomControllerInitialisorPanic, EConfigInterfaceNull));			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   876
				hctlConfigInterface->MhciSetInitPluginState(EWaitUpdateBaudRateAfterPrm);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   877
			}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   878
#else
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   879
			iInitState = EWaitUpdateBaudRateAfterPrm;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   880
			MHctlBcmConfigInterface* hctlConfigInterface = static_cast<MHctlBcmConfigInterface*>(iCoreHci->MchHctlPluginInterface(TUid::Uid(KHctlBcmConfigInterfaceUid)));	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   881
			__ASSERT_DEBUG(hctlConfigInterface, PANIC(KBroadcomControllerInitialisorPanic, EConfigInterfaceNull));			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   882
			hctlConfigInterface->MhciSetInitPluginState(EWaitUpdateBaudRateAfterPrm);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   883
			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   884
			iControllerInitialisationObserver->McioPostResetCommandComplete(err);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   885
#endif
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   886
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   887
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   888
			if(err != KErrNone)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   889
			{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   890
				iInitState = EIdle;	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   891
				
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   892
				MHctlBcmConfigInterface* hctlConfigInterface = static_cast<MHctlBcmConfigInterface*>(iCoreHci->MchHctlPluginInterface(TUid::Uid(KHctlBcmConfigInterfaceUid)));	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   893
				__ASSERT_DEBUG(hctlConfigInterface, PANIC(KBroadcomControllerInitialisorPanic, EConfigInterfaceNull));			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   894
				hctlConfigInterface->MhciSetInitPluginState(EIdle);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   895
				
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   896
				iControllerInitialisationObserver->McioPostResetCommandComplete(err);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   897
			}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   898
			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   899
			// Signal to everyone that we are ready 
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   900
			//BCM_DriverReadySem.CreateGlobal(KGlobalReadySemName,1,EOwnerProcess);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   901
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   902
			}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   903
			break;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   904
			
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   905
		default:
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   906
		break;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   907
		}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   908
	}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   909
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   910
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   911
/*virtual*/ void CControllerInitialisationPluginImpl::MciiSetHCICommandQueue(MHCICommandQueue& aHCICommandQueue)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   912
	{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   913
	LOG_FUNC
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   914
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   915
	__ASSERT_DEBUG(iHCICommandQueue == 0, PANIC(KBroadcomControllerInitialisorPanic, EHciCommandQueueOverwritten));
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   916
	iHCICommandQueue = &aHCICommandQueue;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   917
	}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   918
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   919
/*virtual*/ void CControllerInitialisationPluginImpl::MciiSetControllerInitialisationObserver(MControllerInitialisationObserver& aObserver)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   920
	{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   921
	LOG_FUNC
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   922
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   923
	__ASSERT_DEBUG(iControllerInitialisationObserver == 0, PANIC(KBroadcomControllerInitialisorPanic, EInitialisationObserverOverwritten));
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   924
	iControllerInitialisationObserver = &aObserver;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   925
	}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   926
void CControllerInitialisationPluginImpl::MhcqcCommandErrored(TInt aErrorCode,
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   927
					  										  const CHCICommandBase* /*aCommand*/)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   928
	{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   929
	LOG_FUNC
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   930
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   931
	switch(iInitState)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   932
		{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   933
		default:
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   934
			PANIC(KBroadcomControllerInitialisorPanic, EInvalidInitialisorState);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   935
			break;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   936
		};
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   937
	}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   938
	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   939
void CControllerInitialisationPluginImpl::MhcqcCommandEventReceived(const THCIEventBase& aEvent,
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   940
																	const CHCICommandBase* /*aRelatedCommand*/)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   941
	{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   942
	LOG_FUNC
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   943
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   944
	if (aEvent.EventCode() == ECommandCompleteEvent)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   945
		{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   946
		// Switch on the opcode.
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   947
		THCICommandCompleteEvent& event = THCICommandCompleteEvent::Cast(aEvent);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   948
		switch(event.CommandOpcode())
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   949
			{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   950
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   951
			default:
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   952
				// Check for VS commands.
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   953
				if((event.CommandOpcode() & KVendorDebugOGF) == KVendorDebugOGF)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   954
					{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   955
					TVendorDebugCompleteEvent& vEvent = TVendorDebugCompleteEvent::Cast(event);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   956
					HandleVendorSpecificCompleteEvent(vEvent);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   957
					}						
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   958
				break;	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   959
			}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   960
		}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   961
	}	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   962
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   963
/*virtual*/ void CControllerInitialisationPluginImpl::MciiSetCoreHci(MCoreHci& aCoreHci)
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   964
	{
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   965
	LOG_FUNC
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   966
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   967
	INITIALISOR_BCM_LOG(_L("Initialisor_Broadcom : Setting Core HCI"))
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   968
	__ASSERT_DEBUG(iCoreHci == 0, PANIC(KBroadcomControllerInitialisorPanic, ECoreHciOverwritten));
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   969
    iCoreHci = &aCoreHci;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   970
	}
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   971