Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | |
| 3 | AudioScience HPI driver |
Eliot Blennerhassett | b7f1248 | 2011-07-22 15:52:55 +1200 | [diff] [blame^] | 4 | Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com> |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 5 | |
| 6 | This program is free software; you can redistribute it and/or modify |
| 7 | it under the terms of version 2 of the GNU General Public License as |
| 8 | published by the Free Software Foundation; |
| 9 | |
| 10 | This program is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | GNU General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU General Public License |
| 16 | along with this program; if not, write to the Free Software |
| 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 18 | |
| 19 | HPI internal definitions |
| 20 | |
| 21 | (C) Copyright AudioScience Inc. 1996-2009 |
| 22 | ******************************************************************************/ |
| 23 | |
| 24 | #ifndef _HPI_INTERNAL_H_ |
| 25 | #define _HPI_INTERNAL_H_ |
| 26 | |
| 27 | #include "hpi.h" |
| 28 | /** maximum number of memory regions mapped to an adapter */ |
| 29 | #define HPI_MAX_ADAPTER_MEM_SPACES (2) |
| 30 | |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 31 | /* Each OS needs its own hpios.h */ |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 32 | #include "hpios.h" |
| 33 | |
| 34 | /* physical memory allocation */ |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 35 | |
| 36 | /** Allocate and map an area of locked memory for bus master DMA operations. |
| 37 | |
| 38 | On success, *pLockedMemeHandle is a valid handle, and 0 is returned |
| 39 | On error *pLockedMemHandle marked invalid, non-zero returned. |
| 40 | |
| 41 | If this function succeeds, then HpiOs_LockedMem_GetVirtAddr() and |
| 42 | HpiOs_LockedMem_GetPyhsAddr() will always succed on the returned handle. |
| 43 | */ |
| 44 | u16 hpios_locked_mem_alloc(struct consistent_dma_area *p_locked_mem_handle, |
| 45 | /**< memory handle */ |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 46 | u32 size, /**< Size in bytes to allocate */ |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 47 | struct pci_dev *p_os_reference |
| 48 | /**< OS specific data required for memory allocation */ |
| 49 | ); |
| 50 | |
| 51 | /** Free mapping and memory represented by LockedMemHandle |
| 52 | |
| 53 | Frees any resources, then invalidates the handle. |
| 54 | Returns 0 on success, 1 if handle is invalid. |
| 55 | |
| 56 | */ |
| 57 | u16 hpios_locked_mem_free(struct consistent_dma_area *locked_mem_handle); |
| 58 | |
| 59 | /** Get the physical PCI address of memory represented by LockedMemHandle. |
| 60 | |
| 61 | If handle is invalid *pPhysicalAddr is set to zero and return 1 |
| 62 | */ |
| 63 | u16 hpios_locked_mem_get_phys_addr(struct consistent_dma_area |
| 64 | *locked_mem_handle, u32 *p_physical_addr); |
| 65 | |
| 66 | /** Get the CPU address of of memory represented by LockedMemHandle. |
| 67 | |
| 68 | If handle is NULL *ppvVirtualAddr is set to NULL and return 1 |
| 69 | */ |
| 70 | u16 hpios_locked_mem_get_virt_addr(struct consistent_dma_area |
| 71 | *locked_mem_handle, void **ppv_virtual_addr); |
| 72 | |
| 73 | /** Check that handle is valid |
| 74 | i.e it represents a valid memory area |
| 75 | */ |
| 76 | u16 hpios_locked_mem_valid(struct consistent_dma_area *locked_mem_handle); |
| 77 | |
| 78 | /* timing/delay */ |
| 79 | void hpios_delay_micro_seconds(u32 num_micro_sec); |
| 80 | |
| 81 | struct hpi_message; |
| 82 | struct hpi_response; |
| 83 | |
| 84 | typedef void hpi_handler_func(struct hpi_message *, struct hpi_response *); |
| 85 | |
| 86 | /* If the assert fails, compiler complains |
| 87 | something like size of array `msg' is negative. |
| 88 | Unlike linux BUILD_BUG_ON, this works outside function scope. |
| 89 | */ |
| 90 | #define compile_time_assert(cond, msg) \ |
| 91 | typedef char ASSERT_##msg[(cond) ? 1 : -1] |
| 92 | |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 93 | /******************************************* bus types */ |
| 94 | enum HPI_BUSES { |
| 95 | HPI_BUS_ISAPNP = 1, |
| 96 | HPI_BUS_PCI = 2, |
| 97 | HPI_BUS_USB = 3, |
| 98 | HPI_BUS_NET = 4 |
| 99 | }; |
| 100 | |
Eliot Blennerhassett | ba94455 | 2011-02-10 17:26:04 +1300 | [diff] [blame] | 101 | enum HPI_SUBSYS_OPTIONS { |
| 102 | /* 0, 256 are invalid, 1..255 reserved for global options */ |
| 103 | HPI_SUBSYS_OPT_NET_ENABLE = 257, |
| 104 | HPI_SUBSYS_OPT_NET_BROADCAST = 258, |
| 105 | HPI_SUBSYS_OPT_NET_UNICAST = 259, |
| 106 | HPI_SUBSYS_OPT_NET_ADDR = 260, |
| 107 | HPI_SUBSYS_OPT_NET_MASK = 261, |
| 108 | HPI_SUBSYS_OPT_NET_ADAPTER_ADDRESS_ADD = 262 |
| 109 | }; |
| 110 | |
Eliot Blennerhassett | fc3a399 | 2011-02-10 17:26:11 +1300 | [diff] [blame] | 111 | /** Volume flags |
| 112 | */ |
| 113 | enum HPI_VOLUME_FLAGS { |
| 114 | /** Set if the volume control is muted */ |
| 115 | HPI_VOLUME_FLAG_MUTED = (1 << 0), |
| 116 | /** Set if the volume control has a mute function */ |
| 117 | HPI_VOLUME_FLAG_HAS_MUTE = (1 << 1), |
| 118 | /** Set if volume control can do autofading */ |
| 119 | HPI_VOLUME_FLAG_HAS_AUTOFADE = (1 << 2) |
| 120 | /* Note Flags >= (1<<8) are for DSP internal use only */ |
| 121 | }; |
| 122 | |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 123 | /******************************************* CONTROL ATTRIBUTES ****/ |
| 124 | /* (in order of control type ID */ |
| 125 | |
Eliot Blennerhassett | 108ccb3 | 2010-07-06 08:37:09 +1200 | [diff] [blame] | 126 | /* This allows for 255 control types, 256 unique attributes each */ |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 127 | #define HPI_CTL_ATTR(ctl, ai) ((HPI_CONTROL_##ctl << 8) + ai) |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 128 | |
| 129 | /* Get the sub-index of the attribute for a control type */ |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 130 | #define HPI_CTL_ATTR_INDEX(i) (i & 0xff) |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 131 | |
Eliot Blennerhassett | 108ccb3 | 2010-07-06 08:37:09 +1200 | [diff] [blame] | 132 | /* Extract the control from the control attribute */ |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 133 | #define HPI_CTL_ATTR_CONTROL(i) (i >> 8) |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 134 | |
| 135 | /** Enable event generation for a control. |
| 136 | 0=disable, 1=enable |
| 137 | \note generic to all controls that can generate events |
| 138 | */ |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 139 | |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 140 | /** Unique identifiers for every control attribute |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 141 | */ |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 142 | enum HPI_CONTROL_ATTRIBUTES { |
| 143 | HPI_GENERIC_ENABLE = HPI_CTL_ATTR(GENERIC, 1), |
| 144 | HPI_GENERIC_EVENT_ENABLE = HPI_CTL_ATTR(GENERIC, 2), |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 145 | |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 146 | HPI_VOLUME_GAIN = HPI_CTL_ATTR(VOLUME, 1), |
| 147 | HPI_VOLUME_AUTOFADE = HPI_CTL_ATTR(VOLUME, 2), |
Eliot Blennerhassett | fc3a399 | 2011-02-10 17:26:11 +1300 | [diff] [blame] | 148 | HPI_VOLUME_MUTE = HPI_CTL_ATTR(VOLUME, 3), |
| 149 | HPI_VOLUME_GAIN_AND_FLAGS = HPI_CTL_ATTR(VOLUME, 4), |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 150 | HPI_VOLUME_NUM_CHANNELS = HPI_CTL_ATTR(VOLUME, 6), |
| 151 | HPI_VOLUME_RANGE = HPI_CTL_ATTR(VOLUME, 10), |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 152 | |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 153 | HPI_METER_RMS = HPI_CTL_ATTR(METER, 1), |
| 154 | HPI_METER_PEAK = HPI_CTL_ATTR(METER, 2), |
| 155 | HPI_METER_RMS_BALLISTICS = HPI_CTL_ATTR(METER, 3), |
| 156 | HPI_METER_PEAK_BALLISTICS = HPI_CTL_ATTR(METER, 4), |
| 157 | HPI_METER_NUM_CHANNELS = HPI_CTL_ATTR(METER, 5), |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 158 | |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 159 | HPI_MULTIPLEXER_SOURCE = HPI_CTL_ATTR(MULTIPLEXER, 1), |
| 160 | HPI_MULTIPLEXER_QUERYSOURCE = HPI_CTL_ATTR(MULTIPLEXER, 2), |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 161 | |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 162 | HPI_AESEBUTX_FORMAT = HPI_CTL_ATTR(AESEBUTX, 1), |
| 163 | HPI_AESEBUTX_SAMPLERATE = HPI_CTL_ATTR(AESEBUTX, 3), |
| 164 | HPI_AESEBUTX_CHANNELSTATUS = HPI_CTL_ATTR(AESEBUTX, 4), |
| 165 | HPI_AESEBUTX_USERDATA = HPI_CTL_ATTR(AESEBUTX, 5), |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 166 | |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 167 | HPI_AESEBURX_FORMAT = HPI_CTL_ATTR(AESEBURX, 1), |
| 168 | HPI_AESEBURX_ERRORSTATUS = HPI_CTL_ATTR(AESEBURX, 2), |
| 169 | HPI_AESEBURX_SAMPLERATE = HPI_CTL_ATTR(AESEBURX, 3), |
| 170 | HPI_AESEBURX_CHANNELSTATUS = HPI_CTL_ATTR(AESEBURX, 4), |
| 171 | HPI_AESEBURX_USERDATA = HPI_CTL_ATTR(AESEBURX, 5), |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 172 | |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 173 | HPI_LEVEL_GAIN = HPI_CTL_ATTR(LEVEL, 1), |
| 174 | HPI_LEVEL_RANGE = HPI_CTL_ATTR(LEVEL, 10), |
| 175 | |
| 176 | HPI_TUNER_BAND = HPI_CTL_ATTR(TUNER, 1), |
| 177 | HPI_TUNER_FREQ = HPI_CTL_ATTR(TUNER, 2), |
| 178 | HPI_TUNER_LEVEL_AVG = HPI_CTL_ATTR(TUNER, 3), |
| 179 | HPI_TUNER_LEVEL_RAW = HPI_CTL_ATTR(TUNER, 4), |
| 180 | HPI_TUNER_SNR = HPI_CTL_ATTR(TUNER, 5), |
| 181 | HPI_TUNER_GAIN = HPI_CTL_ATTR(TUNER, 6), |
| 182 | HPI_TUNER_STATUS = HPI_CTL_ATTR(TUNER, 7), |
| 183 | HPI_TUNER_MODE = HPI_CTL_ATTR(TUNER, 8), |
| 184 | HPI_TUNER_RDS = HPI_CTL_ATTR(TUNER, 9), |
| 185 | HPI_TUNER_DEEMPHASIS = HPI_CTL_ATTR(TUNER, 10), |
| 186 | HPI_TUNER_PROGRAM = HPI_CTL_ATTR(TUNER, 11), |
| 187 | HPI_TUNER_HDRADIO_SIGNAL_QUALITY = HPI_CTL_ATTR(TUNER, 12), |
| 188 | HPI_TUNER_HDRADIO_SDK_VERSION = HPI_CTL_ATTR(TUNER, 13), |
| 189 | HPI_TUNER_HDRADIO_DSP_VERSION = HPI_CTL_ATTR(TUNER, 14), |
| 190 | HPI_TUNER_HDRADIO_BLEND = HPI_CTL_ATTR(TUNER, 15), |
| 191 | |
| 192 | HPI_VOX_THRESHOLD = HPI_CTL_ATTR(VOX, 1), |
| 193 | |
| 194 | HPI_CHANNEL_MODE_MODE = HPI_CTL_ATTR(CHANNEL_MODE, 1), |
| 195 | |
| 196 | HPI_BITSTREAM_DATA_POLARITY = HPI_CTL_ATTR(BITSTREAM, 1), |
| 197 | HPI_BITSTREAM_CLOCK_EDGE = HPI_CTL_ATTR(BITSTREAM, 2), |
| 198 | HPI_BITSTREAM_CLOCK_SOURCE = HPI_CTL_ATTR(BITSTREAM, 3), |
| 199 | HPI_BITSTREAM_ACTIVITY = HPI_CTL_ATTR(BITSTREAM, 4), |
| 200 | |
| 201 | HPI_SAMPLECLOCK_SOURCE = HPI_CTL_ATTR(SAMPLECLOCK, 1), |
| 202 | HPI_SAMPLECLOCK_SAMPLERATE = HPI_CTL_ATTR(SAMPLECLOCK, 2), |
| 203 | HPI_SAMPLECLOCK_SOURCE_INDEX = HPI_CTL_ATTR(SAMPLECLOCK, 3), |
| 204 | HPI_SAMPLECLOCK_LOCAL_SAMPLERATE = HPI_CTL_ATTR(SAMPLECLOCK, 4), |
| 205 | HPI_SAMPLECLOCK_AUTO = HPI_CTL_ATTR(SAMPLECLOCK, 5), |
| 206 | HPI_SAMPLECLOCK_LOCAL_LOCK = HPI_CTL_ATTR(SAMPLECLOCK, 6), |
| 207 | |
| 208 | HPI_MICROPHONE_PHANTOM_POWER = HPI_CTL_ATTR(MICROPHONE, 1), |
| 209 | |
| 210 | HPI_EQUALIZER_NUM_FILTERS = HPI_CTL_ATTR(EQUALIZER, 1), |
| 211 | HPI_EQUALIZER_FILTER = HPI_CTL_ATTR(EQUALIZER, 2), |
| 212 | HPI_EQUALIZER_COEFFICIENTS = HPI_CTL_ATTR(EQUALIZER, 3), |
| 213 | |
| 214 | HPI_COMPANDER_PARAMS = HPI_CTL_ATTR(COMPANDER, 1), |
| 215 | HPI_COMPANDER_MAKEUPGAIN = HPI_CTL_ATTR(COMPANDER, 2), |
| 216 | HPI_COMPANDER_THRESHOLD = HPI_CTL_ATTR(COMPANDER, 3), |
| 217 | HPI_COMPANDER_RATIO = HPI_CTL_ATTR(COMPANDER, 4), |
| 218 | HPI_COMPANDER_ATTACK = HPI_CTL_ATTR(COMPANDER, 5), |
| 219 | HPI_COMPANDER_DECAY = HPI_CTL_ATTR(COMPANDER, 6), |
| 220 | |
| 221 | HPI_COBRANET_SET = HPI_CTL_ATTR(COBRANET, 1), |
| 222 | HPI_COBRANET_GET = HPI_CTL_ATTR(COBRANET, 2), |
Eliot Blennerhassett | 58fbf77 | 2011-07-22 15:52:40 +1200 | [diff] [blame] | 223 | /*HPI_COBRANET_SET_DATA = HPI_CTL_ATTR(COBRANET, 3), */ |
| 224 | /*HPI_COBRANET_GET_DATA = HPI_CTL_ATTR(COBRANET, 4), */ |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 225 | HPI_COBRANET_GET_STATUS = HPI_CTL_ATTR(COBRANET, 5), |
| 226 | HPI_COBRANET_SEND_PACKET = HPI_CTL_ATTR(COBRANET, 6), |
| 227 | HPI_COBRANET_GET_PACKET = HPI_CTL_ATTR(COBRANET, 7), |
| 228 | |
| 229 | HPI_TONEDETECTOR_THRESHOLD = HPI_CTL_ATTR(TONEDETECTOR, 1), |
| 230 | HPI_TONEDETECTOR_STATE = HPI_CTL_ATTR(TONEDETECTOR, 2), |
| 231 | HPI_TONEDETECTOR_FREQUENCY = HPI_CTL_ATTR(TONEDETECTOR, 3), |
| 232 | |
| 233 | HPI_SILENCEDETECTOR_THRESHOLD = HPI_CTL_ATTR(SILENCEDETECTOR, 1), |
| 234 | HPI_SILENCEDETECTOR_STATE = HPI_CTL_ATTR(SILENCEDETECTOR, 2), |
| 235 | HPI_SILENCEDETECTOR_DELAY = HPI_CTL_ATTR(SILENCEDETECTOR, 3), |
| 236 | |
| 237 | HPI_PAD_CHANNEL_NAME = HPI_CTL_ATTR(PAD, 1), |
| 238 | HPI_PAD_ARTIST = HPI_CTL_ATTR(PAD, 2), |
| 239 | HPI_PAD_TITLE = HPI_CTL_ATTR(PAD, 3), |
| 240 | HPI_PAD_COMMENT = HPI_CTL_ATTR(PAD, 4), |
| 241 | HPI_PAD_PROGRAM_TYPE = HPI_CTL_ATTR(PAD, 5), |
| 242 | HPI_PAD_PROGRAM_ID = HPI_CTL_ATTR(PAD, 6), |
| 243 | HPI_PAD_TA_SUPPORT = HPI_CTL_ATTR(PAD, 7), |
| 244 | HPI_PAD_TA_ACTIVE = HPI_CTL_ATTR(PAD, 8) |
| 245 | }; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 246 | |
| 247 | #define HPI_POLARITY_POSITIVE 0 |
| 248 | #define HPI_POLARITY_NEGATIVE 1 |
| 249 | |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 250 | /*------------------------------------------------------------ |
| 251 | Cobranet Chip Bridge - copied from HMI.H |
| 252 | ------------------------------------------------------------*/ |
| 253 | #define HPI_COBRANET_HMI_cobra_bridge 0x20000 |
| 254 | #define HPI_COBRANET_HMI_cobra_bridge_tx_pkt_buf \ |
| 255 | (HPI_COBRANET_HMI_cobra_bridge + 0x1000) |
| 256 | #define HPI_COBRANET_HMI_cobra_bridge_rx_pkt_buf \ |
| 257 | (HPI_COBRANET_HMI_cobra_bridge + 0x2000) |
| 258 | #define HPI_COBRANET_HMI_cobra_if_table1 0x110000 |
| 259 | #define HPI_COBRANET_HMI_cobra_if_phy_address \ |
| 260 | (HPI_COBRANET_HMI_cobra_if_table1 + 0xd) |
| 261 | #define HPI_COBRANET_HMI_cobra_protocolIP 0x72000 |
| 262 | #define HPI_COBRANET_HMI_cobra_ip_mon_currentIP \ |
| 263 | (HPI_COBRANET_HMI_cobra_protocolIP + 0x0) |
| 264 | #define HPI_COBRANET_HMI_cobra_ip_mon_staticIP \ |
| 265 | (HPI_COBRANET_HMI_cobra_protocolIP + 0x2) |
| 266 | #define HPI_COBRANET_HMI_cobra_sys 0x100000 |
| 267 | #define HPI_COBRANET_HMI_cobra_sys_desc \ |
| 268 | (HPI_COBRANET_HMI_cobra_sys + 0x0) |
| 269 | #define HPI_COBRANET_HMI_cobra_sys_objectID \ |
| 270 | (HPI_COBRANET_HMI_cobra_sys + 0x100) |
| 271 | #define HPI_COBRANET_HMI_cobra_sys_contact \ |
| 272 | (HPI_COBRANET_HMI_cobra_sys + 0x200) |
| 273 | #define HPI_COBRANET_HMI_cobra_sys_name \ |
| 274 | (HPI_COBRANET_HMI_cobra_sys + 0x300) |
| 275 | #define HPI_COBRANET_HMI_cobra_sys_location \ |
| 276 | (HPI_COBRANET_HMI_cobra_sys + 0x400) |
| 277 | |
| 278 | /*------------------------------------------------------------ |
| 279 | Cobranet Chip Status bits |
| 280 | ------------------------------------------------------------*/ |
| 281 | #define HPI_COBRANET_HMI_STATUS_RXPACKET 2 |
| 282 | #define HPI_COBRANET_HMI_STATUS_TXPACKET 3 |
| 283 | |
| 284 | /*------------------------------------------------------------ |
| 285 | Ethernet header size |
| 286 | ------------------------------------------------------------*/ |
| 287 | #define HPI_ETHERNET_HEADER_SIZE (16) |
| 288 | |
| 289 | /* These defines are used to fill in protocol information for an Ethernet packet |
| 290 | sent using HMI on CS18102 */ |
Eliot Blennerhassett | 6d0b898 | 2011-04-05 20:55:47 +1200 | [diff] [blame] | 291 | /** ID supplied by Cirrus for ASI packets. */ |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 292 | #define HPI_ETHERNET_PACKET_ID 0x85 |
| 293 | /** Simple packet - no special routing required */ |
| 294 | #define HPI_ETHERNET_PACKET_V1 0x01 |
| 295 | /** This packet must make its way to the host across the HPI interface */ |
| 296 | #define HPI_ETHERNET_PACKET_HOSTED_VIA_HMI 0x20 |
| 297 | /** This packet must make its way to the host across the HPI interface */ |
| 298 | #define HPI_ETHERNET_PACKET_HOSTED_VIA_HMI_V1 0x21 |
| 299 | /** This packet must make its way to the host across the HPI interface */ |
| 300 | #define HPI_ETHERNET_PACKET_HOSTED_VIA_HPI 0x40 |
| 301 | /** This packet must make its way to the host across the HPI interface */ |
| 302 | #define HPI_ETHERNET_PACKET_HOSTED_VIA_HPI_V1 0x41 |
| 303 | |
Eliot Blennerhassett | 6d0b898 | 2011-04-05 20:55:47 +1200 | [diff] [blame] | 304 | #define HPI_ETHERNET_UDP_PORT 44600 /**< HPI UDP service */ |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 305 | |
Eliot Blennerhassett | a287ca2 | 2011-02-10 17:26:17 +1300 | [diff] [blame] | 306 | /** Default network timeout in milli-seconds. */ |
| 307 | #define HPI_ETHERNET_TIMEOUT_MS 500 |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 308 | |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 309 | /** Locked memory buffer alloc/free phases */ |
| 310 | enum HPI_BUFFER_CMDS { |
| 311 | /** use one message to allocate or free physical memory */ |
| 312 | HPI_BUFFER_CMD_EXTERNAL = 0, |
| 313 | /** alloc physical memory */ |
| 314 | HPI_BUFFER_CMD_INTERNAL_ALLOC = 1, |
| 315 | /** send physical memory address to adapter */ |
| 316 | HPI_BUFFER_CMD_INTERNAL_GRANTADAPTER = 2, |
| 317 | /** notify adapter to stop using physical buffer */ |
| 318 | HPI_BUFFER_CMD_INTERNAL_REVOKEADAPTER = 3, |
| 319 | /** free physical buffer */ |
| 320 | HPI_BUFFER_CMD_INTERNAL_FREE = 4 |
| 321 | }; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 322 | |
| 323 | /*****************************************************************************/ |
| 324 | /*****************************************************************************/ |
| 325 | /******** HPI LOW LEVEL MESSAGES *******/ |
| 326 | /*****************************************************************************/ |
| 327 | /*****************************************************************************/ |
| 328 | /** Pnp ids */ |
| 329 | /** "ASI" - actual is "ASX" - need to change */ |
| 330 | #define HPI_ID_ISAPNP_AUDIOSCIENCE 0x0669 |
| 331 | /** PCI vendor ID that AudioScience uses */ |
| 332 | #define HPI_PCI_VENDOR_ID_AUDIOSCIENCE 0x175C |
| 333 | /** PCI vendor ID that the DSP56301 has */ |
| 334 | #define HPI_PCI_VENDOR_ID_MOTOROLA 0x1057 |
| 335 | /** PCI vendor ID that TI uses */ |
| 336 | #define HPI_PCI_VENDOR_ID_TI 0x104C |
| 337 | |
| 338 | #define HPI_PCI_DEV_ID_PCI2040 0xAC60 |
| 339 | /** TI's C6205 PCI interface has this ID */ |
| 340 | #define HPI_PCI_DEV_ID_DSP6205 0xA106 |
| 341 | |
| 342 | #define HPI_USB_VENDOR_ID_AUDIOSCIENCE 0x1257 |
| 343 | #define HPI_USB_W2K_TAG 0x57495341 /* "ASIW" */ |
| 344 | #define HPI_USB_LINUX_TAG 0x4C495341 /* "ASIL" */ |
| 345 | |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 346 | /** Invalid Adapter index |
| 347 | Used in HPI messages that are not addressed to a specific adapter |
| 348 | Used in DLL to indicate device not present |
| 349 | */ |
| 350 | #define HPI_ADAPTER_INDEX_INVALID 0xFFFF |
| 351 | |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 352 | /** First 2 hex digits define the adapter family */ |
| 353 | #define HPI_ADAPTER_FAMILY_MASK 0xff00 |
Eliot Blennerhassett | 5a498ef | 2010-05-27 17:53:52 +1200 | [diff] [blame] | 354 | #define HPI_MODULE_FAMILY_MASK 0xfff0 |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 355 | |
| 356 | #define HPI_ADAPTER_FAMILY_ASI(f) (f & HPI_ADAPTER_FAMILY_MASK) |
Eliot Blennerhassett | 5a498ef | 2010-05-27 17:53:52 +1200 | [diff] [blame] | 357 | #define HPI_MODULE_FAMILY_ASI(f) (f & HPI_MODULE_FAMILY_MASK) |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 358 | #define HPI_ADAPTER_ASI(f) (f) |
| 359 | |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 360 | enum HPI_MESSAGE_TYPES { |
Eliot Blennerhassett | 82b5774 | 2011-07-22 15:52:36 +1200 | [diff] [blame] | 361 | HPI_TYPE_REQUEST = 1, |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 362 | HPI_TYPE_RESPONSE = 2, |
| 363 | HPI_TYPE_DATA = 3, |
Eliot Blennerhassett | b7f1248 | 2011-07-22 15:52:55 +1200 | [diff] [blame^] | 364 | HPI_TYPE_SSX2BYPASS_MESSAGE = 4, |
| 365 | HPI_TYPE_COMMAND = 5, |
| 366 | HPI_TYPE_NOTIFICATION = 6 |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 367 | }; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 368 | |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 369 | enum HPI_OBJECT_TYPES { |
| 370 | HPI_OBJ_SUBSYSTEM = 1, |
| 371 | HPI_OBJ_ADAPTER = 2, |
| 372 | HPI_OBJ_OSTREAM = 3, |
| 373 | HPI_OBJ_ISTREAM = 4, |
| 374 | HPI_OBJ_MIXER = 5, |
| 375 | HPI_OBJ_NODE = 6, |
| 376 | HPI_OBJ_CONTROL = 7, |
| 377 | HPI_OBJ_NVMEMORY = 8, |
| 378 | HPI_OBJ_GPIO = 9, |
| 379 | HPI_OBJ_WATCHDOG = 10, |
| 380 | HPI_OBJ_CLOCK = 11, |
| 381 | HPI_OBJ_PROFILE = 12, |
Eliot Blennerhassett | 58fbf77 | 2011-07-22 15:52:40 +1200 | [diff] [blame] | 382 | /* HPI_ OBJ_ CONTROLEX = 13, */ |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 383 | HPI_OBJ_ASYNCEVENT = 14 |
| 384 | #define HPI_OBJ_MAXINDEX 14 |
| 385 | }; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 386 | |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 387 | #define HPI_OBJ_FUNCTION_SPACING 0x100 |
Eliot Blennerhassett | a287ca2 | 2011-02-10 17:26:17 +1300 | [diff] [blame] | 388 | #define HPI_FUNC_ID(obj, i) (HPI_OBJ_##obj * HPI_OBJ_FUNCTION_SPACING + i) |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 389 | |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 390 | #define HPI_EXTRACT_INDEX(fn) (fn & 0xff) |
| 391 | |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 392 | enum HPI_FUNCTION_IDS { |
| 393 | HPI_SUBSYS_OPEN = HPI_FUNC_ID(SUBSYSTEM, 1), |
| 394 | HPI_SUBSYS_GET_VERSION = HPI_FUNC_ID(SUBSYSTEM, 2), |
| 395 | HPI_SUBSYS_GET_INFO = HPI_FUNC_ID(SUBSYSTEM, 3), |
Eliot Blennerhassett | 6d0b898 | 2011-04-05 20:55:47 +1200 | [diff] [blame] | 396 | /* HPI_SUBSYS_FIND_ADAPTERS = HPI_FUNC_ID(SUBSYSTEM, 4), */ |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 397 | HPI_SUBSYS_CREATE_ADAPTER = HPI_FUNC_ID(SUBSYSTEM, 5), |
| 398 | HPI_SUBSYS_CLOSE = HPI_FUNC_ID(SUBSYSTEM, 6), |
Eliot Blennerhassett | 6d0b898 | 2011-04-05 20:55:47 +1200 | [diff] [blame] | 399 | /* HPI_SUBSYS_DELETE_ADAPTER = HPI_FUNC_ID(SUBSYSTEM, 7), */ |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 400 | HPI_SUBSYS_DRIVER_LOAD = HPI_FUNC_ID(SUBSYSTEM, 8), |
| 401 | HPI_SUBSYS_DRIVER_UNLOAD = HPI_FUNC_ID(SUBSYSTEM, 9), |
Eliot Blennerhassett | 6d0b898 | 2011-04-05 20:55:47 +1200 | [diff] [blame] | 402 | /* HPI_SUBSYS_READ_PORT_8 = HPI_FUNC_ID(SUBSYSTEM, 10), */ |
| 403 | /* HPI_SUBSYS_WRITE_PORT_8 = HPI_FUNC_ID(SUBSYSTEM, 11), */ |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 404 | HPI_SUBSYS_GET_NUM_ADAPTERS = HPI_FUNC_ID(SUBSYSTEM, 12), |
| 405 | HPI_SUBSYS_GET_ADAPTER = HPI_FUNC_ID(SUBSYSTEM, 13), |
| 406 | HPI_SUBSYS_SET_NETWORK_INTERFACE = HPI_FUNC_ID(SUBSYSTEM, 14), |
| 407 | HPI_SUBSYS_OPTION_INFO = HPI_FUNC_ID(SUBSYSTEM, 15), |
| 408 | HPI_SUBSYS_OPTION_GET = HPI_FUNC_ID(SUBSYSTEM, 16), |
| 409 | HPI_SUBSYS_OPTION_SET = HPI_FUNC_ID(SUBSYSTEM, 17), |
| 410 | #define HPI_SUBSYS_FUNCTION_COUNT 17 |
| 411 | |
| 412 | HPI_ADAPTER_OPEN = HPI_FUNC_ID(ADAPTER, 1), |
| 413 | HPI_ADAPTER_CLOSE = HPI_FUNC_ID(ADAPTER, 2), |
| 414 | HPI_ADAPTER_GET_INFO = HPI_FUNC_ID(ADAPTER, 3), |
| 415 | HPI_ADAPTER_GET_ASSERT = HPI_FUNC_ID(ADAPTER, 4), |
| 416 | HPI_ADAPTER_TEST_ASSERT = HPI_FUNC_ID(ADAPTER, 5), |
| 417 | HPI_ADAPTER_SET_MODE = HPI_FUNC_ID(ADAPTER, 6), |
| 418 | HPI_ADAPTER_GET_MODE = HPI_FUNC_ID(ADAPTER, 7), |
| 419 | HPI_ADAPTER_ENABLE_CAPABILITY = HPI_FUNC_ID(ADAPTER, 8), |
| 420 | HPI_ADAPTER_SELFTEST = HPI_FUNC_ID(ADAPTER, 9), |
| 421 | HPI_ADAPTER_FIND_OBJECT = HPI_FUNC_ID(ADAPTER, 10), |
| 422 | HPI_ADAPTER_QUERY_FLASH = HPI_FUNC_ID(ADAPTER, 11), |
| 423 | HPI_ADAPTER_START_FLASH = HPI_FUNC_ID(ADAPTER, 12), |
| 424 | HPI_ADAPTER_PROGRAM_FLASH = HPI_FUNC_ID(ADAPTER, 13), |
| 425 | HPI_ADAPTER_SET_PROPERTY = HPI_FUNC_ID(ADAPTER, 14), |
| 426 | HPI_ADAPTER_GET_PROPERTY = HPI_FUNC_ID(ADAPTER, 15), |
| 427 | HPI_ADAPTER_ENUM_PROPERTY = HPI_FUNC_ID(ADAPTER, 16), |
| 428 | HPI_ADAPTER_MODULE_INFO = HPI_FUNC_ID(ADAPTER, 17), |
| 429 | HPI_ADAPTER_DEBUG_READ = HPI_FUNC_ID(ADAPTER, 18), |
Eliot Blennerhassett | bd33c1c | 2011-02-10 17:26:16 +1300 | [diff] [blame] | 430 | HPI_ADAPTER_IRQ_QUERY_AND_CLEAR = HPI_FUNC_ID(ADAPTER, 19), |
| 431 | HPI_ADAPTER_IRQ_CALLBACK = HPI_FUNC_ID(ADAPTER, 20), |
Eliot Blennerhassett | 6d0b898 | 2011-04-05 20:55:47 +1200 | [diff] [blame] | 432 | HPI_ADAPTER_DELETE = HPI_FUNC_ID(ADAPTER, 21), |
| 433 | #define HPI_ADAPTER_FUNCTION_COUNT 21 |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 434 | |
| 435 | HPI_OSTREAM_OPEN = HPI_FUNC_ID(OSTREAM, 1), |
| 436 | HPI_OSTREAM_CLOSE = HPI_FUNC_ID(OSTREAM, 2), |
| 437 | HPI_OSTREAM_WRITE = HPI_FUNC_ID(OSTREAM, 3), |
| 438 | HPI_OSTREAM_START = HPI_FUNC_ID(OSTREAM, 4), |
| 439 | HPI_OSTREAM_STOP = HPI_FUNC_ID(OSTREAM, 5), |
| 440 | HPI_OSTREAM_RESET = HPI_FUNC_ID(OSTREAM, 6), |
| 441 | HPI_OSTREAM_GET_INFO = HPI_FUNC_ID(OSTREAM, 7), |
| 442 | HPI_OSTREAM_QUERY_FORMAT = HPI_FUNC_ID(OSTREAM, 8), |
| 443 | HPI_OSTREAM_DATA = HPI_FUNC_ID(OSTREAM, 9), |
| 444 | HPI_OSTREAM_SET_VELOCITY = HPI_FUNC_ID(OSTREAM, 10), |
| 445 | HPI_OSTREAM_SET_PUNCHINOUT = HPI_FUNC_ID(OSTREAM, 11), |
| 446 | HPI_OSTREAM_SINEGEN = HPI_FUNC_ID(OSTREAM, 12), |
| 447 | HPI_OSTREAM_ANC_RESET = HPI_FUNC_ID(OSTREAM, 13), |
| 448 | HPI_OSTREAM_ANC_GET_INFO = HPI_FUNC_ID(OSTREAM, 14), |
| 449 | HPI_OSTREAM_ANC_READ = HPI_FUNC_ID(OSTREAM, 15), |
| 450 | HPI_OSTREAM_SET_TIMESCALE = HPI_FUNC_ID(OSTREAM, 16), |
| 451 | HPI_OSTREAM_SET_FORMAT = HPI_FUNC_ID(OSTREAM, 17), |
| 452 | HPI_OSTREAM_HOSTBUFFER_ALLOC = HPI_FUNC_ID(OSTREAM, 18), |
| 453 | HPI_OSTREAM_HOSTBUFFER_FREE = HPI_FUNC_ID(OSTREAM, 19), |
| 454 | HPI_OSTREAM_GROUP_ADD = HPI_FUNC_ID(OSTREAM, 20), |
| 455 | HPI_OSTREAM_GROUP_GETMAP = HPI_FUNC_ID(OSTREAM, 21), |
| 456 | HPI_OSTREAM_GROUP_RESET = HPI_FUNC_ID(OSTREAM, 22), |
| 457 | HPI_OSTREAM_HOSTBUFFER_GET_INFO = HPI_FUNC_ID(OSTREAM, 23), |
| 458 | HPI_OSTREAM_WAIT_START = HPI_FUNC_ID(OSTREAM, 24), |
Eliot Blennerhassett | bd33c1c | 2011-02-10 17:26:16 +1300 | [diff] [blame] | 459 | HPI_OSTREAM_WAIT = HPI_FUNC_ID(OSTREAM, 25), |
| 460 | #define HPI_OSTREAM_FUNCTION_COUNT 25 |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 461 | |
| 462 | HPI_ISTREAM_OPEN = HPI_FUNC_ID(ISTREAM, 1), |
| 463 | HPI_ISTREAM_CLOSE = HPI_FUNC_ID(ISTREAM, 2), |
| 464 | HPI_ISTREAM_SET_FORMAT = HPI_FUNC_ID(ISTREAM, 3), |
| 465 | HPI_ISTREAM_READ = HPI_FUNC_ID(ISTREAM, 4), |
| 466 | HPI_ISTREAM_START = HPI_FUNC_ID(ISTREAM, 5), |
| 467 | HPI_ISTREAM_STOP = HPI_FUNC_ID(ISTREAM, 6), |
| 468 | HPI_ISTREAM_RESET = HPI_FUNC_ID(ISTREAM, 7), |
| 469 | HPI_ISTREAM_GET_INFO = HPI_FUNC_ID(ISTREAM, 8), |
| 470 | HPI_ISTREAM_QUERY_FORMAT = HPI_FUNC_ID(ISTREAM, 9), |
| 471 | HPI_ISTREAM_ANC_RESET = HPI_FUNC_ID(ISTREAM, 10), |
| 472 | HPI_ISTREAM_ANC_GET_INFO = HPI_FUNC_ID(ISTREAM, 11), |
| 473 | HPI_ISTREAM_ANC_WRITE = HPI_FUNC_ID(ISTREAM, 12), |
| 474 | HPI_ISTREAM_HOSTBUFFER_ALLOC = HPI_FUNC_ID(ISTREAM, 13), |
| 475 | HPI_ISTREAM_HOSTBUFFER_FREE = HPI_FUNC_ID(ISTREAM, 14), |
| 476 | HPI_ISTREAM_GROUP_ADD = HPI_FUNC_ID(ISTREAM, 15), |
| 477 | HPI_ISTREAM_GROUP_GETMAP = HPI_FUNC_ID(ISTREAM, 16), |
| 478 | HPI_ISTREAM_GROUP_RESET = HPI_FUNC_ID(ISTREAM, 17), |
| 479 | HPI_ISTREAM_HOSTBUFFER_GET_INFO = HPI_FUNC_ID(ISTREAM, 18), |
| 480 | HPI_ISTREAM_WAIT_START = HPI_FUNC_ID(ISTREAM, 19), |
Eliot Blennerhassett | bd33c1c | 2011-02-10 17:26:16 +1300 | [diff] [blame] | 481 | HPI_ISTREAM_WAIT = HPI_FUNC_ID(ISTREAM, 20), |
| 482 | #define HPI_ISTREAM_FUNCTION_COUNT 20 |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 483 | |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 484 | /* NOTE: |
| 485 | GET_NODE_INFO, SET_CONNECTION, GET_CONNECTIONS are not currently used */ |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 486 | HPI_MIXER_OPEN = HPI_FUNC_ID(MIXER, 1), |
| 487 | HPI_MIXER_CLOSE = HPI_FUNC_ID(MIXER, 2), |
| 488 | HPI_MIXER_GET_INFO = HPI_FUNC_ID(MIXER, 3), |
| 489 | HPI_MIXER_GET_NODE_INFO = HPI_FUNC_ID(MIXER, 4), |
| 490 | HPI_MIXER_GET_CONTROL = HPI_FUNC_ID(MIXER, 5), |
| 491 | HPI_MIXER_SET_CONNECTION = HPI_FUNC_ID(MIXER, 6), |
| 492 | HPI_MIXER_GET_CONNECTIONS = HPI_FUNC_ID(MIXER, 7), |
| 493 | HPI_MIXER_GET_CONTROL_BY_INDEX = HPI_FUNC_ID(MIXER, 8), |
| 494 | HPI_MIXER_GET_CONTROL_ARRAY_BY_INDEX = HPI_FUNC_ID(MIXER, 9), |
| 495 | HPI_MIXER_GET_CONTROL_MULTIPLE_VALUES = HPI_FUNC_ID(MIXER, 10), |
| 496 | HPI_MIXER_STORE = HPI_FUNC_ID(MIXER, 11), |
Eliot Blennerhassett | bd33c1c | 2011-02-10 17:26:16 +1300 | [diff] [blame] | 497 | HPI_MIXER_GET_CACHE_INFO = HPI_FUNC_ID(MIXER, 12), |
| 498 | #define HPI_MIXER_FUNCTION_COUNT 12 |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 499 | |
| 500 | HPI_CONTROL_GET_INFO = HPI_FUNC_ID(CONTROL, 1), |
| 501 | HPI_CONTROL_GET_STATE = HPI_FUNC_ID(CONTROL, 2), |
| 502 | HPI_CONTROL_SET_STATE = HPI_FUNC_ID(CONTROL, 3), |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 503 | #define HPI_CONTROL_FUNCTION_COUNT 3 |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 504 | |
| 505 | HPI_NVMEMORY_OPEN = HPI_FUNC_ID(NVMEMORY, 1), |
| 506 | HPI_NVMEMORY_READ_BYTE = HPI_FUNC_ID(NVMEMORY, 2), |
| 507 | HPI_NVMEMORY_WRITE_BYTE = HPI_FUNC_ID(NVMEMORY, 3), |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 508 | #define HPI_NVMEMORY_FUNCTION_COUNT 3 |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 509 | |
| 510 | HPI_GPIO_OPEN = HPI_FUNC_ID(GPIO, 1), |
| 511 | HPI_GPIO_READ_BIT = HPI_FUNC_ID(GPIO, 2), |
| 512 | HPI_GPIO_WRITE_BIT = HPI_FUNC_ID(GPIO, 3), |
| 513 | HPI_GPIO_READ_ALL = HPI_FUNC_ID(GPIO, 4), |
| 514 | HPI_GPIO_WRITE_STATUS = HPI_FUNC_ID(GPIO, 5), |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 515 | #define HPI_GPIO_FUNCTION_COUNT 5 |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 516 | |
| 517 | HPI_ASYNCEVENT_OPEN = HPI_FUNC_ID(ASYNCEVENT, 1), |
| 518 | HPI_ASYNCEVENT_CLOSE = HPI_FUNC_ID(ASYNCEVENT, 2), |
| 519 | HPI_ASYNCEVENT_WAIT = HPI_FUNC_ID(ASYNCEVENT, 3), |
| 520 | HPI_ASYNCEVENT_GETCOUNT = HPI_FUNC_ID(ASYNCEVENT, 4), |
| 521 | HPI_ASYNCEVENT_GET = HPI_FUNC_ID(ASYNCEVENT, 5), |
| 522 | HPI_ASYNCEVENT_SENDEVENTS = HPI_FUNC_ID(ASYNCEVENT, 6), |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 523 | #define HPI_ASYNCEVENT_FUNCTION_COUNT 6 |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 524 | |
| 525 | HPI_WATCHDOG_OPEN = HPI_FUNC_ID(WATCHDOG, 1), |
| 526 | HPI_WATCHDOG_SET_TIME = HPI_FUNC_ID(WATCHDOG, 2), |
| 527 | HPI_WATCHDOG_PING = HPI_FUNC_ID(WATCHDOG, 3), |
| 528 | |
| 529 | HPI_CLOCK_OPEN = HPI_FUNC_ID(CLOCK, 1), |
| 530 | HPI_CLOCK_SET_TIME = HPI_FUNC_ID(CLOCK, 2), |
| 531 | HPI_CLOCK_GET_TIME = HPI_FUNC_ID(CLOCK, 3), |
| 532 | |
| 533 | HPI_PROFILE_OPEN_ALL = HPI_FUNC_ID(PROFILE, 1), |
| 534 | HPI_PROFILE_START_ALL = HPI_FUNC_ID(PROFILE, 2), |
| 535 | HPI_PROFILE_STOP_ALL = HPI_FUNC_ID(PROFILE, 3), |
| 536 | HPI_PROFILE_GET = HPI_FUNC_ID(PROFILE, 4), |
| 537 | HPI_PROFILE_GET_IDLECOUNT = HPI_FUNC_ID(PROFILE, 5), |
| 538 | HPI_PROFILE_GET_NAME = HPI_FUNC_ID(PROFILE, 6), |
| 539 | HPI_PROFILE_GET_UTILIZATION = HPI_FUNC_ID(PROFILE, 7) |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 540 | #define HPI_PROFILE_FUNCTION_COUNT 7 |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 541 | }; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 542 | |
| 543 | /* ////////////////////////////////////////////////////////////////////// */ |
| 544 | /* STRUCTURES */ |
| 545 | #ifndef DISABLE_PRAGMA_PACK1 |
| 546 | #pragma pack(push, 1) |
| 547 | #endif |
| 548 | |
| 549 | /** PCI bus resource */ |
| 550 | struct hpi_pci { |
| 551 | u32 __iomem *ap_mem_base[HPI_MAX_ADAPTER_MEM_SPACES]; |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 552 | struct pci_dev *pci_dev; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 553 | }; |
| 554 | |
| 555 | struct hpi_resource { |
| 556 | union { |
| 557 | const struct hpi_pci *pci; |
| 558 | const char *net_if; |
| 559 | } r; |
| 560 | #ifndef HPI64BIT /* keep structure size constant */ |
| 561 | u32 pad_to64; |
| 562 | #endif |
| 563 | u16 bus_type; /* HPI_BUS_PNPISA, _PCI, _USB etc */ |
| 564 | u16 padding; |
| 565 | |
| 566 | }; |
| 567 | |
| 568 | /** Format info used inside struct hpi_message |
| 569 | Not the same as public API struct hpi_format */ |
| 570 | struct hpi_msg_format { |
Eliot Blennerhassett | 1d595d2 | 2011-02-10 17:26:08 +1300 | [diff] [blame] | 571 | u32 sample_rate; /**< 11025, 32000, 44100 etc. */ |
| 572 | u32 bit_rate; /**< for MPEG */ |
| 573 | u32 attributes; /**< stereo/joint_stereo/mono */ |
| 574 | u16 channels; /**< 1,2..., (or ancillary mode or idle bit */ |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 575 | u16 format; /**< HPI_FORMAT_PCM16, _MPEG etc. see \ref HPI_FORMATS. */ |
| 576 | }; |
| 577 | |
| 578 | /** Buffer+format structure. |
| 579 | Must be kept 7 * 32 bits to match public struct hpi_datastruct */ |
| 580 | struct hpi_msg_data { |
| 581 | struct hpi_msg_format format; |
| 582 | u8 *pb_data; |
| 583 | #ifndef HPI64BIT |
| 584 | u32 padding; |
| 585 | #endif |
| 586 | u32 data_size; |
| 587 | }; |
| 588 | |
| 589 | /** struct hpi_datastructure used up to 3.04 driver */ |
| 590 | struct hpi_data_legacy32 { |
| 591 | struct hpi_format format; |
| 592 | u32 pb_data; |
| 593 | u32 data_size; |
| 594 | }; |
| 595 | |
| 596 | #ifdef HPI64BIT |
| 597 | /* Compatibility version of struct hpi_data*/ |
| 598 | struct hpi_data_compat32 { |
| 599 | struct hpi_msg_format format; |
| 600 | u32 pb_data; |
| 601 | u32 padding; |
| 602 | u32 data_size; |
| 603 | }; |
| 604 | #endif |
| 605 | |
| 606 | struct hpi_buffer { |
Eliot Blennerhassett | 938c565 | 2011-07-22 15:52:50 +1200 | [diff] [blame] | 607 | /** placeholder for backward compatibility (see dwBufferSize) */ |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 608 | struct hpi_msg_format reserved; |
Eliot Blennerhassett | 1d595d2 | 2011-02-10 17:26:08 +1300 | [diff] [blame] | 609 | u32 command; /**< HPI_BUFFER_CMD_xxx*/ |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 610 | u32 pci_address; /**< PCI physical address of buffer for DSP DMA */ |
| 611 | u32 buffer_size; /**< must line up with data_size of HPI_DATA*/ |
| 612 | }; |
| 613 | |
| 614 | /*/////////////////////////////////////////////////////////////////////////// */ |
| 615 | /* This is used for background buffer bus mastering stream buffers. */ |
| 616 | struct hpi_hostbuffer_status { |
| 617 | u32 samples_processed; |
| 618 | u32 auxiliary_data_available; |
| 619 | u32 stream_state; |
| 620 | /* DSP index in to the host bus master buffer. */ |
| 621 | u32 dSP_index; |
| 622 | /* Host index in to the host bus master buffer. */ |
| 623 | u32 host_index; |
| 624 | u32 size_in_bytes; |
| 625 | }; |
| 626 | |
| 627 | struct hpi_streamid { |
| 628 | u16 object_type; |
| 629 | /**< Type of object, HPI_OBJ_OSTREAM or HPI_OBJ_ISTREAM. */ |
| 630 | u16 stream_index; /**< outstream or instream index. */ |
| 631 | }; |
| 632 | |
| 633 | struct hpi_punchinout { |
| 634 | u32 punch_in_sample; |
| 635 | u32 punch_out_sample; |
| 636 | }; |
| 637 | |
| 638 | struct hpi_subsys_msg { |
| 639 | struct hpi_resource resource; |
| 640 | }; |
| 641 | |
| 642 | struct hpi_subsys_res { |
| 643 | u32 version; |
Eliot Blennerhassett | 2f918a6 | 2011-02-10 17:26:09 +1300 | [diff] [blame] | 644 | u32 data; /* extended version */ |
| 645 | u16 num_adapters; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 646 | u16 adapter_index; |
Eliot Blennerhassett | 2f918a6 | 2011-02-10 17:26:09 +1300 | [diff] [blame] | 647 | u16 adapter_type; |
| 648 | u16 pad16; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 649 | }; |
| 650 | |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 651 | union hpi_adapterx_msg { |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 652 | struct { |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 653 | u32 dsp_address; |
| 654 | u32 count_bytes; |
| 655 | } debug_read; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 656 | struct { |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 657 | u32 adapter_mode; |
| 658 | u16 query_or_set; |
| 659 | } mode; |
| 660 | struct { |
| 661 | u16 index; |
| 662 | } module_info; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 663 | struct { |
| 664 | u32 checksum; |
| 665 | u16 sequence; |
| 666 | u16 length; |
| 667 | u16 offset; /**< offset from start of msg to data */ |
| 668 | u16 unused; |
| 669 | } program_flash; |
| 670 | struct { |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 671 | u16 index; |
| 672 | u16 what; |
| 673 | u16 property_index; |
| 674 | } property_enum; |
| 675 | struct { |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 676 | u16 property; |
| 677 | u16 parameter1; |
| 678 | u16 parameter2; |
| 679 | } property_set; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 680 | struct { |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 681 | u32 offset; |
| 682 | } query_flash; |
| 683 | struct { |
| 684 | u32 pad32; |
| 685 | u16 key1; |
| 686 | u16 key2; |
| 687 | } restart; |
| 688 | struct { |
| 689 | u32 offset; |
| 690 | u32 length; |
| 691 | u32 key; |
| 692 | } start_flash; |
| 693 | struct { |
| 694 | u32 pad32; |
| 695 | u16 value; |
| 696 | } test_assert; |
Eliot Blennerhassett | bd33c1c | 2011-02-10 17:26:16 +1300 | [diff] [blame] | 697 | struct { |
| 698 | u32 yes; |
| 699 | } irq_query; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 700 | }; |
| 701 | |
| 702 | struct hpi_adapter_res { |
| 703 | u32 serial_number; |
| 704 | u16 adapter_type; |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 705 | u16 adapter_index; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 706 | u16 num_instreams; |
| 707 | u16 num_outstreams; |
| 708 | u16 num_mixers; |
| 709 | u16 version; |
| 710 | u8 sz_adapter_assert[HPI_STRING_LEN]; |
| 711 | }; |
| 712 | |
| 713 | union hpi_adapterx_res { |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 714 | struct hpi_adapter_res info; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 715 | struct { |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 716 | u32 p1; |
| 717 | u16 count; |
| 718 | u16 dsp_index; |
| 719 | u32 p2; |
| 720 | u32 dsp_msg_addr; |
| 721 | char sz_message[HPI_STRING_LEN]; |
| 722 | } assert; |
| 723 | struct { |
| 724 | u32 adapter_mode; |
| 725 | } mode; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 726 | struct { |
| 727 | u16 sequence; |
| 728 | } program_flash; |
| 729 | struct { |
| 730 | u16 parameter1; |
| 731 | u16 parameter2; |
| 732 | } property_get; |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 733 | struct { |
| 734 | u32 checksum; |
| 735 | u32 length; |
| 736 | u32 version; |
| 737 | } query_flash; |
Eliot Blennerhassett | bd33c1c | 2011-02-10 17:26:16 +1300 | [diff] [blame] | 738 | struct { |
| 739 | u32 yes; |
| 740 | } irq_query; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 741 | }; |
| 742 | |
| 743 | struct hpi_stream_msg { |
| 744 | union { |
| 745 | struct hpi_msg_data data; |
| 746 | struct hpi_data_legacy32 data32; |
| 747 | u16 velocity; |
| 748 | struct hpi_punchinout pio; |
| 749 | u32 time_scale; |
| 750 | struct hpi_buffer buffer; |
| 751 | struct hpi_streamid stream; |
Eliot Blennerhassett | bd33c1c | 2011-02-10 17:26:16 +1300 | [diff] [blame] | 752 | u32 threshold_bytes; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 753 | } u; |
| 754 | }; |
| 755 | |
| 756 | struct hpi_stream_res { |
| 757 | union { |
| 758 | struct { |
| 759 | /* size of hardware buffer */ |
| 760 | u32 buffer_size; |
| 761 | /* OutStream - data to play, |
| 762 | InStream - data recorded */ |
| 763 | u32 data_available; |
| 764 | /* OutStream - samples played, |
| 765 | InStream - samples recorded */ |
| 766 | u32 samples_transferred; |
| 767 | /* Adapter - OutStream - data to play, |
| 768 | InStream - data recorded */ |
| 769 | u32 auxiliary_data_available; |
| 770 | u16 state; /* HPI_STATE_PLAYING, _STATE_STOPPED */ |
| 771 | u16 padding; |
| 772 | } stream_info; |
| 773 | struct { |
| 774 | u32 buffer_size; |
| 775 | u32 data_available; |
| 776 | u32 samples_transfered; |
| 777 | u16 state; |
| 778 | u16 outstream_index; |
| 779 | u16 instream_index; |
| 780 | u16 padding; |
| 781 | u32 auxiliary_data_available; |
| 782 | } legacy_stream_info; |
| 783 | struct { |
| 784 | /* bitmap of grouped OutStreams */ |
| 785 | u32 outstream_group_map; |
| 786 | /* bitmap of grouped InStreams */ |
| 787 | u32 instream_group_map; |
| 788 | } group_info; |
| 789 | struct { |
| 790 | /* pointer to the buffer */ |
| 791 | u8 *p_buffer; |
| 792 | /* pointer to the hostbuffer status */ |
| 793 | struct hpi_hostbuffer_status *p_status; |
| 794 | } hostbuffer_info; |
| 795 | } u; |
| 796 | }; |
| 797 | |
| 798 | struct hpi_mixer_msg { |
| 799 | u16 control_index; |
| 800 | u16 control_type; /* = HPI_CONTROL_METER _VOLUME etc */ |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 801 | u16 padding1; /* Maintain alignment of subsequent fields */ |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 802 | u16 node_type1; /* = HPI_SOURCENODE_LINEIN etc */ |
| 803 | u16 node_index1; /* = 0..N */ |
| 804 | u16 node_type2; |
| 805 | u16 node_index2; |
| 806 | u16 padding2; /* round to 4 bytes */ |
| 807 | }; |
| 808 | |
| 809 | struct hpi_mixer_res { |
| 810 | u16 src_node_type; /* = HPI_SOURCENODE_LINEIN etc */ |
| 811 | u16 src_node_index; /* = 0..N */ |
| 812 | u16 dst_node_type; |
| 813 | u16 dst_node_index; |
| 814 | /* Also controlType for MixerGetControlByIndex */ |
| 815 | u16 control_index; |
| 816 | /* may indicate which DSP the control is located on */ |
| 817 | u16 dsp_index; |
| 818 | }; |
| 819 | |
| 820 | union hpi_mixerx_msg { |
| 821 | struct { |
| 822 | u16 starting_index; |
| 823 | u16 flags; |
| 824 | u32 length_in_bytes; /* length in bytes of p_data */ |
| 825 | u32 p_data; /* pointer to a data array */ |
| 826 | } gcabi; |
| 827 | struct { |
| 828 | u16 command; |
| 829 | u16 index; |
| 830 | } store; /* for HPI_MIXER_STORE message */ |
| 831 | }; |
| 832 | |
| 833 | union hpi_mixerx_res { |
| 834 | struct { |
| 835 | u32 bytes_returned; /* size of items returned */ |
| 836 | u32 p_data; /* pointer to data array */ |
| 837 | u16 more_to_do; /* indicates if there is more to do */ |
| 838 | } gcabi; |
Eliot Blennerhassett | bd33c1c | 2011-02-10 17:26:16 +1300 | [diff] [blame] | 839 | struct { |
| 840 | u32 total_controls; /* count of controls in the mixer */ |
| 841 | u32 cache_controls; /* count of controls in the cac */ |
| 842 | u32 cache_bytes; /* size of cache */ |
| 843 | } cache_info; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 844 | }; |
| 845 | |
| 846 | struct hpi_control_msg { |
| 847 | u16 attribute; /* control attribute or property */ |
| 848 | u16 saved_index; |
| 849 | u32 param1; /* generic parameter 1 */ |
| 850 | u32 param2; /* generic parameter 2 */ |
| 851 | short an_log_value[HPI_MAX_CHANNELS]; |
| 852 | }; |
| 853 | |
| 854 | struct hpi_control_union_msg { |
| 855 | u16 attribute; /* control attribute or property */ |
| 856 | u16 saved_index; /* only used in ctrl save/restore */ |
| 857 | union { |
| 858 | struct { |
| 859 | u32 param1; /* generic parameter 1 */ |
| 860 | u32 param2; /* generic parameter 2 */ |
| 861 | short an_log_value[HPI_MAX_CHANNELS]; |
| 862 | } old; |
| 863 | union { |
| 864 | u32 frequency; |
| 865 | u32 gain; |
| 866 | u32 band; |
| 867 | u32 deemphasis; |
| 868 | u32 program; |
| 869 | struct { |
| 870 | u32 mode; |
| 871 | u32 value; |
| 872 | } mode; |
Eliot Blennerhassett | 5a498ef | 2010-05-27 17:53:52 +1200 | [diff] [blame] | 873 | u32 blend; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 874 | } tuner; |
| 875 | } u; |
| 876 | }; |
| 877 | |
| 878 | struct hpi_control_res { |
| 879 | /* Could make union. dwParam, anLogValue never used in same response */ |
| 880 | u32 param1; |
| 881 | u32 param2; |
| 882 | short an_log_value[HPI_MAX_CHANNELS]; |
| 883 | }; |
| 884 | |
| 885 | union hpi_control_union_res { |
| 886 | struct { |
| 887 | u32 param1; |
| 888 | u32 param2; |
| 889 | short an_log_value[HPI_MAX_CHANNELS]; |
| 890 | } old; |
| 891 | union { |
| 892 | u32 band; |
| 893 | u32 frequency; |
| 894 | u32 gain; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 895 | u32 deemphasis; |
| 896 | struct { |
| 897 | u32 data[2]; |
| 898 | u32 bLER; |
| 899 | } rds; |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 900 | short s_level; |
| 901 | struct { |
| 902 | u16 value; |
| 903 | u16 mask; |
| 904 | } status; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 905 | } tuner; |
| 906 | struct { |
| 907 | char sz_data[8]; |
| 908 | u32 remaining_chars; |
| 909 | } chars8; |
| 910 | char c_data12[12]; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 911 | union { |
Eliot Blennerhassett | 58fbf77 | 2011-07-22 15:52:40 +1200 | [diff] [blame] | 912 | struct { |
| 913 | u32 status; |
| 914 | u32 readable_size; |
| 915 | u32 writeable_size; |
| 916 | } status; |
| 917 | } cobranet; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 918 | }; |
| 919 | |
| 920 | struct hpi_nvmemory_msg { |
| 921 | u16 address; |
| 922 | u16 data; |
| 923 | }; |
| 924 | |
| 925 | struct hpi_nvmemory_res { |
| 926 | u16 size_in_bytes; |
| 927 | u16 data; |
| 928 | }; |
| 929 | |
| 930 | struct hpi_gpio_msg { |
| 931 | u16 bit_index; |
| 932 | u16 bit_data; |
| 933 | }; |
| 934 | |
| 935 | struct hpi_gpio_res { |
| 936 | u16 number_input_bits; |
| 937 | u16 number_output_bits; |
| 938 | u16 bit_data[4]; |
| 939 | }; |
| 940 | |
| 941 | struct hpi_async_msg { |
| 942 | u32 events; |
| 943 | u16 maximum_events; |
| 944 | u16 padding; |
| 945 | }; |
| 946 | |
| 947 | struct hpi_async_res { |
| 948 | union { |
| 949 | struct { |
| 950 | u16 count; |
| 951 | } count; |
| 952 | struct { |
| 953 | u32 events; |
| 954 | u16 number_returned; |
| 955 | u16 padding; |
| 956 | } get; |
| 957 | struct hpi_async_event event; |
| 958 | } u; |
| 959 | }; |
| 960 | |
| 961 | struct hpi_watchdog_msg { |
| 962 | u32 time_ms; |
| 963 | }; |
| 964 | |
| 965 | struct hpi_watchdog_res { |
| 966 | u32 time_ms; |
| 967 | }; |
| 968 | |
| 969 | struct hpi_clock_msg { |
| 970 | u16 hours; |
| 971 | u16 minutes; |
| 972 | u16 seconds; |
| 973 | u16 milli_seconds; |
| 974 | }; |
| 975 | |
| 976 | struct hpi_clock_res { |
| 977 | u16 size_in_bytes; |
| 978 | u16 hours; |
| 979 | u16 minutes; |
| 980 | u16 seconds; |
| 981 | u16 milli_seconds; |
| 982 | u16 padding; |
| 983 | }; |
| 984 | |
| 985 | struct hpi_profile_msg { |
| 986 | u16 bin_index; |
| 987 | u16 padding; |
| 988 | }; |
| 989 | |
| 990 | struct hpi_profile_res_open { |
| 991 | u16 max_profiles; |
| 992 | }; |
| 993 | |
| 994 | struct hpi_profile_res_time { |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 995 | u32 total_tick_count; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 996 | u32 call_count; |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 997 | u32 max_tick_count; |
| 998 | u32 ticks_per_millisecond; |
| 999 | u16 profile_interval; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 1000 | }; |
| 1001 | |
| 1002 | struct hpi_profile_res_name { |
| 1003 | u8 sz_name[32]; |
| 1004 | }; |
| 1005 | |
| 1006 | struct hpi_profile_res { |
| 1007 | union { |
| 1008 | struct hpi_profile_res_open o; |
| 1009 | struct hpi_profile_res_time t; |
| 1010 | struct hpi_profile_res_name n; |
| 1011 | } u; |
| 1012 | }; |
| 1013 | |
| 1014 | struct hpi_message_header { |
| 1015 | u16 size; /* total size in bytes */ |
| 1016 | u8 type; /* HPI_TYPE_MESSAGE */ |
| 1017 | u8 version; /* message version */ |
| 1018 | u16 object; /* HPI_OBJ_* */ |
| 1019 | u16 function; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */ |
| 1020 | u16 adapter_index; /* the adapter index */ |
| 1021 | u16 obj_index; /* */ |
| 1022 | }; |
| 1023 | |
| 1024 | struct hpi_message { |
| 1025 | /* following fields must match HPI_MESSAGE_HEADER */ |
| 1026 | u16 size; /* total size in bytes */ |
| 1027 | u8 type; /* HPI_TYPE_MESSAGE */ |
| 1028 | u8 version; /* message version */ |
| 1029 | u16 object; /* HPI_OBJ_* */ |
| 1030 | u16 function; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */ |
| 1031 | u16 adapter_index; /* the adapter index */ |
| 1032 | u16 obj_index; /* */ |
| 1033 | union { |
| 1034 | struct hpi_subsys_msg s; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 1035 | union hpi_adapterx_msg ax; |
| 1036 | struct hpi_stream_msg d; |
| 1037 | struct hpi_mixer_msg m; |
| 1038 | union hpi_mixerx_msg mx; /* extended mixer; */ |
| 1039 | struct hpi_control_msg c; /* mixer control; */ |
| 1040 | /* identical to struct hpi_control_msg, |
| 1041 | but field naming is improved */ |
| 1042 | struct hpi_control_union_msg cu; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 1043 | struct hpi_nvmemory_msg n; |
| 1044 | struct hpi_gpio_msg l; /* digital i/o */ |
| 1045 | struct hpi_watchdog_msg w; |
| 1046 | struct hpi_clock_msg t; /* dsp time */ |
| 1047 | struct hpi_profile_msg p; |
| 1048 | struct hpi_async_msg as; |
| 1049 | char fixed_size[32]; |
| 1050 | } u; |
| 1051 | }; |
| 1052 | |
| 1053 | #define HPI_MESSAGE_SIZE_BY_OBJECT { \ |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 1054 | sizeof(struct hpi_message_header) , /* Default, no object type 0 */ \ |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 1055 | sizeof(struct hpi_message_header) + sizeof(struct hpi_subsys_msg),\ |
| 1056 | sizeof(struct hpi_message_header) + sizeof(union hpi_adapterx_msg),\ |
| 1057 | sizeof(struct hpi_message_header) + sizeof(struct hpi_stream_msg),\ |
| 1058 | sizeof(struct hpi_message_header) + sizeof(struct hpi_stream_msg),\ |
| 1059 | sizeof(struct hpi_message_header) + sizeof(struct hpi_mixer_msg),\ |
| 1060 | sizeof(struct hpi_message_header) , /* no node message */ \ |
| 1061 | sizeof(struct hpi_message_header) + sizeof(struct hpi_control_msg),\ |
| 1062 | sizeof(struct hpi_message_header) + sizeof(struct hpi_nvmemory_msg),\ |
| 1063 | sizeof(struct hpi_message_header) + sizeof(struct hpi_gpio_msg),\ |
| 1064 | sizeof(struct hpi_message_header) + sizeof(struct hpi_watchdog_msg),\ |
| 1065 | sizeof(struct hpi_message_header) + sizeof(struct hpi_clock_msg),\ |
| 1066 | sizeof(struct hpi_message_header) + sizeof(struct hpi_profile_msg),\ |
Eliot Blennerhassett | 58fbf77 | 2011-07-22 15:52:40 +1200 | [diff] [blame] | 1067 | sizeof(struct hpi_message_header), /* controlx obj removed */ \ |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 1068 | sizeof(struct hpi_message_header) + sizeof(struct hpi_async_msg) \ |
| 1069 | } |
| 1070 | |
Eliot Blennerhassett | 1d595d2 | 2011-02-10 17:26:08 +1300 | [diff] [blame] | 1071 | /* |
| 1072 | Note that the wSpecificError error field should be inspected and potentially |
| 1073 | reported whenever HPI_ERROR_DSP_COMMUNICATION or HPI_ERROR_DSP_BOOTLOAD is |
| 1074 | returned in wError. |
| 1075 | */ |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 1076 | struct hpi_response_header { |
| 1077 | u16 size; |
| 1078 | u8 type; /* HPI_TYPE_RESPONSE */ |
| 1079 | u8 version; /* response version */ |
| 1080 | u16 object; /* HPI_OBJ_* */ |
| 1081 | u16 function; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */ |
| 1082 | u16 error; /* HPI_ERROR_xxx */ |
| 1083 | u16 specific_error; /* adapter specific error */ |
| 1084 | }; |
| 1085 | |
| 1086 | struct hpi_response { |
| 1087 | /* following fields must match HPI_RESPONSE_HEADER */ |
| 1088 | u16 size; |
| 1089 | u8 type; /* HPI_TYPE_RESPONSE */ |
| 1090 | u8 version; /* response version */ |
| 1091 | u16 object; /* HPI_OBJ_* */ |
| 1092 | u16 function; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */ |
| 1093 | u16 error; /* HPI_ERROR_xxx */ |
| 1094 | u16 specific_error; /* adapter specific error */ |
| 1095 | union { |
| 1096 | struct hpi_subsys_res s; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 1097 | union hpi_adapterx_res ax; |
| 1098 | struct hpi_stream_res d; |
| 1099 | struct hpi_mixer_res m; |
| 1100 | union hpi_mixerx_res mx; /* extended mixer; */ |
| 1101 | struct hpi_control_res c; /* mixer control; */ |
| 1102 | /* identical to hpi_control_res, but field naming is improved */ |
| 1103 | union hpi_control_union_res cu; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 1104 | struct hpi_nvmemory_res n; |
| 1105 | struct hpi_gpio_res l; /* digital i/o */ |
| 1106 | struct hpi_watchdog_res w; |
| 1107 | struct hpi_clock_res t; /* dsp time */ |
| 1108 | struct hpi_profile_res p; |
| 1109 | struct hpi_async_res as; |
| 1110 | u8 bytes[52]; |
| 1111 | } u; |
| 1112 | }; |
| 1113 | |
| 1114 | #define HPI_RESPONSE_SIZE_BY_OBJECT { \ |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 1115 | sizeof(struct hpi_response_header) ,/* Default, no object type 0 */ \ |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 1116 | sizeof(struct hpi_response_header) + sizeof(struct hpi_subsys_res),\ |
| 1117 | sizeof(struct hpi_response_header) + sizeof(union hpi_adapterx_res),\ |
| 1118 | sizeof(struct hpi_response_header) + sizeof(struct hpi_stream_res),\ |
| 1119 | sizeof(struct hpi_response_header) + sizeof(struct hpi_stream_res),\ |
| 1120 | sizeof(struct hpi_response_header) + sizeof(struct hpi_mixer_res),\ |
| 1121 | sizeof(struct hpi_response_header) , /* no node response */ \ |
| 1122 | sizeof(struct hpi_response_header) + sizeof(struct hpi_control_res),\ |
| 1123 | sizeof(struct hpi_response_header) + sizeof(struct hpi_nvmemory_res),\ |
| 1124 | sizeof(struct hpi_response_header) + sizeof(struct hpi_gpio_res),\ |
| 1125 | sizeof(struct hpi_response_header) + sizeof(struct hpi_watchdog_res),\ |
| 1126 | sizeof(struct hpi_response_header) + sizeof(struct hpi_clock_res),\ |
| 1127 | sizeof(struct hpi_response_header) + sizeof(struct hpi_profile_res),\ |
Eliot Blennerhassett | 58fbf77 | 2011-07-22 15:52:40 +1200 | [diff] [blame] | 1128 | sizeof(struct hpi_response_header), /* controlx obj removed */ \ |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 1129 | sizeof(struct hpi_response_header) + sizeof(struct hpi_async_res) \ |
| 1130 | } |
| 1131 | |
Eliot Blennerhassett | ba94455 | 2011-02-10 17:26:04 +1300 | [diff] [blame] | 1132 | /*********************** version 1 message/response **************************/ |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 1133 | #define HPINET_ETHERNET_DATA_SIZE (1500) |
| 1134 | #define HPINET_IP_HDR_SIZE (20) |
| 1135 | #define HPINET_IP_DATA_SIZE (HPINET_ETHERNET_DATA_SIZE - HPINET_IP_HDR_SIZE) |
| 1136 | #define HPINET_UDP_HDR_SIZE (8) |
| 1137 | #define HPINET_UDP_DATA_SIZE (HPINET_IP_DATA_SIZE - HPINET_UDP_HDR_SIZE) |
| 1138 | #define HPINET_ASI_HDR_SIZE (2) |
| 1139 | #define HPINET_ASI_DATA_SIZE (HPINET_UDP_DATA_SIZE - HPINET_ASI_HDR_SIZE) |
| 1140 | |
| 1141 | #define HPI_MAX_PAYLOAD_SIZE (HPINET_ASI_DATA_SIZE - 2) |
| 1142 | |
| 1143 | /* New style message/response, but still V0 compatible */ |
| 1144 | struct hpi_msg_adapter_get_info { |
| 1145 | struct hpi_message_header h; |
| 1146 | }; |
| 1147 | |
| 1148 | struct hpi_res_adapter_get_info { |
| 1149 | struct hpi_response_header h; /*v0 */ |
| 1150 | struct hpi_adapter_res p; |
| 1151 | }; |
| 1152 | |
| 1153 | /* padding is so these are same size as v0 hpi_message */ |
| 1154 | struct hpi_msg_adapter_query_flash { |
| 1155 | struct hpi_message_header h; |
| 1156 | u32 offset; |
| 1157 | u8 pad_to_version0_size[sizeof(struct hpi_message) - /* V0 res */ |
| 1158 | sizeof(struct hpi_message_header) - 1 * sizeof(u32)]; |
| 1159 | }; |
| 1160 | |
| 1161 | /* padding is so these are same size as v0 hpi_response */ |
| 1162 | struct hpi_res_adapter_query_flash { |
| 1163 | struct hpi_response_header h; |
| 1164 | u32 checksum; |
| 1165 | u32 length; |
| 1166 | u32 version; |
| 1167 | u8 pad_to_version0_size[sizeof(struct hpi_response) - /* V0 res */ |
| 1168 | sizeof(struct hpi_response_header) - 3 * sizeof(u32)]; |
| 1169 | }; |
| 1170 | |
| 1171 | struct hpi_msg_adapter_start_flash { |
| 1172 | struct hpi_message_header h; |
| 1173 | u32 offset; |
| 1174 | u32 length; |
| 1175 | u32 key; |
| 1176 | u8 pad_to_version0_size[sizeof(struct hpi_message) - /* V0 res */ |
| 1177 | sizeof(struct hpi_message_header) - 3 * sizeof(u32)]; |
| 1178 | }; |
| 1179 | |
| 1180 | struct hpi_res_adapter_start_flash { |
| 1181 | struct hpi_response_header h; |
| 1182 | u8 pad_to_version0_size[sizeof(struct hpi_response) - /* V0 res */ |
| 1183 | sizeof(struct hpi_response_header)]; |
| 1184 | }; |
| 1185 | |
| 1186 | struct hpi_msg_adapter_program_flash_payload { |
| 1187 | u32 checksum; |
| 1188 | u16 sequence; |
| 1189 | u16 length; |
| 1190 | u16 offset; /**< offset from start of msg to data */ |
| 1191 | u16 unused; |
| 1192 | /* ensure sizeof(header + payload) == sizeof(hpi_message_V0) |
| 1193 | because old firmware expects data after message of this size */ |
| 1194 | u8 pad_to_version0_size[sizeof(struct hpi_message) - /* V0 message */ |
| 1195 | sizeof(struct hpi_message_header) - sizeof(u32) - |
| 1196 | 4 * sizeof(u16)]; |
| 1197 | }; |
| 1198 | |
| 1199 | struct hpi_msg_adapter_program_flash { |
| 1200 | struct hpi_message_header h; |
| 1201 | struct hpi_msg_adapter_program_flash_payload p; |
| 1202 | u32 data[256]; |
| 1203 | }; |
| 1204 | |
| 1205 | struct hpi_res_adapter_program_flash { |
| 1206 | struct hpi_response_header h; |
| 1207 | u16 sequence; |
| 1208 | u8 pad_to_version0_size[sizeof(struct hpi_response) - /* V0 res */ |
| 1209 | sizeof(struct hpi_response_header) - sizeof(u16)]; |
| 1210 | }; |
| 1211 | |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 1212 | struct hpi_msg_adapter_debug_read { |
| 1213 | struct hpi_message_header h; |
| 1214 | u32 dsp_address; |
| 1215 | u32 count_bytes; |
| 1216 | }; |
| 1217 | |
| 1218 | struct hpi_res_adapter_debug_read { |
| 1219 | struct hpi_response_header h; |
| 1220 | u8 bytes[256]; |
| 1221 | }; |
| 1222 | |
Eliot Blennerhassett | 58fbf77 | 2011-07-22 15:52:40 +1200 | [diff] [blame] | 1223 | struct hpi_msg_cobranet_hmi { |
| 1224 | u16 attribute; |
| 1225 | u16 padding; |
| 1226 | u32 hmi_address; |
| 1227 | u32 byte_count; |
| 1228 | }; |
| 1229 | |
| 1230 | struct hpi_msg_cobranet_hmiwrite { |
| 1231 | struct hpi_message_header h; |
| 1232 | struct hpi_msg_cobranet_hmi p; |
| 1233 | u8 bytes[256]; |
| 1234 | }; |
| 1235 | |
| 1236 | struct hpi_msg_cobranet_hmiread { |
| 1237 | struct hpi_message_header h; |
| 1238 | struct hpi_msg_cobranet_hmi p; |
| 1239 | }; |
| 1240 | |
| 1241 | struct hpi_res_cobranet_hmiread { |
| 1242 | struct hpi_response_header h; |
| 1243 | u32 byte_count; |
| 1244 | u8 bytes[256]; |
| 1245 | }; |
| 1246 | |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 1247 | #if 1 |
| 1248 | #define hpi_message_header_v1 hpi_message_header |
| 1249 | #define hpi_response_header_v1 hpi_response_header |
| 1250 | #else |
| 1251 | /* V1 headers in Addition to v0 headers */ |
| 1252 | struct hpi_message_header_v1 { |
| 1253 | struct hpi_message_header h0; |
| 1254 | /* struct { |
| 1255 | } h1; */ |
| 1256 | }; |
| 1257 | |
| 1258 | struct hpi_response_header_v1 { |
| 1259 | struct hpi_response_header h0; |
| 1260 | struct { |
| 1261 | u16 adapter_index; /* the adapter index */ |
| 1262 | u16 obj_index; /* object index */ |
| 1263 | } h1; |
| 1264 | }; |
| 1265 | #endif |
| 1266 | |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 1267 | struct hpi_msg_payload_v0 { |
| 1268 | struct hpi_message_header h; |
| 1269 | union { |
| 1270 | struct hpi_subsys_msg s; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 1271 | union hpi_adapterx_msg ax; |
| 1272 | struct hpi_stream_msg d; |
| 1273 | struct hpi_mixer_msg m; |
| 1274 | union hpi_mixerx_msg mx; |
| 1275 | struct hpi_control_msg c; |
| 1276 | struct hpi_control_union_msg cu; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 1277 | struct hpi_nvmemory_msg n; |
| 1278 | struct hpi_gpio_msg l; |
| 1279 | struct hpi_watchdog_msg w; |
| 1280 | struct hpi_clock_msg t; |
| 1281 | struct hpi_profile_msg p; |
| 1282 | struct hpi_async_msg as; |
| 1283 | } u; |
| 1284 | }; |
| 1285 | |
| 1286 | struct hpi_res_payload_v0 { |
| 1287 | struct hpi_response_header h; |
| 1288 | union { |
| 1289 | struct hpi_subsys_res s; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 1290 | union hpi_adapterx_res ax; |
| 1291 | struct hpi_stream_res d; |
| 1292 | struct hpi_mixer_res m; |
| 1293 | union hpi_mixerx_res mx; |
| 1294 | struct hpi_control_res c; |
| 1295 | union hpi_control_union_res cu; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 1296 | struct hpi_nvmemory_res n; |
| 1297 | struct hpi_gpio_res l; |
| 1298 | struct hpi_watchdog_res w; |
| 1299 | struct hpi_clock_res t; |
| 1300 | struct hpi_profile_res p; |
| 1301 | struct hpi_async_res as; |
| 1302 | } u; |
| 1303 | }; |
| 1304 | |
| 1305 | union hpi_message_buffer_v1 { |
| 1306 | struct hpi_message m0; /* version 0 */ |
| 1307 | struct hpi_message_header_v1 h; |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 1308 | u8 buf[HPI_MAX_PAYLOAD_SIZE]; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 1309 | }; |
| 1310 | |
| 1311 | union hpi_response_buffer_v1 { |
| 1312 | struct hpi_response r0; /* version 0 */ |
| 1313 | struct hpi_response_header_v1 h; |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 1314 | u8 buf[HPI_MAX_PAYLOAD_SIZE]; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 1315 | }; |
| 1316 | |
| 1317 | compile_time_assert((sizeof(union hpi_message_buffer_v1) <= |
| 1318 | HPI_MAX_PAYLOAD_SIZE), message_buffer_ok); |
| 1319 | compile_time_assert((sizeof(union hpi_response_buffer_v1) <= |
| 1320 | HPI_MAX_PAYLOAD_SIZE), response_buffer_ok); |
| 1321 | |
| 1322 | /*////////////////////////////////////////////////////////////////////////// */ |
| 1323 | /* declarations for compact control calls */ |
| 1324 | struct hpi_control_defn { |
| 1325 | u8 type; |
| 1326 | u8 channels; |
| 1327 | u8 src_node_type; |
| 1328 | u8 src_node_index; |
| 1329 | u8 dest_node_type; |
| 1330 | u8 dest_node_index; |
| 1331 | }; |
| 1332 | |
| 1333 | /*////////////////////////////////////////////////////////////////////////// */ |
| 1334 | /* declarations for control caching (internal to HPI<->DSP interaction) */ |
| 1335 | |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 1336 | /** indicates a cached u16 value is invalid. */ |
| 1337 | #define HPI_CACHE_INVALID_UINT16 0xFFFF |
| 1338 | /** indicates a cached short value is invalid. */ |
| 1339 | #define HPI_CACHE_INVALID_SHORT -32768 |
| 1340 | |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 1341 | /** A compact representation of (part of) a controls state. |
| 1342 | Used for efficient transfer of the control state |
| 1343 | between DSP and host or across a network |
| 1344 | */ |
| 1345 | struct hpi_control_cache_info { |
| 1346 | /** one of HPI_CONTROL_* */ |
| 1347 | u8 control_type; |
| 1348 | /** The total size of cached information in 32-bit words. */ |
| 1349 | u8 size_in32bit_words; |
| 1350 | /** The original index of the control on the DSP */ |
| 1351 | u16 control_index; |
| 1352 | }; |
| 1353 | |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 1354 | struct hpi_control_cache_vol { |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 1355 | struct hpi_control_cache_info i; |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 1356 | short an_log[2]; |
Eliot Blennerhassett | fc3a399 | 2011-02-10 17:26:11 +1300 | [diff] [blame] | 1357 | unsigned short flags; |
| 1358 | char padding[2]; |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 1359 | }; |
| 1360 | |
| 1361 | struct hpi_control_cache_meter { |
| 1362 | struct hpi_control_cache_info i; |
| 1363 | short an_log_peak[2]; |
| 1364 | short an_logRMS[2]; |
| 1365 | }; |
| 1366 | |
| 1367 | struct hpi_control_cache_channelmode { |
| 1368 | struct hpi_control_cache_info i; |
| 1369 | u16 mode; |
| 1370 | char temp_padding[6]; |
| 1371 | }; |
| 1372 | |
| 1373 | struct hpi_control_cache_mux { |
| 1374 | struct hpi_control_cache_info i; |
| 1375 | u16 source_node_type; |
| 1376 | u16 source_node_index; |
| 1377 | char temp_padding[4]; |
| 1378 | }; |
| 1379 | |
| 1380 | struct hpi_control_cache_level { |
| 1381 | struct hpi_control_cache_info i; |
| 1382 | short an_log[2]; |
| 1383 | char temp_padding[4]; |
| 1384 | }; |
| 1385 | |
| 1386 | struct hpi_control_cache_tuner { |
| 1387 | struct hpi_control_cache_info i; |
| 1388 | u32 freq_ink_hz; |
| 1389 | u16 band; |
| 1390 | short s_level_avg; |
| 1391 | }; |
| 1392 | |
| 1393 | struct hpi_control_cache_aes3rx { |
| 1394 | struct hpi_control_cache_info i; |
| 1395 | u32 error_status; |
| 1396 | u32 format; |
| 1397 | }; |
| 1398 | |
| 1399 | struct hpi_control_cache_aes3tx { |
| 1400 | struct hpi_control_cache_info i; |
| 1401 | u32 format; |
| 1402 | char temp_padding[4]; |
| 1403 | }; |
| 1404 | |
| 1405 | struct hpi_control_cache_tonedetector { |
| 1406 | struct hpi_control_cache_info i; |
| 1407 | u16 state; |
| 1408 | char temp_padding[6]; |
| 1409 | }; |
| 1410 | |
| 1411 | struct hpi_control_cache_silencedetector { |
| 1412 | struct hpi_control_cache_info i; |
| 1413 | u32 state; |
| 1414 | char temp_padding[4]; |
| 1415 | }; |
| 1416 | |
| 1417 | struct hpi_control_cache_sampleclock { |
| 1418 | struct hpi_control_cache_info i; |
| 1419 | u16 source; |
| 1420 | u16 source_index; |
| 1421 | u32 sample_rate; |
| 1422 | }; |
| 1423 | |
| 1424 | struct hpi_control_cache_microphone { |
| 1425 | struct hpi_control_cache_info i; |
| 1426 | u16 phantom_state; |
| 1427 | char temp_padding[6]; |
| 1428 | }; |
| 1429 | |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 1430 | struct hpi_control_cache_single { |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 1431 | union { |
Eliot Blennerhassett | 3285ea1 | 2011-02-10 17:25:58 +1300 | [diff] [blame] | 1432 | struct hpi_control_cache_info i; |
| 1433 | struct hpi_control_cache_vol vol; |
| 1434 | struct hpi_control_cache_meter meter; |
| 1435 | struct hpi_control_cache_channelmode mode; |
| 1436 | struct hpi_control_cache_mux mux; |
| 1437 | struct hpi_control_cache_level level; |
| 1438 | struct hpi_control_cache_tuner tuner; |
| 1439 | struct hpi_control_cache_aes3rx aes3rx; |
| 1440 | struct hpi_control_cache_aes3tx aes3tx; |
| 1441 | struct hpi_control_cache_tonedetector tone; |
| 1442 | struct hpi_control_cache_silencedetector silence; |
| 1443 | struct hpi_control_cache_sampleclock clk; |
| 1444 | struct hpi_control_cache_microphone microphone; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 1445 | } u; |
| 1446 | }; |
| 1447 | |
| 1448 | struct hpi_control_cache_pad { |
| 1449 | struct hpi_control_cache_info i; |
| 1450 | u32 field_valid_flags; |
| 1451 | u8 c_channel[8]; |
| 1452 | u8 c_artist[40]; |
| 1453 | u8 c_title[40]; |
| 1454 | u8 c_comment[200]; |
| 1455 | u32 pTY; |
| 1456 | u32 pI; |
| 1457 | u32 traffic_supported; |
| 1458 | u32 traffic_anouncement; |
| 1459 | }; |
| 1460 | |
Eliot Blennerhassett | ba94455 | 2011-02-10 17:26:04 +1300 | [diff] [blame] | 1461 | /* 2^N sized FIFO buffer (internal to HPI<->DSP interaction) */ |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 1462 | struct hpi_fifo_buffer { |
| 1463 | u32 size; |
| 1464 | u32 dSP_index; |
| 1465 | u32 host_index; |
| 1466 | }; |
| 1467 | |
| 1468 | #ifndef DISABLE_PRAGMA_PACK1 |
| 1469 | #pragma pack(pop) |
| 1470 | #endif |
| 1471 | |
| 1472 | /* skip host side function declarations for DSP |
| 1473 | compile and documentation extraction */ |
| 1474 | |
| 1475 | char hpi_handle_object(const u32 handle); |
| 1476 | |
| 1477 | void hpi_handle_to_indexes(const u32 handle, u16 *pw_adapter_index, |
| 1478 | u16 *pw_object_index); |
| 1479 | |
| 1480 | u32 hpi_indexes_to_handle(const char c_object, const u16 adapter_index, |
| 1481 | const u16 object_index); |
| 1482 | |
| 1483 | /*////////////////////////////////////////////////////////////////////////// */ |
| 1484 | |
| 1485 | /* main HPI entry point */ |
Eliot Blennerhassett | ba94455 | 2011-02-10 17:26:04 +1300 | [diff] [blame] | 1486 | void hpi_send_recv(struct hpi_message *phm, struct hpi_response *phr); |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 1487 | |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 1488 | /* used in PnP OS/driver */ |
Eliot Blennerhassett | ba94455 | 2011-02-10 17:26:04 +1300 | [diff] [blame] | 1489 | u16 hpi_subsys_create_adapter(const struct hpi_resource *p_resource, |
| 1490 | u16 *pw_adapter_index); |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 1491 | |
Eliot Blennerhassett | ba94455 | 2011-02-10 17:26:04 +1300 | [diff] [blame] | 1492 | u16 hpi_outstream_host_buffer_get_info(u32 h_outstream, u8 **pp_buffer, |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 1493 | struct hpi_hostbuffer_status **pp_status); |
| 1494 | |
Eliot Blennerhassett | ba94455 | 2011-02-10 17:26:04 +1300 | [diff] [blame] | 1495 | u16 hpi_instream_host_buffer_get_info(u32 h_instream, u8 **pp_buffer, |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 1496 | struct hpi_hostbuffer_status **pp_status); |
| 1497 | |
| 1498 | u16 hpi_adapter_restart(u16 adapter_index); |
| 1499 | |
| 1500 | /* |
| 1501 | The following 3 functions were last declared in header files for |
| 1502 | driver 3.10. HPI_ControlQuery() used to be the recommended way |
| 1503 | of getting a volume range. Declared here for binary asihpi32.dll |
| 1504 | compatibility. |
| 1505 | */ |
| 1506 | |
| 1507 | void hpi_format_to_msg(struct hpi_msg_format *pMF, |
| 1508 | const struct hpi_format *pF); |
| 1509 | void hpi_stream_response_to_legacy(struct hpi_stream_res *pSR); |
| 1510 | |
| 1511 | /*////////////////////////////////////////////////////////////////////////// */ |
| 1512 | /* declarations for individual HPI entry points */ |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 1513 | hpi_handler_func HPI_6000; |
| 1514 | hpi_handler_func HPI_6205; |
Eliot Blennerhassett | 719f82d | 2010-04-21 18:17:39 +0200 | [diff] [blame] | 1515 | |
| 1516 | #endif /* _HPI_INTERNAL_H_ */ |