xref: /freebsd/sys/contrib/ncsw/inc/Peripherals/bm_ext.h (revision 0aeed3e99367bed5755068d9218cd8041644ff2b)
1*0aeed3e9SJustin Hibbits /******************************************************************************
2*0aeed3e9SJustin Hibbits 
3*0aeed3e9SJustin Hibbits  � 1995-2003, 2004, 2005-2011 Freescale Semiconductor, Inc.
4*0aeed3e9SJustin Hibbits  All rights reserved.
5*0aeed3e9SJustin Hibbits 
6*0aeed3e9SJustin Hibbits  This is proprietary source code of Freescale Semiconductor Inc.,
7*0aeed3e9SJustin Hibbits  and its use is subject to the NetComm Device Drivers EULA.
8*0aeed3e9SJustin Hibbits  The copyright notice above does not evidence any actual or intended
9*0aeed3e9SJustin Hibbits  publication of such source code.
10*0aeed3e9SJustin Hibbits 
11*0aeed3e9SJustin Hibbits  ALTERNATIVELY, redistribution and use in source and binary forms, with
12*0aeed3e9SJustin Hibbits  or without modification, are permitted provided that the following
13*0aeed3e9SJustin Hibbits  conditions are met:
14*0aeed3e9SJustin Hibbits      * Redistributions of source code must retain the above copyright
15*0aeed3e9SJustin Hibbits        notice, this list of conditions and the following disclaimer.
16*0aeed3e9SJustin Hibbits      * Redistributions in binary form must reproduce the above copyright
17*0aeed3e9SJustin Hibbits        notice, this list of conditions and the following disclaimer in the
18*0aeed3e9SJustin Hibbits        documentation and/or other materials provided with the distribution.
19*0aeed3e9SJustin Hibbits      * Neither the name of Freescale Semiconductor nor the
20*0aeed3e9SJustin Hibbits        names of its contributors may be used to endorse or promote products
21*0aeed3e9SJustin Hibbits        derived from this software without specific prior written permission.
22*0aeed3e9SJustin Hibbits 
23*0aeed3e9SJustin Hibbits  THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
24*0aeed3e9SJustin Hibbits  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25*0aeed3e9SJustin Hibbits  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26*0aeed3e9SJustin Hibbits  DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27*0aeed3e9SJustin Hibbits  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28*0aeed3e9SJustin Hibbits  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29*0aeed3e9SJustin Hibbits  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30*0aeed3e9SJustin Hibbits  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31*0aeed3e9SJustin Hibbits  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32*0aeed3e9SJustin Hibbits  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33*0aeed3e9SJustin Hibbits  *
34*0aeed3e9SJustin Hibbits 
35*0aeed3e9SJustin Hibbits  **************************************************************************/
36*0aeed3e9SJustin Hibbits /******************************************************************************
37*0aeed3e9SJustin Hibbits  @File          bm_ext.h
38*0aeed3e9SJustin Hibbits 
39*0aeed3e9SJustin Hibbits  @Description   BM API
40*0aeed3e9SJustin Hibbits *//***************************************************************************/
41*0aeed3e9SJustin Hibbits #ifndef __BM_EXT_H
42*0aeed3e9SJustin Hibbits #define __BM_EXT_H
43*0aeed3e9SJustin Hibbits 
44*0aeed3e9SJustin Hibbits #include "error_ext.h"
45*0aeed3e9SJustin Hibbits #include "std_ext.h"
46*0aeed3e9SJustin Hibbits 
47*0aeed3e9SJustin Hibbits 
48*0aeed3e9SJustin Hibbits /**************************************************************************//**
49*0aeed3e9SJustin Hibbits  @Group         BM_grp Buffer Manager API
50*0aeed3e9SJustin Hibbits 
51*0aeed3e9SJustin Hibbits  @Description   BM API functions, definitions and enums.
52*0aeed3e9SJustin Hibbits 
53*0aeed3e9SJustin Hibbits  @{
54*0aeed3e9SJustin Hibbits *//***************************************************************************/
55*0aeed3e9SJustin Hibbits 
56*0aeed3e9SJustin Hibbits /**************************************************************************//**
57*0aeed3e9SJustin Hibbits  @Description   This callback type is used when handling pool depletion entry/exit.
58*0aeed3e9SJustin Hibbits 
59*0aeed3e9SJustin Hibbits                 User provides this function. Driver invokes it.
60*0aeed3e9SJustin Hibbits 
61*0aeed3e9SJustin Hibbits  @Param[in]     h_App       - User's application descriptor.
62*0aeed3e9SJustin Hibbits  @Param[in]     in          - TRUE when entered depletion state
63*0aeed3e9SJustin Hibbits                               FALSE when exit the depletion state.
64*0aeed3e9SJustin Hibbits  *//***************************************************************************/
65*0aeed3e9SJustin Hibbits typedef void (t_BmDepletionCallback)(t_Handle h_App, bool in);
66*0aeed3e9SJustin Hibbits 
67*0aeed3e9SJustin Hibbits /**************************************************************************//**
68*0aeed3e9SJustin Hibbits  @Group         BM_lib_grp BM common API
69*0aeed3e9SJustin Hibbits 
70*0aeed3e9SJustin Hibbits  @Description   BM common API functions, definitions and enums.
71*0aeed3e9SJustin Hibbits 
72*0aeed3e9SJustin Hibbits  @{
73*0aeed3e9SJustin Hibbits *//***************************************************************************/
74*0aeed3e9SJustin Hibbits 
75*0aeed3e9SJustin Hibbits /**************************************************************************//**
76*0aeed3e9SJustin Hibbits  @Description   BM Exceptions
77*0aeed3e9SJustin Hibbits *//***************************************************************************/
78*0aeed3e9SJustin Hibbits typedef enum e_BmExceptions {
79*0aeed3e9SJustin Hibbits     e_BM_EX_INVALID_COMMAND = 0 ,   /**< Invalid Command Verb Interrupt */
80*0aeed3e9SJustin Hibbits     e_BM_EX_FBPR_THRESHOLD,         /**< FBPR Low Watermark Interrupt. */
81*0aeed3e9SJustin Hibbits     e_BM_EX_SINGLE_ECC,             /**< Single Bit ECC Error Interrupt. */
82*0aeed3e9SJustin Hibbits     e_BM_EX_MULTI_ECC               /**< Multi Bit ECC Error Interrupt */
83*0aeed3e9SJustin Hibbits } e_BmExceptions;
84*0aeed3e9SJustin Hibbits 
85*0aeed3e9SJustin Hibbits 
86*0aeed3e9SJustin Hibbits /**************************************************************************//**
87*0aeed3e9SJustin Hibbits  @Group         BM_init_grp BM (common) Initialization Unit
88*0aeed3e9SJustin Hibbits 
89*0aeed3e9SJustin Hibbits  @Description   BM (common) Initialization Unit
90*0aeed3e9SJustin Hibbits 
91*0aeed3e9SJustin Hibbits  @{
92*0aeed3e9SJustin Hibbits *//***************************************************************************/
93*0aeed3e9SJustin Hibbits 
94*0aeed3e9SJustin Hibbits /**************************************************************************//**
95*0aeed3e9SJustin Hibbits  @Function      t_BmExceptionsCallback
96*0aeed3e9SJustin Hibbits 
97*0aeed3e9SJustin Hibbits  @Description   Exceptions user callback routine, will be called upon an
98*0aeed3e9SJustin Hibbits                 exception passing the exception identification.
99*0aeed3e9SJustin Hibbits 
100*0aeed3e9SJustin Hibbits  @Param[in]     h_App      - User's application descriptor.
101*0aeed3e9SJustin Hibbits  @Param[in]     exception  - The exception.
102*0aeed3e9SJustin Hibbits *//***************************************************************************/
103*0aeed3e9SJustin Hibbits typedef void (t_BmExceptionsCallback) (t_Handle              h_App,
104*0aeed3e9SJustin Hibbits                                        e_BmExceptions        exception);
105*0aeed3e9SJustin Hibbits 
106*0aeed3e9SJustin Hibbits /**************************************************************************//**
107*0aeed3e9SJustin Hibbits  @Description   structure representing BM initialization parameters
108*0aeed3e9SJustin Hibbits *//***************************************************************************/
109*0aeed3e9SJustin Hibbits typedef struct {
110*0aeed3e9SJustin Hibbits     uint8_t                 guestId;                /**< BM Partition Id */
111*0aeed3e9SJustin Hibbits 
112*0aeed3e9SJustin Hibbits     uintptr_t               baseAddress;            /**< Bm base address (virtual).
113*0aeed3e9SJustin Hibbits                                                          NOTE: this parameter relevant only for BM in master mode ('guestId'=NCSW_MASTER_ID). */
114*0aeed3e9SJustin Hibbits     uint16_t                liodn;                  /**< This value is attached to every transaction initiated by
115*0aeed3e9SJustin Hibbits                                                          BMan when accessing its private data structures
116*0aeed3e9SJustin Hibbits                                                          NOTE: this parameter relevant only for BM in master mode ('guestId'=NCSW_MASTER_ID). */
117*0aeed3e9SJustin Hibbits     uint32_t                totalNumOfBuffers;      /**< Total number of buffers
118*0aeed3e9SJustin Hibbits                                                          NOTE: this parameter relevant only for BM in master mode ('guestId'=NCSW_MASTER_ID). */
119*0aeed3e9SJustin Hibbits     uint32_t                fbprMemPartitionId;     /**< FBPR's mem partition id;
120*0aeed3e9SJustin Hibbits                                                          NOTE: The memory partition must be non-cacheable and no-coherent area.
121*0aeed3e9SJustin Hibbits                                                          NOTE: this parameter relevant only for BM in master mode ('guestId'=NCSW_MASTER_ID). */
122*0aeed3e9SJustin Hibbits     t_BmExceptionsCallback  *f_Exception;           /**< An application callback routine to handle exceptions.
123*0aeed3e9SJustin Hibbits                                                          NOTE: this parameter relevant only for BM in master mode ('guestId'=NCSW_MASTER_ID). */
124*0aeed3e9SJustin Hibbits     t_Handle                h_App;                  /**< A handle to an application layer object; This handle will
125*0aeed3e9SJustin Hibbits                                                          be passed by the driver upon calling the above callbacks.
126*0aeed3e9SJustin Hibbits                                                          NOTE: this parameter relevant only for BM in master mode ('guestId'=NCSW_MASTER_ID). */
127*0aeed3e9SJustin Hibbits     int                     errIrq;                 /**< BM error interrupt line; NO_IRQ if interrupts not used.
128*0aeed3e9SJustin Hibbits                                                          NOTE: this parameter relevant only for BM in master mode ('guestId'=NCSW_MASTER_ID). */
129*0aeed3e9SJustin Hibbits 
130*0aeed3e9SJustin Hibbits     uint8_t                 partBpidBase;           /**< The first buffer-pool-id dedicated to this partition.
131*0aeed3e9SJustin Hibbits                                                          NOTE: this parameter relevant only when working with multiple partitions. */
132*0aeed3e9SJustin Hibbits     uint8_t                 partNumOfPools;         /**< Number of Pools dedicated to this partition.
133*0aeed3e9SJustin Hibbits                                                          NOTE: this parameter relevant only when working with multiple partitions. */
134*0aeed3e9SJustin Hibbits } t_BmParam;
135*0aeed3e9SJustin Hibbits 
136*0aeed3e9SJustin Hibbits 
137*0aeed3e9SJustin Hibbits /**************************************************************************//**
138*0aeed3e9SJustin Hibbits  @Function      BM_Config
139*0aeed3e9SJustin Hibbits 
140*0aeed3e9SJustin Hibbits  @Description   Creates descriptor for the BM module and initializes the BM module.
141*0aeed3e9SJustin Hibbits 
142*0aeed3e9SJustin Hibbits                 The routine returns a handle (descriptor) to the BM object.
143*0aeed3e9SJustin Hibbits                 This descriptor must be passed as first parameter to all other
144*0aeed3e9SJustin Hibbits                 BM function calls.
145*0aeed3e9SJustin Hibbits 
146*0aeed3e9SJustin Hibbits  @Param[in]     p_BmParam   - A pointer to data structure of parameters
147*0aeed3e9SJustin Hibbits 
148*0aeed3e9SJustin Hibbits  @Return        Handle to BM object, or NULL for Failure.
149*0aeed3e9SJustin Hibbits *//***************************************************************************/
150*0aeed3e9SJustin Hibbits t_Handle    BM_Config(t_BmParam *p_BmParam);
151*0aeed3e9SJustin Hibbits 
152*0aeed3e9SJustin Hibbits /**************************************************************************//**
153*0aeed3e9SJustin Hibbits  @Function      BM_Init
154*0aeed3e9SJustin Hibbits 
155*0aeed3e9SJustin Hibbits  @Description   Initializes the BM module
156*0aeed3e9SJustin Hibbits 
157*0aeed3e9SJustin Hibbits  @Param[in]     h_Bm            - A handle to the BM module
158*0aeed3e9SJustin Hibbits 
159*0aeed3e9SJustin Hibbits  @Return        E_OK on success; Error code otherwise.
160*0aeed3e9SJustin Hibbits 
161*0aeed3e9SJustin Hibbits  @Cautions      Allowed only following BM_Config().
162*0aeed3e9SJustin Hibbits *//***************************************************************************/
163*0aeed3e9SJustin Hibbits t_Error    BM_Init(t_Handle h_Bm);
164*0aeed3e9SJustin Hibbits 
165*0aeed3e9SJustin Hibbits /**************************************************************************//**
166*0aeed3e9SJustin Hibbits  @Function      BM_Free
167*0aeed3e9SJustin Hibbits 
168*0aeed3e9SJustin Hibbits  @Description   Frees all resources that were assigned to BM module.
169*0aeed3e9SJustin Hibbits 
170*0aeed3e9SJustin Hibbits                 Calling this routine invalidates the descriptor.
171*0aeed3e9SJustin Hibbits 
172*0aeed3e9SJustin Hibbits  @Param[in]     h_Bm            - A handle to the BM module
173*0aeed3e9SJustin Hibbits 
174*0aeed3e9SJustin Hibbits  @Return        E_OK on success; Error code otherwise.
175*0aeed3e9SJustin Hibbits *//***************************************************************************/
176*0aeed3e9SJustin Hibbits t_Error     BM_Free(t_Handle h_Bm);
177*0aeed3e9SJustin Hibbits 
178*0aeed3e9SJustin Hibbits /**************************************************************************//**
179*0aeed3e9SJustin Hibbits  @Group         BM_advanced_init_grp    BM (common) Advanced Configuration Unit
180*0aeed3e9SJustin Hibbits 
181*0aeed3e9SJustin Hibbits  @Description   Configuration functions used to change default values.
182*0aeed3e9SJustin Hibbits 
183*0aeed3e9SJustin Hibbits  @{
184*0aeed3e9SJustin Hibbits *//***************************************************************************/
185*0aeed3e9SJustin Hibbits 
186*0aeed3e9SJustin Hibbits /**************************************************************************//**
187*0aeed3e9SJustin Hibbits  @Function      BM_ConfigFbprThreshold
188*0aeed3e9SJustin Hibbits 
189*0aeed3e9SJustin Hibbits  @Description   Change the fbpr threshold from its default
190*0aeed3e9SJustin Hibbits                 configuration [0].
191*0aeed3e9SJustin Hibbits                 An interrupt if enables is asserted when the number of FBPRs is below this threshold.
192*0aeed3e9SJustin Hibbits                 NOTE: this parameter relevant only for BM in master mode ('guestId'=NCSW_MASTER_ID).
193*0aeed3e9SJustin Hibbits 
194*0aeed3e9SJustin Hibbits  @Param[in]     h_Bm            - A handle to the BM module
195*0aeed3e9SJustin Hibbits  @Param[in]     threshold       - threshold value.
196*0aeed3e9SJustin Hibbits 
197*0aeed3e9SJustin Hibbits  @Return        E_OK on success; Error code otherwise.
198*0aeed3e9SJustin Hibbits 
199*0aeed3e9SJustin Hibbits  @Cautions      Allowed only following BM_Config() and before BM_Init().
200*0aeed3e9SJustin Hibbits *//***************************************************************************/
201*0aeed3e9SJustin Hibbits t_Error     BM_ConfigFbprThreshold(t_Handle h_Bm, uint32_t threshold);
202*0aeed3e9SJustin Hibbits 
203*0aeed3e9SJustin Hibbits /** @} */ /* end of BM_advanced_init_grp group */
204*0aeed3e9SJustin Hibbits /** @} */ /* end of BM_init_grp group */
205*0aeed3e9SJustin Hibbits 
206*0aeed3e9SJustin Hibbits /**************************************************************************//**
207*0aeed3e9SJustin Hibbits  @Group         BM_runtime_control_grp BM (common) Runtime Control Unit
208*0aeed3e9SJustin Hibbits 
209*0aeed3e9SJustin Hibbits  @Description   BM (common) Runtime control unit API functions, definitions and enums.
210*0aeed3e9SJustin Hibbits 
211*0aeed3e9SJustin Hibbits  @{
212*0aeed3e9SJustin Hibbits *//***************************************************************************/
213*0aeed3e9SJustin Hibbits 
214*0aeed3e9SJustin Hibbits /**************************************************************************//**
215*0aeed3e9SJustin Hibbits  @Description   enum for defining BM counters
216*0aeed3e9SJustin Hibbits *//***************************************************************************/
217*0aeed3e9SJustin Hibbits typedef enum e_BmCounters {
218*0aeed3e9SJustin Hibbits     e_BM_COUNTERS_FBPR = 0              /**< Total Free Buffer Proxy Record (FBPR) Free Pool Count in external memory */
219*0aeed3e9SJustin Hibbits } e_BmCounters;
220*0aeed3e9SJustin Hibbits 
221*0aeed3e9SJustin Hibbits /**************************************************************************//**
222*0aeed3e9SJustin Hibbits  @Description   structure for returning revision information
223*0aeed3e9SJustin Hibbits *//***************************************************************************/
224*0aeed3e9SJustin Hibbits typedef struct t_BmRevisionInfo {
225*0aeed3e9SJustin Hibbits     uint8_t         majorRev;               /**< Major revision */
226*0aeed3e9SJustin Hibbits     uint8_t         minorRev;               /**< Minor revision */
227*0aeed3e9SJustin Hibbits } t_BmRevisionInfo;
228*0aeed3e9SJustin Hibbits 
229*0aeed3e9SJustin Hibbits #if (defined(DEBUG_ERRORS) && (DEBUG_ERRORS > 0))
230*0aeed3e9SJustin Hibbits /**************************************************************************//**
231*0aeed3e9SJustin Hibbits  @Function      BM_DumpRegs
232*0aeed3e9SJustin Hibbits 
233*0aeed3e9SJustin Hibbits  @Description   Dumps all BM registers
234*0aeed3e9SJustin Hibbits                 NOTE: this parameter relevant only for BM in master mode ('guestId'=NCSW_MASTER_ID).
235*0aeed3e9SJustin Hibbits 
236*0aeed3e9SJustin Hibbits  @Param[in]     h_Bm      A handle to an BM Module.
237*0aeed3e9SJustin Hibbits 
238*0aeed3e9SJustin Hibbits  @Return        E_OK on success;
239*0aeed3e9SJustin Hibbits 
240*0aeed3e9SJustin Hibbits  @Cautions      Allowed only after BM_Init().
241*0aeed3e9SJustin Hibbits *//***************************************************************************/
242*0aeed3e9SJustin Hibbits t_Error BM_DumpRegs(t_Handle h_Bm);
243*0aeed3e9SJustin Hibbits #endif /* (defined(DEBUG_ERRORS) && ... */
244*0aeed3e9SJustin Hibbits 
245*0aeed3e9SJustin Hibbits /**************************************************************************//**
246*0aeed3e9SJustin Hibbits  @Function      BM_SetException
247*0aeed3e9SJustin Hibbits 
248*0aeed3e9SJustin Hibbits  @Description   Calling this routine enables/disables the specified exception.
249*0aeed3e9SJustin Hibbits                 NOTE: this parameter relevant only for BM in master mode ('guestId'=NCSW_MASTER_ID).
250*0aeed3e9SJustin Hibbits 
251*0aeed3e9SJustin Hibbits  @Param[in]     h_Bm        - A handle to the BM Module.
252*0aeed3e9SJustin Hibbits  @Param[in]     exception   - The exception to be selected.
253*0aeed3e9SJustin Hibbits  @Param[in]     enable      - TRUE to enable interrupt, FALSE to mask it.
254*0aeed3e9SJustin Hibbits 
255*0aeed3e9SJustin Hibbits  @Cautions      Allowed only following BM_Init().
256*0aeed3e9SJustin Hibbits *//***************************************************************************/
257*0aeed3e9SJustin Hibbits t_Error     BM_SetException(t_Handle h_Bm, e_BmExceptions exception, bool enable);
258*0aeed3e9SJustin Hibbits 
259*0aeed3e9SJustin Hibbits /**************************************************************************//**
260*0aeed3e9SJustin Hibbits  @Function      BM_ErrorIsr
261*0aeed3e9SJustin Hibbits 
262*0aeed3e9SJustin Hibbits  @Description   BM interrupt-service-routine for errors.
263*0aeed3e9SJustin Hibbits                 NOTE: this parameter relevant only for BM in master mode ('guestId'=NCSW_MASTER_ID).
264*0aeed3e9SJustin Hibbits 
265*0aeed3e9SJustin Hibbits  @Param[in]     h_Bm        - A handle to the BM Module.
266*0aeed3e9SJustin Hibbits 
267*0aeed3e9SJustin Hibbits  @Cautions      Allowed only following BM_Init().
268*0aeed3e9SJustin Hibbits *//***************************************************************************/
269*0aeed3e9SJustin Hibbits void        BM_ErrorIsr(t_Handle h_Bm);
270*0aeed3e9SJustin Hibbits 
271*0aeed3e9SJustin Hibbits /**************************************************************************//**
272*0aeed3e9SJustin Hibbits  @Function      BM_GetCounter
273*0aeed3e9SJustin Hibbits 
274*0aeed3e9SJustin Hibbits  @Description   Reads one of the BM counters.
275*0aeed3e9SJustin Hibbits 
276*0aeed3e9SJustin Hibbits  @Param[in]     h_Bm        - A handle to the BM Module.
277*0aeed3e9SJustin Hibbits  @Param[in]     counter     - The requested counter.
278*0aeed3e9SJustin Hibbits 
279*0aeed3e9SJustin Hibbits  @Return        Counter's current value.
280*0aeed3e9SJustin Hibbits *//***************************************************************************/
281*0aeed3e9SJustin Hibbits uint32_t    BM_GetCounter(t_Handle h_Bm, e_BmCounters counter);
282*0aeed3e9SJustin Hibbits 
283*0aeed3e9SJustin Hibbits /**************************************************************************//**
284*0aeed3e9SJustin Hibbits  @Function      BM_GetRevision
285*0aeed3e9SJustin Hibbits 
286*0aeed3e9SJustin Hibbits  @Description   Returns the BM revision
287*0aeed3e9SJustin Hibbits 
288*0aeed3e9SJustin Hibbits  @Param[in]     h_Bm                A handle to a BM Module.
289*0aeed3e9SJustin Hibbits  @Param[out]    p_BmRevisionInfo    A structure of revision information parameters.
290*0aeed3e9SJustin Hibbits 
291*0aeed3e9SJustin Hibbits  @Return        E_OK on success; Error code otherwise.
292*0aeed3e9SJustin Hibbits 
293*0aeed3e9SJustin Hibbits  @Cautions      Allowed only following QM_Init().
294*0aeed3e9SJustin Hibbits *//***************************************************************************/
295*0aeed3e9SJustin Hibbits t_Error  BM_GetRevision(t_Handle h_Bm, t_BmRevisionInfo *p_BmRevisionInfo);
296*0aeed3e9SJustin Hibbits 
297*0aeed3e9SJustin Hibbits /** @} */ /* end of BM_runtime_control_grp group */
298*0aeed3e9SJustin Hibbits /** @} */ /* end of BM_lib_grp group */
299*0aeed3e9SJustin Hibbits 
300*0aeed3e9SJustin Hibbits 
301*0aeed3e9SJustin Hibbits /**************************************************************************//**
302*0aeed3e9SJustin Hibbits  @Group         BM_portal_grp BM-Portal API
303*0aeed3e9SJustin Hibbits 
304*0aeed3e9SJustin Hibbits  @Description   BM-Portal API functions, definitions and enums.
305*0aeed3e9SJustin Hibbits 
306*0aeed3e9SJustin Hibbits  @{
307*0aeed3e9SJustin Hibbits *//***************************************************************************/
308*0aeed3e9SJustin Hibbits 
309*0aeed3e9SJustin Hibbits /**************************************************************************//**
310*0aeed3e9SJustin Hibbits  @Group         BM_portal_init_grp BM-Portal Initialization Unit
311*0aeed3e9SJustin Hibbits 
312*0aeed3e9SJustin Hibbits  @Description   BM-Portal Initialization Unit
313*0aeed3e9SJustin Hibbits 
314*0aeed3e9SJustin Hibbits  @{
315*0aeed3e9SJustin Hibbits *//***************************************************************************/
316*0aeed3e9SJustin Hibbits 
317*0aeed3e9SJustin Hibbits /**************************************************************************//**
318*0aeed3e9SJustin Hibbits  @Description   structure representing BM Portal initialization parameters
319*0aeed3e9SJustin Hibbits *//***************************************************************************/
320*0aeed3e9SJustin Hibbits typedef struct {
321*0aeed3e9SJustin Hibbits     uintptr_t       ceBaseAddress;          /**< Cache-enabled base address (virtual) */
322*0aeed3e9SJustin Hibbits     uintptr_t       ciBaseAddress;          /**< Cache-inhibited base address (virtual) */
323*0aeed3e9SJustin Hibbits     t_Handle        h_Bm;                   /**< Bm Handle */
324*0aeed3e9SJustin Hibbits     e_DpaaSwPortal  swPortalId;             /**< Portal id */
325*0aeed3e9SJustin Hibbits     int             irq;                    /**< portal interrupt line; NO_IRQ if interrupts not used */
326*0aeed3e9SJustin Hibbits } t_BmPortalParam;
327*0aeed3e9SJustin Hibbits 
328*0aeed3e9SJustin Hibbits 
329*0aeed3e9SJustin Hibbits /**************************************************************************//**
330*0aeed3e9SJustin Hibbits  @Function      BM_PORTAL_Config
331*0aeed3e9SJustin Hibbits 
332*0aeed3e9SJustin Hibbits  @Description   Creates descriptor for the BM Portal;
333*0aeed3e9SJustin Hibbits 
334*0aeed3e9SJustin Hibbits                 The routine returns a handle (descriptor) to a BM-Portal object;
335*0aeed3e9SJustin Hibbits                 This descriptor must be passed as first parameter to all other
336*0aeed3e9SJustin Hibbits                 BM-Portal function calls.
337*0aeed3e9SJustin Hibbits 
338*0aeed3e9SJustin Hibbits                 No actual initialization or configuration of QM-Portal hardware is
339*0aeed3e9SJustin Hibbits                 done by this routine.
340*0aeed3e9SJustin Hibbits 
341*0aeed3e9SJustin Hibbits  @Param[in]     p_BmPortalParam   - Pointer to data structure of parameters
342*0aeed3e9SJustin Hibbits 
343*0aeed3e9SJustin Hibbits  @Retval        Handle to a BM-Portal object, or NULL for Failure.
344*0aeed3e9SJustin Hibbits *//***************************************************************************/
345*0aeed3e9SJustin Hibbits t_Handle BM_PORTAL_Config(t_BmPortalParam *p_BmPortalParam);
346*0aeed3e9SJustin Hibbits 
347*0aeed3e9SJustin Hibbits /**************************************************************************//**
348*0aeed3e9SJustin Hibbits  @Function      BM_PORTAL_Init
349*0aeed3e9SJustin Hibbits 
350*0aeed3e9SJustin Hibbits  @Description   Initializes a BM-Portal module
351*0aeed3e9SJustin Hibbits 
352*0aeed3e9SJustin Hibbits  @Param[in]     h_BmPortal - A handle to a BM-Portal module
353*0aeed3e9SJustin Hibbits 
354*0aeed3e9SJustin Hibbits  @Return        E_OK on success; Error code otherwise.
355*0aeed3e9SJustin Hibbits *//***************************************************************************/
356*0aeed3e9SJustin Hibbits t_Error  BM_PORTAL_Init(t_Handle h_BmPortal);
357*0aeed3e9SJustin Hibbits 
358*0aeed3e9SJustin Hibbits /**************************************************************************//**
359*0aeed3e9SJustin Hibbits  @Function      BM_PortalFree
360*0aeed3e9SJustin Hibbits 
361*0aeed3e9SJustin Hibbits  @Description   Frees all resources that were assigned to BM Portal module.
362*0aeed3e9SJustin Hibbits 
363*0aeed3e9SJustin Hibbits                 Calling this routine invalidates the descriptor.
364*0aeed3e9SJustin Hibbits 
365*0aeed3e9SJustin Hibbits  @Param[in]     h_BmPortal  - BM Portal module descriptor
366*0aeed3e9SJustin Hibbits 
367*0aeed3e9SJustin Hibbits  @Return        E_OK on success; Error code otherwise.
368*0aeed3e9SJustin Hibbits *//***************************************************************************/
369*0aeed3e9SJustin Hibbits t_Error     BM_PORTAL_Free(t_Handle h_BmPortal);
370*0aeed3e9SJustin Hibbits 
371*0aeed3e9SJustin Hibbits /**************************************************************************//**
372*0aeed3e9SJustin Hibbits  @Function      BM_PORTAL_ConfigMemAttr
373*0aeed3e9SJustin Hibbits 
374*0aeed3e9SJustin Hibbits  @Description   Change the memory attributes
375*0aeed3e9SJustin Hibbits                 from its default configuration [MEMORY_ATTR_CACHEABLE].
376*0aeed3e9SJustin Hibbits 
377*0aeed3e9SJustin Hibbits  @Param[in]     h_BmPortal          - A handle to a BM-Portal module
378*0aeed3e9SJustin Hibbits  @Param[in]     hwExtStructsMemAttr - memory attributes (cache/non-cache, etc.)
379*0aeed3e9SJustin Hibbits 
380*0aeed3e9SJustin Hibbits  @Return        E_OK on success; Error code otherwise.
381*0aeed3e9SJustin Hibbits 
382*0aeed3e9SJustin Hibbits  @Cautions      Allowed only following BM_PORTAL_Config() and before BM_PORTAL_Init().
383*0aeed3e9SJustin Hibbits *//***************************************************************************/
384*0aeed3e9SJustin Hibbits t_Error  BM_PORTAL_ConfigMemAttr(t_Handle h_BmPortal, uint32_t hwExtStructsMemAttr);
385*0aeed3e9SJustin Hibbits 
386*0aeed3e9SJustin Hibbits /** @} */ /* end of BM_portal_init_grp group */
387*0aeed3e9SJustin Hibbits /** @} */ /* end of BM_portal_grp group */
388*0aeed3e9SJustin Hibbits 
389*0aeed3e9SJustin Hibbits 
390*0aeed3e9SJustin Hibbits /**************************************************************************//**
391*0aeed3e9SJustin Hibbits  @Group         BM_pool_grp BM-Pool API
392*0aeed3e9SJustin Hibbits 
393*0aeed3e9SJustin Hibbits  @Description   BM-Pool API functions, definitions and enums.
394*0aeed3e9SJustin Hibbits 
395*0aeed3e9SJustin Hibbits  @{
396*0aeed3e9SJustin Hibbits *//***************************************************************************/
397*0aeed3e9SJustin Hibbits 
398*0aeed3e9SJustin Hibbits /**************************************************************************//**
399*0aeed3e9SJustin Hibbits  @Group         BM_pool_init_grp BM-Pool Initialization Unit
400*0aeed3e9SJustin Hibbits 
401*0aeed3e9SJustin Hibbits  @Description   BM-Pool Initialization Unit
402*0aeed3e9SJustin Hibbits 
403*0aeed3e9SJustin Hibbits  @{
404*0aeed3e9SJustin Hibbits *//***************************************************************************/
405*0aeed3e9SJustin Hibbits 
406*0aeed3e9SJustin Hibbits /**************************************************************************//**
407*0aeed3e9SJustin Hibbits  @Collection    BM Pool Depletion Thresholds macros
408*0aeed3e9SJustin Hibbits                 The thresholds are represent by an array of size MAX_DEPLETION_THRESHOLDS
409*0aeed3e9SJustin Hibbits                 Use the following macros to access the appropriate location in the array.
410*0aeed3e9SJustin Hibbits *//***************************************************************************/
411*0aeed3e9SJustin Hibbits #define BM_POOL_DEP_THRESH_SW_ENTRY 0
412*0aeed3e9SJustin Hibbits #define BM_POOL_DEP_THRESH_SW_EXIT  1
413*0aeed3e9SJustin Hibbits #define BM_POOL_DEP_THRESH_HW_ENTRY 2
414*0aeed3e9SJustin Hibbits #define BM_POOL_DEP_THRESH_HW_EXIT  3
415*0aeed3e9SJustin Hibbits 
416*0aeed3e9SJustin Hibbits #define MAX_DEPLETION_THRESHOLDS    4
417*0aeed3e9SJustin Hibbits /* @} */
418*0aeed3e9SJustin Hibbits 
419*0aeed3e9SJustin Hibbits 
420*0aeed3e9SJustin Hibbits /**************************************************************************//**
421*0aeed3e9SJustin Hibbits  @Description   structure representing BM Pool initialization parameters
422*0aeed3e9SJustin Hibbits *//***************************************************************************/
423*0aeed3e9SJustin Hibbits typedef struct {
424*0aeed3e9SJustin Hibbits     t_Handle                    h_Bm;               /**< A handle to a BM Module. */
425*0aeed3e9SJustin Hibbits     t_Handle                    h_BmPortal;         /**< A handle to a BM Portal Module.
426*0aeed3e9SJustin Hibbits                                                          will be used only for Init and Free routines.
427*0aeed3e9SJustin Hibbits                                                          NOTE: if NULL, assuming affinity */
428*0aeed3e9SJustin Hibbits     uint32_t                    numOfBuffers;       /**< Number of buffers use by this pool
429*0aeed3e9SJustin Hibbits                                                          NOTE: If zero, empty pool buffer is created. */
430*0aeed3e9SJustin Hibbits     t_BufferPoolInfo            bufferPoolInfo;     /**< Data buffers pool information */
431*0aeed3e9SJustin Hibbits     t_Handle                    h_App;              /**< opaque user value passed as a parameter to callbacks */
432*0aeed3e9SJustin Hibbits     bool                        shadowMode;         /**< If TRUE, numOfBuffers will be set to '0'. */
433*0aeed3e9SJustin Hibbits     uint8_t                     bpid;               /**< index of the shadow buffer pool (0-BM_MAX_NUM_OF_POOLS).
434*0aeed3e9SJustin Hibbits                                                          valid only if shadowMode='TRUE'. */
435*0aeed3e9SJustin Hibbits } t_BmPoolParam;
436*0aeed3e9SJustin Hibbits 
437*0aeed3e9SJustin Hibbits 
438*0aeed3e9SJustin Hibbits /**************************************************************************//**
439*0aeed3e9SJustin Hibbits  @Function      BM_POOL_Config
440*0aeed3e9SJustin Hibbits 
441*0aeed3e9SJustin Hibbits  @Description   Creates descriptor for the BM Pool;
442*0aeed3e9SJustin Hibbits 
443*0aeed3e9SJustin Hibbits                 The routine returns a handle (descriptor) to the BM Pool object.
444*0aeed3e9SJustin Hibbits 
445*0aeed3e9SJustin Hibbits  @Param[in]     p_BmPoolParam   - A pointer to data structure of parameters
446*0aeed3e9SJustin Hibbits 
447*0aeed3e9SJustin Hibbits  @Return        Handle to BM Portal object, or NULL for Failure.
448*0aeed3e9SJustin Hibbits *//***************************************************************************/
449*0aeed3e9SJustin Hibbits t_Handle    BM_POOL_Config(t_BmPoolParam *p_BmPoolParam);
450*0aeed3e9SJustin Hibbits 
451*0aeed3e9SJustin Hibbits /**************************************************************************//**
452*0aeed3e9SJustin Hibbits  @Function      BM_POOL_Init
453*0aeed3e9SJustin Hibbits 
454*0aeed3e9SJustin Hibbits  @Description   Initializes a BM-Pool module
455*0aeed3e9SJustin Hibbits 
456*0aeed3e9SJustin Hibbits  @Param[in]     h_BmPool - A handle to a BM-Pool module
457*0aeed3e9SJustin Hibbits 
458*0aeed3e9SJustin Hibbits  @Return        E_OK on success; Error code otherwise.
459*0aeed3e9SJustin Hibbits *//***************************************************************************/
460*0aeed3e9SJustin Hibbits t_Error     BM_POOL_Init(t_Handle h_BmPool);
461*0aeed3e9SJustin Hibbits 
462*0aeed3e9SJustin Hibbits /**************************************************************************//**
463*0aeed3e9SJustin Hibbits  @Function      BM_PoolFree
464*0aeed3e9SJustin Hibbits 
465*0aeed3e9SJustin Hibbits  @Description   Frees all resources that were assigned to BM Pool module.
466*0aeed3e9SJustin Hibbits 
467*0aeed3e9SJustin Hibbits                 Calling this routine invalidates the descriptor.
468*0aeed3e9SJustin Hibbits 
469*0aeed3e9SJustin Hibbits  @Param[in]     h_BmPool    - BM Pool module descriptor
470*0aeed3e9SJustin Hibbits 
471*0aeed3e9SJustin Hibbits  @Return        E_OK on success; Error code otherwise.
472*0aeed3e9SJustin Hibbits *//***************************************************************************/
473*0aeed3e9SJustin Hibbits t_Error     BM_POOL_Free(t_Handle h_BmPool);
474*0aeed3e9SJustin Hibbits 
475*0aeed3e9SJustin Hibbits /**************************************************************************//**
476*0aeed3e9SJustin Hibbits  @Function      BM_POOL_ConfigBpid
477*0aeed3e9SJustin Hibbits 
478*0aeed3e9SJustin Hibbits  @Description   Config a specific pool id rather than dynamic pool id.
479*0aeed3e9SJustin Hibbits 
480*0aeed3e9SJustin Hibbits  @Param[in]     h_BmPool    - A handle to a BM-Pool module
481*0aeed3e9SJustin Hibbits  @Param[in]     bpid        - index of the buffer pool (0-BM_MAX_NUM_OF_POOLS).
482*0aeed3e9SJustin Hibbits 
483*0aeed3e9SJustin Hibbits  @Return        E_OK on success; Error code otherwise.
484*0aeed3e9SJustin Hibbits 
485*0aeed3e9SJustin Hibbits  @Cautions      Allowed only following BM_POOL_Config() and before BM_POOL_Init().
486*0aeed3e9SJustin Hibbits *//***************************************************************************/
487*0aeed3e9SJustin Hibbits t_Error  BM_POOL_ConfigBpid(t_Handle h_BmPool, uint8_t bpid);
488*0aeed3e9SJustin Hibbits 
489*0aeed3e9SJustin Hibbits /**************************************************************************//**
490*0aeed3e9SJustin Hibbits  @Function      BM_POOL_ConfigDepletion
491*0aeed3e9SJustin Hibbits 
492*0aeed3e9SJustin Hibbits  @Description   Config depletion-entry/exit thresholds and callback.
493*0aeed3e9SJustin Hibbits 
494*0aeed3e9SJustin Hibbits  @Param[in]     h_BmPool        - A handle to a BM-Pool module
495*0aeed3e9SJustin Hibbits  @Param[in]     f_Depletion     - depletion-entry/exit callback.
496*0aeed3e9SJustin Hibbits  @Param[in]     thresholds      - depletion-entry/exit thresholds.
497*0aeed3e9SJustin Hibbits 
498*0aeed3e9SJustin Hibbits  @Return        E_OK on success; Error code otherwise.
499*0aeed3e9SJustin Hibbits 
500*0aeed3e9SJustin Hibbits  @Cautions      Allowed only following BM_POOL_Config() and before BM_POOL_Init();
501*0aeed3e9SJustin Hibbits                 Allowed only if shadowMode='FALSE'.
502*0aeed3e9SJustin Hibbits                 Allowed only if BM in master mode ('guestId'=NCSW_MASTER_ID), or
503*0aeed3e9SJustin Hibbits                 the BM is in guest mode BUT than this routine will invoke IPC
504*0aeed3e9SJustin Hibbits                 call to the master.
505*0aeed3e9SJustin Hibbits *//***************************************************************************/
506*0aeed3e9SJustin Hibbits t_Error  BM_POOL_ConfigDepletion(t_Handle               h_BmPool,
507*0aeed3e9SJustin Hibbits                                  t_BmDepletionCallback  *f_Depletion,
508*0aeed3e9SJustin Hibbits                                  uint32_t               thresholds[MAX_DEPLETION_THRESHOLDS]);
509*0aeed3e9SJustin Hibbits 
510*0aeed3e9SJustin Hibbits /**************************************************************************//**
511*0aeed3e9SJustin Hibbits  @Function      BM_POOL_ConfigStockpile
512*0aeed3e9SJustin Hibbits 
513*0aeed3e9SJustin Hibbits  @Description   Config software stockpile.
514*0aeed3e9SJustin Hibbits 
515*0aeed3e9SJustin Hibbits  @Param[in]     h_BmPool     - A handle to a BM-Pool module
516*0aeed3e9SJustin Hibbits  @Param[in]     maxBuffers   - the software data structure size saved for stockpile;
517*0aeed3e9SJustin Hibbits                                when reached this value, release to hw command performed.
518*0aeed3e9SJustin Hibbits  @Param[in]     minBuffers   - if current capacity is equal or lower then this value,
519*0aeed3e9SJustin Hibbits                                acquire from hw command performed.
520*0aeed3e9SJustin Hibbits 
521*0aeed3e9SJustin Hibbits  @Return        E_OK on success; Error code otherwise.
522*0aeed3e9SJustin Hibbits 
523*0aeed3e9SJustin Hibbits  @Cautions      Allowed only following BM_POOL_Config() and before BM_POOL_Init().
524*0aeed3e9SJustin Hibbits *//***************************************************************************/
525*0aeed3e9SJustin Hibbits t_Error  BM_POOL_ConfigStockpile(t_Handle h_BmPool, uint16_t maxBuffers, uint16_t minBuffers);
526*0aeed3e9SJustin Hibbits 
527*0aeed3e9SJustin Hibbits /**************************************************************************//**
528*0aeed3e9SJustin Hibbits  @Function      BM_POOL_ConfigBuffContextMode
529*0aeed3e9SJustin Hibbits 
530*0aeed3e9SJustin Hibbits  @Description   Config the BM pool to set/unset buffer-context
531*0aeed3e9SJustin Hibbits 
532*0aeed3e9SJustin Hibbits  @Param[in]     h_BmPool     - A handle to a BM-Pool module
533*0aeed3e9SJustin Hibbits  @Param[in]     en           - enable/disable buffer context mode
534*0aeed3e9SJustin Hibbits 
535*0aeed3e9SJustin Hibbits  @Return        E_OK on success; Error code otherwise.
536*0aeed3e9SJustin Hibbits 
537*0aeed3e9SJustin Hibbits  @Cautions      Allowed only following BM_POOL_Config() and before BM_POOL_Init().
538*0aeed3e9SJustin Hibbits *//***************************************************************************/
539*0aeed3e9SJustin Hibbits t_Error  BM_POOL_ConfigBuffContextMode(t_Handle h_BmPool, bool en);
540*0aeed3e9SJustin Hibbits 
541*0aeed3e9SJustin Hibbits /** @} */ /* end of BM_pool_init_grp group */
542*0aeed3e9SJustin Hibbits 
543*0aeed3e9SJustin Hibbits 
544*0aeed3e9SJustin Hibbits /**************************************************************************//**
545*0aeed3e9SJustin Hibbits  @Group         BM_pool_runtime_control_grp BM-Pool Runtime Control Unit
546*0aeed3e9SJustin Hibbits 
547*0aeed3e9SJustin Hibbits  @Description   BM-Pool Runtime control unit API functions, definitions and enums.
548*0aeed3e9SJustin Hibbits 
549*0aeed3e9SJustin Hibbits  @{
550*0aeed3e9SJustin Hibbits *//***************************************************************************/
551*0aeed3e9SJustin Hibbits 
552*0aeed3e9SJustin Hibbits /**************************************************************************//**
553*0aeed3e9SJustin Hibbits  @Description   enum for defining BM Pool counters
554*0aeed3e9SJustin Hibbits *//***************************************************************************/
555*0aeed3e9SJustin Hibbits typedef enum e_BmPoolCounters {
556*0aeed3e9SJustin Hibbits     e_BM_POOL_COUNTERS_CONTENT = 0,         /**< number of free buffers for a particular pool */
557*0aeed3e9SJustin Hibbits     e_BM_POOL_COUNTERS_SW_DEPLETION,        /**< number of times pool entered sw depletion */
558*0aeed3e9SJustin Hibbits     e_BM_POOL_COUNTERS_HW_DEPLETION         /**< number of times pool entered hw depletion */
559*0aeed3e9SJustin Hibbits } e_BmPoolCounters;
560*0aeed3e9SJustin Hibbits 
561*0aeed3e9SJustin Hibbits /**************************************************************************//**
562*0aeed3e9SJustin Hibbits  @Function      BM_POOL_GetId
563*0aeed3e9SJustin Hibbits 
564*0aeed3e9SJustin Hibbits  @Description   return a buffer pool id.
565*0aeed3e9SJustin Hibbits 
566*0aeed3e9SJustin Hibbits  @Param[in]     h_BmPool    - A handle to a BM-pool
567*0aeed3e9SJustin Hibbits 
568*0aeed3e9SJustin Hibbits  @Return        Pool ID.
569*0aeed3e9SJustin Hibbits *//***************************************************************************/
570*0aeed3e9SJustin Hibbits uint8_t BM_POOL_GetId(t_Handle h_BmPool);
571*0aeed3e9SJustin Hibbits 
572*0aeed3e9SJustin Hibbits /**************************************************************************//**
573*0aeed3e9SJustin Hibbits  @Function      BM_POOL_GetBufferSize
574*0aeed3e9SJustin Hibbits 
575*0aeed3e9SJustin Hibbits  @Description   returns the pool's buffer size.
576*0aeed3e9SJustin Hibbits 
577*0aeed3e9SJustin Hibbits  @Param[in]     h_BmPool    - A handle to a BM-pool
578*0aeed3e9SJustin Hibbits 
579*0aeed3e9SJustin Hibbits  @Return        pool's buffer size.
580*0aeed3e9SJustin Hibbits *//***************************************************************************/
581*0aeed3e9SJustin Hibbits uint16_t BM_POOL_GetBufferSize(t_Handle h_BmPool);
582*0aeed3e9SJustin Hibbits 
583*0aeed3e9SJustin Hibbits /**************************************************************************//**
584*0aeed3e9SJustin Hibbits  @Function      BM_POOL_GetBufferContext
585*0aeed3e9SJustin Hibbits 
586*0aeed3e9SJustin Hibbits  @Description   Returns the user's private context that
587*0aeed3e9SJustin Hibbits                 should be associated with the buffer.
588*0aeed3e9SJustin Hibbits 
589*0aeed3e9SJustin Hibbits  @Param[in]     h_BmPool    - A handle to a BM-pool
590*0aeed3e9SJustin Hibbits  @Param[in]     p_Buff      - A Pointer to the buffer
591*0aeed3e9SJustin Hibbits 
592*0aeed3e9SJustin Hibbits  @Return        user's private context.
593*0aeed3e9SJustin Hibbits *//***************************************************************************/
594*0aeed3e9SJustin Hibbits t_Handle BM_POOL_GetBufferContext(t_Handle h_BmPool, void *p_Buff);
595*0aeed3e9SJustin Hibbits 
596*0aeed3e9SJustin Hibbits /**************************************************************************//**
597*0aeed3e9SJustin Hibbits  @Function      BM_POOL_PhysToVirt
598*0aeed3e9SJustin Hibbits 
599*0aeed3e9SJustin Hibbits  @Description   Translates a physical address to the matching virtual address.
600*0aeed3e9SJustin Hibbits 
601*0aeed3e9SJustin Hibbits  @Param[in]     h_BmPool    - A handle to a BM-pool
602*0aeed3e9SJustin Hibbits  @Param[in]     addr        - The physical address to translate
603*0aeed3e9SJustin Hibbits 
604*0aeed3e9SJustin Hibbits  @Return        Virtual address.
605*0aeed3e9SJustin Hibbits *//***************************************************************************/
606*0aeed3e9SJustin Hibbits void * BM_POOL_PhysToVirt(t_Handle h_BmPool, physAddress_t addr);
607*0aeed3e9SJustin Hibbits 
608*0aeed3e9SJustin Hibbits /**************************************************************************//**
609*0aeed3e9SJustin Hibbits  @Function      BM_POOL_VirtToPhys
610*0aeed3e9SJustin Hibbits 
611*0aeed3e9SJustin Hibbits  @Description   Translates a virtual address to the matching physical address.
612*0aeed3e9SJustin Hibbits 
613*0aeed3e9SJustin Hibbits  @Param[in]     h_BmPool    - A handle to a BM-pool
614*0aeed3e9SJustin Hibbits  @Param[in]     addr        - The virtual address to translate
615*0aeed3e9SJustin Hibbits 
616*0aeed3e9SJustin Hibbits  @Return        Physical address.
617*0aeed3e9SJustin Hibbits *//***************************************************************************/
618*0aeed3e9SJustin Hibbits physAddress_t BM_POOL_VirtToPhys(t_Handle h_BmPool, void *addr);
619*0aeed3e9SJustin Hibbits 
620*0aeed3e9SJustin Hibbits /**************************************************************************//**
621*0aeed3e9SJustin Hibbits  @Function      BM_POOL_GetCounter
622*0aeed3e9SJustin Hibbits 
623*0aeed3e9SJustin Hibbits  @Description   Reads one of the BM Pool counters.
624*0aeed3e9SJustin Hibbits 
625*0aeed3e9SJustin Hibbits  @Param[in]     h_BmPool    - A handle to a BM-pool
626*0aeed3e9SJustin Hibbits  @Param[in]     counter     - The requested counter.
627*0aeed3e9SJustin Hibbits 
628*0aeed3e9SJustin Hibbits  @Return        Counter's current value.
629*0aeed3e9SJustin Hibbits *//***************************************************************************/
630*0aeed3e9SJustin Hibbits uint32_t BM_POOL_GetCounter(t_Handle h_BmPool, e_BmPoolCounters counter);
631*0aeed3e9SJustin Hibbits 
632*0aeed3e9SJustin Hibbits /** @} */ /* end of BM_pool_runtime_control_grp group */
633*0aeed3e9SJustin Hibbits 
634*0aeed3e9SJustin Hibbits 
635*0aeed3e9SJustin Hibbits /**************************************************************************//**
636*0aeed3e9SJustin Hibbits  @Group         BM_pool_runtime_data_grp BM-Pool Runtime Data Unit
637*0aeed3e9SJustin Hibbits 
638*0aeed3e9SJustin Hibbits  @Description   BM-Pool Runtime data unit API functions, definitions and enums.
639*0aeed3e9SJustin Hibbits 
640*0aeed3e9SJustin Hibbits  @{
641*0aeed3e9SJustin Hibbits *//***************************************************************************/
642*0aeed3e9SJustin Hibbits 
643*0aeed3e9SJustin Hibbits /**************************************************************************//**
644*0aeed3e9SJustin Hibbits  @Function      BM_POOL_GetBuf
645*0aeed3e9SJustin Hibbits 
646*0aeed3e9SJustin Hibbits  @Description   Allocate buffer from a buffer pool.
647*0aeed3e9SJustin Hibbits 
648*0aeed3e9SJustin Hibbits  @Param[in]     h_BmPool    - A handle to a BM-pool
649*0aeed3e9SJustin Hibbits  @Param[in]     h_BmPortal  - A handle to a BM Portal Module;
650*0aeed3e9SJustin Hibbits                               NOTE : if NULL, assuming affinity.
651*0aeed3e9SJustin Hibbits 
652*0aeed3e9SJustin Hibbits  @Return        A Pointer to the allocated buffer.
653*0aeed3e9SJustin Hibbits *//***************************************************************************/
654*0aeed3e9SJustin Hibbits void *      BM_POOL_GetBuf(t_Handle h_BmPool, t_Handle h_BmPortal);
655*0aeed3e9SJustin Hibbits 
656*0aeed3e9SJustin Hibbits /**************************************************************************//**
657*0aeed3e9SJustin Hibbits  @Function      BM_POOL_PutBuf
658*0aeed3e9SJustin Hibbits 
659*0aeed3e9SJustin Hibbits  @Description   Deallocate buffer to a buffer pool.
660*0aeed3e9SJustin Hibbits 
661*0aeed3e9SJustin Hibbits  @Param[in]     h_BmPool    - A handle to a BM-pool
662*0aeed3e9SJustin Hibbits  @Param[in]     h_BmPortal  - A handle to a BM Portal Module;
663*0aeed3e9SJustin Hibbits                               NOTE : if NULL, assuming affinity.
664*0aeed3e9SJustin Hibbits  @Param[in]     p_Buff      - A Pointer to the buffer.
665*0aeed3e9SJustin Hibbits 
666*0aeed3e9SJustin Hibbits  @Return        E_OK on success; Error code otherwise.
667*0aeed3e9SJustin Hibbits *//***************************************************************************/
668*0aeed3e9SJustin Hibbits t_Error     BM_POOL_PutBuf(t_Handle h_BmPool, t_Handle h_BmPortal, void *p_Buff);
669*0aeed3e9SJustin Hibbits 
670*0aeed3e9SJustin Hibbits /**************************************************************************//**
671*0aeed3e9SJustin Hibbits  @Function      BM_POOL_FillBufs
672*0aeed3e9SJustin Hibbits 
673*0aeed3e9SJustin Hibbits  @Description   Fill a BM pool with new buffers.
674*0aeed3e9SJustin Hibbits 
675*0aeed3e9SJustin Hibbits  @Param[in]     h_BmPool    - A handle to a BM-pool
676*0aeed3e9SJustin Hibbits  @Param[in]     h_BmPortal  - A handle to a BM Portal Module;
677*0aeed3e9SJustin Hibbits                               NOTE : if NULL, assuming affinity.
678*0aeed3e9SJustin Hibbits  @Param[in]     numBufs     - How many buffers to fill into the pool.
679*0aeed3e9SJustin Hibbits 
680*0aeed3e9SJustin Hibbits  @Return        E_OK on success; Error code otherwise.
681*0aeed3e9SJustin Hibbits *//***************************************************************************/
682*0aeed3e9SJustin Hibbits t_Error     BM_POOL_FillBufs(t_Handle h_BmPool, t_Handle h_BmPortal, uint32_t numBufs);
683*0aeed3e9SJustin Hibbits 
684*0aeed3e9SJustin Hibbits /** @} */ /* end of BM_pool_runtime_data_grp group */
685*0aeed3e9SJustin Hibbits /** @} */ /* end of BM_pool_grp group */
686*0aeed3e9SJustin Hibbits /** @} */ /* end of BM_grp group */
687*0aeed3e9SJustin Hibbits 
688*0aeed3e9SJustin Hibbits #endif /* __BM_EXT_H */
689