Home | History | Annotate | Download | only in inc
      1 
      2 /*
      3  * Copyright (C) Texas Instruments - http://www.ti.com/
      4  *
      5  * This library is free software; you can redistribute it and/or
      6  * modify it under the terms of the GNU Lesser General Public
      7  * License as published by the Free Software Foundation; either
      8  * version 2.1 of the License, or (at your option) any later version.
      9  *
     10  *
     11  * This library is distributed in the hope that it will be useful,
     12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     14  * Lesser General Public License for more details.
     15  *
     16  *
     17  * You should have received a copy of the GNU Lesser General Public
     18  * License along with this library; if not, write to the Free Software
     19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
     20  */
     21 /* NOTE: This header should be only included from perf.h */
     22 
     23 /* This header defined the macros that translate the external interface
     24    into the implementation calls */
     25 
     26 #ifndef __PERF_OBJ_H
     27 #define __PERF_OBJ_H
     28 
     29 #include "perf_common.h"
     30 #include "perf.h"
     31 
     32 #ifdef __PERF_CUSTOMIZABLE__
     33 /* define any customizable interface */
     34 /* this header includes any customized implementation headers */
     35     #include "perf_custom.h"
     36 #endif
     37 
     38 /******************************************************************************
     39     PRIVATE (INTERNAL) STRUCTURES - NEEDED FOR INLINE LOG IMPLEMENTATIONS
     40 ******************************************************************************/
     41 
     42 /* private PERF structure - common to all implementations */
     43 typedef struct PERF_Private
     44 {
     45     struct PERF_LOG_Private *pLog;
     46     TIME_STRUCT time, tempTime;    /* last and current timestamp */
     47 
     48     unsigned long uMode;           /* PERF instrumentation mode */
     49     unsigned long ulPID;           /* PID for thread */
     50     unsigned long ulID;            /* Performance object name (FOURCC) */
     51 
     52 #ifdef __PERF_CUSTOMIZABLE__
     53     /* additional information for each kind of implementation */
     54     PERF_Custom_Private cip;
     55 #endif
     56 } PERF_Private;
     57 
     58 #define get_Private(handle) \
     59     ((PERF_Private *) ( (handle)->pComponentPrivate ))
     60 
     61 /* PERF Instrumentation mode */
     62 enum PERF_MODE
     63 {
     64     PERF_Mode_None            =  0x0,
     65     PERF_Mode_Log             =  0x1,
     66 };
     67 
     68 /*=============================================================================
     69     INSTRUMENTATION OBJECT
     70 =============================================================================*/
     71 typedef struct PERF_OBJTYPE
     72 {
     73     /** pComponentPrivate is a pointer to the component private
     74     *   data area. This member is allocated and initialized by the
     75     *   component when the component is created.  The application
     76     *   should not access this data area.
     77     *  */
     78     void *pComponentPrivate;
     79 
     80     /** pApplicationPrivate is a 32 bit pointer that is unused by
     81     *   PERF. The value is set to NULL when the component is
     82     *   created and not read or written thereafter.
     83     * */
     84     void *pApplicationPrivate;
     85 
     86     /** The Done method is called at the end of the UC test or UI
     87     *   application.
     88     *   @param phObject
     89     *       Pointer to a handle to the PERF object, which will be
     90     *       deleted and set to NULL upon completion.
     91     *  */
     92     void (*Done)(
     93                 PERF_OBJHANDLE *phObject);
     94 
     95 #ifdef __PERF_CUSTOMIZABLE__
     96     PERF_Custom_Interface ci;
     97 #endif
     98 } PERF_OBJTYPE;
     99 
    100 /* check if handle is defined */
    101 #define PERF_check(handle, exp) ((handle) ? (exp),1 : 0)
    102 
    103 #define __PERF_Done(                                         \
    104         hObject)                                             \
    105     PERF_check((hObject), ((PERF_OBJHANDLE)(hObject))->Done( \
    106         (PERF_OBJHANDLE *)&(hObject)) )  /* Macro End */
    107 
    108 /* define the PERF log interface - standard implementation */
    109 #include "perf_log.h"
    110 
    111 #endif
    112