LOCAL void _buf_pool_static_create_pool(pool_handle_t handle, BUF_POOL_ID poolId, int nItems, int nSize)
{
    int i;
    VBUF *buf;
    VDESC *desc;
    
    //BUF_POOL_STATIC_CONTEXT *ctx = (BUF_POOL_STATIC_CONTEXT *)handle;
    
    for ( i = 0; i < nItems; i++) {
        buf = VBUF_alloc_vbuf();
        desc = VDESC_alloc_vdesc();

        desc->buf_addr = (A_UINT8 *)adf_os_mem_alloc(nSize);
        desc->buf_size = nSize;
        desc->data_offset = 0;
        desc->data_size = 0;
        
        buf->buf_length = 0;        
        buf->desc_list = desc;
        
        if ( g_poolCtx.bufQ[poolId] == NULL ) {
            g_poolCtx.bufQ[poolId] = buf;
        } else {
            buf->next_buf = g_poolCtx.bufQ[poolId];
            g_poolCtx.bufQ[poolId] = buf;
        }
    }
}
void _DMAengine_config_rx_queue(struct zsDmaQueue *q, int num_desc, int buf_size)
{
    int i;
    VDESC *desc;
    VDESC *head = NULL;
        
    for(i=0; i < num_desc; i++)
    {
        desc = VDESC_alloc_vdesc();
        
        adf_os_assert(desc != NULL);
        
        desc->buf_addr = (A_UINT8 *)adf_os_mem_alloc(buf_size);
        desc->buf_size = buf_size;
        desc->next_desc = NULL;
        desc->data_offset = 0;
        desc->data_size = 0;
        desc->control = 0;
               
        if ( head == NULL )
        {
            head = desc;
        }
        else
        {
            desc->next_desc = head;
            head = desc;
        }
    }         
    
    config_queue(q, head);          
}
void _DMAengine_init_rx_queue(struct zsDmaQueue *q) 
{
    VDESC *desc;
    struct zsDmaDesc *usbDesc;
    
    desc = VDESC_alloc_vdesc();
    if ( desc != NULL ) {
        usbDesc = VDESC_TO_USBDESC(desc);
        init_usb_desc(usbDesc);
        
        q->head = q->terminator = usbDesc;
    }   
}