AudioScience HPI driver Copyright (C) 1997-2012 AudioScience Inc. <support@audioscience.com>
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.
/** 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 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);
/* 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) \ typedefchar ASSERT_##msg[(cond) ? 1 : -1]
/** Volume flags
*/ enum HPI_VOLUME_FLAGS { /** Set if the volume control is muted */
HPI_VOLUME_FLAG_MUTED = (1 << 0), /** Set if the volume control has a mute function */
HPI_VOLUME_FLAG_HAS_MUTE = (1 << 1), /** Set if volume control can do autofading */
HPI_VOLUME_FLAG_HAS_AUTOFADE = (1 << 2) /* Note Flags >= (1<<8) are for DSP internal use only */
};
/******************************************* CONTROL ATTRIBUTES ****/ /* (in order of control type ID */
/* This allows for 255 control types, 256 unique attributes each */ #define HPI_CTL_ATTR(ctl, ai) ((HPI_CONTROL_##ctl << 8) + ai)
/* Get the sub-index of the attribute for a control type */ #define HPI_CTL_ATTR_INDEX(i) (i & 0xff)
/* Extract the control from the control attribute */ #define HPI_CTL_ATTR_CONTROL(i) (i >> 8)
/** Enable event generation for a control. 0=disable, 1=enable \note generic to all controls that can generate events
*/
/** Unique identifiers for every control attribute
*/ enum HPI_CONTROL_ATTRIBUTES {
HPI_GENERIC_ENABLE = HPI_CTL_ATTR(GENERIC, 1),
HPI_GENERIC_EVENT_ENABLE = HPI_CTL_ATTR(GENERIC, 2),
/* These defines are used to fill in protocol information for an Ethernet packet
sent using HMI on CS18102 */ /** ID supplied by Cirrus for ASI packets. */ #define HPI_ETHERNET_PACKET_ID 0x85 /** Simple packet - no special routing required */ #define HPI_ETHERNET_PACKET_V1 0x01 /** This packet must make its way to the host across the HPI interface */ #define HPI_ETHERNET_PACKET_HOSTED_VIA_HMI 0x20 /** This packet must make its way to the host across the HPI interface */ #define HPI_ETHERNET_PACKET_HOSTED_VIA_HMI_V1 0x21 /** This packet must make its way to the host across the HPI interface */ #define HPI_ETHERNET_PACKET_HOSTED_VIA_HPI 0x40 /** This packet must make its way to the host across the HPI interface */ #define HPI_ETHERNET_PACKET_HOSTED_VIA_HPI_V1 0x41
#define HPI_ETHERNET_UDP_PORT 44600 /**< HPI UDP service */
/** Default network timeout in milli-seconds. */ #define HPI_ETHERNET_TIMEOUT_MS 500
/** Locked memory buffer alloc/free phases */ enum HPI_BUFFER_CMDS { /** use one message to allocate or free physical memory */
HPI_BUFFER_CMD_EXTERNAL = 0, /** alloc physical memory */
HPI_BUFFER_CMD_INTERNAL_ALLOC = 1, /** send physical memory address to adapter */
HPI_BUFFER_CMD_INTERNAL_GRANTADAPTER = 2, /** notify adapter to stop using physical buffer */
HPI_BUFFER_CMD_INTERNAL_REVOKEADAPTER = 3, /** free physical buffer */
HPI_BUFFER_CMD_INTERNAL_FREE = 4
};
/*****************************************************************************/ /*****************************************************************************/ /******** HPI LOW LEVEL MESSAGES *******/ /*****************************************************************************/ /*****************************************************************************/ /** Pnp ids */ /** "ASI" - actual is "ASX" - need to change */ #define HPI_ID_ISAPNP_AUDIOSCIENCE 0x0669 /** PCI vendor ID that AudioScience uses */ #define HPI_PCI_VENDOR_ID_AUDIOSCIENCE 0x175C /** PCI vendor ID that the DSP56301 has */ #define HPI_PCI_VENDOR_ID_MOTOROLA 0x1057 /** PCI vendor ID that TI uses */ #define HPI_PCI_VENDOR_ID_TI 0x104C
#define HPI_PCI_DEV_ID_PCI2040 0xAC60 /** TI's C6205 PCI interface has this ID */ #define HPI_PCI_DEV_ID_DSP6205 0xA106
/** Invalid Adapter index Used in HPI messages that are not addressed to a specific adapter Used in DLL to indicate device not present
*/ #define HPI_ADAPTER_INDEX_INVALID 0xFFFF
/** First 2 hex digits define the adapter family */ #define HPI_ADAPTER_FAMILY_MASK 0xff00 #define HPI_MODULE_FAMILY_MASK 0xfff0
/** Format info used inside struct hpi_message
Not the same as public API struct hpi_format */ struct hpi_msg_format {
u32 sample_rate; /**< 11025, 32000, 44100 etc. */
u32 bit_rate; /**< for MPEG */
u32 attributes; /**< stereo/joint_stereo/mono */
u16 channels; /**< 1,2..., (or ancillary mode or idle bit */
u16 format; /**< HPI_FORMAT_PCM16, _MPEG etc. see \ref HPI_FORMATS. */
};
/** Buffer+format structure.
Must be kept 7 * 32 bits to match public struct hpi_datastruct */ struct hpi_msg_data { struct hpi_msg_format format;
u8 *pb_data; #ifndef CONFIG_64BIT
u32 padding; #endif
u32 data_size;
};
/** struct hpi_datastructure used up to 3.04 driver */ struct hpi_data_legacy32 { struct hpi_format format;
u32 pb_data;
u32 data_size;
};
struct hpi_buffer { /** placeholder for backward compatibility (see dwBufferSize) */ struct hpi_msg_format reserved;
u32 command; /**< HPI_BUFFER_CMD_xxx*/
u32 pci_address; /**< PCI physical address of buffer for DSP DMA */
u32 buffer_size; /**< must line up with data_size of HPI_DATA*/
};
/*/////////////////////////////////////////////////////////////////////////// */ /* This is used for background buffer bus mastering stream buffers. */ struct hpi_hostbuffer_status {
u32 samples_processed;
u32 auxiliary_data_available;
u32 stream_state; /* DSP index in to the host bus master buffer. */
u32 dsp_index; /* Host index in to the host bus master buffer. */
u32 host_index;
u32 size_in_bytes;
};
struct hpi_streamid {
u16 object_type; /**< Type of object, HPI_OBJ_OSTREAM or HPI_OBJ_ISTREAM. */
u16 stream_index; /**< outstream or instream index. */
};
struct hpi_mixer_res {
u16 src_node_type; /* = HPI_SOURCENODE_LINEIN etc */
u16 src_node_index; /* = 0..N */
u16 dst_node_type;
u16 dst_node_index; /* Also controlType for MixerGetControlByIndex */
u16 control_index; /* may indicate which DSP the control is located on */
u16 dsp_index;
};
union hpi_mixerx_msg { struct {
u16 starting_index;
u16 flags;
u32 length_in_bytes; /* length in bytes of p_data */
u32 p_data; /* pointer to a data array */
} gcabi; struct {
u16 command;
u16 index;
} store; /* for HPI_MIXER_STORE message */
};
union hpi_mixerx_res { struct {
u32 bytes_returned; /* size of items returned */
u32 p_data; /* pointer to data array */
u16 more_to_do; /* indicates if there is more to do */
} gcabi; struct {
u32 total_controls; /* count of controls in the mixer */
u32 cache_controls; /* count of controls in the cac */
u32 cache_bytes; /* size of cache */
} cache_info;
};
struct hpi_control_msg {
u16 attribute; /* control attribute or property */
u16 saved_index;
u32 param1; /* generic parameter 1 */
u32 param2; /* generic parameter 2 */ short an_log_value[HPI_MAX_CHANNELS];
};
struct hpi_control_union_msg {
u16 attribute; /* control attribute or property */
u16 saved_index; /* only used in ctrl save/restore */ union { struct {
u32 param1; /* generic parameter 1 */
u32 param2; /* generic parameter 2 */ short an_log_value[HPI_MAX_CHANNELS];
} old; union {
u32 frequency;
u32 gain;
u32 band;
u32 deemphasis;
u32 program; struct {
u32 mode;
u32 value;
} mode;
u32 blend;
} tuner;
} u;
};
struct hpi_control_res { /* Could make union. dwParam, anLogValue never used in same response */
u32 param1;
u32 param2; short an_log_value[HPI_MAX_CHANNELS];
};
/*////////////////////////////////////////////////////////////////////////// */ /* declarations for control caching (internal to HPI<->DSP interaction) */
/** indicates a cached u16 value is invalid. */ #define HPI_CACHE_INVALID_UINT16 0xFFFF /** indicates a cached short value is invalid. */ #define HPI_CACHE_INVALID_SHORT -32768
/** A compact representation of (part of) a controls state. Used for efficient transfer of the control state between DSP and host or across a network
*/ struct hpi_control_cache_info { /** one of HPI_CONTROL_* */
u8 control_type; /** The total size of cached information in 32-bit words. */
u8 size_in32bit_words; /** The original index of the control on the DSP */
u16 control_index;
};
/* The following 3 functions were last declared in header files for driver 3.10. HPI_ControlQuery() used to be the recommended way of getting a volume range. Declared here for binary asihpi32.dll compatibility.
*/
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.