source: svn/newcon3bcm2_21bu/magnum/portinginterface/dma/7552/bdma_mem_sharf.c

Last change on this file was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 6.6 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_mem_sharf.c $
11 * $brcm_Revision: Hydra_Software_Devel/2 $
12 * $brcm_Date: 2/22/11 7:49a $
13 *
14 * Module Description:
15 *
16 *
17 * Revision History:
18 * $brcm_Log: /magnum/portinginterface/dma/7440/bdma_mem_sharf.c $
19 *
20 * Hydra_Software_Devel/2   2/22/11 7:49a vanessah
21 * SW7550-670: add Sharf DMA support
22 *
23 * Hydra_Software_Devel/3   12/11/07 10:57a syang
24 * PR 34606:  update sharf dma according to big rewriting of regular dma
25 * code / API
26 *
27 * Hydra_Software_Devel/2   4/5/07 10:13a syang
28 * PR 28171:  fixed a typo that causes inf calling loop
29 *
30 * Hydra_Software_Devel/1   3/19/07 4:26p syang
31 * PR 28171: init version
32 *
33 ***************************************************************************/
34
35#include "bdma_mem_priv.h"    /*  */
36#include "bdma_mem_sharf_priv.h"    /*  */
37#include "bkni.h"
38
39
40BDBG_MODULE(BDMA_MEM);
41
42/* Default settings. */
43static const BDMA_Mem_Settings s_stDefaultMemDmaSettings =
44{
45        BDMA_P_NUM_QUEUE_ENTRIES,
46        BDMA_P_MAX_NUM_BLOCKS,
47
48        /* deafult for the case that only one BDMA instance exists in the system */
49        NULL, NULL, NULL, 0, true
50};
51
52
53/***************************************************************************
54 *
55 */
56BERR_Code BDMA_Mem_Sharf_Create(
57        BDMA_Handle              hDma,
58        BDMA_Sharf               eEngine,
59        BDMA_Mem_Settings *      pSettings,     
60        BDMA_Mem_Handle *        phMemDma )
61{
62        BERR_Code  eResult = BERR_SUCCESS;
63        BDMA_P_Context  *pDma;
64
65        BDMA_P_MAIN_GET_CONTEXT( hDma, pDma );
66        if (NULL == pDma)
67        {
68                eResult = BERR_TRACE(BERR_INVALID_PARAMETER);
69                goto BDMA_Err_Mem_Create;
70        }
71       
72        /* hDma passed the magic check, we trust every thing pointed by it now */
73        eResult = BKNI_AcquireMutex(pDma->hMutex);
74        if (BERR_SUCCESS == eResult)
75        {
76                if (NULL != pSettings)
77                        eResult = BDMA_P_Mem_Sharf_Create( hDma, eEngine, pSettings, phMemDma );
78                else
79                        eResult = BDMA_P_Mem_Sharf_Create( hDma, eEngine, &s_stDefaultMemDmaSettings, phMemDma );
80                BKNI_ReleaseMutex(pDma->hMutex);
81        }
82       
83  BDMA_Err_Mem_Create:
84        return BERR_TRACE(eResult);
85}
86
87/***************************************************************************
88 *
89 */
90BERR_Code BDMA_Mem_Sharf_Destroy(
91        BDMA_Mem_Handle       hMemDma )
92{
93        BKNI_MutexHandle  hMutex;
94        BERR_Code  eResult = BERR_SUCCESS;
95
96        eResult = BDMA_P_Mem_AcquireMutex( hMemDma, &hMutex );
97        if (BERR_SUCCESS == eResult)
98        {
99                eResult = BDMA_P_Mem_Sharf_Destroy( hMemDma );
100                BKNI_ReleaseMutex(hMutex);
101        }
102               
103        return BERR_TRACE(eResult);
104}
105
106/***************************************************************************
107 *
108 */
109BERR_Code BDMA_Mem_Sharf_Tran_SetCrypto(
110        BDMA_Mem_Tran_Handle     hTran,
111        BDMA_SharfMode           eSharfMode,
112        bool                     bSgEnable,
113        bool                     bUseBspKey,
114        bool                     bCmp8LstByts)
115{
116        BERR_Code  eResult = BERR_SUCCESS;
117
118        BKNI_EnterCriticalSection();
119        eResult = BDMA_P_Mem_Sharf_Tran_SetCrypto_isr( hTran,
120                eSharfMode, bSgEnable, bUseBspKey, bCmp8LstByts );
121        BKNI_LeaveCriticalSection();
122               
123        return BERR_TRACE(eResult);
124}
125
126/***************************************************************************
127 *
128 */
129BERR_Code BDMA_Mem_Sharf_Tran_SetSgStartEnd(
130        BDMA_Mem_Tran_Handle     hTran,
131        uint32_t                 ulBlockId,
132        bool                     bStartSgScram,
133        bool                     bEndSgScram,
134        bool                     bKeyPresent,
135        bool                     bDigestPresent )
136{
137        BERR_Code  eResult = BERR_SUCCESS;
138
139        BKNI_EnterCriticalSection();   
140        eResult = BDMA_P_Mem_Sharf_Tran_SetSgStartEnd_isr( hTran, ulBlockId,
141                bStartSgScram, bEndSgScram, bKeyPresent, bDigestPresent );
142        BKNI_LeaveCriticalSection();
143               
144        return BERR_TRACE(eResult);
145}
146
147/***************************************************************************
148 *
149 */
150BERR_Code BDMA_Mem_Sharf_Tran_SetDmaBlockInfo(
151        BDMA_Mem_Tran_Handle     hTran,
152        uint32_t                 ulBlockId,
153        BDMA_Context             eContext,
154        uint32_t                 ulDstBusAddr,
155        uint32_t                 ulSrcBusAddr,
156        uint32_t                 ulBlockSize )
157{
158        BERR_Code  eResult = BERR_SUCCESS;
159
160        BKNI_EnterCriticalSection();   
161        eResult = BDMA_P_Mem_Sharf_Tran_SetDmaBlockInfo_isr( hTran, ulBlockId,
162                eContext, ulDstBusAddr, ulSrcBusAddr, ulBlockSize );
163        BKNI_LeaveCriticalSection();
164               
165        return BERR_TRACE(eResult);
166}
167
168/***************************************************************************
169 *
170 */
171BERR_Code BDMA_Mem_Sharf_Tran_SetCrypto_isr(
172        BDMA_Mem_Tran_Handle     hTran,
173        BDMA_SharfMode           eSharfMode,
174        bool                     bSgEnable,
175        bool                     bUseBspKey,
176        bool                     bCmp8LstByts)
177{
178        BERR_Code  eResult = BERR_SUCCESS;
179
180        eResult = BDMA_P_Mem_Sharf_Tran_SetCrypto_isr( hTran,
181                eSharfMode, bSgEnable, bUseBspKey, bCmp8LstByts );
182               
183        return BERR_TRACE(eResult);
184}
185
186/***************************************************************************
187 *
188 */
189BERR_Code BDMA_Mem_Sharf_Tran_SetSgStartEnd_isr(
190        BDMA_Mem_Tran_Handle     hTran,
191        uint32_t                 ulBlockId,
192        bool                     bStartSgScram,
193        bool                     bEndSgScram,
194        bool                     bKeyPresent,
195        bool                     bDigestPresent )
196{
197        BERR_Code  eResult = BERR_SUCCESS;
198
199        eResult = BDMA_P_Mem_Sharf_Tran_SetSgStartEnd_isr( hTran, ulBlockId,
200                bStartSgScram, bEndSgScram, bKeyPresent, bDigestPresent );
201               
202        return BERR_TRACE(eResult);
203}
204
205/***************************************************************************
206 *
207 */
208BERR_Code BDMA_Mem_Sharf_Tran_SetDmaBlockInfo_isr(
209        BDMA_Mem_Tran_Handle     hTran,
210        uint32_t                 ulBlockId,
211        BDMA_Context             eContext,
212        uint32_t                 ulDstBusAddr,
213        uint32_t                 ulSrcBusAddr,
214        uint32_t                 ulBlockSize )
215{
216        BERR_Code  eResult = BERR_SUCCESS;
217
218        eResult = BDMA_P_Mem_Sharf_Tran_SetDmaBlockInfo_isr( hTran, ulBlockId,
219                eContext, ulDstBusAddr, ulSrcBusAddr, ulBlockSize );
220               
221        return BERR_TRACE(eResult);
222}
223
224
225/***************************************************************************
226 *
227 */
228BERR_Code BDMA_Mem_Sharf_Tran_Start(
229        BDMA_Mem_Tran_Handle     hTran )
230{
231        BERR_Code  eResult = BERR_SUCCESS;
232
233        BKNI_EnterCriticalSection();
234        eResult = BDMA_P_Mem_Sharf_Tran_Start_isr(
235                hTran, hTran->QueueEntry.ulNumTranBlocks, NULL, NULL );
236        BKNI_LeaveCriticalSection();
237               
238        return BERR_TRACE(eResult);
239}
240
241
242/* End of File */
Note: See TracBrowser for help on using the repository browser.