baseport/syborg/serial/syborg_serial.h
author andrew.jordan <>
Sun, 02 May 2010 23:03:18 +0100
changeset 63 84dca1410127
parent 2 d55eb581a87c
permissions -rw-r--r--
Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
     1
/*
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
     3
* All rights reserved.
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
     4
* This component and the accompanying materials are made available
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
     6
* which accompanies this distribution, and is available
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
     8
*
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
     9
* Initial Contributors:
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
    11
*
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
    12
* Contributors:
63
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    13
* NTT DOCOMO, INC. -- Fix bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
0
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
    14
*
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
    15
* Description: Minimalistic serial driver
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
    16
*
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
    17
*/
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
    18
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
    19
#ifndef _SYBORG_SERIAL_H
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
    20
#define _SYBORG_SERIAL_H
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
    21
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
    22
#include <comm.h>
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
    23
#include <e32hal.h>
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
    24
#include "system.h"
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
    25
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
    26
const TInt KMinimumLddMajorVersion=1;
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
    27
const TInt KMinimumLddMinorVersion=1;
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
    28
const TInt KMinimumLddBuild=1;
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
    29
63
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    30
/**
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    31
 * Serial Ports Device Driver
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    32
 *
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    33
 *
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    34
 **/
0
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
    35
class DDriverSyborgComm : public DPhysicalDevice
63
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    36
	{
0
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
    37
public:
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
    38
  DDriverSyborgComm();
63
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    39
  ~DDriverSyborgComm();
0
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
    40
  virtual TInt Install();
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
    41
  virtual void GetCaps(TDes8 &aDes) const;
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
    42
  virtual TInt Create(DBase*& aChannel, TInt aUnit, const TDesC8* anInfo, const TVersion &aVer);
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
    43
  virtual TInt Validate(TInt aUnit, const TDesC8* anInfo, const TVersion &aVer);
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
    44
63
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    45
// interface for single comm port.
0
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
    46
public:
63
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    47
  TInt OpenDfcQueue();
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    48
  void CloseDfcQueue();
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    49
  TDfcQue* DfcQueue();
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    50
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    51
private:
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    52
	TDynamicDfcQue* 	iDfcQueue;				// single Dfc queue for all comm ports
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    53
	TUint8  			iDfcQRefCount;			// reference count for dfc queue
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    54
	};
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    55
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    56
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    57
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    58
/**
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    59
 * Driver for a single Comm port
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    60
 **/
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    61
class DCommSyborgSoc : public DComm
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    62
	{
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    63
public:
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    64
	DCommSyborgSoc(DDriverSyborgComm* aDriverSyborgComm);
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    65
	~DCommSyborgSoc();
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    66
	TInt DoCreate(TInt aUnit, const TDesC8* anInfo);
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    67
public:
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    68
	virtual TInt Start();
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    69
	virtual void Stop(TStopMode aMode);
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    70
	virtual void Break(TBool aState);
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    71
	virtual void EnableTransmit();
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    72
	virtual TUint Signals() const;
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    73
	virtual void SetSignals(TUint aSetMask, TUint aClearMask);
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    74
	virtual TInt ValidateConfig(const TCommConfigV01 &aConfig) const;
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    75
	virtual void Configure(TCommConfigV01 &aConfig);
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    76
	virtual void Caps(TDes8 &aCaps) const;
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    77
	virtual TInt DisableIrqs();
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    78
	virtual void RestoreIrqs(TInt aIrq);
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    79
	virtual TDfcQue* DfcQ(TInt aUnit);
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    80
	virtual void CheckConfig(TCommConfigV01& aConfig);
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    81
	static void Isr(TAny* aPtr);
0
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
    82
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
    83
public:
63
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    84
	DDriverSyborgComm* iDriverSyborgComm;
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    85
	TLinAddr iPortAddr;
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    86
	TInt iIrq;
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    87
	TBool iDfcQueueOpened;
0
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
    88
63
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    89
	enum {
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    90
		SERIAL_ID           = 0,
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    91
		SERIAL_DATA         = 1,
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    92
		SERIAL_FIFO_COUNT   = 2,
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    93
		SERIAL_INT_ENABLE   = 3,
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    94
		SERIAL_DMA_TX_ADDR  = 4,
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    95
		SERIAL_DMA_TX_COUNT = 5, /* triggers dma */
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    96
		SERIAL_DMA_RX_ADDR  = 6,
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    97
		SERIAL_DMA_RX_COUNT = 7 /* triggers dma */
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    98
		};
84dca1410127 Fix for Bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
andrew.jordan <>
parents: 2
diff changeset
    99
	};
0
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
   100
ffa851df0825 Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff changeset
   101
#endif