18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/******************************************************************************
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci    AudioScience HPI driver
58c2ecf20Sopenharmony_ci    Copyright (C) 1997-2012  AudioScience Inc. <support@audioscience.com>
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ciHPI internal definitions
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci(C) Copyright AudioScience Inc. 1996-2009
118c2ecf20Sopenharmony_ci******************************************************************************/
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#ifndef _HPI_INTERNAL_H_
148c2ecf20Sopenharmony_ci#define _HPI_INTERNAL_H_
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#include "hpi.h"
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci/** maximum number of memory regions mapped to an adapter */
198c2ecf20Sopenharmony_ci#define HPI_MAX_ADAPTER_MEM_SPACES (2)
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/* Each OS needs its own hpios.h */
228c2ecf20Sopenharmony_ci#include "hpios.h"
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci/* physical memory allocation */
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci/** Allocate and map an area of locked memory for bus master DMA operations.
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ciOn success, *pLockedMemeHandle is a valid handle, and 0 is returned
298c2ecf20Sopenharmony_ciOn error *pLockedMemHandle marked invalid, non-zero returned.
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ciIf this function succeeds, then HpiOs_LockedMem_GetVirtAddr() and
328c2ecf20Sopenharmony_ciHpiOs_LockedMem_GetPyhsAddr() will always succed on the returned handle.
338c2ecf20Sopenharmony_ci*/
348c2ecf20Sopenharmony_ciu16 hpios_locked_mem_alloc(struct consistent_dma_area *p_locked_mem_handle,
358c2ecf20Sopenharmony_ci							   /**< memory handle */
368c2ecf20Sopenharmony_ci	u32 size, /**< Size in bytes to allocate */
378c2ecf20Sopenharmony_ci	struct pci_dev *p_os_reference
388c2ecf20Sopenharmony_ci	/**< OS specific data required for memory allocation */
398c2ecf20Sopenharmony_ci	);
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci/** Free mapping and memory represented by LockedMemHandle
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ciFrees any resources, then invalidates the handle.
448c2ecf20Sopenharmony_ciReturns 0 on success, 1 if handle is invalid.
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci*/
478c2ecf20Sopenharmony_ciu16 hpios_locked_mem_free(struct consistent_dma_area *locked_mem_handle);
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci/** Get the physical PCI address of memory represented by LockedMemHandle.
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ciIf handle is invalid *pPhysicalAddr is set to zero and return 1
528c2ecf20Sopenharmony_ci*/
538c2ecf20Sopenharmony_ciu16 hpios_locked_mem_get_phys_addr(struct consistent_dma_area
548c2ecf20Sopenharmony_ci	*locked_mem_handle, u32 *p_physical_addr);
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci/** Get the CPU address of memory represented by LockedMemHandle.
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ciIf handle is NULL *ppvVirtualAddr is set to NULL and return 1
598c2ecf20Sopenharmony_ci*/
608c2ecf20Sopenharmony_ciu16 hpios_locked_mem_get_virt_addr(struct consistent_dma_area
618c2ecf20Sopenharmony_ci	*locked_mem_handle, void **ppv_virtual_addr);
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci/** Check that handle is valid
648c2ecf20Sopenharmony_cii.e it represents a valid memory area
658c2ecf20Sopenharmony_ci*/
668c2ecf20Sopenharmony_ciu16 hpios_locked_mem_valid(struct consistent_dma_area *locked_mem_handle);
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci/* timing/delay */
698c2ecf20Sopenharmony_civoid hpios_delay_micro_seconds(u32 num_micro_sec);
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_cistruct hpi_message;
728c2ecf20Sopenharmony_cistruct hpi_response;
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_citypedef void hpi_handler_func(struct hpi_message *, struct hpi_response *);
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci/* If the assert fails, compiler complains
778c2ecf20Sopenharmony_ci   something like size of array `msg' is negative.
788c2ecf20Sopenharmony_ci   Unlike linux BUILD_BUG_ON, this works outside function scope.
798c2ecf20Sopenharmony_ci*/
808c2ecf20Sopenharmony_ci#define compile_time_assert(cond, msg) \
818c2ecf20Sopenharmony_ci    typedef char ASSERT_##msg[(cond) ? 1 : -1]
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci/******************************************* bus types */
848c2ecf20Sopenharmony_cienum HPI_BUSES {
858c2ecf20Sopenharmony_ci	HPI_BUS_ISAPNP = 1,
868c2ecf20Sopenharmony_ci	HPI_BUS_PCI = 2,
878c2ecf20Sopenharmony_ci	HPI_BUS_USB = 3,
888c2ecf20Sopenharmony_ci	HPI_BUS_NET = 4
898c2ecf20Sopenharmony_ci};
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_cienum HPI_SUBSYS_OPTIONS {
928c2ecf20Sopenharmony_ci	/* 0, 256 are invalid, 1..255 reserved for global options */
938c2ecf20Sopenharmony_ci	HPI_SUBSYS_OPT_NET_ENABLE = 257,
948c2ecf20Sopenharmony_ci	HPI_SUBSYS_OPT_NET_BROADCAST = 258,
958c2ecf20Sopenharmony_ci	HPI_SUBSYS_OPT_NET_UNICAST = 259,
968c2ecf20Sopenharmony_ci	HPI_SUBSYS_OPT_NET_ADDR = 260,
978c2ecf20Sopenharmony_ci	HPI_SUBSYS_OPT_NET_MASK = 261,
988c2ecf20Sopenharmony_ci	HPI_SUBSYS_OPT_NET_ADAPTER_ADDRESS_ADD = 262
998c2ecf20Sopenharmony_ci};
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci/** Volume flags
1028c2ecf20Sopenharmony_ci*/
1038c2ecf20Sopenharmony_cienum HPI_VOLUME_FLAGS {
1048c2ecf20Sopenharmony_ci	/** Set if the volume control is muted */
1058c2ecf20Sopenharmony_ci	HPI_VOLUME_FLAG_MUTED = (1 << 0),
1068c2ecf20Sopenharmony_ci	/** Set if the volume control has a mute function */
1078c2ecf20Sopenharmony_ci	HPI_VOLUME_FLAG_HAS_MUTE = (1 << 1),
1088c2ecf20Sopenharmony_ci	/** Set if volume control can do autofading */
1098c2ecf20Sopenharmony_ci	HPI_VOLUME_FLAG_HAS_AUTOFADE = (1 << 2)
1108c2ecf20Sopenharmony_ci		/* Note Flags >= (1<<8) are for DSP internal use only */
1118c2ecf20Sopenharmony_ci};
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci/******************************************* CONTROL ATTRIBUTES ****/
1148c2ecf20Sopenharmony_ci/* (in order of control type ID */
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_ci/* This allows for 255 control types, 256 unique attributes each */
1178c2ecf20Sopenharmony_ci#define HPI_CTL_ATTR(ctl, ai) ((HPI_CONTROL_##ctl << 8) + ai)
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci/* Get the sub-index of the attribute for a control type */
1208c2ecf20Sopenharmony_ci#define HPI_CTL_ATTR_INDEX(i) (i & 0xff)
1218c2ecf20Sopenharmony_ci
1228c2ecf20Sopenharmony_ci/* Extract the control from the control attribute */
1238c2ecf20Sopenharmony_ci#define HPI_CTL_ATTR_CONTROL(i) (i >> 8)
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci/** Enable event generation for a control.
1268c2ecf20Sopenharmony_ci0=disable, 1=enable
1278c2ecf20Sopenharmony_ci\note generic to all controls that can generate events
1288c2ecf20Sopenharmony_ci*/
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ci/** Unique identifiers for every control attribute
1318c2ecf20Sopenharmony_ci*/
1328c2ecf20Sopenharmony_cienum HPI_CONTROL_ATTRIBUTES {
1338c2ecf20Sopenharmony_ci	HPI_GENERIC_ENABLE = HPI_CTL_ATTR(GENERIC, 1),
1348c2ecf20Sopenharmony_ci	HPI_GENERIC_EVENT_ENABLE = HPI_CTL_ATTR(GENERIC, 2),
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ci	HPI_VOLUME_GAIN = HPI_CTL_ATTR(VOLUME, 1),
1378c2ecf20Sopenharmony_ci	HPI_VOLUME_AUTOFADE = HPI_CTL_ATTR(VOLUME, 2),
1388c2ecf20Sopenharmony_ci	HPI_VOLUME_MUTE = HPI_CTL_ATTR(VOLUME, 3),
1398c2ecf20Sopenharmony_ci	HPI_VOLUME_GAIN_AND_FLAGS = HPI_CTL_ATTR(VOLUME, 4),
1408c2ecf20Sopenharmony_ci	HPI_VOLUME_NUM_CHANNELS = HPI_CTL_ATTR(VOLUME, 6),
1418c2ecf20Sopenharmony_ci	HPI_VOLUME_RANGE = HPI_CTL_ATTR(VOLUME, 10),
1428c2ecf20Sopenharmony_ci
1438c2ecf20Sopenharmony_ci	HPI_METER_RMS = HPI_CTL_ATTR(METER, 1),
1448c2ecf20Sopenharmony_ci	HPI_METER_PEAK = HPI_CTL_ATTR(METER, 2),
1458c2ecf20Sopenharmony_ci	HPI_METER_RMS_BALLISTICS = HPI_CTL_ATTR(METER, 3),
1468c2ecf20Sopenharmony_ci	HPI_METER_PEAK_BALLISTICS = HPI_CTL_ATTR(METER, 4),
1478c2ecf20Sopenharmony_ci	HPI_METER_NUM_CHANNELS = HPI_CTL_ATTR(METER, 5),
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_ci	HPI_MULTIPLEXER_SOURCE = HPI_CTL_ATTR(MULTIPLEXER, 1),
1508c2ecf20Sopenharmony_ci	HPI_MULTIPLEXER_QUERYSOURCE = HPI_CTL_ATTR(MULTIPLEXER, 2),
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_ci	HPI_AESEBUTX_FORMAT = HPI_CTL_ATTR(AESEBUTX, 1),
1538c2ecf20Sopenharmony_ci	HPI_AESEBUTX_SAMPLERATE = HPI_CTL_ATTR(AESEBUTX, 3),
1548c2ecf20Sopenharmony_ci	HPI_AESEBUTX_CHANNELSTATUS = HPI_CTL_ATTR(AESEBUTX, 4),
1558c2ecf20Sopenharmony_ci	HPI_AESEBUTX_USERDATA = HPI_CTL_ATTR(AESEBUTX, 5),
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_ci	HPI_AESEBURX_FORMAT = HPI_CTL_ATTR(AESEBURX, 1),
1588c2ecf20Sopenharmony_ci	HPI_AESEBURX_ERRORSTATUS = HPI_CTL_ATTR(AESEBURX, 2),
1598c2ecf20Sopenharmony_ci	HPI_AESEBURX_SAMPLERATE = HPI_CTL_ATTR(AESEBURX, 3),
1608c2ecf20Sopenharmony_ci	HPI_AESEBURX_CHANNELSTATUS = HPI_CTL_ATTR(AESEBURX, 4),
1618c2ecf20Sopenharmony_ci	HPI_AESEBURX_USERDATA = HPI_CTL_ATTR(AESEBURX, 5),
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_ci	HPI_LEVEL_GAIN = HPI_CTL_ATTR(LEVEL, 1),
1648c2ecf20Sopenharmony_ci	HPI_LEVEL_RANGE = HPI_CTL_ATTR(LEVEL, 10),
1658c2ecf20Sopenharmony_ci
1668c2ecf20Sopenharmony_ci	HPI_TUNER_BAND = HPI_CTL_ATTR(TUNER, 1),
1678c2ecf20Sopenharmony_ci	HPI_TUNER_FREQ = HPI_CTL_ATTR(TUNER, 2),
1688c2ecf20Sopenharmony_ci	HPI_TUNER_LEVEL_AVG = HPI_CTL_ATTR(TUNER, 3),
1698c2ecf20Sopenharmony_ci	HPI_TUNER_LEVEL_RAW = HPI_CTL_ATTR(TUNER, 4),
1708c2ecf20Sopenharmony_ci	HPI_TUNER_SNR = HPI_CTL_ATTR(TUNER, 5),
1718c2ecf20Sopenharmony_ci	HPI_TUNER_GAIN = HPI_CTL_ATTR(TUNER, 6),
1728c2ecf20Sopenharmony_ci	HPI_TUNER_STATUS = HPI_CTL_ATTR(TUNER, 7),
1738c2ecf20Sopenharmony_ci	HPI_TUNER_MODE = HPI_CTL_ATTR(TUNER, 8),
1748c2ecf20Sopenharmony_ci	HPI_TUNER_RDS = HPI_CTL_ATTR(TUNER, 9),
1758c2ecf20Sopenharmony_ci	HPI_TUNER_DEEMPHASIS = HPI_CTL_ATTR(TUNER, 10),
1768c2ecf20Sopenharmony_ci	HPI_TUNER_PROGRAM = HPI_CTL_ATTR(TUNER, 11),
1778c2ecf20Sopenharmony_ci	HPI_TUNER_HDRADIO_SIGNAL_QUALITY = HPI_CTL_ATTR(TUNER, 12),
1788c2ecf20Sopenharmony_ci	HPI_TUNER_HDRADIO_SDK_VERSION = HPI_CTL_ATTR(TUNER, 13),
1798c2ecf20Sopenharmony_ci	HPI_TUNER_HDRADIO_DSP_VERSION = HPI_CTL_ATTR(TUNER, 14),
1808c2ecf20Sopenharmony_ci	HPI_TUNER_HDRADIO_BLEND = HPI_CTL_ATTR(TUNER, 15),
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_ci	HPI_VOX_THRESHOLD = HPI_CTL_ATTR(VOX, 1),
1838c2ecf20Sopenharmony_ci
1848c2ecf20Sopenharmony_ci	HPI_CHANNEL_MODE_MODE = HPI_CTL_ATTR(CHANNEL_MODE, 1),
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_ci	HPI_BITSTREAM_DATA_POLARITY = HPI_CTL_ATTR(BITSTREAM, 1),
1878c2ecf20Sopenharmony_ci	HPI_BITSTREAM_CLOCK_EDGE = HPI_CTL_ATTR(BITSTREAM, 2),
1888c2ecf20Sopenharmony_ci	HPI_BITSTREAM_CLOCK_SOURCE = HPI_CTL_ATTR(BITSTREAM, 3),
1898c2ecf20Sopenharmony_ci	HPI_BITSTREAM_ACTIVITY = HPI_CTL_ATTR(BITSTREAM, 4),
1908c2ecf20Sopenharmony_ci
1918c2ecf20Sopenharmony_ci	HPI_SAMPLECLOCK_SOURCE = HPI_CTL_ATTR(SAMPLECLOCK, 1),
1928c2ecf20Sopenharmony_ci	HPI_SAMPLECLOCK_SAMPLERATE = HPI_CTL_ATTR(SAMPLECLOCK, 2),
1938c2ecf20Sopenharmony_ci	HPI_SAMPLECLOCK_SOURCE_INDEX = HPI_CTL_ATTR(SAMPLECLOCK, 3),
1948c2ecf20Sopenharmony_ci	HPI_SAMPLECLOCK_LOCAL_SAMPLERATE = HPI_CTL_ATTR(SAMPLECLOCK, 4),
1958c2ecf20Sopenharmony_ci	HPI_SAMPLECLOCK_AUTO = HPI_CTL_ATTR(SAMPLECLOCK, 5),
1968c2ecf20Sopenharmony_ci	HPI_SAMPLECLOCK_LOCAL_LOCK = HPI_CTL_ATTR(SAMPLECLOCK, 6),
1978c2ecf20Sopenharmony_ci
1988c2ecf20Sopenharmony_ci	HPI_MICROPHONE_PHANTOM_POWER = HPI_CTL_ATTR(MICROPHONE, 1),
1998c2ecf20Sopenharmony_ci
2008c2ecf20Sopenharmony_ci	HPI_EQUALIZER_NUM_FILTERS = HPI_CTL_ATTR(EQUALIZER, 1),
2018c2ecf20Sopenharmony_ci	HPI_EQUALIZER_FILTER = HPI_CTL_ATTR(EQUALIZER, 2),
2028c2ecf20Sopenharmony_ci	HPI_EQUALIZER_COEFFICIENTS = HPI_CTL_ATTR(EQUALIZER, 3),
2038c2ecf20Sopenharmony_ci
2048c2ecf20Sopenharmony_ci	HPI_COMPANDER_PARAMS = HPI_CTL_ATTR(COMPANDER, 1),
2058c2ecf20Sopenharmony_ci	HPI_COMPANDER_MAKEUPGAIN = HPI_CTL_ATTR(COMPANDER, 2),
2068c2ecf20Sopenharmony_ci	HPI_COMPANDER_THRESHOLD = HPI_CTL_ATTR(COMPANDER, 3),
2078c2ecf20Sopenharmony_ci	HPI_COMPANDER_RATIO = HPI_CTL_ATTR(COMPANDER, 4),
2088c2ecf20Sopenharmony_ci	HPI_COMPANDER_ATTACK = HPI_CTL_ATTR(COMPANDER, 5),
2098c2ecf20Sopenharmony_ci	HPI_COMPANDER_DECAY = HPI_CTL_ATTR(COMPANDER, 6),
2108c2ecf20Sopenharmony_ci
2118c2ecf20Sopenharmony_ci	HPI_COBRANET_SET = HPI_CTL_ATTR(COBRANET, 1),
2128c2ecf20Sopenharmony_ci	HPI_COBRANET_GET = HPI_CTL_ATTR(COBRANET, 2),
2138c2ecf20Sopenharmony_ci	HPI_COBRANET_GET_STATUS = HPI_CTL_ATTR(COBRANET, 5),
2148c2ecf20Sopenharmony_ci	HPI_COBRANET_SEND_PACKET = HPI_CTL_ATTR(COBRANET, 6),
2158c2ecf20Sopenharmony_ci	HPI_COBRANET_GET_PACKET = HPI_CTL_ATTR(COBRANET, 7),
2168c2ecf20Sopenharmony_ci
2178c2ecf20Sopenharmony_ci	HPI_TONEDETECTOR_THRESHOLD = HPI_CTL_ATTR(TONEDETECTOR, 1),
2188c2ecf20Sopenharmony_ci	HPI_TONEDETECTOR_STATE = HPI_CTL_ATTR(TONEDETECTOR, 2),
2198c2ecf20Sopenharmony_ci	HPI_TONEDETECTOR_FREQUENCY = HPI_CTL_ATTR(TONEDETECTOR, 3),
2208c2ecf20Sopenharmony_ci
2218c2ecf20Sopenharmony_ci	HPI_SILENCEDETECTOR_THRESHOLD = HPI_CTL_ATTR(SILENCEDETECTOR, 1),
2228c2ecf20Sopenharmony_ci	HPI_SILENCEDETECTOR_STATE = HPI_CTL_ATTR(SILENCEDETECTOR, 2),
2238c2ecf20Sopenharmony_ci	HPI_SILENCEDETECTOR_DELAY = HPI_CTL_ATTR(SILENCEDETECTOR, 3),
2248c2ecf20Sopenharmony_ci
2258c2ecf20Sopenharmony_ci	HPI_PAD_CHANNEL_NAME = HPI_CTL_ATTR(PAD, 1),
2268c2ecf20Sopenharmony_ci	HPI_PAD_ARTIST = HPI_CTL_ATTR(PAD, 2),
2278c2ecf20Sopenharmony_ci	HPI_PAD_TITLE = HPI_CTL_ATTR(PAD, 3),
2288c2ecf20Sopenharmony_ci	HPI_PAD_COMMENT = HPI_CTL_ATTR(PAD, 4),
2298c2ecf20Sopenharmony_ci	HPI_PAD_PROGRAM_TYPE = HPI_CTL_ATTR(PAD, 5),
2308c2ecf20Sopenharmony_ci	HPI_PAD_PROGRAM_ID = HPI_CTL_ATTR(PAD, 6),
2318c2ecf20Sopenharmony_ci	HPI_PAD_TA_SUPPORT = HPI_CTL_ATTR(PAD, 7),
2328c2ecf20Sopenharmony_ci	HPI_PAD_TA_ACTIVE = HPI_CTL_ATTR(PAD, 8),
2338c2ecf20Sopenharmony_ci
2348c2ecf20Sopenharmony_ci	HPI_UNIVERSAL_ENTITY = HPI_CTL_ATTR(UNIVERSAL, 1)
2358c2ecf20Sopenharmony_ci};
2368c2ecf20Sopenharmony_ci
2378c2ecf20Sopenharmony_ci#define HPI_POLARITY_POSITIVE           0
2388c2ecf20Sopenharmony_ci#define HPI_POLARITY_NEGATIVE           1
2398c2ecf20Sopenharmony_ci
2408c2ecf20Sopenharmony_ci/*------------------------------------------------------------
2418c2ecf20Sopenharmony_ci Cobranet Chip Bridge - copied from HMI.H
2428c2ecf20Sopenharmony_ci------------------------------------------------------------*/
2438c2ecf20Sopenharmony_ci#define  HPI_COBRANET_HMI_cobra_bridge           0x20000
2448c2ecf20Sopenharmony_ci#define  HPI_COBRANET_HMI_cobra_bridge_tx_pkt_buf \
2458c2ecf20Sopenharmony_ci	(HPI_COBRANET_HMI_cobra_bridge + 0x1000)
2468c2ecf20Sopenharmony_ci#define  HPI_COBRANET_HMI_cobra_bridge_rx_pkt_buf \
2478c2ecf20Sopenharmony_ci	(HPI_COBRANET_HMI_cobra_bridge + 0x2000)
2488c2ecf20Sopenharmony_ci#define  HPI_COBRANET_HMI_cobra_if_table1         0x110000
2498c2ecf20Sopenharmony_ci#define  HPI_COBRANET_HMI_cobra_if_phy_address \
2508c2ecf20Sopenharmony_ci	(HPI_COBRANET_HMI_cobra_if_table1 + 0xd)
2518c2ecf20Sopenharmony_ci#define  HPI_COBRANET_HMI_cobra_protocolIP       0x72000
2528c2ecf20Sopenharmony_ci#define  HPI_COBRANET_HMI_cobra_ip_mon_currentIP \
2538c2ecf20Sopenharmony_ci	(HPI_COBRANET_HMI_cobra_protocolIP + 0x0)
2548c2ecf20Sopenharmony_ci#define  HPI_COBRANET_HMI_cobra_ip_mon_staticIP \
2558c2ecf20Sopenharmony_ci	(HPI_COBRANET_HMI_cobra_protocolIP + 0x2)
2568c2ecf20Sopenharmony_ci#define  HPI_COBRANET_HMI_cobra_sys              0x100000
2578c2ecf20Sopenharmony_ci#define  HPI_COBRANET_HMI_cobra_sys_desc \
2588c2ecf20Sopenharmony_ci		(HPI_COBRANET_HMI_cobra_sys + 0x0)
2598c2ecf20Sopenharmony_ci#define  HPI_COBRANET_HMI_cobra_sys_objectID \
2608c2ecf20Sopenharmony_ci	(HPI_COBRANET_HMI_cobra_sys + 0x100)
2618c2ecf20Sopenharmony_ci#define  HPI_COBRANET_HMI_cobra_sys_contact \
2628c2ecf20Sopenharmony_ci	(HPI_COBRANET_HMI_cobra_sys + 0x200)
2638c2ecf20Sopenharmony_ci#define  HPI_COBRANET_HMI_cobra_sys_name \
2648c2ecf20Sopenharmony_ci		(HPI_COBRANET_HMI_cobra_sys + 0x300)
2658c2ecf20Sopenharmony_ci#define  HPI_COBRANET_HMI_cobra_sys_location \
2668c2ecf20Sopenharmony_ci	(HPI_COBRANET_HMI_cobra_sys + 0x400)
2678c2ecf20Sopenharmony_ci
2688c2ecf20Sopenharmony_ci/*------------------------------------------------------------
2698c2ecf20Sopenharmony_ci Cobranet Chip Status bits
2708c2ecf20Sopenharmony_ci------------------------------------------------------------*/
2718c2ecf20Sopenharmony_ci#define HPI_COBRANET_HMI_STATUS_RXPACKET 2
2728c2ecf20Sopenharmony_ci#define HPI_COBRANET_HMI_STATUS_TXPACKET 3
2738c2ecf20Sopenharmony_ci
2748c2ecf20Sopenharmony_ci/*------------------------------------------------------------
2758c2ecf20Sopenharmony_ci Ethernet header size
2768c2ecf20Sopenharmony_ci------------------------------------------------------------*/
2778c2ecf20Sopenharmony_ci#define HPI_ETHERNET_HEADER_SIZE (16)
2788c2ecf20Sopenharmony_ci
2798c2ecf20Sopenharmony_ci/* These defines are used to fill in protocol information for an Ethernet packet
2808c2ecf20Sopenharmony_ci    sent using HMI on CS18102 */
2818c2ecf20Sopenharmony_ci/** ID supplied by Cirrus for ASI packets. */
2828c2ecf20Sopenharmony_ci#define HPI_ETHERNET_PACKET_ID                  0x85
2838c2ecf20Sopenharmony_ci/** Simple packet - no special routing required */
2848c2ecf20Sopenharmony_ci#define HPI_ETHERNET_PACKET_V1                  0x01
2858c2ecf20Sopenharmony_ci/** This packet must make its way to the host across the HPI interface */
2868c2ecf20Sopenharmony_ci#define HPI_ETHERNET_PACKET_HOSTED_VIA_HMI      0x20
2878c2ecf20Sopenharmony_ci/** This packet must make its way to the host across the HPI interface */
2888c2ecf20Sopenharmony_ci#define HPI_ETHERNET_PACKET_HOSTED_VIA_HMI_V1   0x21
2898c2ecf20Sopenharmony_ci/** This packet must make its way to the host across the HPI interface */
2908c2ecf20Sopenharmony_ci#define HPI_ETHERNET_PACKET_HOSTED_VIA_HPI      0x40
2918c2ecf20Sopenharmony_ci/** This packet must make its way to the host across the HPI interface */
2928c2ecf20Sopenharmony_ci#define HPI_ETHERNET_PACKET_HOSTED_VIA_HPI_V1   0x41
2938c2ecf20Sopenharmony_ci
2948c2ecf20Sopenharmony_ci#define HPI_ETHERNET_UDP_PORT 44600 /**< HPI UDP service */
2958c2ecf20Sopenharmony_ci
2968c2ecf20Sopenharmony_ci/** Default network timeout in milli-seconds. */
2978c2ecf20Sopenharmony_ci#define HPI_ETHERNET_TIMEOUT_MS 500
2988c2ecf20Sopenharmony_ci
2998c2ecf20Sopenharmony_ci/** Locked memory buffer alloc/free phases */
3008c2ecf20Sopenharmony_cienum HPI_BUFFER_CMDS {
3018c2ecf20Sopenharmony_ci	/** use one message to allocate or free physical memory */
3028c2ecf20Sopenharmony_ci	HPI_BUFFER_CMD_EXTERNAL = 0,
3038c2ecf20Sopenharmony_ci	/** alloc physical memory */
3048c2ecf20Sopenharmony_ci	HPI_BUFFER_CMD_INTERNAL_ALLOC = 1,
3058c2ecf20Sopenharmony_ci	/** send physical memory address to adapter */
3068c2ecf20Sopenharmony_ci	HPI_BUFFER_CMD_INTERNAL_GRANTADAPTER = 2,
3078c2ecf20Sopenharmony_ci	/** notify adapter to stop using physical buffer */
3088c2ecf20Sopenharmony_ci	HPI_BUFFER_CMD_INTERNAL_REVOKEADAPTER = 3,
3098c2ecf20Sopenharmony_ci	/** free physical buffer */
3108c2ecf20Sopenharmony_ci	HPI_BUFFER_CMD_INTERNAL_FREE = 4
3118c2ecf20Sopenharmony_ci};
3128c2ecf20Sopenharmony_ci
3138c2ecf20Sopenharmony_ci/*****************************************************************************/
3148c2ecf20Sopenharmony_ci/*****************************************************************************/
3158c2ecf20Sopenharmony_ci/********               HPI LOW LEVEL MESSAGES                  *******/
3168c2ecf20Sopenharmony_ci/*****************************************************************************/
3178c2ecf20Sopenharmony_ci/*****************************************************************************/
3188c2ecf20Sopenharmony_ci/** Pnp ids */
3198c2ecf20Sopenharmony_ci/** "ASI"  - actual is "ASX" - need to change */
3208c2ecf20Sopenharmony_ci#define HPI_ID_ISAPNP_AUDIOSCIENCE      0x0669
3218c2ecf20Sopenharmony_ci/** PCI vendor ID that AudioScience uses */
3228c2ecf20Sopenharmony_ci#define HPI_PCI_VENDOR_ID_AUDIOSCIENCE  0x175C
3238c2ecf20Sopenharmony_ci/** PCI vendor ID that the DSP56301 has */
3248c2ecf20Sopenharmony_ci#define HPI_PCI_VENDOR_ID_MOTOROLA      0x1057
3258c2ecf20Sopenharmony_ci/** PCI vendor ID that TI uses */
3268c2ecf20Sopenharmony_ci#define HPI_PCI_VENDOR_ID_TI            0x104C
3278c2ecf20Sopenharmony_ci
3288c2ecf20Sopenharmony_ci#define HPI_PCI_DEV_ID_PCI2040          0xAC60
3298c2ecf20Sopenharmony_ci/** TI's C6205 PCI interface has this ID */
3308c2ecf20Sopenharmony_ci#define HPI_PCI_DEV_ID_DSP6205          0xA106
3318c2ecf20Sopenharmony_ci
3328c2ecf20Sopenharmony_ci#define HPI_USB_VENDOR_ID_AUDIOSCIENCE  0x1257
3338c2ecf20Sopenharmony_ci#define HPI_USB_W2K_TAG                 0x57495341	/* "ASIW"       */
3348c2ecf20Sopenharmony_ci#define HPI_USB_LINUX_TAG               0x4C495341	/* "ASIL"       */
3358c2ecf20Sopenharmony_ci
3368c2ecf20Sopenharmony_ci/** Invalid Adapter index
3378c2ecf20Sopenharmony_ciUsed in HPI messages that are not addressed to a specific adapter
3388c2ecf20Sopenharmony_ciUsed in DLL to indicate device not present
3398c2ecf20Sopenharmony_ci*/
3408c2ecf20Sopenharmony_ci#define HPI_ADAPTER_INDEX_INVALID 0xFFFF
3418c2ecf20Sopenharmony_ci
3428c2ecf20Sopenharmony_ci/** First 2 hex digits define the adapter family */
3438c2ecf20Sopenharmony_ci#define HPI_ADAPTER_FAMILY_MASK         0xff00
3448c2ecf20Sopenharmony_ci#define HPI_MODULE_FAMILY_MASK          0xfff0
3458c2ecf20Sopenharmony_ci
3468c2ecf20Sopenharmony_ci#define HPI_ADAPTER_FAMILY_ASI(f)   (f & HPI_ADAPTER_FAMILY_MASK)
3478c2ecf20Sopenharmony_ci#define HPI_MODULE_FAMILY_ASI(f)   (f & HPI_MODULE_FAMILY_MASK)
3488c2ecf20Sopenharmony_ci#define HPI_ADAPTER_ASI(f)   (f)
3498c2ecf20Sopenharmony_ci
3508c2ecf20Sopenharmony_cienum HPI_MESSAGE_TYPES {
3518c2ecf20Sopenharmony_ci	HPI_TYPE_REQUEST = 1,
3528c2ecf20Sopenharmony_ci	HPI_TYPE_RESPONSE = 2,
3538c2ecf20Sopenharmony_ci	HPI_TYPE_DATA = 3,
3548c2ecf20Sopenharmony_ci	HPI_TYPE_SSX2BYPASS_MESSAGE = 4,
3558c2ecf20Sopenharmony_ci	HPI_TYPE_COMMAND = 5,
3568c2ecf20Sopenharmony_ci	HPI_TYPE_NOTIFICATION = 6
3578c2ecf20Sopenharmony_ci};
3588c2ecf20Sopenharmony_ci
3598c2ecf20Sopenharmony_cienum HPI_OBJECT_TYPES {
3608c2ecf20Sopenharmony_ci	HPI_OBJ_SUBSYSTEM = 1,
3618c2ecf20Sopenharmony_ci	HPI_OBJ_ADAPTER = 2,
3628c2ecf20Sopenharmony_ci	HPI_OBJ_OSTREAM = 3,
3638c2ecf20Sopenharmony_ci	HPI_OBJ_ISTREAM = 4,
3648c2ecf20Sopenharmony_ci	HPI_OBJ_MIXER = 5,
3658c2ecf20Sopenharmony_ci	HPI_OBJ_NODE = 6,
3668c2ecf20Sopenharmony_ci	HPI_OBJ_CONTROL = 7,
3678c2ecf20Sopenharmony_ci	HPI_OBJ_NVMEMORY = 8,
3688c2ecf20Sopenharmony_ci	HPI_OBJ_GPIO = 9,
3698c2ecf20Sopenharmony_ci	HPI_OBJ_WATCHDOG = 10,
3708c2ecf20Sopenharmony_ci	HPI_OBJ_CLOCK = 11,
3718c2ecf20Sopenharmony_ci	HPI_OBJ_PROFILE = 12,
3728c2ecf20Sopenharmony_ci	/* HPI_ OBJ_ CONTROLEX  = 13, */
3738c2ecf20Sopenharmony_ci	HPI_OBJ_ASYNCEVENT = 14
3748c2ecf20Sopenharmony_ci#define HPI_OBJ_MAXINDEX 14
3758c2ecf20Sopenharmony_ci};
3768c2ecf20Sopenharmony_ci
3778c2ecf20Sopenharmony_ci#define HPI_OBJ_FUNCTION_SPACING 0x100
3788c2ecf20Sopenharmony_ci#define HPI_FUNC_ID(obj, i) (HPI_OBJ_##obj * HPI_OBJ_FUNCTION_SPACING + i)
3798c2ecf20Sopenharmony_ci
3808c2ecf20Sopenharmony_ci#define HPI_EXTRACT_INDEX(fn) (fn & 0xff)
3818c2ecf20Sopenharmony_ci
3828c2ecf20Sopenharmony_cienum HPI_FUNCTION_IDS {
3838c2ecf20Sopenharmony_ci	HPI_SUBSYS_OPEN = HPI_FUNC_ID(SUBSYSTEM, 1),
3848c2ecf20Sopenharmony_ci	HPI_SUBSYS_GET_VERSION = HPI_FUNC_ID(SUBSYSTEM, 2),
3858c2ecf20Sopenharmony_ci	HPI_SUBSYS_GET_INFO = HPI_FUNC_ID(SUBSYSTEM, 3),
3868c2ecf20Sopenharmony_ci	HPI_SUBSYS_CREATE_ADAPTER = HPI_FUNC_ID(SUBSYSTEM, 5),
3878c2ecf20Sopenharmony_ci	HPI_SUBSYS_CLOSE = HPI_FUNC_ID(SUBSYSTEM, 6),
3888c2ecf20Sopenharmony_ci	HPI_SUBSYS_DRIVER_LOAD = HPI_FUNC_ID(SUBSYSTEM, 8),
3898c2ecf20Sopenharmony_ci	HPI_SUBSYS_DRIVER_UNLOAD = HPI_FUNC_ID(SUBSYSTEM, 9),
3908c2ecf20Sopenharmony_ci	HPI_SUBSYS_GET_NUM_ADAPTERS = HPI_FUNC_ID(SUBSYSTEM, 12),
3918c2ecf20Sopenharmony_ci	HPI_SUBSYS_GET_ADAPTER = HPI_FUNC_ID(SUBSYSTEM, 13),
3928c2ecf20Sopenharmony_ci	HPI_SUBSYS_SET_NETWORK_INTERFACE = HPI_FUNC_ID(SUBSYSTEM, 14),
3938c2ecf20Sopenharmony_ci	HPI_SUBSYS_OPTION_INFO = HPI_FUNC_ID(SUBSYSTEM, 15),
3948c2ecf20Sopenharmony_ci	HPI_SUBSYS_OPTION_GET = HPI_FUNC_ID(SUBSYSTEM, 16),
3958c2ecf20Sopenharmony_ci	HPI_SUBSYS_OPTION_SET = HPI_FUNC_ID(SUBSYSTEM, 17),
3968c2ecf20Sopenharmony_ci#define HPI_SUBSYS_FUNCTION_COUNT 17
3978c2ecf20Sopenharmony_ci
3988c2ecf20Sopenharmony_ci	HPI_ADAPTER_OPEN = HPI_FUNC_ID(ADAPTER, 1),
3998c2ecf20Sopenharmony_ci	HPI_ADAPTER_CLOSE = HPI_FUNC_ID(ADAPTER, 2),
4008c2ecf20Sopenharmony_ci	HPI_ADAPTER_GET_INFO = HPI_FUNC_ID(ADAPTER, 3),
4018c2ecf20Sopenharmony_ci	HPI_ADAPTER_GET_ASSERT = HPI_FUNC_ID(ADAPTER, 4),
4028c2ecf20Sopenharmony_ci	HPI_ADAPTER_TEST_ASSERT = HPI_FUNC_ID(ADAPTER, 5),
4038c2ecf20Sopenharmony_ci	HPI_ADAPTER_SET_MODE = HPI_FUNC_ID(ADAPTER, 6),
4048c2ecf20Sopenharmony_ci	HPI_ADAPTER_GET_MODE = HPI_FUNC_ID(ADAPTER, 7),
4058c2ecf20Sopenharmony_ci	HPI_ADAPTER_ENABLE_CAPABILITY = HPI_FUNC_ID(ADAPTER, 8),
4068c2ecf20Sopenharmony_ci	HPI_ADAPTER_SELFTEST = HPI_FUNC_ID(ADAPTER, 9),
4078c2ecf20Sopenharmony_ci	HPI_ADAPTER_FIND_OBJECT = HPI_FUNC_ID(ADAPTER, 10),
4088c2ecf20Sopenharmony_ci	HPI_ADAPTER_QUERY_FLASH = HPI_FUNC_ID(ADAPTER, 11),
4098c2ecf20Sopenharmony_ci	HPI_ADAPTER_START_FLASH = HPI_FUNC_ID(ADAPTER, 12),
4108c2ecf20Sopenharmony_ci	HPI_ADAPTER_PROGRAM_FLASH = HPI_FUNC_ID(ADAPTER, 13),
4118c2ecf20Sopenharmony_ci	HPI_ADAPTER_SET_PROPERTY = HPI_FUNC_ID(ADAPTER, 14),
4128c2ecf20Sopenharmony_ci	HPI_ADAPTER_GET_PROPERTY = HPI_FUNC_ID(ADAPTER, 15),
4138c2ecf20Sopenharmony_ci	HPI_ADAPTER_ENUM_PROPERTY = HPI_FUNC_ID(ADAPTER, 16),
4148c2ecf20Sopenharmony_ci	HPI_ADAPTER_MODULE_INFO = HPI_FUNC_ID(ADAPTER, 17),
4158c2ecf20Sopenharmony_ci	HPI_ADAPTER_DEBUG_READ = HPI_FUNC_ID(ADAPTER, 18),
4168c2ecf20Sopenharmony_ci	HPI_ADAPTER_IRQ_QUERY_AND_CLEAR = HPI_FUNC_ID(ADAPTER, 19),
4178c2ecf20Sopenharmony_ci	HPI_ADAPTER_IRQ_CALLBACK = HPI_FUNC_ID(ADAPTER, 20),
4188c2ecf20Sopenharmony_ci	HPI_ADAPTER_DELETE = HPI_FUNC_ID(ADAPTER, 21),
4198c2ecf20Sopenharmony_ci	HPI_ADAPTER_READ_FLASH = HPI_FUNC_ID(ADAPTER, 22),
4208c2ecf20Sopenharmony_ci	HPI_ADAPTER_END_FLASH = HPI_FUNC_ID(ADAPTER, 23),
4218c2ecf20Sopenharmony_ci	HPI_ADAPTER_FILESTORE_DELETE_ALL = HPI_FUNC_ID(ADAPTER, 24),
4228c2ecf20Sopenharmony_ci#define HPI_ADAPTER_FUNCTION_COUNT 24
4238c2ecf20Sopenharmony_ci
4248c2ecf20Sopenharmony_ci	HPI_OSTREAM_OPEN = HPI_FUNC_ID(OSTREAM, 1),
4258c2ecf20Sopenharmony_ci	HPI_OSTREAM_CLOSE = HPI_FUNC_ID(OSTREAM, 2),
4268c2ecf20Sopenharmony_ci	HPI_OSTREAM_WRITE = HPI_FUNC_ID(OSTREAM, 3),
4278c2ecf20Sopenharmony_ci	HPI_OSTREAM_START = HPI_FUNC_ID(OSTREAM, 4),
4288c2ecf20Sopenharmony_ci	HPI_OSTREAM_STOP = HPI_FUNC_ID(OSTREAM, 5),
4298c2ecf20Sopenharmony_ci	HPI_OSTREAM_RESET = HPI_FUNC_ID(OSTREAM, 6),
4308c2ecf20Sopenharmony_ci	HPI_OSTREAM_GET_INFO = HPI_FUNC_ID(OSTREAM, 7),
4318c2ecf20Sopenharmony_ci	HPI_OSTREAM_QUERY_FORMAT = HPI_FUNC_ID(OSTREAM, 8),
4328c2ecf20Sopenharmony_ci	HPI_OSTREAM_DATA = HPI_FUNC_ID(OSTREAM, 9),
4338c2ecf20Sopenharmony_ci	HPI_OSTREAM_SET_VELOCITY = HPI_FUNC_ID(OSTREAM, 10),
4348c2ecf20Sopenharmony_ci	HPI_OSTREAM_SET_PUNCHINOUT = HPI_FUNC_ID(OSTREAM, 11),
4358c2ecf20Sopenharmony_ci	HPI_OSTREAM_SINEGEN = HPI_FUNC_ID(OSTREAM, 12),
4368c2ecf20Sopenharmony_ci	HPI_OSTREAM_ANC_RESET = HPI_FUNC_ID(OSTREAM, 13),
4378c2ecf20Sopenharmony_ci	HPI_OSTREAM_ANC_GET_INFO = HPI_FUNC_ID(OSTREAM, 14),
4388c2ecf20Sopenharmony_ci	HPI_OSTREAM_ANC_READ = HPI_FUNC_ID(OSTREAM, 15),
4398c2ecf20Sopenharmony_ci	HPI_OSTREAM_SET_TIMESCALE = HPI_FUNC_ID(OSTREAM, 16),
4408c2ecf20Sopenharmony_ci	HPI_OSTREAM_SET_FORMAT = HPI_FUNC_ID(OSTREAM, 17),
4418c2ecf20Sopenharmony_ci	HPI_OSTREAM_HOSTBUFFER_ALLOC = HPI_FUNC_ID(OSTREAM, 18),
4428c2ecf20Sopenharmony_ci	HPI_OSTREAM_HOSTBUFFER_FREE = HPI_FUNC_ID(OSTREAM, 19),
4438c2ecf20Sopenharmony_ci	HPI_OSTREAM_GROUP_ADD = HPI_FUNC_ID(OSTREAM, 20),
4448c2ecf20Sopenharmony_ci	HPI_OSTREAM_GROUP_GETMAP = HPI_FUNC_ID(OSTREAM, 21),
4458c2ecf20Sopenharmony_ci	HPI_OSTREAM_GROUP_RESET = HPI_FUNC_ID(OSTREAM, 22),
4468c2ecf20Sopenharmony_ci	HPI_OSTREAM_HOSTBUFFER_GET_INFO = HPI_FUNC_ID(OSTREAM, 23),
4478c2ecf20Sopenharmony_ci	HPI_OSTREAM_WAIT_START = HPI_FUNC_ID(OSTREAM, 24),
4488c2ecf20Sopenharmony_ci	HPI_OSTREAM_WAIT = HPI_FUNC_ID(OSTREAM, 25),
4498c2ecf20Sopenharmony_ci#define HPI_OSTREAM_FUNCTION_COUNT 25
4508c2ecf20Sopenharmony_ci
4518c2ecf20Sopenharmony_ci	HPI_ISTREAM_OPEN = HPI_FUNC_ID(ISTREAM, 1),
4528c2ecf20Sopenharmony_ci	HPI_ISTREAM_CLOSE = HPI_FUNC_ID(ISTREAM, 2),
4538c2ecf20Sopenharmony_ci	HPI_ISTREAM_SET_FORMAT = HPI_FUNC_ID(ISTREAM, 3),
4548c2ecf20Sopenharmony_ci	HPI_ISTREAM_READ = HPI_FUNC_ID(ISTREAM, 4),
4558c2ecf20Sopenharmony_ci	HPI_ISTREAM_START = HPI_FUNC_ID(ISTREAM, 5),
4568c2ecf20Sopenharmony_ci	HPI_ISTREAM_STOP = HPI_FUNC_ID(ISTREAM, 6),
4578c2ecf20Sopenharmony_ci	HPI_ISTREAM_RESET = HPI_FUNC_ID(ISTREAM, 7),
4588c2ecf20Sopenharmony_ci	HPI_ISTREAM_GET_INFO = HPI_FUNC_ID(ISTREAM, 8),
4598c2ecf20Sopenharmony_ci	HPI_ISTREAM_QUERY_FORMAT = HPI_FUNC_ID(ISTREAM, 9),
4608c2ecf20Sopenharmony_ci	HPI_ISTREAM_ANC_RESET = HPI_FUNC_ID(ISTREAM, 10),
4618c2ecf20Sopenharmony_ci	HPI_ISTREAM_ANC_GET_INFO = HPI_FUNC_ID(ISTREAM, 11),
4628c2ecf20Sopenharmony_ci	HPI_ISTREAM_ANC_WRITE = HPI_FUNC_ID(ISTREAM, 12),
4638c2ecf20Sopenharmony_ci	HPI_ISTREAM_HOSTBUFFER_ALLOC = HPI_FUNC_ID(ISTREAM, 13),
4648c2ecf20Sopenharmony_ci	HPI_ISTREAM_HOSTBUFFER_FREE = HPI_FUNC_ID(ISTREAM, 14),
4658c2ecf20Sopenharmony_ci	HPI_ISTREAM_GROUP_ADD = HPI_FUNC_ID(ISTREAM, 15),
4668c2ecf20Sopenharmony_ci	HPI_ISTREAM_GROUP_GETMAP = HPI_FUNC_ID(ISTREAM, 16),
4678c2ecf20Sopenharmony_ci	HPI_ISTREAM_GROUP_RESET = HPI_FUNC_ID(ISTREAM, 17),
4688c2ecf20Sopenharmony_ci	HPI_ISTREAM_HOSTBUFFER_GET_INFO = HPI_FUNC_ID(ISTREAM, 18),
4698c2ecf20Sopenharmony_ci	HPI_ISTREAM_WAIT_START = HPI_FUNC_ID(ISTREAM, 19),
4708c2ecf20Sopenharmony_ci	HPI_ISTREAM_WAIT = HPI_FUNC_ID(ISTREAM, 20),
4718c2ecf20Sopenharmony_ci#define HPI_ISTREAM_FUNCTION_COUNT 20
4728c2ecf20Sopenharmony_ci
4738c2ecf20Sopenharmony_ci/* NOTE:
4748c2ecf20Sopenharmony_ci   GET_NODE_INFO, SET_CONNECTION, GET_CONNECTIONS are not currently used */
4758c2ecf20Sopenharmony_ci	HPI_MIXER_OPEN = HPI_FUNC_ID(MIXER, 1),
4768c2ecf20Sopenharmony_ci	HPI_MIXER_CLOSE = HPI_FUNC_ID(MIXER, 2),
4778c2ecf20Sopenharmony_ci	HPI_MIXER_GET_INFO = HPI_FUNC_ID(MIXER, 3),
4788c2ecf20Sopenharmony_ci	HPI_MIXER_GET_NODE_INFO = HPI_FUNC_ID(MIXER, 4),
4798c2ecf20Sopenharmony_ci	HPI_MIXER_GET_CONTROL = HPI_FUNC_ID(MIXER, 5),
4808c2ecf20Sopenharmony_ci	HPI_MIXER_SET_CONNECTION = HPI_FUNC_ID(MIXER, 6),
4818c2ecf20Sopenharmony_ci	HPI_MIXER_GET_CONNECTIONS = HPI_FUNC_ID(MIXER, 7),
4828c2ecf20Sopenharmony_ci	HPI_MIXER_GET_CONTROL_BY_INDEX = HPI_FUNC_ID(MIXER, 8),
4838c2ecf20Sopenharmony_ci	HPI_MIXER_GET_CONTROL_ARRAY_BY_INDEX = HPI_FUNC_ID(MIXER, 9),
4848c2ecf20Sopenharmony_ci	HPI_MIXER_GET_CONTROL_MULTIPLE_VALUES = HPI_FUNC_ID(MIXER, 10),
4858c2ecf20Sopenharmony_ci	HPI_MIXER_STORE = HPI_FUNC_ID(MIXER, 11),
4868c2ecf20Sopenharmony_ci	HPI_MIXER_GET_CACHE_INFO = HPI_FUNC_ID(MIXER, 12),
4878c2ecf20Sopenharmony_ci	HPI_MIXER_GET_BLOCK_HANDLE = HPI_FUNC_ID(MIXER, 13),
4888c2ecf20Sopenharmony_ci	HPI_MIXER_GET_PARAMETER_HANDLE = HPI_FUNC_ID(MIXER, 14),
4898c2ecf20Sopenharmony_ci#define HPI_MIXER_FUNCTION_COUNT 14
4908c2ecf20Sopenharmony_ci
4918c2ecf20Sopenharmony_ci	HPI_CONTROL_GET_INFO = HPI_FUNC_ID(CONTROL, 1),
4928c2ecf20Sopenharmony_ci	HPI_CONTROL_GET_STATE = HPI_FUNC_ID(CONTROL, 2),
4938c2ecf20Sopenharmony_ci	HPI_CONTROL_SET_STATE = HPI_FUNC_ID(CONTROL, 3),
4948c2ecf20Sopenharmony_ci#define HPI_CONTROL_FUNCTION_COUNT 3
4958c2ecf20Sopenharmony_ci
4968c2ecf20Sopenharmony_ci	HPI_NVMEMORY_OPEN = HPI_FUNC_ID(NVMEMORY, 1),
4978c2ecf20Sopenharmony_ci	HPI_NVMEMORY_READ_BYTE = HPI_FUNC_ID(NVMEMORY, 2),
4988c2ecf20Sopenharmony_ci	HPI_NVMEMORY_WRITE_BYTE = HPI_FUNC_ID(NVMEMORY, 3),
4998c2ecf20Sopenharmony_ci#define HPI_NVMEMORY_FUNCTION_COUNT 3
5008c2ecf20Sopenharmony_ci
5018c2ecf20Sopenharmony_ci	HPI_GPIO_OPEN = HPI_FUNC_ID(GPIO, 1),
5028c2ecf20Sopenharmony_ci	HPI_GPIO_READ_BIT = HPI_FUNC_ID(GPIO, 2),
5038c2ecf20Sopenharmony_ci	HPI_GPIO_WRITE_BIT = HPI_FUNC_ID(GPIO, 3),
5048c2ecf20Sopenharmony_ci	HPI_GPIO_READ_ALL = HPI_FUNC_ID(GPIO, 4),
5058c2ecf20Sopenharmony_ci	HPI_GPIO_WRITE_STATUS = HPI_FUNC_ID(GPIO, 5),
5068c2ecf20Sopenharmony_ci#define HPI_GPIO_FUNCTION_COUNT 5
5078c2ecf20Sopenharmony_ci
5088c2ecf20Sopenharmony_ci	HPI_ASYNCEVENT_OPEN = HPI_FUNC_ID(ASYNCEVENT, 1),
5098c2ecf20Sopenharmony_ci	HPI_ASYNCEVENT_CLOSE = HPI_FUNC_ID(ASYNCEVENT, 2),
5108c2ecf20Sopenharmony_ci	HPI_ASYNCEVENT_WAIT = HPI_FUNC_ID(ASYNCEVENT, 3),
5118c2ecf20Sopenharmony_ci	HPI_ASYNCEVENT_GETCOUNT = HPI_FUNC_ID(ASYNCEVENT, 4),
5128c2ecf20Sopenharmony_ci	HPI_ASYNCEVENT_GET = HPI_FUNC_ID(ASYNCEVENT, 5),
5138c2ecf20Sopenharmony_ci	HPI_ASYNCEVENT_SENDEVENTS = HPI_FUNC_ID(ASYNCEVENT, 6),
5148c2ecf20Sopenharmony_ci#define HPI_ASYNCEVENT_FUNCTION_COUNT 6
5158c2ecf20Sopenharmony_ci
5168c2ecf20Sopenharmony_ci	HPI_WATCHDOG_OPEN = HPI_FUNC_ID(WATCHDOG, 1),
5178c2ecf20Sopenharmony_ci	HPI_WATCHDOG_SET_TIME = HPI_FUNC_ID(WATCHDOG, 2),
5188c2ecf20Sopenharmony_ci	HPI_WATCHDOG_PING = HPI_FUNC_ID(WATCHDOG, 3),
5198c2ecf20Sopenharmony_ci
5208c2ecf20Sopenharmony_ci	HPI_CLOCK_OPEN = HPI_FUNC_ID(CLOCK, 1),
5218c2ecf20Sopenharmony_ci	HPI_CLOCK_SET_TIME = HPI_FUNC_ID(CLOCK, 2),
5228c2ecf20Sopenharmony_ci	HPI_CLOCK_GET_TIME = HPI_FUNC_ID(CLOCK, 3),
5238c2ecf20Sopenharmony_ci
5248c2ecf20Sopenharmony_ci	HPI_PROFILE_OPEN_ALL = HPI_FUNC_ID(PROFILE, 1),
5258c2ecf20Sopenharmony_ci	HPI_PROFILE_START_ALL = HPI_FUNC_ID(PROFILE, 2),
5268c2ecf20Sopenharmony_ci	HPI_PROFILE_STOP_ALL = HPI_FUNC_ID(PROFILE, 3),
5278c2ecf20Sopenharmony_ci	HPI_PROFILE_GET = HPI_FUNC_ID(PROFILE, 4),
5288c2ecf20Sopenharmony_ci	HPI_PROFILE_GET_IDLECOUNT = HPI_FUNC_ID(PROFILE, 5),
5298c2ecf20Sopenharmony_ci	HPI_PROFILE_GET_NAME = HPI_FUNC_ID(PROFILE, 6),
5308c2ecf20Sopenharmony_ci	HPI_PROFILE_GET_UTILIZATION = HPI_FUNC_ID(PROFILE, 7)
5318c2ecf20Sopenharmony_ci#define HPI_PROFILE_FUNCTION_COUNT 7
5328c2ecf20Sopenharmony_ci};
5338c2ecf20Sopenharmony_ci
5348c2ecf20Sopenharmony_ci/* ////////////////////////////////////////////////////////////////////// */
5358c2ecf20Sopenharmony_ci/* STRUCTURES */
5368c2ecf20Sopenharmony_ci#ifndef DISABLE_PRAGMA_PACK1
5378c2ecf20Sopenharmony_ci#pragma pack(push, 1)
5388c2ecf20Sopenharmony_ci#endif
5398c2ecf20Sopenharmony_ci
5408c2ecf20Sopenharmony_ci/** PCI bus resource */
5418c2ecf20Sopenharmony_cistruct hpi_pci {
5428c2ecf20Sopenharmony_ci	u32 __iomem *ap_mem_base[HPI_MAX_ADAPTER_MEM_SPACES];
5438c2ecf20Sopenharmony_ci	struct pci_dev *pci_dev;
5448c2ecf20Sopenharmony_ci};
5458c2ecf20Sopenharmony_ci
5468c2ecf20Sopenharmony_ci/** Adapter specification resource */
5478c2ecf20Sopenharmony_cistruct hpi_adapter_specification {
5488c2ecf20Sopenharmony_ci	u32 type;
5498c2ecf20Sopenharmony_ci	u8 modules[4];
5508c2ecf20Sopenharmony_ci};
5518c2ecf20Sopenharmony_ci
5528c2ecf20Sopenharmony_cistruct hpi_resource {
5538c2ecf20Sopenharmony_ci	union {
5548c2ecf20Sopenharmony_ci		const struct hpi_pci *pci;
5558c2ecf20Sopenharmony_ci		const char *net_if;
5568c2ecf20Sopenharmony_ci		struct hpi_adapter_specification adapter_spec;
5578c2ecf20Sopenharmony_ci		const void *sw_if;
5588c2ecf20Sopenharmony_ci	} r;
5598c2ecf20Sopenharmony_ci	u16 bus_type;		/* HPI_BUS_PNPISA, _PCI, _USB etc */
5608c2ecf20Sopenharmony_ci	u16 padding;
5618c2ecf20Sopenharmony_ci};
5628c2ecf20Sopenharmony_ci
5638c2ecf20Sopenharmony_ci/** Format info used inside struct hpi_message
5648c2ecf20Sopenharmony_ci    Not the same as public API struct hpi_format */
5658c2ecf20Sopenharmony_cistruct hpi_msg_format {
5668c2ecf20Sopenharmony_ci	u32 sample_rate; /**< 11025, 32000, 44100 etc. */
5678c2ecf20Sopenharmony_ci	u32 bit_rate; /**< for MPEG */
5688c2ecf20Sopenharmony_ci	u32 attributes;	/**< stereo/joint_stereo/mono */
5698c2ecf20Sopenharmony_ci	u16 channels; /**< 1,2..., (or ancillary mode or idle bit */
5708c2ecf20Sopenharmony_ci	u16 format; /**< HPI_FORMAT_PCM16, _MPEG etc. see \ref HPI_FORMATS. */
5718c2ecf20Sopenharmony_ci};
5728c2ecf20Sopenharmony_ci
5738c2ecf20Sopenharmony_ci/**  Buffer+format structure.
5748c2ecf20Sopenharmony_ci	 Must be kept 7 * 32 bits to match public struct hpi_datastruct */
5758c2ecf20Sopenharmony_cistruct hpi_msg_data {
5768c2ecf20Sopenharmony_ci	struct hpi_msg_format format;
5778c2ecf20Sopenharmony_ci	u8 *pb_data;
5788c2ecf20Sopenharmony_ci#ifndef CONFIG_64BIT
5798c2ecf20Sopenharmony_ci	u32 padding;
5808c2ecf20Sopenharmony_ci#endif
5818c2ecf20Sopenharmony_ci	u32 data_size;
5828c2ecf20Sopenharmony_ci};
5838c2ecf20Sopenharmony_ci
5848c2ecf20Sopenharmony_ci/** struct hpi_datastructure used up to 3.04 driver */
5858c2ecf20Sopenharmony_cistruct hpi_data_legacy32 {
5868c2ecf20Sopenharmony_ci	struct hpi_format format;
5878c2ecf20Sopenharmony_ci	u32 pb_data;
5888c2ecf20Sopenharmony_ci	u32 data_size;
5898c2ecf20Sopenharmony_ci};
5908c2ecf20Sopenharmony_ci
5918c2ecf20Sopenharmony_ci#ifdef CONFIG_64BIT
5928c2ecf20Sopenharmony_ci/* Compatibility version of struct hpi_data*/
5938c2ecf20Sopenharmony_cistruct hpi_data_compat32 {
5948c2ecf20Sopenharmony_ci	struct hpi_msg_format format;
5958c2ecf20Sopenharmony_ci	u32 pb_data;
5968c2ecf20Sopenharmony_ci	u32 padding;
5978c2ecf20Sopenharmony_ci	u32 data_size;
5988c2ecf20Sopenharmony_ci};
5998c2ecf20Sopenharmony_ci#endif
6008c2ecf20Sopenharmony_ci
6018c2ecf20Sopenharmony_cistruct hpi_buffer {
6028c2ecf20Sopenharmony_ci  /** placeholder for backward compatibility (see dwBufferSize) */
6038c2ecf20Sopenharmony_ci	struct hpi_msg_format reserved;
6048c2ecf20Sopenharmony_ci	u32 command; /**< HPI_BUFFER_CMD_xxx*/
6058c2ecf20Sopenharmony_ci	u32 pci_address; /**< PCI physical address of buffer for DSP DMA */
6068c2ecf20Sopenharmony_ci	u32 buffer_size; /**< must line up with data_size of HPI_DATA*/
6078c2ecf20Sopenharmony_ci};
6088c2ecf20Sopenharmony_ci
6098c2ecf20Sopenharmony_ci/*/////////////////////////////////////////////////////////////////////////// */
6108c2ecf20Sopenharmony_ci/* This is used for background buffer bus mastering stream buffers.           */
6118c2ecf20Sopenharmony_cistruct hpi_hostbuffer_status {
6128c2ecf20Sopenharmony_ci	u32 samples_processed;
6138c2ecf20Sopenharmony_ci	u32 auxiliary_data_available;
6148c2ecf20Sopenharmony_ci	u32 stream_state;
6158c2ecf20Sopenharmony_ci	/* DSP index in to the host bus master buffer. */
6168c2ecf20Sopenharmony_ci	u32 dsp_index;
6178c2ecf20Sopenharmony_ci	/* Host index in to the host bus master buffer. */
6188c2ecf20Sopenharmony_ci	u32 host_index;
6198c2ecf20Sopenharmony_ci	u32 size_in_bytes;
6208c2ecf20Sopenharmony_ci};
6218c2ecf20Sopenharmony_ci
6228c2ecf20Sopenharmony_cistruct hpi_streamid {
6238c2ecf20Sopenharmony_ci	u16 object_type;
6248c2ecf20Sopenharmony_ci		    /**< Type of object, HPI_OBJ_OSTREAM or HPI_OBJ_ISTREAM. */
6258c2ecf20Sopenharmony_ci	u16 stream_index; /**< outstream or instream index. */
6268c2ecf20Sopenharmony_ci};
6278c2ecf20Sopenharmony_ci
6288c2ecf20Sopenharmony_cistruct hpi_punchinout {
6298c2ecf20Sopenharmony_ci	u32 punch_in_sample;
6308c2ecf20Sopenharmony_ci	u32 punch_out_sample;
6318c2ecf20Sopenharmony_ci};
6328c2ecf20Sopenharmony_ci
6338c2ecf20Sopenharmony_cistruct hpi_subsys_msg {
6348c2ecf20Sopenharmony_ci	struct hpi_resource resource;
6358c2ecf20Sopenharmony_ci};
6368c2ecf20Sopenharmony_ci
6378c2ecf20Sopenharmony_cistruct hpi_subsys_res {
6388c2ecf20Sopenharmony_ci	u32 version;
6398c2ecf20Sopenharmony_ci	u32 data;		/* extended version */
6408c2ecf20Sopenharmony_ci	u16 num_adapters;
6418c2ecf20Sopenharmony_ci	u16 adapter_index;
6428c2ecf20Sopenharmony_ci	u16 adapter_type;
6438c2ecf20Sopenharmony_ci	u16 pad16;
6448c2ecf20Sopenharmony_ci};
6458c2ecf20Sopenharmony_ci
6468c2ecf20Sopenharmony_ciunion hpi_adapterx_msg {
6478c2ecf20Sopenharmony_ci	struct {
6488c2ecf20Sopenharmony_ci		u32 dsp_address;
6498c2ecf20Sopenharmony_ci		u32 count_bytes;
6508c2ecf20Sopenharmony_ci	} debug_read;
6518c2ecf20Sopenharmony_ci	struct {
6528c2ecf20Sopenharmony_ci		u32 adapter_mode;
6538c2ecf20Sopenharmony_ci		u16 query_or_set;
6548c2ecf20Sopenharmony_ci	} mode;
6558c2ecf20Sopenharmony_ci	struct {
6568c2ecf20Sopenharmony_ci		u16 index;
6578c2ecf20Sopenharmony_ci	} module_info;
6588c2ecf20Sopenharmony_ci	struct {
6598c2ecf20Sopenharmony_ci		u16 index;
6608c2ecf20Sopenharmony_ci		u16 what;
6618c2ecf20Sopenharmony_ci		u16 property_index;
6628c2ecf20Sopenharmony_ci	} property_enum;
6638c2ecf20Sopenharmony_ci	struct {
6648c2ecf20Sopenharmony_ci		u16 property;
6658c2ecf20Sopenharmony_ci		u16 parameter1;
6668c2ecf20Sopenharmony_ci		u16 parameter2;
6678c2ecf20Sopenharmony_ci	} property_set;
6688c2ecf20Sopenharmony_ci	struct {
6698c2ecf20Sopenharmony_ci		u32 pad32;
6708c2ecf20Sopenharmony_ci		u16 key1;
6718c2ecf20Sopenharmony_ci		u16 key2;
6728c2ecf20Sopenharmony_ci	} restart;
6738c2ecf20Sopenharmony_ci	struct {
6748c2ecf20Sopenharmony_ci		u32 pad32;
6758c2ecf20Sopenharmony_ci		u16 value;
6768c2ecf20Sopenharmony_ci	} test_assert;
6778c2ecf20Sopenharmony_ci	struct {
6788c2ecf20Sopenharmony_ci		u32 message;
6798c2ecf20Sopenharmony_ci	} irq;
6808c2ecf20Sopenharmony_ci	u32 pad[3];
6818c2ecf20Sopenharmony_ci};
6828c2ecf20Sopenharmony_ci
6838c2ecf20Sopenharmony_cistruct hpi_adapter_res {
6848c2ecf20Sopenharmony_ci	u32 serial_number;
6858c2ecf20Sopenharmony_ci	u16 adapter_type;
6868c2ecf20Sopenharmony_ci	u16 adapter_index;
6878c2ecf20Sopenharmony_ci	u16 num_instreams;
6888c2ecf20Sopenharmony_ci	u16 num_outstreams;
6898c2ecf20Sopenharmony_ci	u16 num_mixers;
6908c2ecf20Sopenharmony_ci	u16 version;
6918c2ecf20Sopenharmony_ci	u8 sz_adapter_assert[HPI_STRING_LEN];
6928c2ecf20Sopenharmony_ci};
6938c2ecf20Sopenharmony_ci
6948c2ecf20Sopenharmony_ciunion hpi_adapterx_res {
6958c2ecf20Sopenharmony_ci	struct hpi_adapter_res info;
6968c2ecf20Sopenharmony_ci	struct {
6978c2ecf20Sopenharmony_ci		u32 p1;
6988c2ecf20Sopenharmony_ci		u16 count;
6998c2ecf20Sopenharmony_ci		u16 dsp_index;
7008c2ecf20Sopenharmony_ci		u32 p2;
7018c2ecf20Sopenharmony_ci		u32 dsp_msg_addr;
7028c2ecf20Sopenharmony_ci		char sz_message[HPI_STRING_LEN];
7038c2ecf20Sopenharmony_ci	} assert;
7048c2ecf20Sopenharmony_ci	struct {
7058c2ecf20Sopenharmony_ci		u32 adapter_mode;
7068c2ecf20Sopenharmony_ci	} mode;
7078c2ecf20Sopenharmony_ci	struct {
7088c2ecf20Sopenharmony_ci		u16 parameter1;
7098c2ecf20Sopenharmony_ci		u16 parameter2;
7108c2ecf20Sopenharmony_ci	} property_get;
7118c2ecf20Sopenharmony_ci	struct {
7128c2ecf20Sopenharmony_ci		u32 yes;
7138c2ecf20Sopenharmony_ci	} irq_query;
7148c2ecf20Sopenharmony_ci};
7158c2ecf20Sopenharmony_ci
7168c2ecf20Sopenharmony_cistruct hpi_stream_msg {
7178c2ecf20Sopenharmony_ci	union {
7188c2ecf20Sopenharmony_ci		struct hpi_msg_data data;
7198c2ecf20Sopenharmony_ci		struct hpi_data_legacy32 data32;
7208c2ecf20Sopenharmony_ci		u16 velocity;
7218c2ecf20Sopenharmony_ci		struct hpi_punchinout pio;
7228c2ecf20Sopenharmony_ci		u32 time_scale;
7238c2ecf20Sopenharmony_ci		struct hpi_buffer buffer;
7248c2ecf20Sopenharmony_ci		struct hpi_streamid stream;
7258c2ecf20Sopenharmony_ci		u32 threshold_bytes;
7268c2ecf20Sopenharmony_ci	} u;
7278c2ecf20Sopenharmony_ci};
7288c2ecf20Sopenharmony_ci
7298c2ecf20Sopenharmony_cistruct hpi_stream_res {
7308c2ecf20Sopenharmony_ci	union {
7318c2ecf20Sopenharmony_ci		struct {
7328c2ecf20Sopenharmony_ci			/* size of hardware buffer */
7338c2ecf20Sopenharmony_ci			u32 buffer_size;
7348c2ecf20Sopenharmony_ci			/* OutStream - data to play,
7358c2ecf20Sopenharmony_ci			   InStream - data recorded */
7368c2ecf20Sopenharmony_ci			u32 data_available;
7378c2ecf20Sopenharmony_ci			/* OutStream - samples played,
7388c2ecf20Sopenharmony_ci			   InStream - samples recorded */
7398c2ecf20Sopenharmony_ci			u32 samples_transferred;
7408c2ecf20Sopenharmony_ci			/* Adapter - OutStream - data to play,
7418c2ecf20Sopenharmony_ci			   InStream - data recorded */
7428c2ecf20Sopenharmony_ci			u32 auxiliary_data_available;
7438c2ecf20Sopenharmony_ci			u16 state;	/* HPI_STATE_PLAYING, _STATE_STOPPED */
7448c2ecf20Sopenharmony_ci			u16 padding;
7458c2ecf20Sopenharmony_ci		} stream_info;
7468c2ecf20Sopenharmony_ci		struct {
7478c2ecf20Sopenharmony_ci			u32 buffer_size;
7488c2ecf20Sopenharmony_ci			u32 data_available;
7498c2ecf20Sopenharmony_ci			u32 samples_transfered;
7508c2ecf20Sopenharmony_ci			u16 state;
7518c2ecf20Sopenharmony_ci			u16 outstream_index;
7528c2ecf20Sopenharmony_ci			u16 instream_index;
7538c2ecf20Sopenharmony_ci			u16 padding;
7548c2ecf20Sopenharmony_ci			u32 auxiliary_data_available;
7558c2ecf20Sopenharmony_ci		} legacy_stream_info;
7568c2ecf20Sopenharmony_ci		struct {
7578c2ecf20Sopenharmony_ci			/* bitmap of grouped OutStreams */
7588c2ecf20Sopenharmony_ci			u32 outstream_group_map;
7598c2ecf20Sopenharmony_ci			/* bitmap of grouped InStreams */
7608c2ecf20Sopenharmony_ci			u32 instream_group_map;
7618c2ecf20Sopenharmony_ci		} group_info;
7628c2ecf20Sopenharmony_ci		struct {
7638c2ecf20Sopenharmony_ci			/* pointer to the buffer */
7648c2ecf20Sopenharmony_ci			u8 *p_buffer;
7658c2ecf20Sopenharmony_ci			/* pointer to the hostbuffer status */
7668c2ecf20Sopenharmony_ci			struct hpi_hostbuffer_status *p_status;
7678c2ecf20Sopenharmony_ci		} hostbuffer_info;
7688c2ecf20Sopenharmony_ci	} u;
7698c2ecf20Sopenharmony_ci};
7708c2ecf20Sopenharmony_ci
7718c2ecf20Sopenharmony_cistruct hpi_mixer_msg {
7728c2ecf20Sopenharmony_ci	u16 control_index;
7738c2ecf20Sopenharmony_ci	u16 control_type;	/* = HPI_CONTROL_METER _VOLUME etc */
7748c2ecf20Sopenharmony_ci	u16 padding1;		/* Maintain alignment of subsequent fields */
7758c2ecf20Sopenharmony_ci	u16 node_type1;		/* = HPI_SOURCENODE_LINEIN etc */
7768c2ecf20Sopenharmony_ci	u16 node_index1;	/* = 0..N */
7778c2ecf20Sopenharmony_ci	u16 node_type2;
7788c2ecf20Sopenharmony_ci	u16 node_index2;
7798c2ecf20Sopenharmony_ci	u16 padding2;		/* round to 4 bytes */
7808c2ecf20Sopenharmony_ci};
7818c2ecf20Sopenharmony_ci
7828c2ecf20Sopenharmony_cistruct hpi_mixer_res {
7838c2ecf20Sopenharmony_ci	u16 src_node_type;	/* = HPI_SOURCENODE_LINEIN etc */
7848c2ecf20Sopenharmony_ci	u16 src_node_index;	/* = 0..N */
7858c2ecf20Sopenharmony_ci	u16 dst_node_type;
7868c2ecf20Sopenharmony_ci	u16 dst_node_index;
7878c2ecf20Sopenharmony_ci	/* Also controlType for MixerGetControlByIndex */
7888c2ecf20Sopenharmony_ci	u16 control_index;
7898c2ecf20Sopenharmony_ci	/* may indicate which DSP the control is located on */
7908c2ecf20Sopenharmony_ci	u16 dsp_index;
7918c2ecf20Sopenharmony_ci};
7928c2ecf20Sopenharmony_ci
7938c2ecf20Sopenharmony_ciunion hpi_mixerx_msg {
7948c2ecf20Sopenharmony_ci	struct {
7958c2ecf20Sopenharmony_ci		u16 starting_index;
7968c2ecf20Sopenharmony_ci		u16 flags;
7978c2ecf20Sopenharmony_ci		u32 length_in_bytes;	/* length in bytes of p_data */
7988c2ecf20Sopenharmony_ci		u32 p_data;	/* pointer to a data array */
7998c2ecf20Sopenharmony_ci	} gcabi;
8008c2ecf20Sopenharmony_ci	struct {
8018c2ecf20Sopenharmony_ci		u16 command;
8028c2ecf20Sopenharmony_ci		u16 index;
8038c2ecf20Sopenharmony_ci	} store;		/* for HPI_MIXER_STORE message */
8048c2ecf20Sopenharmony_ci};
8058c2ecf20Sopenharmony_ci
8068c2ecf20Sopenharmony_ciunion hpi_mixerx_res {
8078c2ecf20Sopenharmony_ci	struct {
8088c2ecf20Sopenharmony_ci		u32 bytes_returned;	/* size of items returned */
8098c2ecf20Sopenharmony_ci		u32 p_data;	/* pointer to data array */
8108c2ecf20Sopenharmony_ci		u16 more_to_do;	/* indicates if there is more to do */
8118c2ecf20Sopenharmony_ci	} gcabi;
8128c2ecf20Sopenharmony_ci	struct {
8138c2ecf20Sopenharmony_ci		u32 total_controls;	/* count of controls in the mixer */
8148c2ecf20Sopenharmony_ci		u32 cache_controls;	/* count of controls in the cac */
8158c2ecf20Sopenharmony_ci		u32 cache_bytes;	/* size of cache */
8168c2ecf20Sopenharmony_ci	} cache_info;
8178c2ecf20Sopenharmony_ci};
8188c2ecf20Sopenharmony_ci
8198c2ecf20Sopenharmony_cistruct hpi_control_msg {
8208c2ecf20Sopenharmony_ci	u16 attribute;		/* control attribute or property */
8218c2ecf20Sopenharmony_ci	u16 saved_index;
8228c2ecf20Sopenharmony_ci	u32 param1;		/* generic parameter 1 */
8238c2ecf20Sopenharmony_ci	u32 param2;		/* generic parameter 2 */
8248c2ecf20Sopenharmony_ci	short an_log_value[HPI_MAX_CHANNELS];
8258c2ecf20Sopenharmony_ci};
8268c2ecf20Sopenharmony_ci
8278c2ecf20Sopenharmony_cistruct hpi_control_union_msg {
8288c2ecf20Sopenharmony_ci	u16 attribute;		/* control attribute or property */
8298c2ecf20Sopenharmony_ci	u16 saved_index;	/* only used in ctrl save/restore */
8308c2ecf20Sopenharmony_ci	union {
8318c2ecf20Sopenharmony_ci		struct {
8328c2ecf20Sopenharmony_ci			u32 param1;	/* generic parameter 1 */
8338c2ecf20Sopenharmony_ci			u32 param2;	/* generic parameter 2 */
8348c2ecf20Sopenharmony_ci			short an_log_value[HPI_MAX_CHANNELS];
8358c2ecf20Sopenharmony_ci		} old;
8368c2ecf20Sopenharmony_ci		union {
8378c2ecf20Sopenharmony_ci			u32 frequency;
8388c2ecf20Sopenharmony_ci			u32 gain;
8398c2ecf20Sopenharmony_ci			u32 band;
8408c2ecf20Sopenharmony_ci			u32 deemphasis;
8418c2ecf20Sopenharmony_ci			u32 program;
8428c2ecf20Sopenharmony_ci			struct {
8438c2ecf20Sopenharmony_ci				u32 mode;
8448c2ecf20Sopenharmony_ci				u32 value;
8458c2ecf20Sopenharmony_ci			} mode;
8468c2ecf20Sopenharmony_ci			u32 blend;
8478c2ecf20Sopenharmony_ci		} tuner;
8488c2ecf20Sopenharmony_ci	} u;
8498c2ecf20Sopenharmony_ci};
8508c2ecf20Sopenharmony_ci
8518c2ecf20Sopenharmony_cistruct hpi_control_res {
8528c2ecf20Sopenharmony_ci	/* Could make union. dwParam, anLogValue never used in same response */
8538c2ecf20Sopenharmony_ci	u32 param1;
8548c2ecf20Sopenharmony_ci	u32 param2;
8558c2ecf20Sopenharmony_ci	short an_log_value[HPI_MAX_CHANNELS];
8568c2ecf20Sopenharmony_ci};
8578c2ecf20Sopenharmony_ci
8588c2ecf20Sopenharmony_ciunion hpi_control_union_res {
8598c2ecf20Sopenharmony_ci	struct {
8608c2ecf20Sopenharmony_ci		u32 param1;
8618c2ecf20Sopenharmony_ci		u32 param2;
8628c2ecf20Sopenharmony_ci		short an_log_value[HPI_MAX_CHANNELS];
8638c2ecf20Sopenharmony_ci	} old;
8648c2ecf20Sopenharmony_ci	union {
8658c2ecf20Sopenharmony_ci		u32 band;
8668c2ecf20Sopenharmony_ci		u32 frequency;
8678c2ecf20Sopenharmony_ci		u32 gain;
8688c2ecf20Sopenharmony_ci		u32 deemphasis;
8698c2ecf20Sopenharmony_ci		struct {
8708c2ecf20Sopenharmony_ci			u32 data[2];
8718c2ecf20Sopenharmony_ci			u32 bLER;
8728c2ecf20Sopenharmony_ci		} rds;
8738c2ecf20Sopenharmony_ci		short s_level;
8748c2ecf20Sopenharmony_ci		struct {
8758c2ecf20Sopenharmony_ci			u16 value;
8768c2ecf20Sopenharmony_ci			u16 mask;
8778c2ecf20Sopenharmony_ci		} status;
8788c2ecf20Sopenharmony_ci	} tuner;
8798c2ecf20Sopenharmony_ci	struct {
8808c2ecf20Sopenharmony_ci		char sz_data[8];
8818c2ecf20Sopenharmony_ci		u32 remaining_chars;
8828c2ecf20Sopenharmony_ci	} chars8;
8838c2ecf20Sopenharmony_ci	char c_data12[12];
8848c2ecf20Sopenharmony_ci	union {
8858c2ecf20Sopenharmony_ci		struct {
8868c2ecf20Sopenharmony_ci			u32 status;
8878c2ecf20Sopenharmony_ci			u32 readable_size;
8888c2ecf20Sopenharmony_ci			u32 writeable_size;
8898c2ecf20Sopenharmony_ci		} status;
8908c2ecf20Sopenharmony_ci	} cobranet;
8918c2ecf20Sopenharmony_ci};
8928c2ecf20Sopenharmony_ci
8938c2ecf20Sopenharmony_cistruct hpi_nvmemory_msg {
8948c2ecf20Sopenharmony_ci	u16 address;
8958c2ecf20Sopenharmony_ci	u16 data;
8968c2ecf20Sopenharmony_ci};
8978c2ecf20Sopenharmony_ci
8988c2ecf20Sopenharmony_cistruct hpi_nvmemory_res {
8998c2ecf20Sopenharmony_ci	u16 size_in_bytes;
9008c2ecf20Sopenharmony_ci	u16 data;
9018c2ecf20Sopenharmony_ci};
9028c2ecf20Sopenharmony_ci
9038c2ecf20Sopenharmony_cistruct hpi_gpio_msg {
9048c2ecf20Sopenharmony_ci	u16 bit_index;
9058c2ecf20Sopenharmony_ci	u16 bit_data;
9068c2ecf20Sopenharmony_ci};
9078c2ecf20Sopenharmony_ci
9088c2ecf20Sopenharmony_cistruct hpi_gpio_res {
9098c2ecf20Sopenharmony_ci	u16 number_input_bits;
9108c2ecf20Sopenharmony_ci	u16 number_output_bits;
9118c2ecf20Sopenharmony_ci	u16 bit_data[4];
9128c2ecf20Sopenharmony_ci};
9138c2ecf20Sopenharmony_ci
9148c2ecf20Sopenharmony_cistruct hpi_async_msg {
9158c2ecf20Sopenharmony_ci	u32 events;
9168c2ecf20Sopenharmony_ci	u16 maximum_events;
9178c2ecf20Sopenharmony_ci	u16 padding;
9188c2ecf20Sopenharmony_ci};
9198c2ecf20Sopenharmony_ci
9208c2ecf20Sopenharmony_cistruct hpi_async_res {
9218c2ecf20Sopenharmony_ci	union {
9228c2ecf20Sopenharmony_ci		struct {
9238c2ecf20Sopenharmony_ci			u16 count;
9248c2ecf20Sopenharmony_ci		} count;
9258c2ecf20Sopenharmony_ci		struct {
9268c2ecf20Sopenharmony_ci			u32 events;
9278c2ecf20Sopenharmony_ci			u16 number_returned;
9288c2ecf20Sopenharmony_ci			u16 padding;
9298c2ecf20Sopenharmony_ci		} get;
9308c2ecf20Sopenharmony_ci		struct hpi_async_event event;
9318c2ecf20Sopenharmony_ci	} u;
9328c2ecf20Sopenharmony_ci};
9338c2ecf20Sopenharmony_ci
9348c2ecf20Sopenharmony_cistruct hpi_watchdog_msg {
9358c2ecf20Sopenharmony_ci	u32 time_ms;
9368c2ecf20Sopenharmony_ci};
9378c2ecf20Sopenharmony_ci
9388c2ecf20Sopenharmony_cistruct hpi_watchdog_res {
9398c2ecf20Sopenharmony_ci	u32 time_ms;
9408c2ecf20Sopenharmony_ci};
9418c2ecf20Sopenharmony_ci
9428c2ecf20Sopenharmony_cistruct hpi_clock_msg {
9438c2ecf20Sopenharmony_ci	u16 hours;
9448c2ecf20Sopenharmony_ci	u16 minutes;
9458c2ecf20Sopenharmony_ci	u16 seconds;
9468c2ecf20Sopenharmony_ci	u16 milli_seconds;
9478c2ecf20Sopenharmony_ci};
9488c2ecf20Sopenharmony_ci
9498c2ecf20Sopenharmony_cistruct hpi_clock_res {
9508c2ecf20Sopenharmony_ci	u16 size_in_bytes;
9518c2ecf20Sopenharmony_ci	u16 hours;
9528c2ecf20Sopenharmony_ci	u16 minutes;
9538c2ecf20Sopenharmony_ci	u16 seconds;
9548c2ecf20Sopenharmony_ci	u16 milli_seconds;
9558c2ecf20Sopenharmony_ci	u16 padding;
9568c2ecf20Sopenharmony_ci};
9578c2ecf20Sopenharmony_ci
9588c2ecf20Sopenharmony_cistruct hpi_profile_msg {
9598c2ecf20Sopenharmony_ci	u16 bin_index;
9608c2ecf20Sopenharmony_ci	u16 padding;
9618c2ecf20Sopenharmony_ci};
9628c2ecf20Sopenharmony_ci
9638c2ecf20Sopenharmony_cistruct hpi_profile_res_open {
9648c2ecf20Sopenharmony_ci	u16 max_profiles;
9658c2ecf20Sopenharmony_ci};
9668c2ecf20Sopenharmony_ci
9678c2ecf20Sopenharmony_cistruct hpi_profile_res_time {
9688c2ecf20Sopenharmony_ci	u32 total_tick_count;
9698c2ecf20Sopenharmony_ci	u32 call_count;
9708c2ecf20Sopenharmony_ci	u32 max_tick_count;
9718c2ecf20Sopenharmony_ci	u32 ticks_per_millisecond;
9728c2ecf20Sopenharmony_ci	u16 profile_interval;
9738c2ecf20Sopenharmony_ci};
9748c2ecf20Sopenharmony_ci
9758c2ecf20Sopenharmony_cistruct hpi_profile_res_name {
9768c2ecf20Sopenharmony_ci	u8 sz_name[32];
9778c2ecf20Sopenharmony_ci};
9788c2ecf20Sopenharmony_ci
9798c2ecf20Sopenharmony_cistruct hpi_profile_res {
9808c2ecf20Sopenharmony_ci	union {
9818c2ecf20Sopenharmony_ci		struct hpi_profile_res_open o;
9828c2ecf20Sopenharmony_ci		struct hpi_profile_res_time t;
9838c2ecf20Sopenharmony_ci		struct hpi_profile_res_name n;
9848c2ecf20Sopenharmony_ci	} u;
9858c2ecf20Sopenharmony_ci};
9868c2ecf20Sopenharmony_ci
9878c2ecf20Sopenharmony_cistruct hpi_message_header {
9888c2ecf20Sopenharmony_ci	u16 size;		/* total size in bytes */
9898c2ecf20Sopenharmony_ci	u8 type;		/* HPI_TYPE_MESSAGE  */
9908c2ecf20Sopenharmony_ci	u8 version;		/* message version */
9918c2ecf20Sopenharmony_ci	u16 object;		/* HPI_OBJ_* */
9928c2ecf20Sopenharmony_ci	u16 function;		/* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
9938c2ecf20Sopenharmony_ci	u16 adapter_index;	/* the adapter index */
9948c2ecf20Sopenharmony_ci	u16 obj_index;		/* */
9958c2ecf20Sopenharmony_ci};
9968c2ecf20Sopenharmony_ci
9978c2ecf20Sopenharmony_cistruct hpi_message {
9988c2ecf20Sopenharmony_ci	/* following fields must match HPI_MESSAGE_HEADER */
9998c2ecf20Sopenharmony_ci	u16 size;		/* total size in bytes */
10008c2ecf20Sopenharmony_ci	u8 type;		/* HPI_TYPE_MESSAGE  */
10018c2ecf20Sopenharmony_ci	u8 version;		/* message version */
10028c2ecf20Sopenharmony_ci	u16 object;		/* HPI_OBJ_* */
10038c2ecf20Sopenharmony_ci	u16 function;		/* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
10048c2ecf20Sopenharmony_ci	u16 adapter_index;	/* the adapter index */
10058c2ecf20Sopenharmony_ci	u16 obj_index;		/*  */
10068c2ecf20Sopenharmony_ci	union {
10078c2ecf20Sopenharmony_ci		struct hpi_subsys_msg s;
10088c2ecf20Sopenharmony_ci		union hpi_adapterx_msg ax;
10098c2ecf20Sopenharmony_ci		struct hpi_stream_msg d;
10108c2ecf20Sopenharmony_ci		struct hpi_mixer_msg m;
10118c2ecf20Sopenharmony_ci		union hpi_mixerx_msg mx;	/* extended mixer; */
10128c2ecf20Sopenharmony_ci		struct hpi_control_msg c;	/* mixer control; */
10138c2ecf20Sopenharmony_ci		/* identical to struct hpi_control_msg,
10148c2ecf20Sopenharmony_ci		   but field naming is improved */
10158c2ecf20Sopenharmony_ci		struct hpi_control_union_msg cu;
10168c2ecf20Sopenharmony_ci		struct hpi_nvmemory_msg n;
10178c2ecf20Sopenharmony_ci		struct hpi_gpio_msg l;	/* digital i/o */
10188c2ecf20Sopenharmony_ci		struct hpi_watchdog_msg w;
10198c2ecf20Sopenharmony_ci		struct hpi_clock_msg t;	/* dsp time */
10208c2ecf20Sopenharmony_ci		struct hpi_profile_msg p;
10218c2ecf20Sopenharmony_ci		struct hpi_async_msg as;
10228c2ecf20Sopenharmony_ci		char fixed_size[32];
10238c2ecf20Sopenharmony_ci	} u;
10248c2ecf20Sopenharmony_ci};
10258c2ecf20Sopenharmony_ci
10268c2ecf20Sopenharmony_ci#define HPI_MESSAGE_SIZE_BY_OBJECT { \
10278c2ecf20Sopenharmony_ci	sizeof(struct hpi_message_header) ,   /* Default, no object type 0 */ \
10288c2ecf20Sopenharmony_ci	sizeof(struct hpi_message_header) + sizeof(struct hpi_subsys_msg),\
10298c2ecf20Sopenharmony_ci	sizeof(struct hpi_message_header) + sizeof(union hpi_adapterx_msg),\
10308c2ecf20Sopenharmony_ci	sizeof(struct hpi_message_header) + sizeof(struct hpi_stream_msg),\
10318c2ecf20Sopenharmony_ci	sizeof(struct hpi_message_header) + sizeof(struct hpi_stream_msg),\
10328c2ecf20Sopenharmony_ci	sizeof(struct hpi_message_header) + sizeof(struct hpi_mixer_msg),\
10338c2ecf20Sopenharmony_ci	sizeof(struct hpi_message_header) ,   /* no node message */ \
10348c2ecf20Sopenharmony_ci	sizeof(struct hpi_message_header) + sizeof(struct hpi_control_msg),\
10358c2ecf20Sopenharmony_ci	sizeof(struct hpi_message_header) + sizeof(struct hpi_nvmemory_msg),\
10368c2ecf20Sopenharmony_ci	sizeof(struct hpi_message_header) + sizeof(struct hpi_gpio_msg),\
10378c2ecf20Sopenharmony_ci	sizeof(struct hpi_message_header) + sizeof(struct hpi_watchdog_msg),\
10388c2ecf20Sopenharmony_ci	sizeof(struct hpi_message_header) + sizeof(struct hpi_clock_msg),\
10398c2ecf20Sopenharmony_ci	sizeof(struct hpi_message_header) + sizeof(struct hpi_profile_msg),\
10408c2ecf20Sopenharmony_ci	sizeof(struct hpi_message_header), /* controlx obj removed */ \
10418c2ecf20Sopenharmony_ci	sizeof(struct hpi_message_header) + sizeof(struct hpi_async_msg) \
10428c2ecf20Sopenharmony_ci}
10438c2ecf20Sopenharmony_ci
10448c2ecf20Sopenharmony_ci/*
10458c2ecf20Sopenharmony_ciNote that the wSpecificError error field should be inspected and potentially
10468c2ecf20Sopenharmony_cireported whenever HPI_ERROR_DSP_COMMUNICATION or HPI_ERROR_DSP_BOOTLOAD is
10478c2ecf20Sopenharmony_cireturned in wError.
10488c2ecf20Sopenharmony_ci*/
10498c2ecf20Sopenharmony_cistruct hpi_response_header {
10508c2ecf20Sopenharmony_ci	u16 size;
10518c2ecf20Sopenharmony_ci	u8 type;		/* HPI_TYPE_RESPONSE  */
10528c2ecf20Sopenharmony_ci	u8 version;		/* response version */
10538c2ecf20Sopenharmony_ci	u16 object;		/* HPI_OBJ_* */
10548c2ecf20Sopenharmony_ci	u16 function;		/* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
10558c2ecf20Sopenharmony_ci	u16 error;		/* HPI_ERROR_xxx */
10568c2ecf20Sopenharmony_ci	u16 specific_error;	/* adapter specific error */
10578c2ecf20Sopenharmony_ci};
10588c2ecf20Sopenharmony_ci
10598c2ecf20Sopenharmony_cistruct hpi_response {
10608c2ecf20Sopenharmony_ci/* following fields must match HPI_RESPONSE_HEADER */
10618c2ecf20Sopenharmony_ci	u16 size;
10628c2ecf20Sopenharmony_ci	u8 type;		/* HPI_TYPE_RESPONSE  */
10638c2ecf20Sopenharmony_ci	u8 version;		/* response version */
10648c2ecf20Sopenharmony_ci	u16 object;		/* HPI_OBJ_* */
10658c2ecf20Sopenharmony_ci	u16 function;		/* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
10668c2ecf20Sopenharmony_ci	u16 error;		/* HPI_ERROR_xxx */
10678c2ecf20Sopenharmony_ci	u16 specific_error;	/* adapter specific error */
10688c2ecf20Sopenharmony_ci	union {
10698c2ecf20Sopenharmony_ci		struct hpi_subsys_res s;
10708c2ecf20Sopenharmony_ci		union hpi_adapterx_res ax;
10718c2ecf20Sopenharmony_ci		struct hpi_stream_res d;
10728c2ecf20Sopenharmony_ci		struct hpi_mixer_res m;
10738c2ecf20Sopenharmony_ci		union hpi_mixerx_res mx;	/* extended mixer; */
10748c2ecf20Sopenharmony_ci		struct hpi_control_res c;	/* mixer control; */
10758c2ecf20Sopenharmony_ci		/* identical to hpi_control_res, but field naming is improved */
10768c2ecf20Sopenharmony_ci		union hpi_control_union_res cu;
10778c2ecf20Sopenharmony_ci		struct hpi_nvmemory_res n;
10788c2ecf20Sopenharmony_ci		struct hpi_gpio_res l;	/* digital i/o */
10798c2ecf20Sopenharmony_ci		struct hpi_watchdog_res w;
10808c2ecf20Sopenharmony_ci		struct hpi_clock_res t;	/* dsp time */
10818c2ecf20Sopenharmony_ci		struct hpi_profile_res p;
10828c2ecf20Sopenharmony_ci		struct hpi_async_res as;
10838c2ecf20Sopenharmony_ci		u8 bytes[52];
10848c2ecf20Sopenharmony_ci	} u;
10858c2ecf20Sopenharmony_ci};
10868c2ecf20Sopenharmony_ci
10878c2ecf20Sopenharmony_ci#define HPI_RESPONSE_SIZE_BY_OBJECT { \
10888c2ecf20Sopenharmony_ci	sizeof(struct hpi_response_header) ,/* Default, no object type 0 */ \
10898c2ecf20Sopenharmony_ci	sizeof(struct hpi_response_header) + sizeof(struct hpi_subsys_res),\
10908c2ecf20Sopenharmony_ci	sizeof(struct hpi_response_header) + sizeof(union  hpi_adapterx_res),\
10918c2ecf20Sopenharmony_ci	sizeof(struct hpi_response_header) + sizeof(struct hpi_stream_res),\
10928c2ecf20Sopenharmony_ci	sizeof(struct hpi_response_header) + sizeof(struct hpi_stream_res),\
10938c2ecf20Sopenharmony_ci	sizeof(struct hpi_response_header) + sizeof(struct hpi_mixer_res),\
10948c2ecf20Sopenharmony_ci	sizeof(struct hpi_response_header) , /* no node response */ \
10958c2ecf20Sopenharmony_ci	sizeof(struct hpi_response_header) + sizeof(struct hpi_control_res),\
10968c2ecf20Sopenharmony_ci	sizeof(struct hpi_response_header) + sizeof(struct hpi_nvmemory_res),\
10978c2ecf20Sopenharmony_ci	sizeof(struct hpi_response_header) + sizeof(struct hpi_gpio_res),\
10988c2ecf20Sopenharmony_ci	sizeof(struct hpi_response_header) + sizeof(struct hpi_watchdog_res),\
10998c2ecf20Sopenharmony_ci	sizeof(struct hpi_response_header) + sizeof(struct hpi_clock_res),\
11008c2ecf20Sopenharmony_ci	sizeof(struct hpi_response_header) + sizeof(struct hpi_profile_res),\
11018c2ecf20Sopenharmony_ci	sizeof(struct hpi_response_header), /* controlx obj removed */ \
11028c2ecf20Sopenharmony_ci	sizeof(struct hpi_response_header) + sizeof(struct hpi_async_res) \
11038c2ecf20Sopenharmony_ci}
11048c2ecf20Sopenharmony_ci
11058c2ecf20Sopenharmony_ci/*********************** version 1 message/response **************************/
11068c2ecf20Sopenharmony_ci#define HPINET_ETHERNET_DATA_SIZE (1500)
11078c2ecf20Sopenharmony_ci#define HPINET_IP_HDR_SIZE (20)
11088c2ecf20Sopenharmony_ci#define HPINET_IP_DATA_SIZE (HPINET_ETHERNET_DATA_SIZE - HPINET_IP_HDR_SIZE)
11098c2ecf20Sopenharmony_ci#define HPINET_UDP_HDR_SIZE (8)
11108c2ecf20Sopenharmony_ci#define HPINET_UDP_DATA_SIZE (HPINET_IP_DATA_SIZE - HPINET_UDP_HDR_SIZE)
11118c2ecf20Sopenharmony_ci#define HPINET_ASI_HDR_SIZE (2)
11128c2ecf20Sopenharmony_ci#define HPINET_ASI_DATA_SIZE (HPINET_UDP_DATA_SIZE - HPINET_ASI_HDR_SIZE)
11138c2ecf20Sopenharmony_ci
11148c2ecf20Sopenharmony_ci#define HPI_MAX_PAYLOAD_SIZE (HPINET_ASI_DATA_SIZE - 2)
11158c2ecf20Sopenharmony_ci
11168c2ecf20Sopenharmony_ci/* New style message/response, but still V0 compatible */
11178c2ecf20Sopenharmony_cistruct hpi_msg_adapter_get_info {
11188c2ecf20Sopenharmony_ci	struct hpi_message_header h;
11198c2ecf20Sopenharmony_ci};
11208c2ecf20Sopenharmony_ci
11218c2ecf20Sopenharmony_cistruct hpi_res_adapter_get_info {
11228c2ecf20Sopenharmony_ci	struct hpi_response_header h;	/*v0 */
11238c2ecf20Sopenharmony_ci	struct hpi_adapter_res p;
11248c2ecf20Sopenharmony_ci};
11258c2ecf20Sopenharmony_ci
11268c2ecf20Sopenharmony_cistruct hpi_res_adapter_debug_read {
11278c2ecf20Sopenharmony_ci	struct hpi_response_header h;
11288c2ecf20Sopenharmony_ci	u8 bytes[1024];
11298c2ecf20Sopenharmony_ci};
11308c2ecf20Sopenharmony_ci
11318c2ecf20Sopenharmony_cistruct hpi_msg_cobranet_hmi {
11328c2ecf20Sopenharmony_ci	u16 attribute;
11338c2ecf20Sopenharmony_ci	u16 padding;
11348c2ecf20Sopenharmony_ci	u32 hmi_address;
11358c2ecf20Sopenharmony_ci	u32 byte_count;
11368c2ecf20Sopenharmony_ci};
11378c2ecf20Sopenharmony_ci
11388c2ecf20Sopenharmony_cistruct hpi_msg_cobranet_hmiwrite {
11398c2ecf20Sopenharmony_ci	struct hpi_message_header h;
11408c2ecf20Sopenharmony_ci	struct hpi_msg_cobranet_hmi p;
11418c2ecf20Sopenharmony_ci	u8 bytes[256];
11428c2ecf20Sopenharmony_ci};
11438c2ecf20Sopenharmony_ci
11448c2ecf20Sopenharmony_cistruct hpi_msg_cobranet_hmiread {
11458c2ecf20Sopenharmony_ci	struct hpi_message_header h;
11468c2ecf20Sopenharmony_ci	struct hpi_msg_cobranet_hmi p;
11478c2ecf20Sopenharmony_ci};
11488c2ecf20Sopenharmony_ci
11498c2ecf20Sopenharmony_cistruct hpi_res_cobranet_hmiread {
11508c2ecf20Sopenharmony_ci	struct hpi_response_header h;
11518c2ecf20Sopenharmony_ci	u32 byte_count;
11528c2ecf20Sopenharmony_ci	u8 bytes[256];
11538c2ecf20Sopenharmony_ci};
11548c2ecf20Sopenharmony_ci
11558c2ecf20Sopenharmony_ci#if 1
11568c2ecf20Sopenharmony_ci#define hpi_message_header_v1 hpi_message_header
11578c2ecf20Sopenharmony_ci#define hpi_response_header_v1 hpi_response_header
11588c2ecf20Sopenharmony_ci#else
11598c2ecf20Sopenharmony_ci/* V1 headers in Addition to v0 headers */
11608c2ecf20Sopenharmony_cistruct hpi_message_header_v1 {
11618c2ecf20Sopenharmony_ci	struct hpi_message_header h0;
11628c2ecf20Sopenharmony_ci/* struct {
11638c2ecf20Sopenharmony_ci} h1; */
11648c2ecf20Sopenharmony_ci};
11658c2ecf20Sopenharmony_ci
11668c2ecf20Sopenharmony_cistruct hpi_response_header_v1 {
11678c2ecf20Sopenharmony_ci	struct hpi_response_header h0;
11688c2ecf20Sopenharmony_ci	struct {
11698c2ecf20Sopenharmony_ci		u16 adapter_index;	/* the adapter index */
11708c2ecf20Sopenharmony_ci		u16 obj_index;	/* object index */
11718c2ecf20Sopenharmony_ci	} h1;
11728c2ecf20Sopenharmony_ci};
11738c2ecf20Sopenharmony_ci#endif
11748c2ecf20Sopenharmony_ci
11758c2ecf20Sopenharmony_cistruct hpi_msg_payload_v0 {
11768c2ecf20Sopenharmony_ci	struct hpi_message_header h;
11778c2ecf20Sopenharmony_ci	union {
11788c2ecf20Sopenharmony_ci		struct hpi_subsys_msg s;
11798c2ecf20Sopenharmony_ci		union hpi_adapterx_msg ax;
11808c2ecf20Sopenharmony_ci		struct hpi_stream_msg d;
11818c2ecf20Sopenharmony_ci		struct hpi_mixer_msg m;
11828c2ecf20Sopenharmony_ci		union hpi_mixerx_msg mx;
11838c2ecf20Sopenharmony_ci		struct hpi_control_msg c;
11848c2ecf20Sopenharmony_ci		struct hpi_control_union_msg cu;
11858c2ecf20Sopenharmony_ci		struct hpi_nvmemory_msg n;
11868c2ecf20Sopenharmony_ci		struct hpi_gpio_msg l;
11878c2ecf20Sopenharmony_ci		struct hpi_watchdog_msg w;
11888c2ecf20Sopenharmony_ci		struct hpi_clock_msg t;
11898c2ecf20Sopenharmony_ci		struct hpi_profile_msg p;
11908c2ecf20Sopenharmony_ci		struct hpi_async_msg as;
11918c2ecf20Sopenharmony_ci	} u;
11928c2ecf20Sopenharmony_ci};
11938c2ecf20Sopenharmony_ci
11948c2ecf20Sopenharmony_cistruct hpi_res_payload_v0 {
11958c2ecf20Sopenharmony_ci	struct hpi_response_header h;
11968c2ecf20Sopenharmony_ci	union {
11978c2ecf20Sopenharmony_ci		struct hpi_subsys_res s;
11988c2ecf20Sopenharmony_ci		union hpi_adapterx_res ax;
11998c2ecf20Sopenharmony_ci		struct hpi_stream_res d;
12008c2ecf20Sopenharmony_ci		struct hpi_mixer_res m;
12018c2ecf20Sopenharmony_ci		union hpi_mixerx_res mx;
12028c2ecf20Sopenharmony_ci		struct hpi_control_res c;
12038c2ecf20Sopenharmony_ci		union hpi_control_union_res cu;
12048c2ecf20Sopenharmony_ci		struct hpi_nvmemory_res n;
12058c2ecf20Sopenharmony_ci		struct hpi_gpio_res l;
12068c2ecf20Sopenharmony_ci		struct hpi_watchdog_res w;
12078c2ecf20Sopenharmony_ci		struct hpi_clock_res t;
12088c2ecf20Sopenharmony_ci		struct hpi_profile_res p;
12098c2ecf20Sopenharmony_ci		struct hpi_async_res as;
12108c2ecf20Sopenharmony_ci	} u;
12118c2ecf20Sopenharmony_ci};
12128c2ecf20Sopenharmony_ci
12138c2ecf20Sopenharmony_ciunion hpi_message_buffer_v1 {
12148c2ecf20Sopenharmony_ci	struct hpi_message m0;	/* version 0 */
12158c2ecf20Sopenharmony_ci	struct hpi_message_header_v1 h;
12168c2ecf20Sopenharmony_ci	u8 buf[HPI_MAX_PAYLOAD_SIZE];
12178c2ecf20Sopenharmony_ci};
12188c2ecf20Sopenharmony_ci
12198c2ecf20Sopenharmony_ciunion hpi_response_buffer_v1 {
12208c2ecf20Sopenharmony_ci	struct hpi_response r0;	/* version 0 */
12218c2ecf20Sopenharmony_ci	struct hpi_response_header_v1 h;
12228c2ecf20Sopenharmony_ci	u8 buf[HPI_MAX_PAYLOAD_SIZE];
12238c2ecf20Sopenharmony_ci};
12248c2ecf20Sopenharmony_ci
12258c2ecf20Sopenharmony_cicompile_time_assert((sizeof(union hpi_message_buffer_v1) <=
12268c2ecf20Sopenharmony_ci		HPI_MAX_PAYLOAD_SIZE), message_buffer_ok);
12278c2ecf20Sopenharmony_cicompile_time_assert((sizeof(union hpi_response_buffer_v1) <=
12288c2ecf20Sopenharmony_ci		HPI_MAX_PAYLOAD_SIZE), response_buffer_ok);
12298c2ecf20Sopenharmony_ci
12308c2ecf20Sopenharmony_ci/*////////////////////////////////////////////////////////////////////////// */
12318c2ecf20Sopenharmony_ci/* declarations for compact control calls  */
12328c2ecf20Sopenharmony_cistruct hpi_control_defn {
12338c2ecf20Sopenharmony_ci	u8 type;
12348c2ecf20Sopenharmony_ci	u8 channels;
12358c2ecf20Sopenharmony_ci	u8 src_node_type;
12368c2ecf20Sopenharmony_ci	u8 src_node_index;
12378c2ecf20Sopenharmony_ci	u8 dest_node_type;
12388c2ecf20Sopenharmony_ci	u8 dest_node_index;
12398c2ecf20Sopenharmony_ci};
12408c2ecf20Sopenharmony_ci
12418c2ecf20Sopenharmony_ci/*////////////////////////////////////////////////////////////////////////// */
12428c2ecf20Sopenharmony_ci/* declarations for control caching (internal to HPI<->DSP interaction)      */
12438c2ecf20Sopenharmony_ci
12448c2ecf20Sopenharmony_ci/** indicates a cached u16 value is invalid. */
12458c2ecf20Sopenharmony_ci#define HPI_CACHE_INVALID_UINT16 0xFFFF
12468c2ecf20Sopenharmony_ci/** indicates a cached short value is invalid. */
12478c2ecf20Sopenharmony_ci#define HPI_CACHE_INVALID_SHORT -32768
12488c2ecf20Sopenharmony_ci
12498c2ecf20Sopenharmony_ci/** A compact representation of (part of) a controls state.
12508c2ecf20Sopenharmony_ciUsed for efficient transfer of the control state
12518c2ecf20Sopenharmony_cibetween DSP and host or across a network
12528c2ecf20Sopenharmony_ci*/
12538c2ecf20Sopenharmony_cistruct hpi_control_cache_info {
12548c2ecf20Sopenharmony_ci	/** one of HPI_CONTROL_* */
12558c2ecf20Sopenharmony_ci	u8 control_type;
12568c2ecf20Sopenharmony_ci	/** The total size of cached information in 32-bit words. */
12578c2ecf20Sopenharmony_ci	u8 size_in32bit_words;
12588c2ecf20Sopenharmony_ci	/** The original index of the control on the DSP */
12598c2ecf20Sopenharmony_ci	u16 control_index;
12608c2ecf20Sopenharmony_ci};
12618c2ecf20Sopenharmony_ci
12628c2ecf20Sopenharmony_cistruct hpi_control_cache_vol {
12638c2ecf20Sopenharmony_ci	struct hpi_control_cache_info i;
12648c2ecf20Sopenharmony_ci	short an_log[2];
12658c2ecf20Sopenharmony_ci	unsigned short flags;
12668c2ecf20Sopenharmony_ci	char padding[2];
12678c2ecf20Sopenharmony_ci};
12688c2ecf20Sopenharmony_ci
12698c2ecf20Sopenharmony_cistruct hpi_control_cache_meter {
12708c2ecf20Sopenharmony_ci	struct hpi_control_cache_info i;
12718c2ecf20Sopenharmony_ci	short an_log_peak[2];
12728c2ecf20Sopenharmony_ci	short an_logRMS[2];
12738c2ecf20Sopenharmony_ci};
12748c2ecf20Sopenharmony_ci
12758c2ecf20Sopenharmony_cistruct hpi_control_cache_channelmode {
12768c2ecf20Sopenharmony_ci	struct hpi_control_cache_info i;
12778c2ecf20Sopenharmony_ci	u16 mode;
12788c2ecf20Sopenharmony_ci	char temp_padding[6];
12798c2ecf20Sopenharmony_ci};
12808c2ecf20Sopenharmony_ci
12818c2ecf20Sopenharmony_cistruct hpi_control_cache_mux {
12828c2ecf20Sopenharmony_ci	struct hpi_control_cache_info i;
12838c2ecf20Sopenharmony_ci	u16 source_node_type;
12848c2ecf20Sopenharmony_ci	u16 source_node_index;
12858c2ecf20Sopenharmony_ci	char temp_padding[4];
12868c2ecf20Sopenharmony_ci};
12878c2ecf20Sopenharmony_ci
12888c2ecf20Sopenharmony_cistruct hpi_control_cache_level {
12898c2ecf20Sopenharmony_ci	struct hpi_control_cache_info i;
12908c2ecf20Sopenharmony_ci	short an_log[2];
12918c2ecf20Sopenharmony_ci	char temp_padding[4];
12928c2ecf20Sopenharmony_ci};
12938c2ecf20Sopenharmony_ci
12948c2ecf20Sopenharmony_cistruct hpi_control_cache_tuner {
12958c2ecf20Sopenharmony_ci	struct hpi_control_cache_info i;
12968c2ecf20Sopenharmony_ci	u32 freq_ink_hz;
12978c2ecf20Sopenharmony_ci	u16 band;
12988c2ecf20Sopenharmony_ci	short s_level_avg;
12998c2ecf20Sopenharmony_ci};
13008c2ecf20Sopenharmony_ci
13018c2ecf20Sopenharmony_cistruct hpi_control_cache_aes3rx {
13028c2ecf20Sopenharmony_ci	struct hpi_control_cache_info i;
13038c2ecf20Sopenharmony_ci	u32 error_status;
13048c2ecf20Sopenharmony_ci	u32 format;
13058c2ecf20Sopenharmony_ci};
13068c2ecf20Sopenharmony_ci
13078c2ecf20Sopenharmony_cistruct hpi_control_cache_aes3tx {
13088c2ecf20Sopenharmony_ci	struct hpi_control_cache_info i;
13098c2ecf20Sopenharmony_ci	u32 format;
13108c2ecf20Sopenharmony_ci	char temp_padding[4];
13118c2ecf20Sopenharmony_ci};
13128c2ecf20Sopenharmony_ci
13138c2ecf20Sopenharmony_cistruct hpi_control_cache_tonedetector {
13148c2ecf20Sopenharmony_ci	struct hpi_control_cache_info i;
13158c2ecf20Sopenharmony_ci	u16 state;
13168c2ecf20Sopenharmony_ci	char temp_padding[6];
13178c2ecf20Sopenharmony_ci};
13188c2ecf20Sopenharmony_ci
13198c2ecf20Sopenharmony_cistruct hpi_control_cache_silencedetector {
13208c2ecf20Sopenharmony_ci	struct hpi_control_cache_info i;
13218c2ecf20Sopenharmony_ci	u32 state;
13228c2ecf20Sopenharmony_ci	char temp_padding[4];
13238c2ecf20Sopenharmony_ci};
13248c2ecf20Sopenharmony_ci
13258c2ecf20Sopenharmony_cistruct hpi_control_cache_sampleclock {
13268c2ecf20Sopenharmony_ci	struct hpi_control_cache_info i;
13278c2ecf20Sopenharmony_ci	u16 source;
13288c2ecf20Sopenharmony_ci	u16 source_index;
13298c2ecf20Sopenharmony_ci	u32 sample_rate;
13308c2ecf20Sopenharmony_ci};
13318c2ecf20Sopenharmony_ci
13328c2ecf20Sopenharmony_cistruct hpi_control_cache_microphone {
13338c2ecf20Sopenharmony_ci	struct hpi_control_cache_info i;
13348c2ecf20Sopenharmony_ci	u16 phantom_state;
13358c2ecf20Sopenharmony_ci	char temp_padding[6];
13368c2ecf20Sopenharmony_ci};
13378c2ecf20Sopenharmony_ci
13388c2ecf20Sopenharmony_cistruct hpi_control_cache_single {
13398c2ecf20Sopenharmony_ci	union {
13408c2ecf20Sopenharmony_ci		struct hpi_control_cache_info i;
13418c2ecf20Sopenharmony_ci		struct hpi_control_cache_vol vol;
13428c2ecf20Sopenharmony_ci		struct hpi_control_cache_meter meter;
13438c2ecf20Sopenharmony_ci		struct hpi_control_cache_channelmode mode;
13448c2ecf20Sopenharmony_ci		struct hpi_control_cache_mux mux;
13458c2ecf20Sopenharmony_ci		struct hpi_control_cache_level level;
13468c2ecf20Sopenharmony_ci		struct hpi_control_cache_tuner tuner;
13478c2ecf20Sopenharmony_ci		struct hpi_control_cache_aes3rx aes3rx;
13488c2ecf20Sopenharmony_ci		struct hpi_control_cache_aes3tx aes3tx;
13498c2ecf20Sopenharmony_ci		struct hpi_control_cache_tonedetector tone;
13508c2ecf20Sopenharmony_ci		struct hpi_control_cache_silencedetector silence;
13518c2ecf20Sopenharmony_ci		struct hpi_control_cache_sampleclock clk;
13528c2ecf20Sopenharmony_ci		struct hpi_control_cache_microphone microphone;
13538c2ecf20Sopenharmony_ci	} u;
13548c2ecf20Sopenharmony_ci};
13558c2ecf20Sopenharmony_ci
13568c2ecf20Sopenharmony_cistruct hpi_control_cache_pad {
13578c2ecf20Sopenharmony_ci	struct hpi_control_cache_info i;
13588c2ecf20Sopenharmony_ci	u32 field_valid_flags;
13598c2ecf20Sopenharmony_ci	u8 c_channel[40];
13608c2ecf20Sopenharmony_ci	u8 c_artist[100];
13618c2ecf20Sopenharmony_ci	u8 c_title[100];
13628c2ecf20Sopenharmony_ci	u8 c_comment[200];
13638c2ecf20Sopenharmony_ci	u32 pTY;
13648c2ecf20Sopenharmony_ci	u32 pI;
13658c2ecf20Sopenharmony_ci	u32 traffic_supported;
13668c2ecf20Sopenharmony_ci	u32 traffic_anouncement;
13678c2ecf20Sopenharmony_ci};
13688c2ecf20Sopenharmony_ci
13698c2ecf20Sopenharmony_ci/* 2^N sized FIFO buffer (internal to HPI<->DSP interaction) */
13708c2ecf20Sopenharmony_cistruct hpi_fifo_buffer {
13718c2ecf20Sopenharmony_ci	u32 size;
13728c2ecf20Sopenharmony_ci	u32 dsp_index;
13738c2ecf20Sopenharmony_ci	u32 host_index;
13748c2ecf20Sopenharmony_ci};
13758c2ecf20Sopenharmony_ci
13768c2ecf20Sopenharmony_ci#ifndef DISABLE_PRAGMA_PACK1
13778c2ecf20Sopenharmony_ci#pragma pack(pop)
13788c2ecf20Sopenharmony_ci#endif
13798c2ecf20Sopenharmony_ci
13808c2ecf20Sopenharmony_ci/* skip host side function declarations for DSP
13818c2ecf20Sopenharmony_ci   compile and documentation extraction */
13828c2ecf20Sopenharmony_ci
13838c2ecf20Sopenharmony_cichar hpi_handle_object(const u32 handle);
13848c2ecf20Sopenharmony_ci
13858c2ecf20Sopenharmony_civoid hpi_handle_to_indexes(const u32 handle, u16 *pw_adapter_index,
13868c2ecf20Sopenharmony_ci	u16 *pw_object_index);
13878c2ecf20Sopenharmony_ci
13888c2ecf20Sopenharmony_ciu32 hpi_indexes_to_handle(const char c_object, const u16 adapter_index,
13898c2ecf20Sopenharmony_ci	const u16 object_index);
13908c2ecf20Sopenharmony_ci
13918c2ecf20Sopenharmony_ci/*////////////////////////////////////////////////////////////////////////// */
13928c2ecf20Sopenharmony_ci
13938c2ecf20Sopenharmony_ci/* main HPI entry point */
13948c2ecf20Sopenharmony_civoid hpi_send_recv(struct hpi_message *phm, struct hpi_response *phr);
13958c2ecf20Sopenharmony_ci
13968c2ecf20Sopenharmony_ci/* used in PnP OS/driver */
13978c2ecf20Sopenharmony_ciu16 hpi_subsys_create_adapter(const struct hpi_resource *p_resource,
13988c2ecf20Sopenharmony_ci	u16 *pw_adapter_index);
13998c2ecf20Sopenharmony_ci
14008c2ecf20Sopenharmony_ciu16 hpi_outstream_host_buffer_get_info(u32 h_outstream, u8 **pp_buffer,
14018c2ecf20Sopenharmony_ci	struct hpi_hostbuffer_status **pp_status);
14028c2ecf20Sopenharmony_ci
14038c2ecf20Sopenharmony_ciu16 hpi_instream_host_buffer_get_info(u32 h_instream, u8 **pp_buffer,
14048c2ecf20Sopenharmony_ci	struct hpi_hostbuffer_status **pp_status);
14058c2ecf20Sopenharmony_ci
14068c2ecf20Sopenharmony_ciu16 hpi_adapter_restart(u16 adapter_index);
14078c2ecf20Sopenharmony_ci
14088c2ecf20Sopenharmony_ci/*
14098c2ecf20Sopenharmony_ciThe following 3 functions were last declared in header files for
14108c2ecf20Sopenharmony_cidriver 3.10. HPI_ControlQuery() used to be the recommended way
14118c2ecf20Sopenharmony_ciof getting a volume range. Declared here for binary asihpi32.dll
14128c2ecf20Sopenharmony_cicompatibility.
14138c2ecf20Sopenharmony_ci*/
14148c2ecf20Sopenharmony_ci
14158c2ecf20Sopenharmony_civoid hpi_format_to_msg(struct hpi_msg_format *pMF,
14168c2ecf20Sopenharmony_ci	const struct hpi_format *pF);
14178c2ecf20Sopenharmony_civoid hpi_stream_response_to_legacy(struct hpi_stream_res *pSR);
14188c2ecf20Sopenharmony_ci
14198c2ecf20Sopenharmony_ci/*////////////////////////////////////////////////////////////////////////// */
14208c2ecf20Sopenharmony_ci/* declarations for individual HPI entry points */
14218c2ecf20Sopenharmony_cihpi_handler_func HPI_6000;
14228c2ecf20Sopenharmony_cihpi_handler_func HPI_6205;
14238c2ecf20Sopenharmony_ci
14248c2ecf20Sopenharmony_ci#endif				/* _HPI_INTERNAL_H_ */
1425