hpi_internal.h 46 KB

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