Home | History | Annotate | Download | only in common
      1 /******************************************************************************
      2  *
      3  *  Copyright (C) 1999-2012 Broadcom Corporation
      4  *
      5  *  Licensed under the Apache License, Version 2.0 (the "License");
      6  *  you may not use this file except in compliance with the License.
      7  *  You may obtain a copy of the License at:
      8  *
      9  *  http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  *  Unless required by applicable law or agreed to in writing, software
     12  *  distributed under the License is distributed on an "AS IS" BASIS,
     13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  *  See the License for the specific language governing permissions and
     15  *  limitations under the License.
     16  *
     17  ******************************************************************************/
     18 
     19 #pragma once
     20 
     21 #include "gki.h"
     22 
     23 typedef struct _buffer_hdr
     24 {
     25 	struct _buffer_hdr *p_next;   /* next buffer in the queue */
     26 	UINT8   q_id;                 /* id of the queue */
     27 	UINT8   status;               /* FREE, UNLINKED or QUEUED */
     28 	UINT8   Type;
     29         UINT16  size;
     30 } BUFFER_HDR_T;
     31 
     32 typedef struct _free_queue
     33 {
     34 	BUFFER_HDR_T *_p_first;      /* first buffer in the queue */
     35 	BUFFER_HDR_T *_p_last;       /* last buffer in the queue */
     36 	UINT16		 size;             /* size of the buffers in the pool */
     37 	UINT16		 total;            /* toatal number of buffers */
     38 	UINT16		 cur_cnt;          /* number of  buffers currently allocated */
     39 	UINT16		 max_cnt;          /* maximum number of buffers allocated at any time */
     40 } FREE_QUEUE_T;
     41 
     42 /* Put all GKI variables into one control block
     43 */
     44 typedef struct
     45 {
     46     /* Define the buffer pool management variables
     47     */
     48     FREE_QUEUE_T    freeq[GKI_NUM_TOTAL_BUF_POOLS];
     49 
     50     UINT16   pool_buf_size[GKI_NUM_TOTAL_BUF_POOLS];
     51 
     52     /* Define the buffer pool start addresses
     53     */
     54     UINT8   *pool_start[GKI_NUM_TOTAL_BUF_POOLS];   /* array of pointers to the start of each buffer pool */
     55     UINT8   *pool_end[GKI_NUM_TOTAL_BUF_POOLS];     /* array of pointers to the end of each buffer pool */
     56     UINT16   pool_size[GKI_NUM_TOTAL_BUF_POOLS];    /* actual size of the buffers in a pool */
     57 
     58     /* Define the buffer pool access control variables */
     59     UINT16      pool_access_mask;                   /* Bits are set if the corresponding buffer pool is a restricted pool */
     60 } tGKI_COM_CB;
     61 
     62 /* Internal GKI function prototypes
     63 */
     64 void      gki_buffer_init(void);
     65 void      gki_buffer_cleanup(void);
     66