kernel/eka/include/d32fir.h
changeset 43 96e5fb8b040d
equal deleted inserted replaced
-1:000000000000 43:96e5fb8b040d
       
     1 // Copyright (c) 1994-2009 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 //
       
    13 // Description:
       
    14 // e32\include\d32fir.h
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @publishedPartner
       
    21  @released
       
    22 */
       
    23 
       
    24 #include <e32cmn.h>
       
    25 #include <e32ver.h>
       
    26 
       
    27 
       
    28 #ifndef __FIRCOMM_H__
       
    29 #define __FIRCOMM_H__
       
    30 
       
    31 enum chan{KReadChannel,KWriteChannel};
       
    32 
       
    33 
       
    34 class TCapsDevFir
       
    35       {
       
    36 public:
       
    37       TVersion version;
       
    38       };
       
    39 
       
    40 class TFirConfigV01
       
    41     {
       
    42 public:
       
    43 	TBps iRate;
       
    44 	};
       
    45 typedef TPckgBuf<TFirConfigV01> TFirConfig;
       
    46 
       
    47 const TUint KCapsFirBps576000 =0x00080000;
       
    48 const TUint KCapsFirBps1152000=0x00100000;
       
    49 const TUint KCapsFirBps4000000=0x00200000;
       
    50 
       
    51 class TFirCapsV01
       
    52 	{
       
    53 public:
       
    54 	TUint iRate;
       
    55 	};
       
    56 typedef TPckgBuf<TFirCapsV01> TFirCaps;
       
    57 
       
    58 _LIT(KRDevFir,"Fastir");
       
    59 
       
    60 class RDevFir : public RBusLogicalChannel
       
    61 	{
       
    62 public:
       
    63 	enum TVer
       
    64 		{
       
    65 		EMajorVersion=1,
       
    66 		EMinorVersion=0,
       
    67 		EBuildVersion=1
       
    68 		};
       
    69 
       
    70 	enum TRequest
       
    71 		{
       
    72 		// 0 to 3 (ie KMaxRequests)
       
    73 		EWriteReq=0x0,EWriteReqCancel=0x1,
       
    74 		EReadReq =0x1,EReadReqCancel =0x2,
       
    75 		};
       
    76 
       
    77 	enum TControl
       
    78 		{
       
    79 		KDebugWrite,
       
    80 		KControlConfig,
       
    81 		KControlSetConfig,
       
    82 		KControlCaps,
       
    83 		KFlushBuffers,
       
    84 		KSetBufferSize,
       
    85 		KSetRange,
       
    86 
       
    87 		KGetDmaChunkInfo,
       
    88 		KGetRxBufInfo,
       
    89 		KGetTxBufInfo,
       
    90 		KGetDmaRxRegs,
       
    91 		KGetDmaTxRegs,
       
    92 		KGetFirRegs,
       
    93 		KGetInterruptsInfo,
       
    94 		KIsChunkFree,
       
    95 		};
       
    96 
       
    97 public:	
       
    98 #ifndef __KERNEL_MODE__
       
    99 	inline TInt Open(TInt aUnit=KNullUnit)
       
   100 		{return DoCreate(KRDevFir,VersionRequired(),aUnit,NULL,NULL);}
       
   101 
       
   102 	inline void Write(TRequestStatus& aStatus, TDesC8& aDes, TInt aSize)
       
   103 		{DoRequest(EWriteReq,aStatus,(TAny *)&aDes,(TAny *)&aSize);}
       
   104 
       
   105 	inline void Read(TRequestStatus& aStatus, TDes8& aDes, TInt aSize)
       
   106 		{DoRequest(EReadReq,aStatus,(TAny *)&aDes,(TAny *)&aSize);}
       
   107 
       
   108 	inline void WriteCancel()
       
   109 		{DoCancel(EWriteReqCancel);}
       
   110 
       
   111 	inline void ReadCancel()
       
   112 		{DoCancel(EReadReqCancel);}
       
   113 
       
   114 
       
   115 	inline TInt Config(TDes8& aConfig)
       
   116 		{return DoControl(KControlConfig,(TAny *)&aConfig);}
       
   117 
       
   118 	inline TInt SetConfig(const TDes8& aConfig)
       
   119 		{return DoControl(KControlSetConfig,(TAny *)&aConfig);}
       
   120 
       
   121 	inline TInt Caps(TDes8& aCaps)
       
   122 		{return DoControl(KControlCaps,(TAny *)&aCaps);}
       
   123 
       
   124 	inline TInt FlushBuffers()
       
   125 		{return DoControl(KFlushBuffers);}
       
   126 
       
   127 	inline TInt SetRange(TUint aPercentage)
       
   128 		{return DoControl(KSetRange,(TAny *)&aPercentage);}
       
   129 
       
   130 	inline TVersion VersionRequired() const
       
   131 		{return TVersion(EMajorVersion,EMinorVersion,EBuildVersion);}
       
   132 
       
   133 	//debugging stuff
       
   134 	inline void DebugWrite(TDes8& aDes)
       
   135 		{TInt len=aDes.Length();DoControl(KDebugWrite,(TAny *)&aDes,(TAny *)&(len));}
       
   136 #endif
       
   137 	};
       
   138 
       
   139 #endif  // __FIRCOMM_H__