]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/pdk.git/blob - packages/ti/drv/dfe/src/dfefl/dfe_fl_cbClose.c
dfe-lld: add to PDK
[processor-sdk/pdk.git] / packages / ti / drv / dfe / src / dfefl / dfe_fl_cbClose.c
1 /********************************************************************
2 * Copyright (C) 2012-2013 Texas Instruments Incorporated.
3  * 
4  *  Redistribution and use in source and binary forms, with or without 
5  *  modification, are permitted provided that the following conditions 
6  *  are met:
7  *
8  *    Redistributions of source code must retain the above copyright 
9  *    notice, this list of conditions and the following disclaimer.
10  *
11  *    Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the 
13  *    documentation and/or other materials provided with the   
14  *    distribution.
15  *
16  *    Neither the name of Texas Instruments Incorporated nor the names of
17  *    its contributors may be used to endorse or promote products derived
18  *    from this software without specific prior written permission.
19  *
20  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
21  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
22  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
24  *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
25  *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
26  *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
29  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
30  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32 */
33 /** @file dfe_fl_cbClose.c
34  *
35  *  @path  $(CSLPATH)\src\ip\dfe
36  *
37  *  @brief File for functional layer of CSL API dfeFl_CbClose()
38  *
39  *
40  */
41 /* =============================================================================
42  * Revision History
43  * ===============
44  *
45  *
46  * =============================================================================
47  */
48 #include <ti/drv/dfe/dfe_fl_cb.h>
50 /** ============================================================================
51  *   @n@b dfeFl_CbClose
52  *
53  *   @b Description
54  *   @n Close the Dfe Cb handle.
55  *
56  *   @b Arguments
57  *   @verbatim
58          hDfeCb    Valid dfeFl_CbHandle
59      @endverbatim
60  *
61  *   <b> Return Value </b>  DfeFl_Status
62  *   @li                    DFE_FL_SOK             - Close successful
63  *   @li                    DFE_FL_BADHANDLE  - Close failure
64  *
65  *   <b> Pre Condition </b>
66  *   @n  Valid dfeFl_CbHandle handle
67  *
68  *   <b> Post Condition </b>
69  *   @n  None
70  *
71  *   @b Reads
72  *   @n  None
73  *
74  *   @b Writes
75  *   @n  None
76  *
77  *   @b Example
78  *   @verbatim
80          DfeFl_Context dfeCtx;
81          DfeFl_Param dfeParam;
82          DfeFl_Obj objDfe;
83          DfeFl_CbObj objDfeCb[DFE_FL_CB_PER_CNT];
84          DfeFl_Handle hDfe;
85          DfeFl_CbHandle hDfeCb[DFE_FL_CB_PER_CNT];
86          DfeFl_Status status = DFE_FL_SOK;
88          // open DFE
89          dfeFl_Init(&dfeCtx);
90          dfeParam.flags = 0;
91          hDfe = dfeFl_Open(&objDfe, 0, &dfeParam, &status);
92          if(status != DFE_FL_SOK)
93          {
94                  return FAIL;
95          }
97          for(i = 0; i < DFE_FL_CB_PER_CNT; i++)
98          {
99                          hDfeCb[i] = dfeFl_CbOpen(hDfe, &objDfeCb[i], i, &status);
100                          if(status != DFE_FL_SOK)
101                          {
102                                  return FAIL;
103                          }
104          }
106          // close handle
107          for(i = 0; i < DFE_FL_CB_PER_CNT; i++)
108          {
109                  status = dfeFl_CbClose(hDfeCb[i]);
110                  if(status != DFE_FL_SOK)
111                  {
112                          return FAIL;
113                  }
114          }
115          return PASS;
117      @endverbatim
118  * ===========================================================================
119  */
120 DfeFl_Status dfeFl_CbClose(DfeFl_CbHandle hDfeCb)
122     DfeFl_Status st;
124     if (hDfeCb != NULL)
125     {
126         hDfeCb->hDfe = NULL;
127         hDfeCb->regs = (DfeFl_CbRegsOvly)NULL;
128         hDfeCb->perNum = (DfeFl_InstNum)-1;
130         st = DFE_FL_SOK;
131     }
132     else 
133     {
134         st = DFE_FL_BADHANDLE;
135     }
137     return st;