source: svn/trunk/newcon3bcm2_21bu/magnum/portinginterface/dma/7552/bdma_priv.c

Last change on this file was 2, checked in by jglee, 11 years ago

first commit

  • Property svn:executable set to *
File size: 6.2 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2003-2011, 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: bdma_priv.c $
11 * $brcm_Revision: Hydra_Software_Devel/3 $
12 * $brcm_Date: 2/2/11 10:29a $
13 *
14 * Module Description:
15 *
16 *
17 * Revision History:
18 * $brcm_Log: /magnum/portinginterface/dma/7400/bdma_priv.c $
19 *
20 * Hydra_Software_Devel/3   2/2/11 10:29a vanessah
21 * SW7550-670: add Sharf DMA support
22 *
23 * Hydra_Software_Devel/2   7/30/08 11:54a syang
24 * PR 45128: fix ptr over-run caused by using BDMA_MemDmaEngine_eUnknown
25 * for engine handle array boundary
26 *
27 * Hydra_Software_Devel/6   2/21/08 1:38p rpan
28 * PR34854: Initial work for bcm3548.
29 *
30 * Hydra_Software_Devel/5   12/7/07 4:10p syang
31 * PR 34606: rewrite more than half of code to support hw sharing for
32 * kernel and user-mode sides
33 *
34 * Hydra_Software_Devel/4   10/23/03 11:07a syang
35 * first time checking after resolving comipling errors
36 *
37 * Hydra_Software_Devel/3   10/21/03 4:45p syang
38 * added GetMemDmaHandle and GetPciDmaHandle
39 *
40 * Hydra_Software_Devel/2   10/20/03 12:17p syang
41 * change SetMem/PciHandle to  SetMem/PciDmaHandle to
42 *
43 * Hydra_Software_Devel/1   10/7/03 3:53p syang
44 * init version
45 *
46 ***************************************************************************/
47
48#include "bdma_priv.h"    /*  */
49
50BDBG_MODULE(BDMA);
51
52
53/***************************************************************************
54 * Note: assume parameters are valid
55 */
56BCHP_Handle BDMA_P_GetChipHandle(
57        BDMA_Handle  hDma )
58{
59        BDMA_P_Context *     pDma;
60       
61        BDMA_P_MAIN_GET_CONTEXT(hDma, pDma);
62        BDBG_ASSERT( NULL != pDma );
63
64        return pDma->hChip;
65}
66
67/***************************************************************************
68 * Note: assume parameters are valid
69 */
70BREG_Handle BDMA_P_GetRegisterHandle(
71        BDMA_Handle  hDma )
72{
73        BDMA_P_Context *     pDma;
74       
75        BDMA_P_MAIN_GET_CONTEXT(hDma, pDma);
76        BDBG_ASSERT( NULL != pDma );
77
78        return pDma->hRegister;
79}
80
81/***************************************************************************
82 * Note: assume parameters are valid
83 */
84BMEM_Handle BDMA_P_GetMemoryHandle(
85        BDMA_Handle  hDma )
86{
87        BDMA_P_Context *     pDma;
88       
89        BDMA_P_MAIN_GET_CONTEXT(hDma, pDma);
90        BDBG_ASSERT( NULL != pDma );
91
92        return pDma->hMemory;
93}
94
95/***************************************************************************
96 * Note: assume parameters are valid
97 */
98BINT_Handle BDMA_P_GetInterruptHandle(
99        BDMA_Handle  hDma )
100{
101        BDMA_P_Context *     pDma;
102       
103        BDMA_P_MAIN_GET_CONTEXT(hDma, pDma);
104        BDBG_ASSERT( NULL != pDma );
105
106        return pDma->hInterrupt;
107}
108
109#if BDMA_P_SUPPORT_MEM_DMA_ENGINE
110/***************************************************************************
111 * Note: assume parameters are valid
112 */
113void BDMA_P_SetMemDmaHandle(
114        BDMA_Handle       hDma,
115        BDMA_MemDmaEngine eEngine,
116        BDMA_Mem_Handle   hMemDma )
117{
118        BDMA_P_Context *     pDma;
119       
120        BDMA_P_MAIN_GET_CONTEXT(hDma, pDma);
121        BDBG_ASSERT( NULL != pDma );
122
123        if (eEngine < BDMA_P_SUPPORT_MEM_DMA_ENGINE)
124                pDma->hMemDma[eEngine] = hMemDma;  /* hMemDma will be NULL when destroy */
125        else
126                BDBG_ASSERT(eEngine < BDMA_P_SUPPORT_MEM_DMA_ENGINE);
127}
128
129/***************************************************************************
130 * Note: assume parameters are valid
131 */
132BDMA_Mem_Handle BDMA_P_GetMemDmaHandle(
133        BDMA_Handle        hDma,
134        BDMA_MemDmaEngine eEngine )
135{
136        BDMA_P_Context *     pDma;
137       
138        BDMA_P_MAIN_GET_CONTEXT(hDma, pDma);
139        BDBG_ASSERT( NULL != pDma );
140
141        if (eEngine < BDMA_P_SUPPORT_MEM_DMA_ENGINE)
142                return pDma->hMemDma[eEngine];  /* hMemDma will be NULL when destroy */
143        else
144        {
145                BDBG_ASSERT(eEngine < BDMA_P_SUPPORT_MEM_DMA_ENGINE);
146                return NULL;
147        }
148}
149#endif
150
151#if BDMA_P_SUPPORT_PCI_DMA_ENGINE
152/***************************************************************************
153 * Note: assume parameters are valid
154 */
155void BDMA_P_SetPciDmaHandle(
156        BDMA_Handle       hDma,
157        BDMA_PciDmaEngine eEngine,
158        BDMA_Pci_Handle   hPciDma )
159{
160        BDMA_P_Context *     pDma;
161       
162        BDMA_P_MAIN_GET_CONTEXT(hDma, pDma);
163        BDBG_ASSERT( NULL != pDma );
164
165        if (eEngine < BDMA_P_SUPPORT_PCI_DMA_ENGINE)
166                pDma->hPciDma[eEngine] = hPciDma;  /* hPciDma will be NULL when destroy */
167        else
168                BDBG_ASSERT(eEngine < BDMA_P_SUPPORT_PCI_DMA_ENGINE);
169}
170
171/***************************************************************************
172 * Note: assume parameters are valid
173 */
174BDMA_Pci_Handle BDMA_P_GetPciDmaHandle(
175        BDMA_Handle        hDma,
176        BDMA_PciDmaEngine eEngine )
177{
178        BDMA_P_Context *     pDma;
179       
180        BDMA_P_MAIN_GET_CONTEXT(hDma, pDma);
181        BDBG_ASSERT( NULL != pDma );
182
183        if (eEngine < BDMA_P_SUPPORT_PCI_DMA_ENGINE)
184                return pDma->hPciDma[eEngine];  /* hPciDma will be NULL when destroy */
185        else
186        {
187                BDBG_ASSERT(eEngine < BDMA_P_SUPPORT_PCI_DMA_ENGINE);
188                return NULL;
189        }
190}
191#endif
192
193#if BDMA_P_SUPPORT_SHARF_DMA_ENGINE
194/***************************************************************************
195 * Note: assume parameters are valid. It should be in bdma_priv.c, but we
196 * put it here because we want to export sharf concept to outside as less
197 * as possible.
198 */
199void BDMA_P_SetSharfDmaHandle(
200        BDMA_Handle       hDma,
201        BDMA_Sharf        eEngine,
202        BDMA_Mem_Handle   hMemDma )
203{
204        BDMA_P_Context *     pDma;
205
206        BDMA_P_MAIN_GET_CONTEXT(hDma, pDma);
207        BDBG_ASSERT( NULL != pDma );
208
209        if (eEngine < BDMA_Sharf_eInvalid)
210                pDma->hSharfDma[eEngine] = hMemDma;  /* hMemDma will be NULL when destroy */
211        else
212                BDBG_ASSERT(eEngine < BDMA_Sharf_eInvalid);
213}
214
215/***************************************************************************
216 * Note: assume parameters are valid. It should be in bdma_priv.c, but we
217 * put it here because we want to export sharf concept to outside as less
218 * as possible.
219 */
220BDMA_Mem_Handle BDMA_P_GetSharfDmaHandle(
221        BDMA_Handle        hDma,
222        BDMA_Sharf         eEngine )
223{
224        BDMA_P_Context *     pDma;
225
226        BDMA_P_MAIN_GET_CONTEXT(hDma, pDma);
227        BDBG_ASSERT( NULL != pDma );
228
229        if (eEngine < BDMA_Sharf_eInvalid)
230                return pDma->hSharfDma[eEngine];  /* hMemDma will be NULL when destroy */
231        else
232        {
233                BDBG_ASSERT(eEngine < BDMA_Sharf_eInvalid);
234                return NULL;
235        }
236}
237#endif
238/* End of File */
Note: See TracBrowser for help on using the repository browser.