dbgsrv/coredumpserver/test/crashapps/inc/t_crashdriver_drv.h
changeset 0 c6b0df440bee
equal deleted inserted replaced
-1:000000000000 0:c6b0df440bee
       
     1 // Copyright (c) 2008-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 "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 // Core Dump Server Crash Driver
       
    15 //
       
    16 
       
    17 
       
    18 
       
    19 /**
       
    20  @file
       
    21  @internalTechnology
       
    22  @prototype
       
    23 */
       
    24 
       
    25 #ifndef __T_CRASHDRIVER_DRV_H__
       
    26 #define __T_CRASHDRIVER_DRV_H__
       
    27 
       
    28 #include <e32cmn.h>
       
    29 #include <e32ver.h>
       
    30 #ifndef __KERNEL_MODE__
       
    31 #include <e32std.h>
       
    32 #endif
       
    33 
       
    34 //size of message buffer
       
    35 const TInt KMaxBufferSize = 150;
       
    36 
       
    37 /**
       
    38 User interface for 'crashdriver'
       
    39 */
       
    40 class RKernelCrashDrv : public RBusLogicalChannel
       
    41     {
       
    42 public:
       
    43 	/**
       
    44     Structure for holding driver capabilities information
       
    45     (Just a version number in this example.)
       
    46     */
       
    47     class TCaps
       
    48         {
       
    49     public:
       
    50         TVersion iVersion;
       
    51         };
       
    52     
       
    53 public:
       
    54     TInt Open();   
       
    55     void SendNullPointerFault(TRequestStatus& aStatus);
       
    56     void SendPrefetchAbortFault(TRequestStatus& aStatus);
       
    57     void SendDataReadFault(TRequestStatus& aStatus);
       
    58     void SendDataWriteFault(TRequestStatus& aStatus);  
       
    59     void SendUndefInstructionFault(TRequestStatus& aStatus);
       
    60     void SendDivByZeroFault(TRequestStatus& aStatus);
       
    61     void SendStackOverFlowFault(TRequestStatus& aStatus);
       
    62     void TestSCMConfigInsertMethod(TRequestStatus& aStatus, TBool& aPass, TDes8& aBuf);
       
    63     
       
    64     inline static const TDesC& Name();
       
    65     inline static TVersion VersionRequired();
       
    66 
       
    67 public:
       
    68      /**
       
    69     Enumeration of Request messages. Causes kernel Panics
       
    70     */
       
    71     enum TRequest
       
    72         {
       
    73         ENullPointer,
       
    74         EPrefetchAbort,
       
    75         EDataRead,
       
    76         EDataWrite,
       
    77         EUndefInst,
       
    78         EDivByZero,
       
    79         EStackOverflow,
       
    80         ETestSCMConfigInsertMethod,
       
    81         };      
       
    82     };
       
    83 
       
    84 
       
    85 /**
       
    86   Returns the driver's name
       
    87 */
       
    88 inline const TDesC& RKernelCrashDrv::Name()
       
    89     {
       
    90     _LIT(KCrashDriverName,"crashdriver");
       
    91     return KCrashDriverName;
       
    92     }
       
    93 
       
    94 /**
       
    95   Returns the version number of the driver
       
    96 */
       
    97 inline TVersion RKernelCrashDrv::VersionRequired()
       
    98     {
       
    99     const TInt KMajorVersionNumber=1;
       
   100     const TInt KMinorVersionNumber=0;
       
   101     const TInt KBuildVersionNumber=KE32BuildVersionNumber;
       
   102     return TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber);
       
   103     }
       
   104 
       
   105 /*
       
   106   NOTE: The following member functions would normally be exported from a seperate client DLL
       
   107   but are included inline in this header file for convenience.
       
   108 */
       
   109 
       
   110 #ifndef __KERNEL_MODE__
       
   111 
       
   112 /**
       
   113   Opens a logical channel to the driver
       
   114 
       
   115   @return One of the system wide error codes.
       
   116 */
       
   117 TInt RKernelCrashDrv::Open()
       
   118     {
       
   119     __UHEAP_MARK;
       
   120     TInt x = DoCreate(Name(),VersionRequired(),KNullUnit,NULL,NULL,EOwnerThread);    
       
   121     __UHEAP_MARKEND;
       
   122     return x;
       
   123     }
       
   124 
       
   125 
       
   126 /** 
       
   127  *   Sends data to the device.
       
   128  *   Only one send request may be pending at any time.
       
   129  *   @param aStatus The request to be signalled when the data has been sent.
       
   130  *                  The result value will be set to KErrNone on success;
       
   131  *                  or set to one of the system wide error codes when an error occurs.
       
   132  */
       
   133 void RKernelCrashDrv::SendPrefetchAbortFault(TRequestStatus& aStatus)
       
   134     {
       
   135     DoRequest(EPrefetchAbort,aStatus);
       
   136     }
       
   137 
       
   138 /**
       
   139  *   Sends data to the device.
       
   140  *   Only one send request may be pending at any time.
       
   141  *   @param aStatus The request to be signalled when the data has been sent.
       
   142  *                  The result value will be set to KErrNone on success;
       
   143  *                  or set to one of the system wide error codes when an error occurs.
       
   144  */
       
   145 void RKernelCrashDrv::SendDataReadFault(TRequestStatus& aStatus)
       
   146     {
       
   147     DoRequest(EDataRead,aStatus);
       
   148     }
       
   149 
       
   150 /**
       
   151  *   Sends data to the device.
       
   152  *   Only one send request may be pending at any time.
       
   153  *   @param aStatus The request to be signalled when the data has been sent.
       
   154  *                  The result value will be set to KErrNone on success;
       
   155  *                  or set to one of the system wide error codes when an error occurs.
       
   156  */
       
   157 void RKernelCrashDrv::SendDataWriteFault(TRequestStatus& aStatus)
       
   158     {
       
   159     DoRequest(EDataWrite,aStatus);
       
   160     }
       
   161 
       
   162 /**
       
   163  *   Sends data to the device.
       
   164  *   Only one send request may be pending at any time.
       
   165  *   @param aStatus The request to be signalled when the data has been sent.
       
   166  *                  The result value will be set to KErrNone on success;
       
   167  *                  or set to one of the system wide error codes when an error occurs.
       
   168  */
       
   169 void RKernelCrashDrv::SendUndefInstructionFault(TRequestStatus& aStatus)
       
   170     {
       
   171     DoRequest(EUndefInst,aStatus);
       
   172     }
       
   173 
       
   174 /**
       
   175  *   Sends data to the device.
       
   176  *   Only one send request may be pending at any time.
       
   177  *   @param aStatus The request to be signalled when the data has been sent.
       
   178  *                  The result value will be set to KErrNone on success;
       
   179  *                  or set to one of the system wide error codes when an error occurs.
       
   180  */
       
   181 void RKernelCrashDrv::SendDivByZeroFault(TRequestStatus& aStatus)
       
   182     {
       
   183     DoRequest(EDivByZero,aStatus);
       
   184     }
       
   185 
       
   186 /**
       
   187  *   Sends data to the device.
       
   188  *   Only one send request may be pending at any time.
       
   189  *   @param aStatus The request to be signalled when the data has been sent.
       
   190  *                  The result value will be set to KErrNone on success;
       
   191  *                  or set to one of the system wide error codes when an error occurs.
       
   192  */
       
   193 void RKernelCrashDrv::SendStackOverFlowFault(TRequestStatus& aStatus)
       
   194     {
       
   195     DoRequest(EStackOverflow,aStatus);
       
   196     }
       
   197 
       
   198 /**
       
   199  *   Sends data to the device.
       
   200  *   Only one send request may be pending at any time.
       
   201  *   @param aStatus The request to be signalled when the data has been sent.
       
   202  *                  The result value will be set to KErrNone on success;
       
   203  *                  or set to one of the system wide error codes when an error occurs.
       
   204  */
       
   205 void RKernelCrashDrv::TestSCMConfigInsertMethod(TRequestStatus& aStatus, TBool& aPass, TDes8& aBuf)
       
   206     {
       
   207     DoRequest(ETestSCMConfigInsertMethod, aStatus, reinterpret_cast<TAny*>(&aPass), reinterpret_cast<TAny*>(&aBuf));
       
   208     }
       
   209 
       
   210 
       
   211 
       
   212 #endif   // !__KERNEL_MODE__
       
   213 
       
   214 #endif
       
   215