162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/******************************************************************************
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci    AudioScience HPI driver
562306a36Sopenharmony_ci    Copyright (C) 1997-2012  AudioScience Inc. <support@audioscience.com>
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci
862306a36Sopenharmony_ciHPI internal definitions
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci(C) Copyright AudioScience Inc. 1996-2009
1162306a36Sopenharmony_ci******************************************************************************/
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#ifndef _HPI_INTERNAL_H_
1462306a36Sopenharmony_ci#define _HPI_INTERNAL_H_
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci#include "hpi.h"
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci/** maximum number of memory regions mapped to an adapter */
1962306a36Sopenharmony_ci#define HPI_MAX_ADAPTER_MEM_SPACES (2)
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci/* Each OS needs its own hpios.h */
2262306a36Sopenharmony_ci#include "hpios.h"
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci/* physical memory allocation */
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci/** Allocate and map an area of locked memory for bus master DMA operations.
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ciOn success, *pLockedMemeHandle is a valid handle, and 0 is returned
2962306a36Sopenharmony_ciOn error *pLockedMemHandle marked invalid, non-zero returned.
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ciIf this function succeeds, then HpiOs_LockedMem_GetVirtAddr() and
3262306a36Sopenharmony_ciHpiOs_LockedMem_GetPyhsAddr() will always succed on the returned handle.
3362306a36Sopenharmony_ci*/
3462306a36Sopenharmony_ciu16 hpios_locked_mem_alloc(struct consistent_dma_area *p_locked_mem_handle,
3562306a36Sopenharmony_ci							   /**< memory handle */
3662306a36Sopenharmony_ci	u32 size, /**< Size in bytes to allocate */
3762306a36Sopenharmony_ci	struct pci_dev *p_os_reference
3862306a36Sopenharmony_ci	/**< OS specific data required for memory allocation */
3962306a36Sopenharmony_ci	);
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci/** Free mapping and memory represented by LockedMemHandle
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ciFrees any resources, then invalidates the handle.
4462306a36Sopenharmony_ciReturns 0 on success, 1 if handle is invalid.
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci*/
4762306a36Sopenharmony_ciu16 hpios_locked_mem_free(struct consistent_dma_area *locked_mem_handle);
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci/** Get the physical PCI address of memory represented by LockedMemHandle.
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ciIf handle is invalid *pPhysicalAddr is set to zero and return 1
5262306a36Sopenharmony_ci*/
5362306a36Sopenharmony_ciu16 hpios_locked_mem_get_phys_addr(struct consistent_dma_area
5462306a36Sopenharmony_ci	*locked_mem_handle, u32 *p_physical_addr);
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ci/** Get the CPU address of memory represented by LockedMemHandle.
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ciIf handle is NULL *ppvVirtualAddr is set to NULL and return 1
5962306a36Sopenharmony_ci*/
6062306a36Sopenharmony_ciu16 hpios_locked_mem_get_virt_addr(struct consistent_dma_area
6162306a36Sopenharmony_ci	*locked_mem_handle, void **ppv_virtual_addr);
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci/** Check that handle is valid
6462306a36Sopenharmony_cii.e it represents a valid memory area
6562306a36Sopenharmony_ci*/
6662306a36Sopenharmony_ciu16 hpios_locked_mem_valid(struct consistent_dma_area *locked_mem_handle);
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ci/* timing/delay */
6962306a36Sopenharmony_civoid hpios_delay_micro_seconds(u32 num_micro_sec);
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_cistruct hpi_message;
7262306a36Sopenharmony_cistruct hpi_response;
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_citypedef void hpi_handler_func(struct hpi_message *, struct hpi_response *);
7562306a36Sopenharmony_ci
7662306a36Sopenharmony_ci/* If the assert fails, compiler complains
7762306a36Sopenharmony_ci   something like size of array `msg' is negative.
7862306a36Sopenharmony_ci   Unlike linux BUILD_BUG_ON, this works outside function scope.
7962306a36Sopenharmony_ci*/
8062306a36Sopenharmony_ci#define compile_time_assert(cond, msg) \
8162306a36Sopenharmony_ci    typedef char ASSERT_##msg[(cond) ? 1 : -1]
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_ci/******************************************* bus types */
8462306a36Sopenharmony_cienum HPI_BUSES {
8562306a36Sopenharmony_ci	HPI_BUS_ISAPNP = 1,
8662306a36Sopenharmony_ci	HPI_BUS_PCI = 2,
8762306a36Sopenharmony_ci	HPI_BUS_USB = 3,
8862306a36Sopenharmony_ci	HPI_BUS_NET = 4
8962306a36Sopenharmony_ci};
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_cienum HPI_SUBSYS_OPTIONS {
9262306a36Sopenharmony_ci	/* 0, 256 are invalid, 1..255 reserved for global options */
9362306a36Sopenharmony_ci	HPI_SUBSYS_OPT_NET_ENABLE = 257,
9462306a36Sopenharmony_ci	HPI_SUBSYS_OPT_NET_BROADCAST = 258,
9562306a36Sopenharmony_ci	HPI_SUBSYS_OPT_NET_UNICAST = 259,
9662306a36Sopenharmony_ci	HPI_SUBSYS_OPT_NET_ADDR = 260,
9762306a36Sopenharmony_ci	HPI_SUBSYS_OPT_NET_MASK = 261,
9862306a36Sopenharmony_ci	HPI_SUBSYS_OPT_NET_ADAPTER_ADDRESS_ADD = 262
9962306a36Sopenharmony_ci};
10062306a36Sopenharmony_ci
10162306a36Sopenharmony_ci/** Volume flags
10262306a36Sopenharmony_ci*/
10362306a36Sopenharmony_cienum HPI_VOLUME_FLAGS {
10462306a36Sopenharmony_ci	/** Set if the volume control is muted */
10562306a36Sopenharmony_ci	HPI_VOLUME_FLAG_MUTED = (1 << 0),
10662306a36Sopenharmony_ci	/** Set if the volume control has a mute function */
10762306a36Sopenharmony_ci	HPI_VOLUME_FLAG_HAS_MUTE = (1 << 1),
10862306a36Sopenharmony_ci	/** Set if volume control can do autofading */
10962306a36Sopenharmony_ci	HPI_VOLUME_FLAG_HAS_AUTOFADE = (1 << 2)
11062306a36Sopenharmony_ci		/* Note Flags >= (1<<8) are for DSP internal use only */
11162306a36Sopenharmony_ci};
11262306a36Sopenharmony_ci
11362306a36Sopenharmony_ci/******************************************* CONTROL ATTRIBUTES ****/
11462306a36Sopenharmony_ci/* (in order of control type ID */
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_ci/* This allows for 255 control types, 256 unique attributes each */
11762306a36Sopenharmony_ci#define HPI_CTL_ATTR(ctl, ai) ((HPI_CONTROL_##ctl << 8) + ai)
11862306a36Sopenharmony_ci
11962306a36Sopenharmony_ci/* Get the sub-index of the attribute for a control type */
12062306a36Sopenharmony_ci#define HPI_CTL_ATTR_INDEX(i) (i & 0xff)
12162306a36Sopenharmony_ci
12262306a36Sopenharmony_ci/* Extract the control from the control attribute */
12362306a36Sopenharmony_ci#define HPI_CTL_ATTR_CONTROL(i) (i >> 8)
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_ci/** Enable event generation for a control.
12662306a36Sopenharmony_ci0=disable, 1=enable
12762306a36Sopenharmony_ci\note generic to all controls that can generate events
12862306a36Sopenharmony_ci*/
12962306a36Sopenharmony_ci
13062306a36Sopenharmony_ci/** Unique identifiers for every control attribute
13162306a36Sopenharmony_ci*/
13262306a36Sopenharmony_cienum HPI_CONTROL_ATTRIBUTES {
13362306a36Sopenharmony_ci	HPI_GENERIC_ENABLE = HPI_CTL_ATTR(GENERIC, 1),
13462306a36Sopenharmony_ci	HPI_GENERIC_EVENT_ENABLE = HPI_CTL_ATTR(GENERIC, 2),
13562306a36Sopenharmony_ci
13662306a36Sopenharmony_ci	HPI_VOLUME_GAIN = HPI_CTL_ATTR(VOLUME, 1),
13762306a36Sopenharmony_ci	HPI_VOLUME_AUTOFADE = HPI_CTL_ATTR(VOLUME, 2),
13862306a36Sopenharmony_ci	HPI_VOLUME_MUTE = HPI_CTL_ATTR(VOLUME, 3),
13962306a36Sopenharmony_ci	HPI_VOLUME_GAIN_AND_FLAGS = HPI_CTL_ATTR(VOLUME, 4),
14062306a36Sopenharmony_ci	HPI_VOLUME_NUM_CHANNELS = HPI_CTL_ATTR(VOLUME, 6),
14162306a36Sopenharmony_ci	HPI_VOLUME_RANGE = HPI_CTL_ATTR(VOLUME, 10),
14262306a36Sopenharmony_ci
14362306a36Sopenharmony_ci	HPI_METER_RMS = HPI_CTL_ATTR(METER, 1),
14462306a36Sopenharmony_ci	HPI_METER_PEAK = HPI_CTL_ATTR(METER, 2),
14562306a36Sopenharmony_ci	HPI_METER_RMS_BALLISTICS = HPI_CTL_ATTR(METER, 3),
14662306a36Sopenharmony_ci	HPI_METER_PEAK_BALLISTICS = HPI_CTL_ATTR(METER, 4),
14762306a36Sopenharmony_ci	HPI_METER_NUM_CHANNELS = HPI_CTL_ATTR(METER, 5),
14862306a36Sopenharmony_ci
14962306a36Sopenharmony_ci	HPI_MULTIPLEXER_SOURCE = HPI_CTL_ATTR(MULTIPLEXER, 1),
15062306a36Sopenharmony_ci	HPI_MULTIPLEXER_QUERYSOURCE = HPI_CTL_ATTR(MULTIPLEXER, 2),
15162306a36Sopenharmony_ci
15262306a36Sopenharmony_ci	HPI_AESEBUTX_FORMAT = HPI_CTL_ATTR(AESEBUTX, 1),
15362306a36Sopenharmony_ci	HPI_AESEBUTX_SAMPLERATE = HPI_CTL_ATTR(AESEBUTX, 3),
15462306a36Sopenharmony_ci	HPI_AESEBUTX_CHANNELSTATUS = HPI_CTL_ATTR(AESEBUTX, 4),
15562306a36Sopenharmony_ci	HPI_AESEBUTX_USERDATA = HPI_CTL_ATTR(AESEBUTX, 5),
15662306a36Sopenharmony_ci
15762306a36Sopenharmony_ci	HPI_AESEBURX_FORMAT = HPI_CTL_ATTR(AESEBURX, 1),
15862306a36Sopenharmony_ci	HPI_AESEBURX_ERRORSTATUS = HPI_CTL_ATTR(AESEBURX, 2),
15962306a36Sopenharmony_ci	HPI_AESEBURX_SAMPLERATE = HPI_CTL_ATTR(AESEBURX, 3),
16062306a36Sopenharmony_ci	HPI_AESEBURX_CHANNELSTATUS = HPI_CTL_ATTR(AESEBURX, 4),
16162306a36Sopenharmony_ci	HPI_AESEBURX_USERDATA = HPI_CTL_ATTR(AESEBURX, 5),
16262306a36Sopenharmony_ci
16362306a36Sopenharmony_ci	HPI_LEVEL_GAIN = HPI_CTL_ATTR(LEVEL, 1),
16462306a36Sopenharmony_ci	HPI_LEVEL_RANGE = HPI_CTL_ATTR(LEVEL, 10),
16562306a36Sopenharmony_ci
16662306a36Sopenharmony_ci	HPI_TUNER_BAND = HPI_CTL_ATTR(TUNER, 1),
16762306a36Sopenharmony_ci	HPI_TUNER_FREQ = HPI_CTL_ATTR(TUNER, 2),
16862306a36Sopenharmony_ci	HPI_TUNER_LEVEL_AVG = HPI_CTL_ATTR(TUNER, 3),
16962306a36Sopenharmony_ci	HPI_TUNER_LEVEL_RAW = HPI_CTL_ATTR(TUNER, 4),
17062306a36Sopenharmony_ci	HPI_TUNER_SNR = HPI_CTL_ATTR(TUNER, 5),
17162306a36Sopenharmony_ci	HPI_TUNER_GAIN = HPI_CTL_ATTR(TUNER, 6),
17262306a36Sopenharmony_ci	HPI_TUNER_STATUS = HPI_CTL_ATTR(TUNER, 7),
17362306a36Sopenharmony_ci	HPI_TUNER_MODE = HPI_CTL_ATTR(TUNER, 8),
17462306a36Sopenharmony_ci	HPI_TUNER_RDS = HPI_CTL_ATTR(TUNER, 9),
17562306a36Sopenharmony_ci	HPI_TUNER_DEEMPHASIS = HPI_CTL_ATTR(TUNER, 10),
17662306a36Sopenharmony_ci	HPI_TUNER_PROGRAM = HPI_CTL_ATTR(TUNER, 11),
17762306a36Sopenharmony_ci	HPI_TUNER_HDRADIO_SIGNAL_QUALITY = HPI_CTL_ATTR(TUNER, 12),
17862306a36Sopenharmony_ci	HPI_TUNER_HDRADIO_SDK_VERSION = HPI_CTL_ATTR(TUNER, 13),
17962306a36Sopenharmony_ci	HPI_TUNER_HDRADIO_DSP_VERSION = HPI_CTL_ATTR(TUNER, 14),
18062306a36Sopenharmony_ci	HPI_TUNER_HDRADIO_BLEND = HPI_CTL_ATTR(TUNER, 15),
18162306a36Sopenharmony_ci
18262306a36Sopenharmony_ci	HPI_VOX_THRESHOLD = HPI_CTL_ATTR(VOX, 1),
18362306a36Sopenharmony_ci
18462306a36Sopenharmony_ci	HPI_CHANNEL_MODE_MODE = HPI_CTL_ATTR(CHANNEL_MODE, 1),
18562306a36Sopenharmony_ci
18662306a36Sopenharmony_ci	HPI_BITSTREAM_DATA_POLARITY = HPI_CTL_ATTR(BITSTREAM, 1),
18762306a36Sopenharmony_ci	HPI_BITSTREAM_CLOCK_EDGE = HPI_CTL_ATTR(BITSTREAM, 2),
18862306a36Sopenharmony_ci	HPI_BITSTREAM_CLOCK_SOURCE = HPI_CTL_ATTR(BITSTREAM, 3),
18962306a36Sopenharmony_ci	HPI_BITSTREAM_ACTIVITY = HPI_CTL_ATTR(BITSTREAM, 4),
19062306a36Sopenharmony_ci
19162306a36Sopenharmony_ci	HPI_SAMPLECLOCK_SOURCE = HPI_CTL_ATTR(SAMPLECLOCK, 1),
19262306a36Sopenharmony_ci	HPI_SAMPLECLOCK_SAMPLERATE = HPI_CTL_ATTR(SAMPLECLOCK, 2),
19362306a36Sopenharmony_ci	HPI_SAMPLECLOCK_SOURCE_INDEX = HPI_CTL_ATTR(SAMPLECLOCK, 3),
19462306a36Sopenharmony_ci	HPI_SAMPLECLOCK_LOCAL_SAMPLERATE = HPI_CTL_ATTR(SAMPLECLOCK, 4),
19562306a36Sopenharmony_ci	HPI_SAMPLECLOCK_AUTO = HPI_CTL_ATTR(SAMPLECLOCK, 5),
19662306a36Sopenharmony_ci	HPI_SAMPLECLOCK_LOCAL_LOCK = HPI_CTL_ATTR(SAMPLECLOCK, 6),
19762306a36Sopenharmony_ci
19862306a36Sopenharmony_ci	HPI_MICROPHONE_PHANTOM_POWER = HPI_CTL_ATTR(MICROPHONE, 1),
19962306a36Sopenharmony_ci
20062306a36Sopenharmony_ci	HPI_EQUALIZER_NUM_FILTERS = HPI_CTL_ATTR(EQUALIZER, 1),
20162306a36Sopenharmony_ci	HPI_EQUALIZER_FILTER = HPI_CTL_ATTR(EQUALIZER, 2),
20262306a36Sopenharmony_ci	HPI_EQUALIZER_COEFFICIENTS = HPI_CTL_ATTR(EQUALIZER, 3),
20362306a36Sopenharmony_ci
20462306a36Sopenharmony_ci	HPI_COMPANDER_PARAMS = HPI_CTL_ATTR(COMPANDER, 1),
20562306a36Sopenharmony_ci	HPI_COMPANDER_MAKEUPGAIN = HPI_CTL_ATTR(COMPANDER, 2),
20662306a36Sopenharmony_ci	HPI_COMPANDER_THRESHOLD = HPI_CTL_ATTR(COMPANDER, 3),
20762306a36Sopenharmony_ci	HPI_COMPANDER_RATIO = HPI_CTL_ATTR(COMPANDER, 4),
20862306a36Sopenharmony_ci	HPI_COMPANDER_ATTACK = HPI_CTL_ATTR(COMPANDER, 5),
20962306a36Sopenharmony_ci	HPI_COMPANDER_DECAY = HPI_CTL_ATTR(COMPANDER, 6),
21062306a36Sopenharmony_ci
21162306a36Sopenharmony_ci	HPI_COBRANET_SET = HPI_CTL_ATTR(COBRANET, 1),
21262306a36Sopenharmony_ci	HPI_COBRANET_GET = HPI_CTL_ATTR(COBRANET, 2),
21362306a36Sopenharmony_ci	HPI_COBRANET_GET_STATUS = HPI_CTL_ATTR(COBRANET, 5),
21462306a36Sopenharmony_ci	HPI_COBRANET_SEND_PACKET = HPI_CTL_ATTR(COBRANET, 6),
21562306a36Sopenharmony_ci	HPI_COBRANET_GET_PACKET = HPI_CTL_ATTR(COBRANET, 7),
21662306a36Sopenharmony_ci
21762306a36Sopenharmony_ci	HPI_TONEDETECTOR_THRESHOLD = HPI_CTL_ATTR(TONEDETECTOR, 1),
21862306a36Sopenharmony_ci	HPI_TONEDETECTOR_STATE = HPI_CTL_ATTR(TONEDETECTOR, 2),
21962306a36Sopenharmony_ci	HPI_TONEDETECTOR_FREQUENCY = HPI_CTL_ATTR(TONEDETECTOR, 3),
22062306a36Sopenharmony_ci
22162306a36Sopenharmony_ci	HPI_SILENCEDETECTOR_THRESHOLD = HPI_CTL_ATTR(SILENCEDETECTOR, 1),
22262306a36Sopenharmony_ci	HPI_SILENCEDETECTOR_STATE = HPI_CTL_ATTR(SILENCEDETECTOR, 2),
22362306a36Sopenharmony_ci	HPI_SILENCEDETECTOR_DELAY = HPI_CTL_ATTR(SILENCEDETECTOR, 3),
22462306a36Sopenharmony_ci
22562306a36Sopenharmony_ci	HPI_PAD_CHANNEL_NAME = HPI_CTL_ATTR(PAD, 1),
22662306a36Sopenharmony_ci	HPI_PAD_ARTIST = HPI_CTL_ATTR(PAD, 2),
22762306a36Sopenharmony_ci	HPI_PAD_TITLE = HPI_CTL_ATTR(PAD, 3),
22862306a36Sopenharmony_ci	HPI_PAD_COMMENT = HPI_CTL_ATTR(PAD, 4),
22962306a36Sopenharmony_ci	HPI_PAD_PROGRAM_TYPE = HPI_CTL_ATTR(PAD, 5),
23062306a36Sopenharmony_ci	HPI_PAD_PROGRAM_ID = HPI_CTL_ATTR(PAD, 6),
23162306a36Sopenharmony_ci	HPI_PAD_TA_SUPPORT = HPI_CTL_ATTR(PAD, 7),
23262306a36Sopenharmony_ci	HPI_PAD_TA_ACTIVE = HPI_CTL_ATTR(PAD, 8),
23362306a36Sopenharmony_ci
23462306a36Sopenharmony_ci	HPI_UNIVERSAL_ENTITY = HPI_CTL_ATTR(UNIVERSAL, 1)
23562306a36Sopenharmony_ci};
23662306a36Sopenharmony_ci
23762306a36Sopenharmony_ci#define HPI_POLARITY_POSITIVE           0
23862306a36Sopenharmony_ci#define HPI_POLARITY_NEGATIVE           1
23962306a36Sopenharmony_ci
24062306a36Sopenharmony_ci/*------------------------------------------------------------
24162306a36Sopenharmony_ci Cobranet Chip Bridge - copied from HMI.H
24262306a36Sopenharmony_ci------------------------------------------------------------*/
24362306a36Sopenharmony_ci#define  HPI_COBRANET_HMI_cobra_bridge           0x20000
24462306a36Sopenharmony_ci#define  HPI_COBRANET_HMI_cobra_bridge_tx_pkt_buf \
24562306a36Sopenharmony_ci	(HPI_COBRANET_HMI_cobra_bridge + 0x1000)
24662306a36Sopenharmony_ci#define  HPI_COBRANET_HMI_cobra_bridge_rx_pkt_buf \
24762306a36Sopenharmony_ci	(HPI_COBRANET_HMI_cobra_bridge + 0x2000)
24862306a36Sopenharmony_ci#define  HPI_COBRANET_HMI_cobra_if_table1         0x110000
24962306a36Sopenharmony_ci#define  HPI_COBRANET_HMI_cobra_if_phy_address \
25062306a36Sopenharmony_ci	(HPI_COBRANET_HMI_cobra_if_table1 + 0xd)
25162306a36Sopenharmony_ci#define  HPI_COBRANET_HMI_cobra_protocolIP       0x72000
25262306a36Sopenharmony_ci#define  HPI_COBRANET_HMI_cobra_ip_mon_currentIP \
25362306a36Sopenharmony_ci	(HPI_COBRANET_HMI_cobra_protocolIP + 0x0)
25462306a36Sopenharmony_ci#define  HPI_COBRANET_HMI_cobra_ip_mon_staticIP \
25562306a36Sopenharmony_ci	(HPI_COBRANET_HMI_cobra_protocolIP + 0x2)
25662306a36Sopenharmony_ci#define  HPI_COBRANET_HMI_cobra_sys              0x100000
25762306a36Sopenharmony_ci#define  HPI_COBRANET_HMI_cobra_sys_desc \
25862306a36Sopenharmony_ci		(HPI_COBRANET_HMI_cobra_sys + 0x0)
25962306a36Sopenharmony_ci#define  HPI_COBRANET_HMI_cobra_sys_objectID \
26062306a36Sopenharmony_ci	(HPI_COBRANET_HMI_cobra_sys + 0x100)
26162306a36Sopenharmony_ci#define  HPI_COBRANET_HMI_cobra_sys_contact \
26262306a36Sopenharmony_ci	(HPI_COBRANET_HMI_cobra_sys + 0x200)
26362306a36Sopenharmony_ci#define  HPI_COBRANET_HMI_cobra_sys_name \
26462306a36Sopenharmony_ci		(HPI_COBRANET_HMI_cobra_sys + 0x300)
26562306a36Sopenharmony_ci#define  HPI_COBRANET_HMI_cobra_sys_location \
26662306a36Sopenharmony_ci	(HPI_COBRANET_HMI_cobra_sys + 0x400)
26762306a36Sopenharmony_ci
26862306a36Sopenharmony_ci/*------------------------------------------------------------
26962306a36Sopenharmony_ci Cobranet Chip Status bits
27062306a36Sopenharmony_ci------------------------------------------------------------*/
27162306a36Sopenharmony_ci#define HPI_COBRANET_HMI_STATUS_RXPACKET 2
27262306a36Sopenharmony_ci#define HPI_COBRANET_HMI_STATUS_TXPACKET 3
27362306a36Sopenharmony_ci
27462306a36Sopenharmony_ci/*------------------------------------------------------------
27562306a36Sopenharmony_ci Ethernet header size
27662306a36Sopenharmony_ci------------------------------------------------------------*/
27762306a36Sopenharmony_ci#define HPI_ETHERNET_HEADER_SIZE (16)
27862306a36Sopenharmony_ci
27962306a36Sopenharmony_ci/* These defines are used to fill in protocol information for an Ethernet packet
28062306a36Sopenharmony_ci    sent using HMI on CS18102 */
28162306a36Sopenharmony_ci/** ID supplied by Cirrus for ASI packets. */
28262306a36Sopenharmony_ci#define HPI_ETHERNET_PACKET_ID                  0x85
28362306a36Sopenharmony_ci/** Simple packet - no special routing required */
28462306a36Sopenharmony_ci#define HPI_ETHERNET_PACKET_V1                  0x01
28562306a36Sopenharmony_ci/** This packet must make its way to the host across the HPI interface */
28662306a36Sopenharmony_ci#define HPI_ETHERNET_PACKET_HOSTED_VIA_HMI      0x20
28762306a36Sopenharmony_ci/** This packet must make its way to the host across the HPI interface */
28862306a36Sopenharmony_ci#define HPI_ETHERNET_PACKET_HOSTED_VIA_HMI_V1   0x21
28962306a36Sopenharmony_ci/** This packet must make its way to the host across the HPI interface */
29062306a36Sopenharmony_ci#define HPI_ETHERNET_PACKET_HOSTED_VIA_HPI      0x40
29162306a36Sopenharmony_ci/** This packet must make its way to the host across the HPI interface */
29262306a36Sopenharmony_ci#define HPI_ETHERNET_PACKET_HOSTED_VIA_HPI_V1   0x41
29362306a36Sopenharmony_ci
29462306a36Sopenharmony_ci#define HPI_ETHERNET_UDP_PORT 44600 /**< HPI UDP service */
29562306a36Sopenharmony_ci
29662306a36Sopenharmony_ci/** Default network timeout in milli-seconds. */
29762306a36Sopenharmony_ci#define HPI_ETHERNET_TIMEOUT_MS 500
29862306a36Sopenharmony_ci
29962306a36Sopenharmony_ci/** Locked memory buffer alloc/free phases */
30062306a36Sopenharmony_cienum HPI_BUFFER_CMDS {
30162306a36Sopenharmony_ci	/** use one message to allocate or free physical memory */
30262306a36Sopenharmony_ci	HPI_BUFFER_CMD_EXTERNAL = 0,
30362306a36Sopenharmony_ci	/** alloc physical memory */
30462306a36Sopenharmony_ci	HPI_BUFFER_CMD_INTERNAL_ALLOC = 1,
30562306a36Sopenharmony_ci	/** send physical memory address to adapter */
30662306a36Sopenharmony_ci	HPI_BUFFER_CMD_INTERNAL_GRANTADAPTER = 2,
30762306a36Sopenharmony_ci	/** notify adapter to stop using physical buffer */
30862306a36Sopenharmony_ci	HPI_BUFFER_CMD_INTERNAL_REVOKEADAPTER = 3,
30962306a36Sopenharmony_ci	/** free physical buffer */
31062306a36Sopenharmony_ci	HPI_BUFFER_CMD_INTERNAL_FREE = 4
31162306a36Sopenharmony_ci};
31262306a36Sopenharmony_ci
31362306a36Sopenharmony_ci/*****************************************************************************/
31462306a36Sopenharmony_ci/*****************************************************************************/
31562306a36Sopenharmony_ci/********               HPI LOW LEVEL MESSAGES                  *******/
31662306a36Sopenharmony_ci/*****************************************************************************/
31762306a36Sopenharmony_ci/*****************************************************************************/
31862306a36Sopenharmony_ci/** Pnp ids */
31962306a36Sopenharmony_ci/** "ASI"  - actual is "ASX" - need to change */
32062306a36Sopenharmony_ci#define HPI_ID_ISAPNP_AUDIOSCIENCE      0x0669
32162306a36Sopenharmony_ci/** PCI vendor ID that AudioScience uses */
32262306a36Sopenharmony_ci#define HPI_PCI_VENDOR_ID_AUDIOSCIENCE  0x175C
32362306a36Sopenharmony_ci/** PCI vendor ID that the DSP56301 has */
32462306a36Sopenharmony_ci#define HPI_PCI_VENDOR_ID_MOTOROLA      0x1057
32562306a36Sopenharmony_ci/** PCI vendor ID that TI uses */
32662306a36Sopenharmony_ci#define HPI_PCI_VENDOR_ID_TI            0x104C
32762306a36Sopenharmony_ci
32862306a36Sopenharmony_ci#define HPI_PCI_DEV_ID_PCI2040          0xAC60
32962306a36Sopenharmony_ci/** TI's C6205 PCI interface has this ID */
33062306a36Sopenharmony_ci#define HPI_PCI_DEV_ID_DSP6205          0xA106
33162306a36Sopenharmony_ci
33262306a36Sopenharmony_ci#define HPI_USB_VENDOR_ID_AUDIOSCIENCE  0x1257
33362306a36Sopenharmony_ci#define HPI_USB_W2K_TAG                 0x57495341	/* "ASIW"       */
33462306a36Sopenharmony_ci#define HPI_USB_LINUX_TAG               0x4C495341	/* "ASIL"       */
33562306a36Sopenharmony_ci
33662306a36Sopenharmony_ci/** Invalid Adapter index
33762306a36Sopenharmony_ciUsed in HPI messages that are not addressed to a specific adapter
33862306a36Sopenharmony_ciUsed in DLL to indicate device not present
33962306a36Sopenharmony_ci*/
34062306a36Sopenharmony_ci#define HPI_ADAPTER_INDEX_INVALID 0xFFFF
34162306a36Sopenharmony_ci
34262306a36Sopenharmony_ci/** First 2 hex digits define the adapter family */
34362306a36Sopenharmony_ci#define HPI_ADAPTER_FAMILY_MASK         0xff00
34462306a36Sopenharmony_ci#define HPI_MODULE_FAMILY_MASK          0xfff0
34562306a36Sopenharmony_ci
34662306a36Sopenharmony_ci#define HPI_ADAPTER_FAMILY_ASI(f)   (f & HPI_ADAPTER_FAMILY_MASK)
34762306a36Sopenharmony_ci#define HPI_MODULE_FAMILY_ASI(f)   (f & HPI_MODULE_FAMILY_MASK)
34862306a36Sopenharmony_ci#define HPI_ADAPTER_ASI(f)   (f)
34962306a36Sopenharmony_ci
35062306a36Sopenharmony_cienum HPI_MESSAGE_TYPES {
35162306a36Sopenharmony_ci	HPI_TYPE_REQUEST = 1,
35262306a36Sopenharmony_ci	HPI_TYPE_RESPONSE = 2,
35362306a36Sopenharmony_ci	HPI_TYPE_DATA = 3,
35462306a36Sopenharmony_ci	HPI_TYPE_SSX2BYPASS_MESSAGE = 4,
35562306a36Sopenharmony_ci	HPI_TYPE_COMMAND = 5,
35662306a36Sopenharmony_ci	HPI_TYPE_NOTIFICATION = 6
35762306a36Sopenharmony_ci};
35862306a36Sopenharmony_ci
35962306a36Sopenharmony_cienum HPI_OBJECT_TYPES {
36062306a36Sopenharmony_ci	HPI_OBJ_SUBSYSTEM = 1,
36162306a36Sopenharmony_ci	HPI_OBJ_ADAPTER = 2,
36262306a36Sopenharmony_ci	HPI_OBJ_OSTREAM = 3,
36362306a36Sopenharmony_ci	HPI_OBJ_ISTREAM = 4,
36462306a36Sopenharmony_ci	HPI_OBJ_MIXER = 5,
36562306a36Sopenharmony_ci	HPI_OBJ_NODE = 6,
36662306a36Sopenharmony_ci	HPI_OBJ_CONTROL = 7,
36762306a36Sopenharmony_ci	HPI_OBJ_NVMEMORY = 8,
36862306a36Sopenharmony_ci	HPI_OBJ_GPIO = 9,
36962306a36Sopenharmony_ci	HPI_OBJ_WATCHDOG = 10,
37062306a36Sopenharmony_ci	HPI_OBJ_CLOCK = 11,
37162306a36Sopenharmony_ci	HPI_OBJ_PROFILE = 12,
37262306a36Sopenharmony_ci	/* HPI_ OBJ_ CONTROLEX  = 13, */
37362306a36Sopenharmony_ci	HPI_OBJ_ASYNCEVENT = 14
37462306a36Sopenharmony_ci#define HPI_OBJ_MAXINDEX 14
37562306a36Sopenharmony_ci};
37662306a36Sopenharmony_ci
37762306a36Sopenharmony_ci#define HPI_OBJ_FUNCTION_SPACING 0x100
37862306a36Sopenharmony_ci#define HPI_FUNC_ID(obj, i) (HPI_OBJ_##obj * HPI_OBJ_FUNCTION_SPACING + i)
37962306a36Sopenharmony_ci
38062306a36Sopenharmony_ci#define HPI_EXTRACT_INDEX(fn) (fn & 0xff)
38162306a36Sopenharmony_ci
38262306a36Sopenharmony_cienum HPI_FUNCTION_IDS {
38362306a36Sopenharmony_ci	HPI_SUBSYS_OPEN = HPI_FUNC_ID(SUBSYSTEM, 1),
38462306a36Sopenharmony_ci	HPI_SUBSYS_GET_VERSION = HPI_FUNC_ID(SUBSYSTEM, 2),
38562306a36Sopenharmony_ci	HPI_SUBSYS_GET_INFO = HPI_FUNC_ID(SUBSYSTEM, 3),
38662306a36Sopenharmony_ci	HPI_SUBSYS_CREATE_ADAPTER = HPI_FUNC_ID(SUBSYSTEM, 5),
38762306a36Sopenharmony_ci	HPI_SUBSYS_CLOSE = HPI_FUNC_ID(SUBSYSTEM, 6),
38862306a36Sopenharmony_ci	HPI_SUBSYS_DRIVER_LOAD = HPI_FUNC_ID(SUBSYSTEM, 8),
38962306a36Sopenharmony_ci	HPI_SUBSYS_DRIVER_UNLOAD = HPI_FUNC_ID(SUBSYSTEM, 9),
39062306a36Sopenharmony_ci	HPI_SUBSYS_GET_NUM_ADAPTERS = HPI_FUNC_ID(SUBSYSTEM, 12),
39162306a36Sopenharmony_ci	HPI_SUBSYS_GET_ADAPTER = HPI_FUNC_ID(SUBSYSTEM, 13),
39262306a36Sopenharmony_ci	HPI_SUBSYS_SET_NETWORK_INTERFACE = HPI_FUNC_ID(SUBSYSTEM, 14),
39362306a36Sopenharmony_ci	HPI_SUBSYS_OPTION_INFO = HPI_FUNC_ID(SUBSYSTEM, 15),
39462306a36Sopenharmony_ci	HPI_SUBSYS_OPTION_GET = HPI_FUNC_ID(SUBSYSTEM, 16),
39562306a36Sopenharmony_ci	HPI_SUBSYS_OPTION_SET = HPI_FUNC_ID(SUBSYSTEM, 17),
39662306a36Sopenharmony_ci#define HPI_SUBSYS_FUNCTION_COUNT 17
39762306a36Sopenharmony_ci
39862306a36Sopenharmony_ci	HPI_ADAPTER_OPEN = HPI_FUNC_ID(ADAPTER, 1),
39962306a36Sopenharmony_ci	HPI_ADAPTER_CLOSE = HPI_FUNC_ID(ADAPTER, 2),
40062306a36Sopenharmony_ci	HPI_ADAPTER_GET_INFO = HPI_FUNC_ID(ADAPTER, 3),
40162306a36Sopenharmony_ci	HPI_ADAPTER_GET_ASSERT = HPI_FUNC_ID(ADAPTER, 4),
40262306a36Sopenharmony_ci	HPI_ADAPTER_TEST_ASSERT = HPI_FUNC_ID(ADAPTER, 5),
40362306a36Sopenharmony_ci	HPI_ADAPTER_SET_MODE = HPI_FUNC_ID(ADAPTER, 6),
40462306a36Sopenharmony_ci	HPI_ADAPTER_GET_MODE = HPI_FUNC_ID(ADAPTER, 7),
40562306a36Sopenharmony_ci	HPI_ADAPTER_ENABLE_CAPABILITY = HPI_FUNC_ID(ADAPTER, 8),
40662306a36Sopenharmony_ci	HPI_ADAPTER_SELFTEST = HPI_FUNC_ID(ADAPTER, 9),
40762306a36Sopenharmony_ci	HPI_ADAPTER_FIND_OBJECT = HPI_FUNC_ID(ADAPTER, 10),
40862306a36Sopenharmony_ci	HPI_ADAPTER_QUERY_FLASH = HPI_FUNC_ID(ADAPTER, 11),
40962306a36Sopenharmony_ci	HPI_ADAPTER_START_FLASH = HPI_FUNC_ID(ADAPTER, 12),
41062306a36Sopenharmony_ci	HPI_ADAPTER_PROGRAM_FLASH = HPI_FUNC_ID(ADAPTER, 13),
41162306a36Sopenharmony_ci	HPI_ADAPTER_SET_PROPERTY = HPI_FUNC_ID(ADAPTER, 14),
41262306a36Sopenharmony_ci	HPI_ADAPTER_GET_PROPERTY = HPI_FUNC_ID(ADAPTER, 15),
41362306a36Sopenharmony_ci	HPI_ADAPTER_ENUM_PROPERTY = HPI_FUNC_ID(ADAPTER, 16),
41462306a36Sopenharmony_ci	HPI_ADAPTER_MODULE_INFO = HPI_FUNC_ID(ADAPTER, 17),
41562306a36Sopenharmony_ci	HPI_ADAPTER_DEBUG_READ = HPI_FUNC_ID(ADAPTER, 18),
41662306a36Sopenharmony_ci	HPI_ADAPTER_IRQ_QUERY_AND_CLEAR = HPI_FUNC_ID(ADAPTER, 19),
41762306a36Sopenharmony_ci	HPI_ADAPTER_IRQ_CALLBACK = HPI_FUNC_ID(ADAPTER, 20),
41862306a36Sopenharmony_ci	HPI_ADAPTER_DELETE = HPI_FUNC_ID(ADAPTER, 21),
41962306a36Sopenharmony_ci	HPI_ADAPTER_READ_FLASH = HPI_FUNC_ID(ADAPTER, 22),
42062306a36Sopenharmony_ci	HPI_ADAPTER_END_FLASH = HPI_FUNC_ID(ADAPTER, 23),
42162306a36Sopenharmony_ci	HPI_ADAPTER_FILESTORE_DELETE_ALL = HPI_FUNC_ID(ADAPTER, 24),
42262306a36Sopenharmony_ci#define HPI_ADAPTER_FUNCTION_COUNT 24
42362306a36Sopenharmony_ci
42462306a36Sopenharmony_ci	HPI_OSTREAM_OPEN = HPI_FUNC_ID(OSTREAM, 1),
42562306a36Sopenharmony_ci	HPI_OSTREAM_CLOSE = HPI_FUNC_ID(OSTREAM, 2),
42662306a36Sopenharmony_ci	HPI_OSTREAM_WRITE = HPI_FUNC_ID(OSTREAM, 3),
42762306a36Sopenharmony_ci	HPI_OSTREAM_START = HPI_FUNC_ID(OSTREAM, 4),
42862306a36Sopenharmony_ci	HPI_OSTREAM_STOP = HPI_FUNC_ID(OSTREAM, 5),
42962306a36Sopenharmony_ci	HPI_OSTREAM_RESET = HPI_FUNC_ID(OSTREAM, 6),
43062306a36Sopenharmony_ci	HPI_OSTREAM_GET_INFO = HPI_FUNC_ID(OSTREAM, 7),
43162306a36Sopenharmony_ci	HPI_OSTREAM_QUERY_FORMAT = HPI_FUNC_ID(OSTREAM, 8),
43262306a36Sopenharmony_ci	HPI_OSTREAM_DATA = HPI_FUNC_ID(OSTREAM, 9),
43362306a36Sopenharmony_ci	HPI_OSTREAM_SET_VELOCITY = HPI_FUNC_ID(OSTREAM, 10),
43462306a36Sopenharmony_ci	HPI_OSTREAM_SET_PUNCHINOUT = HPI_FUNC_ID(OSTREAM, 11),
43562306a36Sopenharmony_ci	HPI_OSTREAM_SINEGEN = HPI_FUNC_ID(OSTREAM, 12),
43662306a36Sopenharmony_ci	HPI_OSTREAM_ANC_RESET = HPI_FUNC_ID(OSTREAM, 13),
43762306a36Sopenharmony_ci	HPI_OSTREAM_ANC_GET_INFO = HPI_FUNC_ID(OSTREAM, 14),
43862306a36Sopenharmony_ci	HPI_OSTREAM_ANC_READ = HPI_FUNC_ID(OSTREAM, 15),
43962306a36Sopenharmony_ci	HPI_OSTREAM_SET_TIMESCALE = HPI_FUNC_ID(OSTREAM, 16),
44062306a36Sopenharmony_ci	HPI_OSTREAM_SET_FORMAT = HPI_FUNC_ID(OSTREAM, 17),
44162306a36Sopenharmony_ci	HPI_OSTREAM_HOSTBUFFER_ALLOC = HPI_FUNC_ID(OSTREAM, 18),
44262306a36Sopenharmony_ci	HPI_OSTREAM_HOSTBUFFER_FREE = HPI_FUNC_ID(OSTREAM, 19),
44362306a36Sopenharmony_ci	HPI_OSTREAM_GROUP_ADD = HPI_FUNC_ID(OSTREAM, 20),
44462306a36Sopenharmony_ci	HPI_OSTREAM_GROUP_GETMAP = HPI_FUNC_ID(OSTREAM, 21),
44562306a36Sopenharmony_ci	HPI_OSTREAM_GROUP_RESET = HPI_FUNC_ID(OSTREAM, 22),
44662306a36Sopenharmony_ci	HPI_OSTREAM_HOSTBUFFER_GET_INFO = HPI_FUNC_ID(OSTREAM, 23),
44762306a36Sopenharmony_ci	HPI_OSTREAM_WAIT_START = HPI_FUNC_ID(OSTREAM, 24),
44862306a36Sopenharmony_ci	HPI_OSTREAM_WAIT = HPI_FUNC_ID(OSTREAM, 25),
44962306a36Sopenharmony_ci#define HPI_OSTREAM_FUNCTION_COUNT 25
45062306a36Sopenharmony_ci
45162306a36Sopenharmony_ci	HPI_ISTREAM_OPEN = HPI_FUNC_ID(ISTREAM, 1),
45262306a36Sopenharmony_ci	HPI_ISTREAM_CLOSE = HPI_FUNC_ID(ISTREAM, 2),
45362306a36Sopenharmony_ci	HPI_ISTREAM_SET_FORMAT = HPI_FUNC_ID(ISTREAM, 3),
45462306a36Sopenharmony_ci	HPI_ISTREAM_READ = HPI_FUNC_ID(ISTREAM, 4),
45562306a36Sopenharmony_ci	HPI_ISTREAM_START = HPI_FUNC_ID(ISTREAM, 5),
45662306a36Sopenharmony_ci	HPI_ISTREAM_STOP = HPI_FUNC_ID(ISTREAM, 6),
45762306a36Sopenharmony_ci	HPI_ISTREAM_RESET = HPI_FUNC_ID(ISTREAM, 7),
45862306a36Sopenharmony_ci	HPI_ISTREAM_GET_INFO = HPI_FUNC_ID(ISTREAM, 8),
45962306a36Sopenharmony_ci	HPI_ISTREAM_QUERY_FORMAT = HPI_FUNC_ID(ISTREAM, 9),
46062306a36Sopenharmony_ci	HPI_ISTREAM_ANC_RESET = HPI_FUNC_ID(ISTREAM, 10),
46162306a36Sopenharmony_ci	HPI_ISTREAM_ANC_GET_INFO = HPI_FUNC_ID(ISTREAM, 11),
46262306a36Sopenharmony_ci	HPI_ISTREAM_ANC_WRITE = HPI_FUNC_ID(ISTREAM, 12),
46362306a36Sopenharmony_ci	HPI_ISTREAM_HOSTBUFFER_ALLOC = HPI_FUNC_ID(ISTREAM, 13),
46462306a36Sopenharmony_ci	HPI_ISTREAM_HOSTBUFFER_FREE = HPI_FUNC_ID(ISTREAM, 14),
46562306a36Sopenharmony_ci	HPI_ISTREAM_GROUP_ADD = HPI_FUNC_ID(ISTREAM, 15),
46662306a36Sopenharmony_ci	HPI_ISTREAM_GROUP_GETMAP = HPI_FUNC_ID(ISTREAM, 16),
46762306a36Sopenharmony_ci	HPI_ISTREAM_GROUP_RESET = HPI_FUNC_ID(ISTREAM, 17),
46862306a36Sopenharmony_ci	HPI_ISTREAM_HOSTBUFFER_GET_INFO = HPI_FUNC_ID(ISTREAM, 18),
46962306a36Sopenharmony_ci	HPI_ISTREAM_WAIT_START = HPI_FUNC_ID(ISTREAM, 19),
47062306a36Sopenharmony_ci	HPI_ISTREAM_WAIT = HPI_FUNC_ID(ISTREAM, 20),
47162306a36Sopenharmony_ci#define HPI_ISTREAM_FUNCTION_COUNT 20
47262306a36Sopenharmony_ci
47362306a36Sopenharmony_ci/* NOTE:
47462306a36Sopenharmony_ci   GET_NODE_INFO, SET_CONNECTION, GET_CONNECTIONS are not currently used */
47562306a36Sopenharmony_ci	HPI_MIXER_OPEN = HPI_FUNC_ID(MIXER, 1),
47662306a36Sopenharmony_ci	HPI_MIXER_CLOSE = HPI_FUNC_ID(MIXER, 2),
47762306a36Sopenharmony_ci	HPI_MIXER_GET_INFO = HPI_FUNC_ID(MIXER, 3),
47862306a36Sopenharmony_ci	HPI_MIXER_GET_NODE_INFO = HPI_FUNC_ID(MIXER, 4),
47962306a36Sopenharmony_ci	HPI_MIXER_GET_CONTROL = HPI_FUNC_ID(MIXER, 5),
48062306a36Sopenharmony_ci	HPI_MIXER_SET_CONNECTION = HPI_FUNC_ID(MIXER, 6),
48162306a36Sopenharmony_ci	HPI_MIXER_GET_CONNECTIONS = HPI_FUNC_ID(MIXER, 7),
48262306a36Sopenharmony_ci	HPI_MIXER_GET_CONTROL_BY_INDEX = HPI_FUNC_ID(MIXER, 8),
48362306a36Sopenharmony_ci	HPI_MIXER_GET_CONTROL_ARRAY_BY_INDEX = HPI_FUNC_ID(MIXER, 9),
48462306a36Sopenharmony_ci	HPI_MIXER_GET_CONTROL_MULTIPLE_VALUES = HPI_FUNC_ID(MIXER, 10),
48562306a36Sopenharmony_ci	HPI_MIXER_STORE = HPI_FUNC_ID(MIXER, 11),
48662306a36Sopenharmony_ci	HPI_MIXER_GET_CACHE_INFO = HPI_FUNC_ID(MIXER, 12),
48762306a36Sopenharmony_ci	HPI_MIXER_GET_BLOCK_HANDLE = HPI_FUNC_ID(MIXER, 13),
48862306a36Sopenharmony_ci	HPI_MIXER_GET_PARAMETER_HANDLE = HPI_FUNC_ID(MIXER, 14),
48962306a36Sopenharmony_ci#define HPI_MIXER_FUNCTION_COUNT 14
49062306a36Sopenharmony_ci
49162306a36Sopenharmony_ci	HPI_CONTROL_GET_INFO = HPI_FUNC_ID(CONTROL, 1),
49262306a36Sopenharmony_ci	HPI_CONTROL_GET_STATE = HPI_FUNC_ID(CONTROL, 2),
49362306a36Sopenharmony_ci	HPI_CONTROL_SET_STATE = HPI_FUNC_ID(CONTROL, 3),
49462306a36Sopenharmony_ci#define HPI_CONTROL_FUNCTION_COUNT 3
49562306a36Sopenharmony_ci
49662306a36Sopenharmony_ci	HPI_NVMEMORY_OPEN = HPI_FUNC_ID(NVMEMORY, 1),
49762306a36Sopenharmony_ci	HPI_NVMEMORY_READ_BYTE = HPI_FUNC_ID(NVMEMORY, 2),
49862306a36Sopenharmony_ci	HPI_NVMEMORY_WRITE_BYTE = HPI_FUNC_ID(NVMEMORY, 3),
49962306a36Sopenharmony_ci#define HPI_NVMEMORY_FUNCTION_COUNT 3
50062306a36Sopenharmony_ci
50162306a36Sopenharmony_ci	HPI_GPIO_OPEN = HPI_FUNC_ID(GPIO, 1),
50262306a36Sopenharmony_ci	HPI_GPIO_READ_BIT = HPI_FUNC_ID(GPIO, 2),
50362306a36Sopenharmony_ci	HPI_GPIO_WRITE_BIT = HPI_FUNC_ID(GPIO, 3),
50462306a36Sopenharmony_ci	HPI_GPIO_READ_ALL = HPI_FUNC_ID(GPIO, 4),
50562306a36Sopenharmony_ci	HPI_GPIO_WRITE_STATUS = HPI_FUNC_ID(GPIO, 5),
50662306a36Sopenharmony_ci#define HPI_GPIO_FUNCTION_COUNT 5
50762306a36Sopenharmony_ci
50862306a36Sopenharmony_ci	HPI_ASYNCEVENT_OPEN = HPI_FUNC_ID(ASYNCEVENT, 1),
50962306a36Sopenharmony_ci	HPI_ASYNCEVENT_CLOSE = HPI_FUNC_ID(ASYNCEVENT, 2),
51062306a36Sopenharmony_ci	HPI_ASYNCEVENT_WAIT = HPI_FUNC_ID(ASYNCEVENT, 3),
51162306a36Sopenharmony_ci	HPI_ASYNCEVENT_GETCOUNT = HPI_FUNC_ID(ASYNCEVENT, 4),
51262306a36Sopenharmony_ci	HPI_ASYNCEVENT_GET = HPI_FUNC_ID(ASYNCEVENT, 5),
51362306a36Sopenharmony_ci	HPI_ASYNCEVENT_SENDEVENTS = HPI_FUNC_ID(ASYNCEVENT, 6),
51462306a36Sopenharmony_ci#define HPI_ASYNCEVENT_FUNCTION_COUNT 6
51562306a36Sopenharmony_ci
51662306a36Sopenharmony_ci	HPI_WATCHDOG_OPEN = HPI_FUNC_ID(WATCHDOG, 1),
51762306a36Sopenharmony_ci	HPI_WATCHDOG_SET_TIME = HPI_FUNC_ID(WATCHDOG, 2),
51862306a36Sopenharmony_ci	HPI_WATCHDOG_PING = HPI_FUNC_ID(WATCHDOG, 3),
51962306a36Sopenharmony_ci
52062306a36Sopenharmony_ci	HPI_CLOCK_OPEN = HPI_FUNC_ID(CLOCK, 1),
52162306a36Sopenharmony_ci	HPI_CLOCK_SET_TIME = HPI_FUNC_ID(CLOCK, 2),
52262306a36Sopenharmony_ci	HPI_CLOCK_GET_TIME = HPI_FUNC_ID(CLOCK, 3),
52362306a36Sopenharmony_ci
52462306a36Sopenharmony_ci	HPI_PROFILE_OPEN_ALL = HPI_FUNC_ID(PROFILE, 1),
52562306a36Sopenharmony_ci	HPI_PROFILE_START_ALL = HPI_FUNC_ID(PROFILE, 2),
52662306a36Sopenharmony_ci	HPI_PROFILE_STOP_ALL = HPI_FUNC_ID(PROFILE, 3),
52762306a36Sopenharmony_ci	HPI_PROFILE_GET = HPI_FUNC_ID(PROFILE, 4),
52862306a36Sopenharmony_ci	HPI_PROFILE_GET_IDLECOUNT = HPI_FUNC_ID(PROFILE, 5),
52962306a36Sopenharmony_ci	HPI_PROFILE_GET_NAME = HPI_FUNC_ID(PROFILE, 6),
53062306a36Sopenharmony_ci	HPI_PROFILE_GET_UTILIZATION = HPI_FUNC_ID(PROFILE, 7)
53162306a36Sopenharmony_ci#define HPI_PROFILE_FUNCTION_COUNT 7
53262306a36Sopenharmony_ci};
53362306a36Sopenharmony_ci
53462306a36Sopenharmony_ci/* ////////////////////////////////////////////////////////////////////// */
53562306a36Sopenharmony_ci/* STRUCTURES */
53662306a36Sopenharmony_ci#ifndef DISABLE_PRAGMA_PACK1
53762306a36Sopenharmony_ci#pragma pack(push, 1)
53862306a36Sopenharmony_ci#endif
53962306a36Sopenharmony_ci
54062306a36Sopenharmony_ci/** PCI bus resource */
54162306a36Sopenharmony_cistruct hpi_pci {
54262306a36Sopenharmony_ci	u32 __iomem *ap_mem_base[HPI_MAX_ADAPTER_MEM_SPACES];
54362306a36Sopenharmony_ci	struct pci_dev *pci_dev;
54462306a36Sopenharmony_ci};
54562306a36Sopenharmony_ci
54662306a36Sopenharmony_ci/** Adapter specification resource */
54762306a36Sopenharmony_cistruct hpi_adapter_specification {
54862306a36Sopenharmony_ci	u32 type;
54962306a36Sopenharmony_ci	u8 modules[4];
55062306a36Sopenharmony_ci};
55162306a36Sopenharmony_ci
55262306a36Sopenharmony_cistruct hpi_resource {
55362306a36Sopenharmony_ci	union {
55462306a36Sopenharmony_ci		const struct hpi_pci *pci;
55562306a36Sopenharmony_ci		const char *net_if;
55662306a36Sopenharmony_ci		struct hpi_adapter_specification adapter_spec;
55762306a36Sopenharmony_ci		const void *sw_if;
55862306a36Sopenharmony_ci	} r;
55962306a36Sopenharmony_ci	u16 bus_type;		/* HPI_BUS_PNPISA, _PCI, _USB etc */
56062306a36Sopenharmony_ci	u16 padding;
56162306a36Sopenharmony_ci};
56262306a36Sopenharmony_ci
56362306a36Sopenharmony_ci/** Format info used inside struct hpi_message
56462306a36Sopenharmony_ci    Not the same as public API struct hpi_format */
56562306a36Sopenharmony_cistruct hpi_msg_format {
56662306a36Sopenharmony_ci	u32 sample_rate; /**< 11025, 32000, 44100 etc. */
56762306a36Sopenharmony_ci	u32 bit_rate; /**< for MPEG */
56862306a36Sopenharmony_ci	u32 attributes;	/**< stereo/joint_stereo/mono */
56962306a36Sopenharmony_ci	u16 channels; /**< 1,2..., (or ancillary mode or idle bit */
57062306a36Sopenharmony_ci	u16 format; /**< HPI_FORMAT_PCM16, _MPEG etc. see \ref HPI_FORMATS. */
57162306a36Sopenharmony_ci};
57262306a36Sopenharmony_ci
57362306a36Sopenharmony_ci/**  Buffer+format structure.
57462306a36Sopenharmony_ci	 Must be kept 7 * 32 bits to match public struct hpi_datastruct */
57562306a36Sopenharmony_cistruct hpi_msg_data {
57662306a36Sopenharmony_ci	struct hpi_msg_format format;
57762306a36Sopenharmony_ci	u8 *pb_data;
57862306a36Sopenharmony_ci#ifndef CONFIG_64BIT
57962306a36Sopenharmony_ci	u32 padding;
58062306a36Sopenharmony_ci#endif
58162306a36Sopenharmony_ci	u32 data_size;
58262306a36Sopenharmony_ci};
58362306a36Sopenharmony_ci
58462306a36Sopenharmony_ci/** struct hpi_datastructure used up to 3.04 driver */
58562306a36Sopenharmony_cistruct hpi_data_legacy32 {
58662306a36Sopenharmony_ci	struct hpi_format format;
58762306a36Sopenharmony_ci	u32 pb_data;
58862306a36Sopenharmony_ci	u32 data_size;
58962306a36Sopenharmony_ci};
59062306a36Sopenharmony_ci
59162306a36Sopenharmony_ci#ifdef CONFIG_64BIT
59262306a36Sopenharmony_ci/* Compatibility version of struct hpi_data*/
59362306a36Sopenharmony_cistruct hpi_data_compat32 {
59462306a36Sopenharmony_ci	struct hpi_msg_format format;
59562306a36Sopenharmony_ci	u32 pb_data;
59662306a36Sopenharmony_ci	u32 padding;
59762306a36Sopenharmony_ci	u32 data_size;
59862306a36Sopenharmony_ci};
59962306a36Sopenharmony_ci#endif
60062306a36Sopenharmony_ci
60162306a36Sopenharmony_cistruct hpi_buffer {
60262306a36Sopenharmony_ci  /** placeholder for backward compatibility (see dwBufferSize) */
60362306a36Sopenharmony_ci	struct hpi_msg_format reserved;
60462306a36Sopenharmony_ci	u32 command; /**< HPI_BUFFER_CMD_xxx*/
60562306a36Sopenharmony_ci	u32 pci_address; /**< PCI physical address of buffer for DSP DMA */
60662306a36Sopenharmony_ci	u32 buffer_size; /**< must line up with data_size of HPI_DATA*/
60762306a36Sopenharmony_ci};
60862306a36Sopenharmony_ci
60962306a36Sopenharmony_ci/*/////////////////////////////////////////////////////////////////////////// */
61062306a36Sopenharmony_ci/* This is used for background buffer bus mastering stream buffers.           */
61162306a36Sopenharmony_cistruct hpi_hostbuffer_status {
61262306a36Sopenharmony_ci	u32 samples_processed;
61362306a36Sopenharmony_ci	u32 auxiliary_data_available;
61462306a36Sopenharmony_ci	u32 stream_state;
61562306a36Sopenharmony_ci	/* DSP index in to the host bus master buffer. */
61662306a36Sopenharmony_ci	u32 dsp_index;
61762306a36Sopenharmony_ci	/* Host index in to the host bus master buffer. */
61862306a36Sopenharmony_ci	u32 host_index;
61962306a36Sopenharmony_ci	u32 size_in_bytes;
62062306a36Sopenharmony_ci};
62162306a36Sopenharmony_ci
62262306a36Sopenharmony_cistruct hpi_streamid {
62362306a36Sopenharmony_ci	u16 object_type;
62462306a36Sopenharmony_ci		    /**< Type of object, HPI_OBJ_OSTREAM or HPI_OBJ_ISTREAM. */
62562306a36Sopenharmony_ci	u16 stream_index; /**< outstream or instream index. */
62662306a36Sopenharmony_ci};
62762306a36Sopenharmony_ci
62862306a36Sopenharmony_cistruct hpi_punchinout {
62962306a36Sopenharmony_ci	u32 punch_in_sample;
63062306a36Sopenharmony_ci	u32 punch_out_sample;
63162306a36Sopenharmony_ci};
63262306a36Sopenharmony_ci
63362306a36Sopenharmony_cistruct hpi_subsys_msg {
63462306a36Sopenharmony_ci	struct hpi_resource resource;
63562306a36Sopenharmony_ci};
63662306a36Sopenharmony_ci
63762306a36Sopenharmony_cistruct hpi_subsys_res {
63862306a36Sopenharmony_ci	u32 version;
63962306a36Sopenharmony_ci	u32 data;		/* extended version */
64062306a36Sopenharmony_ci	u16 num_adapters;
64162306a36Sopenharmony_ci	u16 adapter_index;
64262306a36Sopenharmony_ci	u16 adapter_type;
64362306a36Sopenharmony_ci	u16 pad16;
64462306a36Sopenharmony_ci};
64562306a36Sopenharmony_ci
64662306a36Sopenharmony_ciunion hpi_adapterx_msg {
64762306a36Sopenharmony_ci	struct {
64862306a36Sopenharmony_ci		u32 dsp_address;
64962306a36Sopenharmony_ci		u32 count_bytes;
65062306a36Sopenharmony_ci	} debug_read;
65162306a36Sopenharmony_ci	struct {
65262306a36Sopenharmony_ci		u32 adapter_mode;
65362306a36Sopenharmony_ci		u16 query_or_set;
65462306a36Sopenharmony_ci	} mode;
65562306a36Sopenharmony_ci	struct {
65662306a36Sopenharmony_ci		u16 index;
65762306a36Sopenharmony_ci	} module_info;
65862306a36Sopenharmony_ci	struct {
65962306a36Sopenharmony_ci		u16 index;
66062306a36Sopenharmony_ci		u16 what;
66162306a36Sopenharmony_ci		u16 property_index;
66262306a36Sopenharmony_ci	} property_enum;
66362306a36Sopenharmony_ci	struct {
66462306a36Sopenharmony_ci		u16 property;
66562306a36Sopenharmony_ci		u16 parameter1;
66662306a36Sopenharmony_ci		u16 parameter2;
66762306a36Sopenharmony_ci	} property_set;
66862306a36Sopenharmony_ci	struct {
66962306a36Sopenharmony_ci		u32 pad32;
67062306a36Sopenharmony_ci		u16 key1;
67162306a36Sopenharmony_ci		u16 key2;
67262306a36Sopenharmony_ci	} restart;
67362306a36Sopenharmony_ci	struct {
67462306a36Sopenharmony_ci		u32 pad32;
67562306a36Sopenharmony_ci		u16 value;
67662306a36Sopenharmony_ci	} test_assert;
67762306a36Sopenharmony_ci	struct {
67862306a36Sopenharmony_ci		u32 message;
67962306a36Sopenharmony_ci	} irq;
68062306a36Sopenharmony_ci	u32 pad[3];
68162306a36Sopenharmony_ci};
68262306a36Sopenharmony_ci
68362306a36Sopenharmony_cistruct hpi_adapter_res {
68462306a36Sopenharmony_ci	u32 serial_number;
68562306a36Sopenharmony_ci	u16 adapter_type;
68662306a36Sopenharmony_ci	u16 adapter_index;
68762306a36Sopenharmony_ci	u16 num_instreams;
68862306a36Sopenharmony_ci	u16 num_outstreams;
68962306a36Sopenharmony_ci	u16 num_mixers;
69062306a36Sopenharmony_ci	u16 version;
69162306a36Sopenharmony_ci	u8 sz_adapter_assert[HPI_STRING_LEN];
69262306a36Sopenharmony_ci};
69362306a36Sopenharmony_ci
69462306a36Sopenharmony_ciunion hpi_adapterx_res {
69562306a36Sopenharmony_ci	struct hpi_adapter_res info;
69662306a36Sopenharmony_ci	struct {
69762306a36Sopenharmony_ci		u32 p1;
69862306a36Sopenharmony_ci		u16 count;
69962306a36Sopenharmony_ci		u16 dsp_index;
70062306a36Sopenharmony_ci		u32 p2;
70162306a36Sopenharmony_ci		u32 dsp_msg_addr;
70262306a36Sopenharmony_ci		char sz_message[HPI_STRING_LEN];
70362306a36Sopenharmony_ci	} assert;
70462306a36Sopenharmony_ci	struct {
70562306a36Sopenharmony_ci		u32 adapter_mode;
70662306a36Sopenharmony_ci	} mode;
70762306a36Sopenharmony_ci	struct {
70862306a36Sopenharmony_ci		u16 parameter1;
70962306a36Sopenharmony_ci		u16 parameter2;
71062306a36Sopenharmony_ci	} property_get;
71162306a36Sopenharmony_ci	struct {
71262306a36Sopenharmony_ci		u32 yes;
71362306a36Sopenharmony_ci	} irq_query;
71462306a36Sopenharmony_ci};
71562306a36Sopenharmony_ci
71662306a36Sopenharmony_cistruct hpi_stream_msg {
71762306a36Sopenharmony_ci	union {
71862306a36Sopenharmony_ci		struct hpi_msg_data data;
71962306a36Sopenharmony_ci		struct hpi_data_legacy32 data32;
72062306a36Sopenharmony_ci		u16 velocity;
72162306a36Sopenharmony_ci		struct hpi_punchinout pio;
72262306a36Sopenharmony_ci		u32 time_scale;
72362306a36Sopenharmony_ci		struct hpi_buffer buffer;
72462306a36Sopenharmony_ci		struct hpi_streamid stream;
72562306a36Sopenharmony_ci		u32 threshold_bytes;
72662306a36Sopenharmony_ci	} u;
72762306a36Sopenharmony_ci};
72862306a36Sopenharmony_ci
72962306a36Sopenharmony_cistruct hpi_stream_res {
73062306a36Sopenharmony_ci	union {
73162306a36Sopenharmony_ci		struct {
73262306a36Sopenharmony_ci			/* size of hardware buffer */
73362306a36Sopenharmony_ci			u32 buffer_size;
73462306a36Sopenharmony_ci			/* OutStream - data to play,
73562306a36Sopenharmony_ci			   InStream - data recorded */
73662306a36Sopenharmony_ci			u32 data_available;
73762306a36Sopenharmony_ci			/* OutStream - samples played,
73862306a36Sopenharmony_ci			   InStream - samples recorded */
73962306a36Sopenharmony_ci			u32 samples_transferred;
74062306a36Sopenharmony_ci			/* Adapter - OutStream - data to play,
74162306a36Sopenharmony_ci			   InStream - data recorded */
74262306a36Sopenharmony_ci			u32 auxiliary_data_available;
74362306a36Sopenharmony_ci			u16 state;	/* HPI_STATE_PLAYING, _STATE_STOPPED */
74462306a36Sopenharmony_ci			u16 padding;
74562306a36Sopenharmony_ci		} stream_info;
74662306a36Sopenharmony_ci		struct {
74762306a36Sopenharmony_ci			u32 buffer_size;
74862306a36Sopenharmony_ci			u32 data_available;
74962306a36Sopenharmony_ci			u32 samples_transfered;
75062306a36Sopenharmony_ci			u16 state;
75162306a36Sopenharmony_ci			u16 outstream_index;
75262306a36Sopenharmony_ci			u16 instream_index;
75362306a36Sopenharmony_ci			u16 padding;
75462306a36Sopenharmony_ci			u32 auxiliary_data_available;
75562306a36Sopenharmony_ci		} legacy_stream_info;
75662306a36Sopenharmony_ci		struct {
75762306a36Sopenharmony_ci			/* bitmap of grouped OutStreams */
75862306a36Sopenharmony_ci			u32 outstream_group_map;
75962306a36Sopenharmony_ci			/* bitmap of grouped InStreams */
76062306a36Sopenharmony_ci			u32 instream_group_map;
76162306a36Sopenharmony_ci		} group_info;
76262306a36Sopenharmony_ci		struct {
76362306a36Sopenharmony_ci			/* pointer to the buffer */
76462306a36Sopenharmony_ci			u8 *p_buffer;
76562306a36Sopenharmony_ci			/* pointer to the hostbuffer status */
76662306a36Sopenharmony_ci			struct hpi_hostbuffer_status *p_status;
76762306a36Sopenharmony_ci		} hostbuffer_info;
76862306a36Sopenharmony_ci	} u;
76962306a36Sopenharmony_ci};
77062306a36Sopenharmony_ci
77162306a36Sopenharmony_cistruct hpi_mixer_msg {
77262306a36Sopenharmony_ci	u16 control_index;
77362306a36Sopenharmony_ci	u16 control_type;	/* = HPI_CONTROL_METER _VOLUME etc */
77462306a36Sopenharmony_ci	u16 padding1;		/* Maintain alignment of subsequent fields */
77562306a36Sopenharmony_ci	u16 node_type1;		/* = HPI_SOURCENODE_LINEIN etc */
77662306a36Sopenharmony_ci	u16 node_index1;	/* = 0..N */
77762306a36Sopenharmony_ci	u16 node_type2;
77862306a36Sopenharmony_ci	u16 node_index2;
77962306a36Sopenharmony_ci	u16 padding2;		/* round to 4 bytes */
78062306a36Sopenharmony_ci};
78162306a36Sopenharmony_ci
78262306a36Sopenharmony_cistruct hpi_mixer_res {
78362306a36Sopenharmony_ci	u16 src_node_type;	/* = HPI_SOURCENODE_LINEIN etc */
78462306a36Sopenharmony_ci	u16 src_node_index;	/* = 0..N */
78562306a36Sopenharmony_ci	u16 dst_node_type;
78662306a36Sopenharmony_ci	u16 dst_node_index;
78762306a36Sopenharmony_ci	/* Also controlType for MixerGetControlByIndex */
78862306a36Sopenharmony_ci	u16 control_index;
78962306a36Sopenharmony_ci	/* may indicate which DSP the control is located on */
79062306a36Sopenharmony_ci	u16 dsp_index;
79162306a36Sopenharmony_ci};
79262306a36Sopenharmony_ci
79362306a36Sopenharmony_ciunion hpi_mixerx_msg {
79462306a36Sopenharmony_ci	struct {
79562306a36Sopenharmony_ci		u16 starting_index;
79662306a36Sopenharmony_ci		u16 flags;
79762306a36Sopenharmony_ci		u32 length_in_bytes;	/* length in bytes of p_data */
79862306a36Sopenharmony_ci		u32 p_data;	/* pointer to a data array */
79962306a36Sopenharmony_ci	} gcabi;
80062306a36Sopenharmony_ci	struct {
80162306a36Sopenharmony_ci		u16 command;
80262306a36Sopenharmony_ci		u16 index;
80362306a36Sopenharmony_ci	} store;		/* for HPI_MIXER_STORE message */
80462306a36Sopenharmony_ci};
80562306a36Sopenharmony_ci
80662306a36Sopenharmony_ciunion hpi_mixerx_res {
80762306a36Sopenharmony_ci	struct {
80862306a36Sopenharmony_ci		u32 bytes_returned;	/* size of items returned */
80962306a36Sopenharmony_ci		u32 p_data;	/* pointer to data array */
81062306a36Sopenharmony_ci		u16 more_to_do;	/* indicates if there is more to do */
81162306a36Sopenharmony_ci	} gcabi;
81262306a36Sopenharmony_ci	struct {
81362306a36Sopenharmony_ci		u32 total_controls;	/* count of controls in the mixer */
81462306a36Sopenharmony_ci		u32 cache_controls;	/* count of controls in the cac */
81562306a36Sopenharmony_ci		u32 cache_bytes;	/* size of cache */
81662306a36Sopenharmony_ci	} cache_info;
81762306a36Sopenharmony_ci};
81862306a36Sopenharmony_ci
81962306a36Sopenharmony_cistruct hpi_control_msg {
82062306a36Sopenharmony_ci	u16 attribute;		/* control attribute or property */
82162306a36Sopenharmony_ci	u16 saved_index;
82262306a36Sopenharmony_ci	u32 param1;		/* generic parameter 1 */
82362306a36Sopenharmony_ci	u32 param2;		/* generic parameter 2 */
82462306a36Sopenharmony_ci	short an_log_value[HPI_MAX_CHANNELS];
82562306a36Sopenharmony_ci};
82662306a36Sopenharmony_ci
82762306a36Sopenharmony_cistruct hpi_control_union_msg {
82862306a36Sopenharmony_ci	u16 attribute;		/* control attribute or property */
82962306a36Sopenharmony_ci	u16 saved_index;	/* only used in ctrl save/restore */
83062306a36Sopenharmony_ci	union {
83162306a36Sopenharmony_ci		struct {
83262306a36Sopenharmony_ci			u32 param1;	/* generic parameter 1 */
83362306a36Sopenharmony_ci			u32 param2;	/* generic parameter 2 */
83462306a36Sopenharmony_ci			short an_log_value[HPI_MAX_CHANNELS];
83562306a36Sopenharmony_ci		} old;
83662306a36Sopenharmony_ci		union {
83762306a36Sopenharmony_ci			u32 frequency;
83862306a36Sopenharmony_ci			u32 gain;
83962306a36Sopenharmony_ci			u32 band;
84062306a36Sopenharmony_ci			u32 deemphasis;
84162306a36Sopenharmony_ci			u32 program;
84262306a36Sopenharmony_ci			struct {
84362306a36Sopenharmony_ci				u32 mode;
84462306a36Sopenharmony_ci				u32 value;
84562306a36Sopenharmony_ci			} mode;
84662306a36Sopenharmony_ci			u32 blend;
84762306a36Sopenharmony_ci		} tuner;
84862306a36Sopenharmony_ci	} u;
84962306a36Sopenharmony_ci};
85062306a36Sopenharmony_ci
85162306a36Sopenharmony_cistruct hpi_control_res {
85262306a36Sopenharmony_ci	/* Could make union. dwParam, anLogValue never used in same response */
85362306a36Sopenharmony_ci	u32 param1;
85462306a36Sopenharmony_ci	u32 param2;
85562306a36Sopenharmony_ci	short an_log_value[HPI_MAX_CHANNELS];
85662306a36Sopenharmony_ci};
85762306a36Sopenharmony_ci
85862306a36Sopenharmony_ciunion hpi_control_union_res {
85962306a36Sopenharmony_ci	struct {
86062306a36Sopenharmony_ci		u32 param1;
86162306a36Sopenharmony_ci		u32 param2;
86262306a36Sopenharmony_ci		short an_log_value[HPI_MAX_CHANNELS];
86362306a36Sopenharmony_ci	} old;
86462306a36Sopenharmony_ci	union {
86562306a36Sopenharmony_ci		u32 band;
86662306a36Sopenharmony_ci		u32 frequency;
86762306a36Sopenharmony_ci		u32 gain;
86862306a36Sopenharmony_ci		u32 deemphasis;
86962306a36Sopenharmony_ci		struct {
87062306a36Sopenharmony_ci			u32 data[2];
87162306a36Sopenharmony_ci			u32 bLER;
87262306a36Sopenharmony_ci		} rds;
87362306a36Sopenharmony_ci		short s_level;
87462306a36Sopenharmony_ci		struct {
87562306a36Sopenharmony_ci			u16 value;
87662306a36Sopenharmony_ci			u16 mask;
87762306a36Sopenharmony_ci		} status;
87862306a36Sopenharmony_ci	} tuner;
87962306a36Sopenharmony_ci	struct {
88062306a36Sopenharmony_ci		char sz_data[8];
88162306a36Sopenharmony_ci		u32 remaining_chars;
88262306a36Sopenharmony_ci	} chars8;
88362306a36Sopenharmony_ci	char c_data12[12];
88462306a36Sopenharmony_ci	union {
88562306a36Sopenharmony_ci		struct {
88662306a36Sopenharmony_ci			u32 status;
88762306a36Sopenharmony_ci			u32 readable_size;
88862306a36Sopenharmony_ci			u32 writeable_size;
88962306a36Sopenharmony_ci		} status;
89062306a36Sopenharmony_ci	} cobranet;
89162306a36Sopenharmony_ci};
89262306a36Sopenharmony_ci
89362306a36Sopenharmony_cistruct hpi_nvmemory_msg {
89462306a36Sopenharmony_ci	u16 address;
89562306a36Sopenharmony_ci	u16 data;
89662306a36Sopenharmony_ci};
89762306a36Sopenharmony_ci
89862306a36Sopenharmony_cistruct hpi_nvmemory_res {
89962306a36Sopenharmony_ci	u16 size_in_bytes;
90062306a36Sopenharmony_ci	u16 data;
90162306a36Sopenharmony_ci};
90262306a36Sopenharmony_ci
90362306a36Sopenharmony_cistruct hpi_gpio_msg {
90462306a36Sopenharmony_ci	u16 bit_index;
90562306a36Sopenharmony_ci	u16 bit_data;
90662306a36Sopenharmony_ci};
90762306a36Sopenharmony_ci
90862306a36Sopenharmony_cistruct hpi_gpio_res {
90962306a36Sopenharmony_ci	u16 number_input_bits;
91062306a36Sopenharmony_ci	u16 number_output_bits;
91162306a36Sopenharmony_ci	u16 bit_data[4];
91262306a36Sopenharmony_ci};
91362306a36Sopenharmony_ci
91462306a36Sopenharmony_cistruct hpi_async_msg {
91562306a36Sopenharmony_ci	u32 events;
91662306a36Sopenharmony_ci	u16 maximum_events;
91762306a36Sopenharmony_ci	u16 padding;
91862306a36Sopenharmony_ci};
91962306a36Sopenharmony_ci
92062306a36Sopenharmony_cistruct hpi_async_res {
92162306a36Sopenharmony_ci	union {
92262306a36Sopenharmony_ci		struct {
92362306a36Sopenharmony_ci			u16 count;
92462306a36Sopenharmony_ci		} count;
92562306a36Sopenharmony_ci		struct {
92662306a36Sopenharmony_ci			u32 events;
92762306a36Sopenharmony_ci			u16 number_returned;
92862306a36Sopenharmony_ci			u16 padding;
92962306a36Sopenharmony_ci		} get;
93062306a36Sopenharmony_ci		struct hpi_async_event event;
93162306a36Sopenharmony_ci	} u;
93262306a36Sopenharmony_ci};
93362306a36Sopenharmony_ci
93462306a36Sopenharmony_cistruct hpi_watchdog_msg {
93562306a36Sopenharmony_ci	u32 time_ms;
93662306a36Sopenharmony_ci};
93762306a36Sopenharmony_ci
93862306a36Sopenharmony_cistruct hpi_watchdog_res {
93962306a36Sopenharmony_ci	u32 time_ms;
94062306a36Sopenharmony_ci};
94162306a36Sopenharmony_ci
94262306a36Sopenharmony_cistruct hpi_clock_msg {
94362306a36Sopenharmony_ci	u16 hours;
94462306a36Sopenharmony_ci	u16 minutes;
94562306a36Sopenharmony_ci	u16 seconds;
94662306a36Sopenharmony_ci	u16 milli_seconds;
94762306a36Sopenharmony_ci};
94862306a36Sopenharmony_ci
94962306a36Sopenharmony_cistruct hpi_clock_res {
95062306a36Sopenharmony_ci	u16 size_in_bytes;
95162306a36Sopenharmony_ci	u16 hours;
95262306a36Sopenharmony_ci	u16 minutes;
95362306a36Sopenharmony_ci	u16 seconds;
95462306a36Sopenharmony_ci	u16 milli_seconds;
95562306a36Sopenharmony_ci	u16 padding;
95662306a36Sopenharmony_ci};
95762306a36Sopenharmony_ci
95862306a36Sopenharmony_cistruct hpi_profile_msg {
95962306a36Sopenharmony_ci	u16 bin_index;
96062306a36Sopenharmony_ci	u16 padding;
96162306a36Sopenharmony_ci};
96262306a36Sopenharmony_ci
96362306a36Sopenharmony_cistruct hpi_profile_res_open {
96462306a36Sopenharmony_ci	u16 max_profiles;
96562306a36Sopenharmony_ci};
96662306a36Sopenharmony_ci
96762306a36Sopenharmony_cistruct hpi_profile_res_time {
96862306a36Sopenharmony_ci	u32 total_tick_count;
96962306a36Sopenharmony_ci	u32 call_count;
97062306a36Sopenharmony_ci	u32 max_tick_count;
97162306a36Sopenharmony_ci	u32 ticks_per_millisecond;
97262306a36Sopenharmony_ci	u16 profile_interval;
97362306a36Sopenharmony_ci};
97462306a36Sopenharmony_ci
97562306a36Sopenharmony_cistruct hpi_profile_res_name {
97662306a36Sopenharmony_ci	u8 sz_name[32];
97762306a36Sopenharmony_ci};
97862306a36Sopenharmony_ci
97962306a36Sopenharmony_cistruct hpi_profile_res {
98062306a36Sopenharmony_ci	union {
98162306a36Sopenharmony_ci		struct hpi_profile_res_open o;
98262306a36Sopenharmony_ci		struct hpi_profile_res_time t;
98362306a36Sopenharmony_ci		struct hpi_profile_res_name n;
98462306a36Sopenharmony_ci	} u;
98562306a36Sopenharmony_ci};
98662306a36Sopenharmony_ci
98762306a36Sopenharmony_cistruct hpi_message_header {
98862306a36Sopenharmony_ci	u16 size;		/* total size in bytes */
98962306a36Sopenharmony_ci	u8 type;		/* HPI_TYPE_MESSAGE  */
99062306a36Sopenharmony_ci	u8 version;		/* message version */
99162306a36Sopenharmony_ci	u16 object;		/* HPI_OBJ_* */
99262306a36Sopenharmony_ci	u16 function;		/* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
99362306a36Sopenharmony_ci	u16 adapter_index;	/* the adapter index */
99462306a36Sopenharmony_ci	u16 obj_index;		/* */
99562306a36Sopenharmony_ci};
99662306a36Sopenharmony_ci
99762306a36Sopenharmony_cistruct hpi_message {
99862306a36Sopenharmony_ci	/* following fields must match HPI_MESSAGE_HEADER */
99962306a36Sopenharmony_ci	u16 size;		/* total size in bytes */
100062306a36Sopenharmony_ci	u8 type;		/* HPI_TYPE_MESSAGE  */
100162306a36Sopenharmony_ci	u8 version;		/* message version */
100262306a36Sopenharmony_ci	u16 object;		/* HPI_OBJ_* */
100362306a36Sopenharmony_ci	u16 function;		/* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
100462306a36Sopenharmony_ci	u16 adapter_index;	/* the adapter index */
100562306a36Sopenharmony_ci	u16 obj_index;		/*  */
100662306a36Sopenharmony_ci	union {
100762306a36Sopenharmony_ci		struct hpi_subsys_msg s;
100862306a36Sopenharmony_ci		union hpi_adapterx_msg ax;
100962306a36Sopenharmony_ci		struct hpi_stream_msg d;
101062306a36Sopenharmony_ci		struct hpi_mixer_msg m;
101162306a36Sopenharmony_ci		union hpi_mixerx_msg mx;	/* extended mixer; */
101262306a36Sopenharmony_ci		struct hpi_control_msg c;	/* mixer control; */
101362306a36Sopenharmony_ci		/* identical to struct hpi_control_msg,
101462306a36Sopenharmony_ci		   but field naming is improved */
101562306a36Sopenharmony_ci		struct hpi_control_union_msg cu;
101662306a36Sopenharmony_ci		struct hpi_nvmemory_msg n;
101762306a36Sopenharmony_ci		struct hpi_gpio_msg l;	/* digital i/o */
101862306a36Sopenharmony_ci		struct hpi_watchdog_msg w;
101962306a36Sopenharmony_ci		struct hpi_clock_msg t;	/* dsp time */
102062306a36Sopenharmony_ci		struct hpi_profile_msg p;
102162306a36Sopenharmony_ci		struct hpi_async_msg as;
102262306a36Sopenharmony_ci		char fixed_size[32];
102362306a36Sopenharmony_ci	} u;
102462306a36Sopenharmony_ci};
102562306a36Sopenharmony_ci
102662306a36Sopenharmony_ci#define HPI_MESSAGE_SIZE_BY_OBJECT { \
102762306a36Sopenharmony_ci	sizeof(struct hpi_message_header) ,   /* Default, no object type 0 */ \
102862306a36Sopenharmony_ci	sizeof(struct hpi_message_header) + sizeof(struct hpi_subsys_msg),\
102962306a36Sopenharmony_ci	sizeof(struct hpi_message_header) + sizeof(union hpi_adapterx_msg),\
103062306a36Sopenharmony_ci	sizeof(struct hpi_message_header) + sizeof(struct hpi_stream_msg),\
103162306a36Sopenharmony_ci	sizeof(struct hpi_message_header) + sizeof(struct hpi_stream_msg),\
103262306a36Sopenharmony_ci	sizeof(struct hpi_message_header) + sizeof(struct hpi_mixer_msg),\
103362306a36Sopenharmony_ci	sizeof(struct hpi_message_header) ,   /* no node message */ \
103462306a36Sopenharmony_ci	sizeof(struct hpi_message_header) + sizeof(struct hpi_control_msg),\
103562306a36Sopenharmony_ci	sizeof(struct hpi_message_header) + sizeof(struct hpi_nvmemory_msg),\
103662306a36Sopenharmony_ci	sizeof(struct hpi_message_header) + sizeof(struct hpi_gpio_msg),\
103762306a36Sopenharmony_ci	sizeof(struct hpi_message_header) + sizeof(struct hpi_watchdog_msg),\
103862306a36Sopenharmony_ci	sizeof(struct hpi_message_header) + sizeof(struct hpi_clock_msg),\
103962306a36Sopenharmony_ci	sizeof(struct hpi_message_header) + sizeof(struct hpi_profile_msg),\
104062306a36Sopenharmony_ci	sizeof(struct hpi_message_header), /* controlx obj removed */ \
104162306a36Sopenharmony_ci	sizeof(struct hpi_message_header) + sizeof(struct hpi_async_msg) \
104262306a36Sopenharmony_ci}
104362306a36Sopenharmony_ci
104462306a36Sopenharmony_ci/*
104562306a36Sopenharmony_ciNote that the wSpecificError error field should be inspected and potentially
104662306a36Sopenharmony_cireported whenever HPI_ERROR_DSP_COMMUNICATION or HPI_ERROR_DSP_BOOTLOAD is
104762306a36Sopenharmony_cireturned in wError.
104862306a36Sopenharmony_ci*/
104962306a36Sopenharmony_cistruct hpi_response_header {
105062306a36Sopenharmony_ci	u16 size;
105162306a36Sopenharmony_ci	u8 type;		/* HPI_TYPE_RESPONSE  */
105262306a36Sopenharmony_ci	u8 version;		/* response version */
105362306a36Sopenharmony_ci	u16 object;		/* HPI_OBJ_* */
105462306a36Sopenharmony_ci	u16 function;		/* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
105562306a36Sopenharmony_ci	u16 error;		/* HPI_ERROR_xxx */
105662306a36Sopenharmony_ci	u16 specific_error;	/* adapter specific error */
105762306a36Sopenharmony_ci};
105862306a36Sopenharmony_ci
105962306a36Sopenharmony_cistruct hpi_response {
106062306a36Sopenharmony_ci/* following fields must match HPI_RESPONSE_HEADER */
106162306a36Sopenharmony_ci	u16 size;
106262306a36Sopenharmony_ci	u8 type;		/* HPI_TYPE_RESPONSE  */
106362306a36Sopenharmony_ci	u8 version;		/* response version */
106462306a36Sopenharmony_ci	u16 object;		/* HPI_OBJ_* */
106562306a36Sopenharmony_ci	u16 function;		/* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
106662306a36Sopenharmony_ci	u16 error;		/* HPI_ERROR_xxx */
106762306a36Sopenharmony_ci	u16 specific_error;	/* adapter specific error */
106862306a36Sopenharmony_ci	union {
106962306a36Sopenharmony_ci		struct hpi_subsys_res s;
107062306a36Sopenharmony_ci		union hpi_adapterx_res ax;
107162306a36Sopenharmony_ci		struct hpi_stream_res d;
107262306a36Sopenharmony_ci		struct hpi_mixer_res m;
107362306a36Sopenharmony_ci		union hpi_mixerx_res mx;	/* extended mixer; */
107462306a36Sopenharmony_ci		struct hpi_control_res c;	/* mixer control; */
107562306a36Sopenharmony_ci		/* identical to hpi_control_res, but field naming is improved */
107662306a36Sopenharmony_ci		union hpi_control_union_res cu;
107762306a36Sopenharmony_ci		struct hpi_nvmemory_res n;
107862306a36Sopenharmony_ci		struct hpi_gpio_res l;	/* digital i/o */
107962306a36Sopenharmony_ci		struct hpi_watchdog_res w;
108062306a36Sopenharmony_ci		struct hpi_clock_res t;	/* dsp time */
108162306a36Sopenharmony_ci		struct hpi_profile_res p;
108262306a36Sopenharmony_ci		struct hpi_async_res as;
108362306a36Sopenharmony_ci		u8 bytes[52];
108462306a36Sopenharmony_ci	} u;
108562306a36Sopenharmony_ci};
108662306a36Sopenharmony_ci
108762306a36Sopenharmony_ci#define HPI_RESPONSE_SIZE_BY_OBJECT { \
108862306a36Sopenharmony_ci	sizeof(struct hpi_response_header) ,/* Default, no object type 0 */ \
108962306a36Sopenharmony_ci	sizeof(struct hpi_response_header) + sizeof(struct hpi_subsys_res),\
109062306a36Sopenharmony_ci	sizeof(struct hpi_response_header) + sizeof(union  hpi_adapterx_res),\
109162306a36Sopenharmony_ci	sizeof(struct hpi_response_header) + sizeof(struct hpi_stream_res),\
109262306a36Sopenharmony_ci	sizeof(struct hpi_response_header) + sizeof(struct hpi_stream_res),\
109362306a36Sopenharmony_ci	sizeof(struct hpi_response_header) + sizeof(struct hpi_mixer_res),\
109462306a36Sopenharmony_ci	sizeof(struct hpi_response_header) , /* no node response */ \
109562306a36Sopenharmony_ci	sizeof(struct hpi_response_header) + sizeof(struct hpi_control_res),\
109662306a36Sopenharmony_ci	sizeof(struct hpi_response_header) + sizeof(struct hpi_nvmemory_res),\
109762306a36Sopenharmony_ci	sizeof(struct hpi_response_header) + sizeof(struct hpi_gpio_res),\
109862306a36Sopenharmony_ci	sizeof(struct hpi_response_header) + sizeof(struct hpi_watchdog_res),\
109962306a36Sopenharmony_ci	sizeof(struct hpi_response_header) + sizeof(struct hpi_clock_res),\
110062306a36Sopenharmony_ci	sizeof(struct hpi_response_header) + sizeof(struct hpi_profile_res),\
110162306a36Sopenharmony_ci	sizeof(struct hpi_response_header), /* controlx obj removed */ \
110262306a36Sopenharmony_ci	sizeof(struct hpi_response_header) + sizeof(struct hpi_async_res) \
110362306a36Sopenharmony_ci}
110462306a36Sopenharmony_ci
110562306a36Sopenharmony_ci/*********************** version 1 message/response **************************/
110662306a36Sopenharmony_ci#define HPINET_ETHERNET_DATA_SIZE (1500)
110762306a36Sopenharmony_ci#define HPINET_IP_HDR_SIZE (20)
110862306a36Sopenharmony_ci#define HPINET_IP_DATA_SIZE (HPINET_ETHERNET_DATA_SIZE - HPINET_IP_HDR_SIZE)
110962306a36Sopenharmony_ci#define HPINET_UDP_HDR_SIZE (8)
111062306a36Sopenharmony_ci#define HPINET_UDP_DATA_SIZE (HPINET_IP_DATA_SIZE - HPINET_UDP_HDR_SIZE)
111162306a36Sopenharmony_ci#define HPINET_ASI_HDR_SIZE (2)
111262306a36Sopenharmony_ci#define HPINET_ASI_DATA_SIZE (HPINET_UDP_DATA_SIZE - HPINET_ASI_HDR_SIZE)
111362306a36Sopenharmony_ci
111462306a36Sopenharmony_ci#define HPI_MAX_PAYLOAD_SIZE (HPINET_ASI_DATA_SIZE - 2)
111562306a36Sopenharmony_ci
111662306a36Sopenharmony_ci/* New style message/response, but still V0 compatible */
111762306a36Sopenharmony_cistruct hpi_msg_adapter_get_info {
111862306a36Sopenharmony_ci	struct hpi_message_header h;
111962306a36Sopenharmony_ci};
112062306a36Sopenharmony_ci
112162306a36Sopenharmony_cistruct hpi_res_adapter_get_info {
112262306a36Sopenharmony_ci	struct hpi_response_header h;	/*v0 */
112362306a36Sopenharmony_ci	struct hpi_adapter_res p;
112462306a36Sopenharmony_ci};
112562306a36Sopenharmony_ci
112662306a36Sopenharmony_cistruct hpi_res_adapter_debug_read {
112762306a36Sopenharmony_ci	struct hpi_response_header h;
112862306a36Sopenharmony_ci	u8 bytes[1024];
112962306a36Sopenharmony_ci};
113062306a36Sopenharmony_ci
113162306a36Sopenharmony_cistruct hpi_msg_cobranet_hmi {
113262306a36Sopenharmony_ci	u16 attribute;
113362306a36Sopenharmony_ci	u16 padding;
113462306a36Sopenharmony_ci	u32 hmi_address;
113562306a36Sopenharmony_ci	u32 byte_count;
113662306a36Sopenharmony_ci};
113762306a36Sopenharmony_ci
113862306a36Sopenharmony_cistruct hpi_msg_cobranet_hmiwrite {
113962306a36Sopenharmony_ci	struct hpi_message_header h;
114062306a36Sopenharmony_ci	struct hpi_msg_cobranet_hmi p;
114162306a36Sopenharmony_ci	u8 bytes[256];
114262306a36Sopenharmony_ci};
114362306a36Sopenharmony_ci
114462306a36Sopenharmony_cistruct hpi_msg_cobranet_hmiread {
114562306a36Sopenharmony_ci	struct hpi_message_header h;
114662306a36Sopenharmony_ci	struct hpi_msg_cobranet_hmi p;
114762306a36Sopenharmony_ci};
114862306a36Sopenharmony_ci
114962306a36Sopenharmony_cistruct hpi_res_cobranet_hmiread {
115062306a36Sopenharmony_ci	struct hpi_response_header h;
115162306a36Sopenharmony_ci	u32 byte_count;
115262306a36Sopenharmony_ci	u8 bytes[256];
115362306a36Sopenharmony_ci};
115462306a36Sopenharmony_ci
115562306a36Sopenharmony_ci#if 1
115662306a36Sopenharmony_ci#define hpi_message_header_v1 hpi_message_header
115762306a36Sopenharmony_ci#define hpi_response_header_v1 hpi_response_header
115862306a36Sopenharmony_ci#else
115962306a36Sopenharmony_ci/* V1 headers in Addition to v0 headers */
116062306a36Sopenharmony_cistruct hpi_message_header_v1 {
116162306a36Sopenharmony_ci	struct hpi_message_header h0;
116262306a36Sopenharmony_ci/* struct {
116362306a36Sopenharmony_ci} h1; */
116462306a36Sopenharmony_ci};
116562306a36Sopenharmony_ci
116662306a36Sopenharmony_cistruct hpi_response_header_v1 {
116762306a36Sopenharmony_ci	struct hpi_response_header h0;
116862306a36Sopenharmony_ci	struct {
116962306a36Sopenharmony_ci		u16 adapter_index;	/* the adapter index */
117062306a36Sopenharmony_ci		u16 obj_index;	/* object index */
117162306a36Sopenharmony_ci	} h1;
117262306a36Sopenharmony_ci};
117362306a36Sopenharmony_ci#endif
117462306a36Sopenharmony_ci
117562306a36Sopenharmony_cistruct hpi_msg_payload_v0 {
117662306a36Sopenharmony_ci	struct hpi_message_header h;
117762306a36Sopenharmony_ci	union {
117862306a36Sopenharmony_ci		struct hpi_subsys_msg s;
117962306a36Sopenharmony_ci		union hpi_adapterx_msg ax;
118062306a36Sopenharmony_ci		struct hpi_stream_msg d;
118162306a36Sopenharmony_ci		struct hpi_mixer_msg m;
118262306a36Sopenharmony_ci		union hpi_mixerx_msg mx;
118362306a36Sopenharmony_ci		struct hpi_control_msg c;
118462306a36Sopenharmony_ci		struct hpi_control_union_msg cu;
118562306a36Sopenharmony_ci		struct hpi_nvmemory_msg n;
118662306a36Sopenharmony_ci		struct hpi_gpio_msg l;
118762306a36Sopenharmony_ci		struct hpi_watchdog_msg w;
118862306a36Sopenharmony_ci		struct hpi_clock_msg t;
118962306a36Sopenharmony_ci		struct hpi_profile_msg p;
119062306a36Sopenharmony_ci		struct hpi_async_msg as;
119162306a36Sopenharmony_ci	} u;
119262306a36Sopenharmony_ci};
119362306a36Sopenharmony_ci
119462306a36Sopenharmony_cistruct hpi_res_payload_v0 {
119562306a36Sopenharmony_ci	struct hpi_response_header h;
119662306a36Sopenharmony_ci	union {
119762306a36Sopenharmony_ci		struct hpi_subsys_res s;
119862306a36Sopenharmony_ci		union hpi_adapterx_res ax;
119962306a36Sopenharmony_ci		struct hpi_stream_res d;
120062306a36Sopenharmony_ci		struct hpi_mixer_res m;
120162306a36Sopenharmony_ci		union hpi_mixerx_res mx;
120262306a36Sopenharmony_ci		struct hpi_control_res c;
120362306a36Sopenharmony_ci		union hpi_control_union_res cu;
120462306a36Sopenharmony_ci		struct hpi_nvmemory_res n;
120562306a36Sopenharmony_ci		struct hpi_gpio_res l;
120662306a36Sopenharmony_ci		struct hpi_watchdog_res w;
120762306a36Sopenharmony_ci		struct hpi_clock_res t;
120862306a36Sopenharmony_ci		struct hpi_profile_res p;
120962306a36Sopenharmony_ci		struct hpi_async_res as;
121062306a36Sopenharmony_ci	} u;
121162306a36Sopenharmony_ci};
121262306a36Sopenharmony_ci
121362306a36Sopenharmony_ciunion hpi_message_buffer_v1 {
121462306a36Sopenharmony_ci	struct hpi_message m0;	/* version 0 */
121562306a36Sopenharmony_ci	struct hpi_message_header_v1 h;
121662306a36Sopenharmony_ci	u8 buf[HPI_MAX_PAYLOAD_SIZE];
121762306a36Sopenharmony_ci};
121862306a36Sopenharmony_ci
121962306a36Sopenharmony_ciunion hpi_response_buffer_v1 {
122062306a36Sopenharmony_ci	struct hpi_response r0;	/* version 0 */
122162306a36Sopenharmony_ci	struct hpi_response_header_v1 h;
122262306a36Sopenharmony_ci	u8 buf[HPI_MAX_PAYLOAD_SIZE];
122362306a36Sopenharmony_ci};
122462306a36Sopenharmony_ci
122562306a36Sopenharmony_cicompile_time_assert((sizeof(union hpi_message_buffer_v1) <=
122662306a36Sopenharmony_ci		HPI_MAX_PAYLOAD_SIZE), message_buffer_ok);
122762306a36Sopenharmony_cicompile_time_assert((sizeof(union hpi_response_buffer_v1) <=
122862306a36Sopenharmony_ci		HPI_MAX_PAYLOAD_SIZE), response_buffer_ok);
122962306a36Sopenharmony_ci
123062306a36Sopenharmony_ci/*////////////////////////////////////////////////////////////////////////// */
123162306a36Sopenharmony_ci/* declarations for compact control calls  */
123262306a36Sopenharmony_cistruct hpi_control_defn {
123362306a36Sopenharmony_ci	u8 type;
123462306a36Sopenharmony_ci	u8 channels;
123562306a36Sopenharmony_ci	u8 src_node_type;
123662306a36Sopenharmony_ci	u8 src_node_index;
123762306a36Sopenharmony_ci	u8 dest_node_type;
123862306a36Sopenharmony_ci	u8 dest_node_index;
123962306a36Sopenharmony_ci};
124062306a36Sopenharmony_ci
124162306a36Sopenharmony_ci/*////////////////////////////////////////////////////////////////////////// */
124262306a36Sopenharmony_ci/* declarations for control caching (internal to HPI<->DSP interaction)      */
124362306a36Sopenharmony_ci
124462306a36Sopenharmony_ci/** indicates a cached u16 value is invalid. */
124562306a36Sopenharmony_ci#define HPI_CACHE_INVALID_UINT16 0xFFFF
124662306a36Sopenharmony_ci/** indicates a cached short value is invalid. */
124762306a36Sopenharmony_ci#define HPI_CACHE_INVALID_SHORT -32768
124862306a36Sopenharmony_ci
124962306a36Sopenharmony_ci/** A compact representation of (part of) a controls state.
125062306a36Sopenharmony_ciUsed for efficient transfer of the control state
125162306a36Sopenharmony_cibetween DSP and host or across a network
125262306a36Sopenharmony_ci*/
125362306a36Sopenharmony_cistruct hpi_control_cache_info {
125462306a36Sopenharmony_ci	/** one of HPI_CONTROL_* */
125562306a36Sopenharmony_ci	u8 control_type;
125662306a36Sopenharmony_ci	/** The total size of cached information in 32-bit words. */
125762306a36Sopenharmony_ci	u8 size_in32bit_words;
125862306a36Sopenharmony_ci	/** The original index of the control on the DSP */
125962306a36Sopenharmony_ci	u16 control_index;
126062306a36Sopenharmony_ci};
126162306a36Sopenharmony_ci
126262306a36Sopenharmony_cistruct hpi_control_cache_vol {
126362306a36Sopenharmony_ci	struct hpi_control_cache_info i;
126462306a36Sopenharmony_ci	short an_log[2];
126562306a36Sopenharmony_ci	unsigned short flags;
126662306a36Sopenharmony_ci	char padding[2];
126762306a36Sopenharmony_ci};
126862306a36Sopenharmony_ci
126962306a36Sopenharmony_cistruct hpi_control_cache_meter {
127062306a36Sopenharmony_ci	struct hpi_control_cache_info i;
127162306a36Sopenharmony_ci	short an_log_peak[2];
127262306a36Sopenharmony_ci	short an_logRMS[2];
127362306a36Sopenharmony_ci};
127462306a36Sopenharmony_ci
127562306a36Sopenharmony_cistruct hpi_control_cache_channelmode {
127662306a36Sopenharmony_ci	struct hpi_control_cache_info i;
127762306a36Sopenharmony_ci	u16 mode;
127862306a36Sopenharmony_ci	char temp_padding[6];
127962306a36Sopenharmony_ci};
128062306a36Sopenharmony_ci
128162306a36Sopenharmony_cistruct hpi_control_cache_mux {
128262306a36Sopenharmony_ci	struct hpi_control_cache_info i;
128362306a36Sopenharmony_ci	u16 source_node_type;
128462306a36Sopenharmony_ci	u16 source_node_index;
128562306a36Sopenharmony_ci	char temp_padding[4];
128662306a36Sopenharmony_ci};
128762306a36Sopenharmony_ci
128862306a36Sopenharmony_cistruct hpi_control_cache_level {
128962306a36Sopenharmony_ci	struct hpi_control_cache_info i;
129062306a36Sopenharmony_ci	short an_log[2];
129162306a36Sopenharmony_ci	char temp_padding[4];
129262306a36Sopenharmony_ci};
129362306a36Sopenharmony_ci
129462306a36Sopenharmony_cistruct hpi_control_cache_tuner {
129562306a36Sopenharmony_ci	struct hpi_control_cache_info i;
129662306a36Sopenharmony_ci	u32 freq_ink_hz;
129762306a36Sopenharmony_ci	u16 band;
129862306a36Sopenharmony_ci	short s_level_avg;
129962306a36Sopenharmony_ci};
130062306a36Sopenharmony_ci
130162306a36Sopenharmony_cistruct hpi_control_cache_aes3rx {
130262306a36Sopenharmony_ci	struct hpi_control_cache_info i;
130362306a36Sopenharmony_ci	u32 error_status;
130462306a36Sopenharmony_ci	u32 format;
130562306a36Sopenharmony_ci};
130662306a36Sopenharmony_ci
130762306a36Sopenharmony_cistruct hpi_control_cache_aes3tx {
130862306a36Sopenharmony_ci	struct hpi_control_cache_info i;
130962306a36Sopenharmony_ci	u32 format;
131062306a36Sopenharmony_ci	char temp_padding[4];
131162306a36Sopenharmony_ci};
131262306a36Sopenharmony_ci
131362306a36Sopenharmony_cistruct hpi_control_cache_tonedetector {
131462306a36Sopenharmony_ci	struct hpi_control_cache_info i;
131562306a36Sopenharmony_ci	u16 state;
131662306a36Sopenharmony_ci	char temp_padding[6];
131762306a36Sopenharmony_ci};
131862306a36Sopenharmony_ci
131962306a36Sopenharmony_cistruct hpi_control_cache_silencedetector {
132062306a36Sopenharmony_ci	struct hpi_control_cache_info i;
132162306a36Sopenharmony_ci	u32 state;
132262306a36Sopenharmony_ci	char temp_padding[4];
132362306a36Sopenharmony_ci};
132462306a36Sopenharmony_ci
132562306a36Sopenharmony_cistruct hpi_control_cache_sampleclock {
132662306a36Sopenharmony_ci	struct hpi_control_cache_info i;
132762306a36Sopenharmony_ci	u16 source;
132862306a36Sopenharmony_ci	u16 source_index;
132962306a36Sopenharmony_ci	u32 sample_rate;
133062306a36Sopenharmony_ci};
133162306a36Sopenharmony_ci
133262306a36Sopenharmony_cistruct hpi_control_cache_microphone {
133362306a36Sopenharmony_ci	struct hpi_control_cache_info i;
133462306a36Sopenharmony_ci	u16 phantom_state;
133562306a36Sopenharmony_ci	char temp_padding[6];
133662306a36Sopenharmony_ci};
133762306a36Sopenharmony_ci
133862306a36Sopenharmony_cistruct hpi_control_cache_single {
133962306a36Sopenharmony_ci	union {
134062306a36Sopenharmony_ci		struct hpi_control_cache_info i;
134162306a36Sopenharmony_ci		struct hpi_control_cache_vol vol;
134262306a36Sopenharmony_ci		struct hpi_control_cache_meter meter;
134362306a36Sopenharmony_ci		struct hpi_control_cache_channelmode mode;
134462306a36Sopenharmony_ci		struct hpi_control_cache_mux mux;
134562306a36Sopenharmony_ci		struct hpi_control_cache_level level;
134662306a36Sopenharmony_ci		struct hpi_control_cache_tuner tuner;
134762306a36Sopenharmony_ci		struct hpi_control_cache_aes3rx aes3rx;
134862306a36Sopenharmony_ci		struct hpi_control_cache_aes3tx aes3tx;
134962306a36Sopenharmony_ci		struct hpi_control_cache_tonedetector tone;
135062306a36Sopenharmony_ci		struct hpi_control_cache_silencedetector silence;
135162306a36Sopenharmony_ci		struct hpi_control_cache_sampleclock clk;
135262306a36Sopenharmony_ci		struct hpi_control_cache_microphone microphone;
135362306a36Sopenharmony_ci	} u;
135462306a36Sopenharmony_ci};
135562306a36Sopenharmony_ci
135662306a36Sopenharmony_cistruct hpi_control_cache_pad {
135762306a36Sopenharmony_ci	struct hpi_control_cache_info i;
135862306a36Sopenharmony_ci	u32 field_valid_flags;
135962306a36Sopenharmony_ci	u8 c_channel[40];
136062306a36Sopenharmony_ci	u8 c_artist[100];
136162306a36Sopenharmony_ci	u8 c_title[100];
136262306a36Sopenharmony_ci	u8 c_comment[200];
136362306a36Sopenharmony_ci	u32 pTY;
136462306a36Sopenharmony_ci	u32 pI;
136562306a36Sopenharmony_ci	u32 traffic_supported;
136662306a36Sopenharmony_ci	u32 traffic_anouncement;
136762306a36Sopenharmony_ci};
136862306a36Sopenharmony_ci
136962306a36Sopenharmony_ci/* 2^N sized FIFO buffer (internal to HPI<->DSP interaction) */
137062306a36Sopenharmony_cistruct hpi_fifo_buffer {
137162306a36Sopenharmony_ci	u32 size;
137262306a36Sopenharmony_ci	u32 dsp_index;
137362306a36Sopenharmony_ci	u32 host_index;
137462306a36Sopenharmony_ci};
137562306a36Sopenharmony_ci
137662306a36Sopenharmony_ci#ifndef DISABLE_PRAGMA_PACK1
137762306a36Sopenharmony_ci#pragma pack(pop)
137862306a36Sopenharmony_ci#endif
137962306a36Sopenharmony_ci
138062306a36Sopenharmony_ci/* skip host side function declarations for DSP
138162306a36Sopenharmony_ci   compile and documentation extraction */
138262306a36Sopenharmony_ci
138362306a36Sopenharmony_cichar hpi_handle_object(const u32 handle);
138462306a36Sopenharmony_ci
138562306a36Sopenharmony_civoid hpi_handle_to_indexes(const u32 handle, u16 *pw_adapter_index,
138662306a36Sopenharmony_ci	u16 *pw_object_index);
138762306a36Sopenharmony_ci
138862306a36Sopenharmony_ciu32 hpi_indexes_to_handle(const char c_object, const u16 adapter_index,
138962306a36Sopenharmony_ci	const u16 object_index);
139062306a36Sopenharmony_ci
139162306a36Sopenharmony_ci/*////////////////////////////////////////////////////////////////////////// */
139262306a36Sopenharmony_ci
139362306a36Sopenharmony_ci/* main HPI entry point */
139462306a36Sopenharmony_civoid hpi_send_recv(struct hpi_message *phm, struct hpi_response *phr);
139562306a36Sopenharmony_ci
139662306a36Sopenharmony_ci/* used in PnP OS/driver */
139762306a36Sopenharmony_ciu16 hpi_outstream_host_buffer_get_info(u32 h_outstream, u8 **pp_buffer,
139862306a36Sopenharmony_ci	struct hpi_hostbuffer_status **pp_status);
139962306a36Sopenharmony_ci
140062306a36Sopenharmony_ciu16 hpi_instream_host_buffer_get_info(u32 h_instream, u8 **pp_buffer,
140162306a36Sopenharmony_ci	struct hpi_hostbuffer_status **pp_status);
140262306a36Sopenharmony_ci
140362306a36Sopenharmony_ci/*
140462306a36Sopenharmony_ciThe following 3 functions were last declared in header files for
140562306a36Sopenharmony_cidriver 3.10. HPI_ControlQuery() used to be the recommended way
140662306a36Sopenharmony_ciof getting a volume range. Declared here for binary asihpi32.dll
140762306a36Sopenharmony_cicompatibility.
140862306a36Sopenharmony_ci*/
140962306a36Sopenharmony_ci
141062306a36Sopenharmony_civoid hpi_format_to_msg(struct hpi_msg_format *pMF,
141162306a36Sopenharmony_ci	const struct hpi_format *pF);
141262306a36Sopenharmony_civoid hpi_stream_response_to_legacy(struct hpi_stream_res *pSR);
141362306a36Sopenharmony_ci
141462306a36Sopenharmony_ci/*////////////////////////////////////////////////////////////////////////// */
141562306a36Sopenharmony_ci/* declarations for individual HPI entry points */
141662306a36Sopenharmony_cihpi_handler_func HPI_6000;
141762306a36Sopenharmony_cihpi_handler_func HPI_6205;
141862306a36Sopenharmony_ci
141962306a36Sopenharmony_ci#endif				/* _HPI_INTERNAL_H_ */
1420