bthci/hci2implementations/hctls/brcmh4/inc/Broadcom_Hctl_H4.h
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
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    21
#ifndef BROADCOMHCTLH4_H
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    22
#define BROADCOMHCTLH4_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/hctluartbase.h>
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    25
#include <bluetooth/hciframelogger.h>
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    26
#include <bluetooth/hci/hcitypes.h>
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/hctlbcmconfiginterface.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
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    31
class CHCTLBcmH4Receiver;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    32
class CHCTLBcmH4Sender;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    33
class CControllerManager;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    34
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    35
// Define HCTL Packet Header Size
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    36
static const TInt KHctlHeaderSize = 1;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    37
static const TInt KHctlPacketTypeOffset = 0;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    38
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    39
// UART HCI Framing constants for command frames
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    40
static const TInt KHCTLCommandHeaderSize = 1;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    41
static const TInt KHCTLCommandTrailerSize = 0;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    42
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    43
// UART HCI Framing constants for ACL data frames
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    44
static const TInt KHCTLAclDataHeaderSize = 1;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    45
static const TInt KHCTLAclDataTrailerSize = 0;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    46
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    47
// UART HCI Framing constants for Synchronous data frames
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    48
static const TInt KHCTLSynchronousDataHeaderSize = 1;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    49
static const TInt KHCTLSynchronousDataTrailerSize = 0;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    50
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    51
_LIT(KIniFileName, "hctl_broadcom");
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    52
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    53
/**
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    54
This is the class that implements the UART specific HCTL.	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    55
*/
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    56
NONSHARABLE_CLASS(CHCTLBcmH4) : public CHCTLUartBase,
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    57
								public MHctlBcmConfigInterface
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
public:
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    60
	static CHCTLBcmH4* NewL();
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    61
	~CHCTLBcmH4();
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    62
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    63
	void DoConfigL();
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    64
	virtual void ProcessACLData(const TDesC8& aData);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    65
	virtual void ProcessSynchronousData(const TDesC8& aData);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    66
	virtual void ProcessEvent(const TDesC8& aEvent);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    67
	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    68
	MQdpPluginInterfaceFinder* QdpPluginInterfaceFinder();
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    69
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    70
	// From MHardResetInitiator
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    71
	virtual void MhriStartHardReset();
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
	// Called from the Controller Manager
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    74
	void HandlePowerOff();
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    75
	void HandlePowerOn();
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    76
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    77
	TBTPowerState CurrentPowerState() const;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    78
	//CHRIS MODIF
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    79
	//void SetInitFlag(TBool flag);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    80
	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    81
public:
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    82
	// HCTL packet types as defined in Section 2, Part H: 4 of the
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    83
	// bluetooth specification.
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    84
	enum THctlPacketType 
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    85
	    {
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    86
		ECommandPacket			= 0x01,
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    87
		EACLDataPacket			= 0x02,
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    88
		ESynchronousDataPacket	= 0x03,
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    89
		EEventPacket			= 0x04,
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
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    92
private:
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    93
	CHCTLBcmH4();
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    94
	void ConstructL();
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    95
	TAny* Interface(TUid aUid);
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
	static void SetPacketIndicator(THctlPacketType aType, const TDesC8& aData);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    98
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
    99
	// From CHCTLUartBase
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   100
	virtual void PortOpenedL();
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
	// From MHCTLInterface
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   103
	virtual TInt MhiWriteCommand(const TDesC8& aData);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   104
	virtual TInt MhiWriteAclData(const TDesC8& aData);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   105
	virtual TInt MhiWriteSynchronousData(const TDesC8& aData);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   106
	virtual void MhiGetAclDataTransportOverhead(TUint& aHeaderSize, TUint& aTrailerSize) const;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   107
	virtual void MhiGetSynchronousDataTransportOverhead(TUint& aHeaderSize, TUint& aTrailerSize) const;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   108
	virtual void MhiGetCommandTransportOverhead(TUint& aHeaderSize, TUint& aTrailerSize) const;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   109
	virtual void MhiSetChannelObserver(MHCTLChannelObserver& aChannelObserver);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   110
	virtual void MhiSetDataObserver(MHCTLDataObserver& aDataObserver);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   111
	virtual void MhiSetEventObserver(MHCTLEventObserver& aEventObserver);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   112
	virtual void MhiSetControllerStateObserver(MControllerStateObserver& aControllerStateObserver);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   113
	virtual void MhiSetQdpPluginInterfaceFinder(MQdpPluginInterfaceFinder& aQdpPluginInterfaceFinder);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   114
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   115
	// From MHCTLBcmConfigInterface
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   116
	virtual TInt MhciUpdateBaudRate(TUint32 aBaudRate);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   117
	
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   118
	virtual void MhciSetInitPluginState(TInitState InitState);
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   119
private:
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   120
	CHCTLBcmH4Receiver* iReceiver;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   121
	CHCTLBcmH4Sender* iSender;   
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   122
	MQdpPluginInterfaceFinder* iQdpPluginInterfaceFinder;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   123
	TBTPowerState iCurrentPowerState;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   124
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   125
	CControllerManager* iControllerMan;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   126
	//CHRIS MODIF
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   127
	//TBool iInitFlag;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   128
public:
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   129
	TInitState iInitpluginState;
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   130
	DECLARE_HCI_LOGGER
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   131
	};
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
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   134
#endif // BROADCOMHCTLH4_H
f53839ff73b7 Broadcom H4 contribution
Christophe Porcel <christophe.porcel@broadcom.com>
parents:
diff changeset
   135