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