omap3530/omap3530_drivers/spi/master.h
branchBYD_LCD_Integration
changeset 86 56c9b613f311
parent 84 09e266454dcf
equal deleted inserted replaced
81:8b0d299f2a61 86:56c9b613f311
       
     1 // Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 // lukasz.forynski@gmail.com
       
    13 //
       
    14 // Description:
       
    15 // omap3530/omap3530_drivers/spi/master.h
       
    16 //
       
    17 
       
    18 
       
    19 #ifndef __OMAP3530_SPI_MASTER_H__
       
    20 #define __OMAP3530_SPI_MASTER_H__
       
    21 
       
    22 #include <drivers/iic_channel.h>
       
    23 
       
    24 _LIT(KIicPslThreadName,"SpiChannelThread_");
       
    25 const TInt KIicPslDfcPriority = 0;
       
    26 const TInt KIicPslThreadPriority = 24;
       
    27 
       
    28 // class declaration for SPI master
       
    29 class DSpiMasterBeagle : public DIicBusChannelMaster
       
    30 	{
       
    31 public:
       
    32 	static DSpiMasterBeagle* New(TInt aChannelNumber, const TBusType aBusType, const TChannelDuplex aChanDuplex);
       
    33 	virtual TInt DoRequest(TIicBusTransaction* aTransaction); // Gateway function for PSL implementation
       
    34 
       
    35 private:
       
    36 	DSpiMasterBeagle(TInt aChannelNumber, const TBusType aBusType, const TChannelDuplex aChanDuplex);
       
    37 
       
    38 	// Override base-class pure virtual methods
       
    39 	virtual TInt DoCreate();
       
    40 	virtual TInt CheckHdr(TDes8* aHdr);
       
    41 	virtual TInt HandleSlaveTimeout();
       
    42 
       
    43 	// Internal methods
       
    44 	TInt PrepareConfiguration();
       
    45 	TInt ConfigureInterface();
       
    46 	TInt ProcessNextTransfers();
       
    47 	TInt StartTransfer(TIicBusTransfer* aTransferPtr, TUint8 aType);
       
    48 	TInt DoTransfer(TUint8 aType);
       
    49 	static void Isr(TAny* aPtr);
       
    50 	static void TransferEndDfc(TAny* aPtr);
       
    51 	void ExitComplete(TInt aErr, TBool aComplete = ETrue);
       
    52 
       
    53 #ifdef _DEBUG
       
    54 	void DumpCurrentStatus(const TInt8* aWhere = NULL);
       
    55 #endif
       
    56 
       
    57 private:
       
    58 	TDfc iTransferEndDfc;
       
    59 	TIicOperationType iOperation;
       
    60 	TUint8 iWordSize;
       
    61 
       
    62 	TInt8 iTxFifoThreshold;
       
    63 	enum TMyState
       
    64 		{
       
    65 		EIdle,
       
    66 		EBusy
       
    67 		};
       
    68 	TMyState iState;
       
    69 
       
    70 	TInt iIrqId;
       
    71 	TLinAddr iHwBase;
       
    72 
       
    73 	// Pointers used to store current transfers information
       
    74 	TIicBusTransfer* iHalfDTransfer;
       
    75 	TIicBusTransfer* iFullDTransfer;
       
    76 
       
    77 	// Pointer to the current transaction.
       
    78 	TIicBusTransaction* iCurrTransaction;
       
    79 
       
    80 	// Pointers to buffers used for Rx and Tx transfers
       
    81 	TInt8 *iTxData;
       
    82 	TInt8 *iRxData;
       
    83 	TInt8 *iTxDataEnd;
       
    84 	TInt8 *iRxDataEnd;
       
    85 
       
    86 	// global status of the transaction
       
    87 	volatile TInt iTransactionStatus;
       
    88 
       
    89 	TConfigSpiV01 iCurrHeader;
       
    90 	TInt iCurrSS;
       
    91 	TInt iCurrSlavePinSet;
       
    92 	};
       
    93 
       
    94 #endif //__OMAP3530_SPI_MASTER_H__