| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2006-2009, Broadcom Corporation |
|---|
| 3 | * All Rights Reserved |
|---|
| 4 | * Confidential Property of Broadcom Corporation |
|---|
| 5 | * |
|---|
| 6 | * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE |
|---|
| 7 | * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR |
|---|
| 8 | * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. |
|---|
| 9 | * |
|---|
| 10 | * $brcm_Workfile: bdbg_os_priv.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/2 $ |
|---|
| 12 | * $brcm_Date: 1/26/09 10:33a $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/basemodules/dbg/bdbg_os_priv.h $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/2 1/26/09 10:33a erickson |
|---|
| 21 | * PR51415: rework bdbg_os_priv interface to not suggest BKNI_EventHandle |
|---|
| 22 | * usage in BDBG_P_Lock, which must lock in both task and isr contexts |
|---|
| 23 | * |
|---|
| 24 | * Hydra_Software_Devel/1 4/27/06 10:10a vle |
|---|
| 25 | * PR 21065: Redefined BDBG_LOCK and BDBG_UNLOCK to be OS specific |
|---|
| 26 | * functions. |
|---|
| 27 | * |
|---|
| 28 | ***************************************************************************/ |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | #ifndef BDBG_OS_PRIV_H__ |
|---|
| 32 | #define BDBG_OS_PRIV_H__ |
|---|
| 33 | |
|---|
| 34 | #ifdef __cplusplus |
|---|
| 35 | extern "C" { |
|---|
| 36 | #endif |
|---|
| 37 | |
|---|
| 38 | /* The functions below are OS specific and must exist for OS using BDBG module */ |
|---|
| 39 | |
|---|
| 40 | /**************************************************************** |
|---|
| 41 | Summary: |
|---|
| 42 | Initialize the OS-specific layer in the DBG basemodule |
|---|
| 43 | ****************************************************************/ |
|---|
| 44 | BERR_Code BDBG_P_OsInit(void); |
|---|
| 45 | |
|---|
| 46 | /**************************************************************** |
|---|
| 47 | Summary: |
|---|
| 48 | Uninitialize the OS-specific layer in the DBG basemodule |
|---|
| 49 | ****************************************************************/ |
|---|
| 50 | void BDBG_P_OsUninit(void); |
|---|
| 51 | |
|---|
| 52 | /**************************************************************** |
|---|
| 53 | Summary: |
|---|
| 54 | Lock BDBG module from multiple accesses. |
|---|
| 55 | |
|---|
| 56 | Description: |
|---|
| 57 | DBG requires that BDBG_P_Lock be implemented per OS. |
|---|
| 58 | BDBG_P_Lock must work in both task and isr modes. |
|---|
| 59 | Therefore, BDBG_P_Lock cannot be implemented by calling BKNI_AcquireMutex or BKNI_EnterCriticalSection which only work in task mode. |
|---|
| 60 | |
|---|
| 61 | Your OS's implementation of BDBG_P_Lock will likely look similar to your OS's implementation of BKNI_EnterCriticalSection. |
|---|
| 62 | For example, in linux user mode, BDBG_P_Lock acquries a pthread mutex. |
|---|
| 63 | For another example, in linux kernel mode, BDBG_P_Lock acquires a spin lock. |
|---|
| 64 | ****************************************************************/ |
|---|
| 65 | void BDBG_P_Lock(void); |
|---|
| 66 | |
|---|
| 67 | |
|---|
| 68 | /**************************************************************** |
|---|
| 69 | Summary: |
|---|
| 70 | Release BDBG module from a BDBG_P_Lock state. |
|---|
| 71 | ****************************************************************/ |
|---|
| 72 | void BDBG_P_Unlock(void); |
|---|
| 73 | |
|---|
| 74 | |
|---|
| 75 | /**************************************************************** |
|---|
| 76 | Summary: |
|---|
| 77 | This function initializes the initial timestamp when BDBG module |
|---|
| 78 | is initialize. This initial timestamp will be used as reference |
|---|
| 79 | for determining the run time thus far. |
|---|
| 80 | ****************************************************************/ |
|---|
| 81 | void BDBG_P_InitializeTimeStamp(void); |
|---|
| 82 | |
|---|
| 83 | |
|---|
| 84 | /**************************************************************** |
|---|
| 85 | Summary: |
|---|
| 86 | This function calculates the run time and convert it into a |
|---|
| 87 | more readable form so that it can be attach to debug messages. |
|---|
| 88 | *****************************************************************/ |
|---|
| 89 | void BDBG_P_GetTimeStamp( |
|---|
| 90 | char *timeStamp, /* size of the string containing the formatted timestamp */ |
|---|
| 91 | int size_t /* the formatted timestamp to attach to debug messages */ |
|---|
| 92 | ); |
|---|
| 93 | |
|---|
| 94 | |
|---|
| 95 | #ifdef __cplusplus |
|---|
| 96 | } |
|---|
| 97 | #endif |
|---|
| 98 | |
|---|
| 99 | #endif |
|---|