cm-kernel /drivers/net/wireless/tiwlan1251/CUDK/Inc/TI_OAL.h

Language C/C++ Header Lines 150
MD5 Hash 3372106cc9366be7b8990ebb52ebbe33 Estimated Cost $1,755 (why?)
Repository git://github.com/CyanogenMod/cm-kernel.git View Raw File View Project SPDX
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/*******************************************************************************
**+--------------------------------------------------------------------------+**
**|                                                                          |**
**| Copyright 1998-2008 Texas Instruments, Inc. - http://www.ti.com/         |**
**|                                                                          |**
**| Licensed under the Apache License, Version 2.0 (the "License");          |**
**| you may not use this file except in compliance with the License.         |**
**| You may obtain a copy of the License at                                  |**
**|                                                                          |**
**|     http://www.apache.org/licenses/LICENSE-2.0                           |**
**|                                                                          |**
**| Unless required by applicable law or agreed to in writing, software      |**
**| distributed under the License is distributed on an "AS IS" BASIS,        |**
**| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |**
**| See the License for the specific language governing permissions and      |**
**| limitations under the License.                                           |**
**|                                                                          |**
**+--------------------------------------------------------------------------+**
*******************************************************************************/

/*--------------------------------------------------------------------------*/
/* Module:      TI_OAL.h*/
/**/
/* Purpose:     This file contains a interface for the TI_OAL class.*/
/**/
/*////////////////////////////////////////////////////////////////////*/

#if !defined(AFX_TIUNILIB_H__F79CA4B8_8596_4F36_B541_2B2FCCF70197__INCLUDED_)
#define AFX_TIUNILIB_H__F79CA4B8_8596_4F36_B541_2B2FCCF70197__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif /* _MSC_VER > 1000*/

#include "osTIType.h"
#include "TI_Results.h"

#ifdef _UNICODE
    #define tisprintf   swprintf
    #define tistrncpy   wcsncpy
#else
    #define tisprintf   sprintf
    #define tistrncpy   strncpy
#endif


class  TI_OSWrapCriticalSection
{               
    protected:
                tiVOID*     m_pCS;   
    public: 
        static  TI_OSWrapCriticalSection*   CreateObject();
        static  tiVOID          DeleteObject(TI_OSWrapCriticalSection* pObj);
        
                    TI_OSWrapCriticalSection() {}
        virtual    ~TI_OSWrapCriticalSection() {}
        virtual tiVOID    Enter               ()  = 0;
        virtual tiVOID    Leave               ()  = 0;
};

class  TI_OSCriticalSection
{
        TI_OSWrapCriticalSection*               m_pWrapCS;
     
    public: 
                    TI_OSCriticalSection();
                   ~TI_OSCriticalSection();
                tiVOID    Enter               ();
                tiVOID    Leave               ();
};
/*
class  TI_OSWrapEvent
{               
    protected:
                tiVOID*     m_pEvent;   
    public: 
        static  TI_OSWrapEvent*   CreateObject();
        
                    TI_OSWrapEvent()    {}
                   ~TI_OSWrapEvent()    {}
        virtual tiUINT32    Wait    ( tiUINT32 uTime )  = 0;
        virtual tiVOID      Set     ()  = 0;
        virtual tiVOID      Reset   ()  = 0;
};

class  TI_OSEvent
{
        TI_OSWrapEvent*               m_pWrapEvent;
     
    public: 
                    TI_OSEvent();
                   ~TI_OSEvent();
             tiUINT32    Wait    ( tiUINT32 uTime );
             tiVOID      Set     ();
             tiVOID      Reset   ();
};
*/
typedef tiUINT32 (* tiPTHREAD_START_ROUTINE)( tiVOID* pThreadParameter );

class  TI_OAL  
{
    protected:
        
                                TI_OAL            ();
        virtual                ~TI_OAL            ();

        static  TI_OAL*       _instance;
        static  tiUINT32        m_uReferenceCount; 
        
    public:
        static  TI_OAL*     GetInstance             (); /* static function for create TI_OSlib object*/
        static  tiVOID      FreeInstance            (); /* static function for release TI_OAL object*/

        /* list of functions that will call from Utility Adapter and Utility GUI modules */
        virtual tiVOID      TIOutputDebugString     (tiCHAR* lpOutputString)                                        = 0;
        virtual tiBOOL      TIIsBadWritePtr         (tiVOID* lp, tiUINT32 ucb )                                     = 0;

        /* list of functions that will call from Windows Utility module */
        virtual tiUINT32    TILoadLibrary           (tiCHAR*    pLibFileName)                                       = 0;
        virtual tiBOOL      TIFreeLibrary           (tiUINT32   hLibModule)                                         = 0;
        virtual tiUINT32    TIGetProcAddress        (tiUINT32   hModule, tiCHAR* lpProcName )                       = 0;
        virtual tiUINT32    TIRegisterWindowMessage (tiCHAR*    pszMsgName )                                        = 0;
        virtual tiBOOL      TIPostMessage           (tiUINT32 hWnd, tiUINT32 Msg, tiUINT32 wParam, tiUINT32 lParam) = 0;
        virtual tiVOID      TIPrintLastError        (tiCHAR*    psz)                                                = 0;
        virtual tiUINT32    TIGetCurrentThreadId    ()                                                              = 0;
        virtual tiUINT32    TICreateThread          (tiPTHREAD_START_ROUTINE pStartAddress, tiVOID* pParameter )    = 0;
        virtual tiVOID      TISleep                 (tiUINT32 msec)                                                = 0;
};

#define TIOALib_OBJECT_CREATOR_IMP( ClassApi, ClassBase )   \
ClassBase* ClassBase::CreateObject(){ return (ClassBase*) new ClassApi;} \
tiVOID  ClassBase::DeleteObject(ClassBase* pObj){ClassApi* pRealObj = (ClassApi*)pObj; \
if(pRealObj)delete pRealObj; }


#define TIOALib_SINGLETON_CLASS_IMP( ClassApi )             \
TI_OAL* TI_OAL::GetInstance()                               \
{ return (TI_OAL*) ClassApi::GetInstance(); }               \
TI_OAL* ClassApi::GetInstance()                             \
{if( _instance == 0){_instance = new ClassApi();}           \
m_uReferenceCount++; return _instance;}                     \
tiVOID TI_OAL::FreeInstance()                               \
{ ClassApi::FreeInstance(); }                               \
tiVOID ClassApi::FreeInstance()                             \
{ m_uReferenceCount--;if(!m_uReferenceCount && _instance )  \
{delete (ClassApi*)_instance;_instance = NULL;}}                                                   
    
#endif /* !defined(AFX_TIUNILIB_H__F79CA4B8_8596_4F36_B541_2B2FCCF70197__INCLUDED_)*/
Back to Top