/******************************************************************************
AudioScience HPI driver
Copyright (C) 1997-2012 AudioScience Inc. <support@audioscience.com>
This program is free software; you can redistribute it and/or modify
it under the terms of version 2 of the GNU General Public License as
published by the Free Software Foundation;
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
HPI internal definitions
(C) Copyright AudioScience Inc. 1996-2009
******************************************************************************/
#ifndef _HPI_INTERNAL_H_
#define _HPI_INTERNAL_H_
#include "hpi.h"
/** maximum number of memory regions mapped to an adapter */
#define HPI_MAX_ADAPTER_MEM_SPACES (2)
/* Each OS needs its own hpios.h */
#include "hpios.h"
/* physical memory allocation */
/** Allocate and map an area of locked memory for bus master DMA operations.
On success, *pLockedMemeHandle is a valid handle, and 0 is returned
On error *pLockedMemHandle marked invalid, non-zero returned.
If this function succeeds, then HpiOs_LockedMem_GetVirtAddr() and
HpiOs_LockedMem_GetPyhsAddr() will always succed on the returned handle.
*/
u16 hpios_locked_mem_alloc(struct consistent_dma_area *p_locked_mem_handle,
/**< memory handle */
u32 size, /**< Size in bytes to allocate */
struct pci_dev *p_os_reference
/**< OS specific data required for memory allocation */
);
/** Free mapping and memory represented by LockedMemHandle
Frees any resources, then invalidates the handle.
Returns 0 on success, 1 if handle is invalid.
*/
u16 hpios_locked_mem_free(struct consistent_dma_area *locked_mem_handle);
/** Get the physical PCI address of memory represented by LockedMemHandle.
If handle is invalid *pPhysicalAddr is set to zero and return 1
*/
u16 hpios_locked_mem_get_phys_addr(struct consistent_dma_area
*locked_mem_handle, u32 *p_physical_addr);
/** Get the CPU address of of memory represented by LockedMemHandle.
If handle is NULL *ppvVirtualAddr is set to NULL and return 1
*/
u16 hpios_locked_mem_get_virt_addr(struct consistent_dma_area
*locked_mem_handle, void **ppv_virtual_addr);
/** Check that handle is valid
i.e it represents a valid memory area
*/
u16 hpios_locked_mem_valid(struct consistent_dma_area *locked_mem_handle);
/* timing/delay */
void hpios_delay_micro_seconds(u32 num_micro_sec);
struct hpi_message;
struct hpi_response;
typedef void hpi_handler_func(struct hpi_message *, struct hpi_response *);
/* If the assert fails, compiler complains
something like size of array `msg' is negative.
Unlike linux BUILD_BUG_ON, this works outside function scope.
*/
#define compile_time_assert(cond, msg) \
typedef char ASSERT_##msg[(cond) ? 1 : -1]
/******************************************* bus types */
enum HPI_BUSES {
HPI_BUS_ISAPNP = 1,
HPI_BU