/*                                                                          */
/* Function    : define PCI utils                                           */
/*                                                                          */
/* Remark in following functions                                            */
/*                                                                          */
/*                                                                          */

#ifndef _MBDR_DSP_PCI_HW_UTILS_H
#define _MBDR_DSP_PCI_HW_UTILS_H

#include  "windef.h"
#include  "string.h"
#include  "mbdr_dsp_common_status.h"


/* copy via pci from DSP memory to external device   */
/* remark: parameters order reminds stadard C memcpy */
/* I/O                  */
/* 1) po_dst_external_buf_bofs         - destination byte offset               */
/* 2) pi_dsp_src_buf_p                 - DSP source buffer pointer             */
/* 3) pi_byte_size                     - buffer byte size,                     */
/*                                       valid values 4,8,12,16,....           */
/* 4) pi_external_device_pci_base_tbl_index - device PCI base address is      */
/*      being read from:                                                       */
/*        mbdr_dsp_pci_utils_base_tbl[pi_external_device_pci_base_tbl_index] */
/*                                                                           */
/* Global: 1) mbdr_dsp_pci_utils_base_tbl - created and initialized by user  */
extern void mbdr_dsp_pci_hw_utils_memcpy_write(
                         LONG    po_dst_external_buf_bofs,
                         void   *pi_dsp_src_buf_p,
                         size_t  pi_byte_size,
                         LONG    pi_mbdr_dsp_pci_utils_base_tbl_index);

/* copy via pci from DSP memory to external device   */
/* remark: parameters order reminds stadard C memcpy */
/* I/O                  */
/* 1) po_dst_external_buf_pci_p - destination external device already mapped to PCIe data */
/* 2) pi_dsp_src_buf_p                 - DSP source buffer pointer             */
/* 3) pi_byte_size                     - buffer byte size,                     */
/*                                       valid values 4,8,12,16,....           */
extern void mbdr_dsp_pci_hw_utils_memcpy_write_no_base(
                         void         *po_dst_external_buf_pci_p,
                         const void   *pi_dsp_src_buf_p,
                         size_t        pi_byte_size);


/* copy via pci from external PCI device to DSP memory  */
/* remark: parameters order reminds stadard C memcpy    */
/* I/O                  */
/* 1) po_dsp_dst_buf_p                 - DSP destination buffer pointer already mapped     */
/*                                       {align 4}                           */
/* 2) po_src_external_buf_bofs - external device source     */
/*                         buffer physical address {only 4K values are valid}*/
/* 3) pi_byte_size                     - buffer byte size,                   */
/*                                       valid values 4,8,12,16,....         */
/* 4) pi_external_device_pci_base_tbl_index - device PCI base address is     */
/*      being read from:                                                     */
/*        mbdr_dsp_pci_utils_base_tbl[pi_external_device_pci_base_tbl_index] */
/*                                                                           */
/* Global: 1) mbdr_dsp_pci_utils_base_tbl - created and initialized by user  */
extern void mbdr_dsp_pci_hw_utils_memcpy_read(
                    void   *po_dsp_dst_buf_p,
                    LONG    pi_src_external_buf_bofs,
                    size_t  pi_byte_size,
                    LONG    pi_mbdr_dsp_pci_utils_base_tbl_index);

/* copy via pci from external PCI device to DSP memory  */
/* remark: parameters order reminds stadard C memcpy    */
/* I/O                                                  */
/* 1) po_dsp_dst_buf_p - DSP destination buffer pointer(already mapped) */
/*                                       {align 4}                           */
/* 2) pi_src_external_buf_pci_p - external device source PCI address         */
/*                         buffer physical address {only 4K values are valid}*/
/* 3) pi_byte_size                     - buffer byte size,                   */
/*                                       valid values 4,8,12,16,....         */
extern void* mbdr_dsp_pci_hw_utils_memcpy_read_no_base(
                    void         *po_dsp_dst_buf_p,
                    const  void  *pi_src_external_buf_pci_p,
                    size_t        pi_byte_size);
					
/* performs family and core index depend initializations */
extern void mbdr_dsp_pci_hw_utils_family_init(void);
					
					

#endif
