| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2003-2008, 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: bvbi_prot.c $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/1 $ |
|---|
| 12 | * $brcm_Date: 12/3/08 7:47p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/portinginterface/vbi/7400/bvbi_prot.c $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/1 12/3/08 7:47p darnstein |
|---|
| 21 | * PR45819: Source files for 7400 are no longer symbolic links. |
|---|
| 22 | * |
|---|
| 23 | * Hydra_Software_Devel/5 12/13/04 7:40p darnstein |
|---|
| 24 | * PR 13255: When recycling a field handle, clear out all its attributes. |
|---|
| 25 | * |
|---|
| 26 | * Hydra_Software_Devel/4 7/27/04 11:11a darnstein |
|---|
| 27 | * PR 9080: don't use private functions to access field handle usage count |
|---|
| 28 | * in BVBI porting interface. It is against the rules. |
|---|
| 29 | * |
|---|
| 30 | * Hydra_Software_Devel/3 10/16/03 1:21p darnstein |
|---|
| 31 | * Fix usage of BDBG_ENTER(), BDBG_LEAVE(). |
|---|
| 32 | * |
|---|
| 33 | * Hydra_Software_Devel/2 10/9/03 6:42p darnstein |
|---|
| 34 | * Change name of several functions to indicate that they may be called |
|---|
| 35 | * from an ISR. |
|---|
| 36 | * |
|---|
| 37 | * Hydra_Software_Devel/1 10/9/03 1:13p darnstein |
|---|
| 38 | * Initial version |
|---|
| 39 | * |
|---|
| 40 | ***************************************************************************/ |
|---|
| 41 | #include "bstd.h" /* standard types */ |
|---|
| 42 | #include "bdbg.h" /* Dbglib */ |
|---|
| 43 | #include "bvbi.h" /* VBI processing, this module. */ |
|---|
| 44 | #include "bvbi_priv.h" /* VBI internal data structures */ |
|---|
| 45 | #include "bvbi_prot.h" /* VBI protected functions */ |
|---|
| 46 | |
|---|
| 47 | BDBG_MODULE(BVBI); |
|---|
| 48 | |
|---|
| 49 | /*************************************************************************** |
|---|
| 50 | * Forward declarations of static (private) functions |
|---|
| 51 | ***************************************************************************/ |
|---|
| 52 | |
|---|
| 53 | |
|---|
| 54 | /*************************************************************************** |
|---|
| 55 | * Implementation of "BVBI_" protected functions |
|---|
| 56 | ***************************************************************************/ |
|---|
| 57 | |
|---|
| 58 | |
|---|
| 59 | /*************************************************************************** |
|---|
| 60 | * |
|---|
| 61 | */ |
|---|
| 62 | void BVBI_Field_Zero_UsageCount_isr (BVBI_Field_Handle fieldHandle) |
|---|
| 63 | { |
|---|
| 64 | BVBI_P_Field_Handle *pVbi_Fld; |
|---|
| 65 | |
|---|
| 66 | BDBG_ENTER(BVBI_Field_Zero_UsageCount_isr); |
|---|
| 67 | |
|---|
| 68 | /* check parameter */ |
|---|
| 69 | BVBI_P_GET_FIELD_CONTEXT(fieldHandle, pVbi_Fld); |
|---|
| 70 | BDBG_ASSERT (pVbi_Fld != NULL); |
|---|
| 71 | |
|---|
| 72 | pVbi_Fld->inUseCount = 0; |
|---|
| 73 | |
|---|
| 74 | BDBG_LEAVE(BVBI_Field_Zero_UsageCount_isr); |
|---|
| 75 | } |
|---|
| 76 | |
|---|
| 77 | |
|---|
| 78 | /*************************************************************************** |
|---|
| 79 | * |
|---|
| 80 | */ |
|---|
| 81 | void BVBI_Field_Increment_UsageCount_isr (BVBI_Field_Handle fieldHandle) |
|---|
| 82 | { |
|---|
| 83 | BVBI_P_Field_Handle *pVbi_Fld; |
|---|
| 84 | |
|---|
| 85 | BDBG_ENTER(BVBI_Field_Increment_UsageCount_isr); |
|---|
| 86 | |
|---|
| 87 | /* check parameter */ |
|---|
| 88 | BVBI_P_GET_FIELD_CONTEXT(fieldHandle, pVbi_Fld); |
|---|
| 89 | BDBG_ASSERT (pVbi_Fld != NULL); |
|---|
| 90 | |
|---|
| 91 | ++(pVbi_Fld->inUseCount); |
|---|
| 92 | |
|---|
| 93 | BDBG_LEAVE(BVBI_Field_Increment_UsageCount_isr); |
|---|
| 94 | } |
|---|
| 95 | |
|---|
| 96 | |
|---|
| 97 | /*************************************************************************** |
|---|
| 98 | * |
|---|
| 99 | */ |
|---|
| 100 | void BVBI_Field_Decrement_UsageCount_isr (BVBI_Field_Handle fieldHandle) |
|---|
| 101 | { |
|---|
| 102 | BVBI_P_Field_Handle *pVbi_Fld; |
|---|
| 103 | |
|---|
| 104 | BDBG_ENTER(BVBI_Field_Decrement_UsageCount_isr); |
|---|
| 105 | |
|---|
| 106 | /* check parameter */ |
|---|
| 107 | BVBI_P_GET_FIELD_CONTEXT(fieldHandle, pVbi_Fld); |
|---|
| 108 | BDBG_ASSERT (pVbi_Fld != NULL); |
|---|
| 109 | |
|---|
| 110 | BDBG_ASSERT (pVbi_Fld->inUseCount > 0); |
|---|
| 111 | --(pVbi_Fld->inUseCount); |
|---|
| 112 | |
|---|
| 113 | BDBG_LEAVE(BVBI_Field_Decrement_UsageCount_isr); |
|---|
| 114 | } |
|---|
| 115 | |
|---|
| 116 | |
|---|
| 117 | /*************************************************************************** |
|---|
| 118 | * |
|---|
| 119 | */ |
|---|
| 120 | int BVBI_Field_Get_UsageCount_isr (BVBI_Field_Handle fieldHandle) |
|---|
| 121 | { |
|---|
| 122 | BVBI_P_Field_Handle *pVbi_Fld; |
|---|
| 123 | |
|---|
| 124 | BDBG_ENTER(BVBI_Field_Get_UsageCount_isr); |
|---|
| 125 | |
|---|
| 126 | /* check parameter */ |
|---|
| 127 | BVBI_P_GET_FIELD_CONTEXT(fieldHandle, pVbi_Fld); |
|---|
| 128 | BDBG_ASSERT (pVbi_Fld != NULL); |
|---|
| 129 | |
|---|
| 130 | BDBG_LEAVE(BVBI_Field_Get_UsageCount_isr); |
|---|
| 131 | return pVbi_Fld->inUseCount; |
|---|
| 132 | } |
|---|
| 133 | |
|---|
| 134 | |
|---|
| 135 | /*************************************************************************** |
|---|
| 136 | * |
|---|
| 137 | */ |
|---|
| 138 | void BVBI_Field_ClearState_isr (BVBI_Field_Handle fieldHandle) |
|---|
| 139 | { |
|---|
| 140 | BVBI_P_Field_Handle *pVbi_Fld; |
|---|
| 141 | |
|---|
| 142 | BDBG_ENTER(BVBI_Field_ClearState_isr); |
|---|
| 143 | |
|---|
| 144 | /* check parameter */ |
|---|
| 145 | BVBI_P_GET_FIELD_CONTEXT(fieldHandle, pVbi_Fld); |
|---|
| 146 | BDBG_ASSERT (pVbi_Fld != NULL); |
|---|
| 147 | |
|---|
| 148 | /* Clear out simple attributes */ |
|---|
| 149 | pVbi_Fld->ulWhichPresent = 0x0; |
|---|
| 150 | pVbi_Fld->ulErrInfo = 0x0; |
|---|
| 151 | pVbi_Fld->polarityMask = 0x0; |
|---|
| 152 | |
|---|
| 153 | BDBG_LEAVE(BVBI_Field_ClearState_isr); |
|---|
| 154 | } |
|---|
| 155 | |
|---|
| 156 | /* End of File */ |
|---|