omap3530/omap3530_drivers/spi/slave.h
branchBeagle_BSP_dev
changeset 77 e5fd00cbb70a
equal deleted inserted replaced
76:29b14275133a 77:e5fd00cbb70a
       
     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/slave.h
       
    16 //
       
    17 
       
    18 
       
    19 #ifndef __OMAP3530_SPI_SLAVE_H__
       
    20 #define __OMAP3530_SPI_SLAVE_H__
       
    21 
       
    22 #include <drivers/iic_channel.h>
       
    23 
       
    24 class DSpiSlaveBeagle: public DIicBusChannelSlave
       
    25 	{
       
    26 
       
    27 public:
       
    28 	static DSpiSlaveBeagle* New(TInt aChannelNumber, const TBusType aBusType,
       
    29 	                              const TChannelDuplex aChanDuplex);
       
    30 
       
    31 	// Gateway function for PSL implementation
       
    32 	virtual TInt DoRequest(TInt aOperation);
       
    33 
       
    34 	DSpiSlaveBeagle(TInt aChannelNumber, const TBusType aBusType,
       
    35 	                 const TChannelDuplex aChanDuplex);
       
    36 
       
    37 private:
       
    38 	// Overriders for base class pure-virtual methods
       
    39 	virtual TInt DoCreate(); // second-stage construction,
       
    40 	virtual TInt CheckHdr(TDes8* aHdrBuff);
       
    41 	virtual void ProcessData(TInt aTrigger, TIicBusSlaveCallback* aCb);
       
    42 
       
    43 	// Internal methods..
       
    44 	TBool TransConfigDiffersFromPrev();
       
    45 	TInt ConfigureInterface();
       
    46 	TInt AsynchConfigureInterface();
       
    47 	TInt InitTransfer();
       
    48 
       
    49 	// ISR handler and other static methods..
       
    50 	static void IicPslIsr(TAny* aPtr);
       
    51 	static void TimeoutCallback(TAny* aPtr);
       
    52 	static inline void NotifyClientEnd(DSpiSlaveBeagle* aPtr);
       
    53 
       
    54 	// Register base for the Master channel
       
    55 	TUint iSlaveChanBase;
       
    56 
       
    57 	// Interrupt ID for the Master channel
       
    58 	TInt iSlaveIntId;
       
    59 
       
    60 	// Bit mask of the transfer triggers managed by the channel
       
    61 	TUint8 iTrigger;
       
    62 
       
    63 	// Granularity, expressed as the number of bytes in a word
       
    64 	TInt8 iWordSize;
       
    65 
       
    66 	// Flag indicating transmission activity - optional, may not be required for all bus types
       
    67 	// In the template example it is used to indicate transitions on a chip-select line, such as for SPI.
       
    68 	TInt8 iInProgress;
       
    69 
       
    70 	// Dummy variable used merely to demonstrate the asynchronous channel capture mechanism
       
    71 	// See method AsynchConfigureInterface
       
    72 	TInt8 iAsyncConfig;
       
    73 
       
    74 	// Pointers to buffers used for Rx and Tx transfers
       
    75 	TInt8 *iTxData;
       
    76 	TInt8 *iRxData;
       
    77 	TInt8 *iTxDataEnd;
       
    78 	TInt8 *iRxDataEnd;
       
    79 
       
    80 	// Timer to guard 'while' loops..
       
    81 	NTimer iHwGuardTimer;
       
    82 
       
    83 	// status of the transaction
       
    84 	volatile TInt iTransactionStatus;
       
    85 	};
       
    86 
       
    87 #endif /*__OMAP3530_SPI_SLAVE_H__*/