hpi_internal.h 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590
  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 Cirrus 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 /**< HPI UDP service */
  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. HPI_ADAPTER_DELETE = HPI_FUNC_ID(ADAPTER, 21),
  365. #define HPI_ADAPTER_FUNCTION_COUNT 21
  366. HPI_OSTREAM_OPEN = HPI_FUNC_ID(OSTREAM, 1),
  367. HPI_OSTREAM_CLOSE = HPI_FUNC_ID(OSTREAM, 2),
  368. HPI_OSTREAM_WRITE = HPI_FUNC_ID(OSTREAM, 3),
  369. HPI_OSTREAM_START = HPI_FUNC_ID(OSTREAM, 4),
  370. HPI_OSTREAM_STOP = HPI_FUNC_ID(OSTREAM, 5),
  371. HPI_OSTREAM_RESET = HPI_FUNC_ID(OSTREAM, 6),
  372. HPI_OSTREAM_GET_INFO = HPI_FUNC_ID(OSTREAM, 7),
  373. HPI_OSTREAM_QUERY_FORMAT = HPI_FUNC_ID(OSTREAM, 8),
  374. HPI_OSTREAM_DATA = HPI_FUNC_ID(OSTREAM, 9),
  375. HPI_OSTREAM_SET_VELOCITY = HPI_FUNC_ID(OSTREAM, 10),
  376. HPI_OSTREAM_SET_PUNCHINOUT = HPI_FUNC_ID(OSTREAM, 11),
  377. HPI_OSTREAM_SINEGEN = HPI_FUNC_ID(OSTREAM, 12),
  378. HPI_OSTREAM_ANC_RESET = HPI_FUNC_ID(OSTREAM, 13),
  379. HPI_OSTREAM_ANC_GET_INFO = HPI_FUNC_ID(OSTREAM, 14),
  380. HPI_OSTREAM_ANC_READ = HPI_FUNC_ID(OSTREAM, 15),
  381. HPI_OSTREAM_SET_TIMESCALE = HPI_FUNC_ID(OSTREAM, 16),
  382. HPI_OSTREAM_SET_FORMAT = HPI_FUNC_ID(OSTREAM, 17),
  383. HPI_OSTREAM_HOSTBUFFER_ALLOC = HPI_FUNC_ID(OSTREAM, 18),
  384. HPI_OSTREAM_HOSTBUFFER_FREE = HPI_FUNC_ID(OSTREAM, 19),
  385. HPI_OSTREAM_GROUP_ADD = HPI_FUNC_ID(OSTREAM, 20),
  386. HPI_OSTREAM_GROUP_GETMAP = HPI_FUNC_ID(OSTREAM, 21),
  387. HPI_OSTREAM_GROUP_RESET = HPI_FUNC_ID(OSTREAM, 22),
  388. HPI_OSTREAM_HOSTBUFFER_GET_INFO = HPI_FUNC_ID(OSTREAM, 23),
  389. HPI_OSTREAM_WAIT_START = HPI_FUNC_ID(OSTREAM, 24),
  390. HPI_OSTREAM_WAIT = HPI_FUNC_ID(OSTREAM, 25),
  391. #define HPI_OSTREAM_FUNCTION_COUNT 25
  392. HPI_ISTREAM_OPEN = HPI_FUNC_ID(ISTREAM, 1),
  393. HPI_ISTREAM_CLOSE = HPI_FUNC_ID(ISTREAM, 2),
  394. HPI_ISTREAM_SET_FORMAT = HPI_FUNC_ID(ISTREAM, 3),
  395. HPI_ISTREAM_READ = HPI_FUNC_ID(ISTREAM, 4),
  396. HPI_ISTREAM_START = HPI_FUNC_ID(ISTREAM, 5),
  397. HPI_ISTREAM_STOP = HPI_FUNC_ID(ISTREAM, 6),
  398. HPI_ISTREAM_RESET = HPI_FUNC_ID(ISTREAM, 7),
  399. HPI_ISTREAM_GET_INFO = HPI_FUNC_ID(ISTREAM, 8),
  400. HPI_ISTREAM_QUERY_FORMAT = HPI_FUNC_ID(ISTREAM, 9),
  401. HPI_ISTREAM_ANC_RESET = HPI_FUNC_ID(ISTREAM, 10),
  402. HPI_ISTREAM_ANC_GET_INFO = HPI_FUNC_ID(ISTREAM, 11),
  403. HPI_ISTREAM_ANC_WRITE = HPI_FUNC_ID(ISTREAM, 12),
  404. HPI_ISTREAM_HOSTBUFFER_ALLOC = HPI_FUNC_ID(ISTREAM, 13),
  405. HPI_ISTREAM_HOSTBUFFER_FREE = HPI_FUNC_ID(ISTREAM, 14),
  406. HPI_ISTREAM_GROUP_ADD = HPI_FUNC_ID(ISTREAM, 15),
  407. HPI_ISTREAM_GROUP_GETMAP = HPI_FUNC_ID(ISTREAM, 16),
  408. HPI_ISTREAM_GROUP_RESET = HPI_FUNC_ID(ISTREAM, 17),
  409. HPI_ISTREAM_HOSTBUFFER_GET_INFO = HPI_FUNC_ID(ISTREAM, 18),
  410. HPI_ISTREAM_WAIT_START = HPI_FUNC_ID(ISTREAM, 19),
  411. HPI_ISTREAM_WAIT = HPI_FUNC_ID(ISTREAM, 20),
  412. #define HPI_ISTREAM_FUNCTION_COUNT 20
  413. /* NOTE:
  414. GET_NODE_INFO, SET_CONNECTION, GET_CONNECTIONS are not currently used */
  415. HPI_MIXER_OPEN = HPI_FUNC_ID(MIXER, 1),
  416. HPI_MIXER_CLOSE = HPI_FUNC_ID(MIXER, 2),
  417. HPI_MIXER_GET_INFO = HPI_FUNC_ID(MIXER, 3),
  418. HPI_MIXER_GET_NODE_INFO = HPI_FUNC_ID(MIXER, 4),
  419. HPI_MIXER_GET_CONTROL = HPI_FUNC_ID(MIXER, 5),
  420. HPI_MIXER_SET_CONNECTION = HPI_FUNC_ID(MIXER, 6),
  421. HPI_MIXER_GET_CONNECTIONS = HPI_FUNC_ID(MIXER, 7),
  422. HPI_MIXER_GET_CONTROL_BY_INDEX = HPI_FUNC_ID(MIXER, 8),
  423. HPI_MIXER_GET_CONTROL_ARRAY_BY_INDEX = HPI_FUNC_ID(MIXER, 9),
  424. HPI_MIXER_GET_CONTROL_MULTIPLE_VALUES = HPI_FUNC_ID(MIXER, 10),
  425. HPI_MIXER_STORE = HPI_FUNC_ID(MIXER, 11),
  426. HPI_MIXER_GET_CACHE_INFO = HPI_FUNC_ID(MIXER, 12),
  427. #define HPI_MIXER_FUNCTION_COUNT 12
  428. HPI_CONTROL_GET_INFO = HPI_FUNC_ID(CONTROL, 1),
  429. HPI_CONTROL_GET_STATE = HPI_FUNC_ID(CONTROL, 2),
  430. HPI_CONTROL_SET_STATE = HPI_FUNC_ID(CONTROL, 3),
  431. #define HPI_CONTROL_FUNCTION_COUNT 3
  432. HPI_NVMEMORY_OPEN = HPI_FUNC_ID(NVMEMORY, 1),
  433. HPI_NVMEMORY_READ_BYTE = HPI_FUNC_ID(NVMEMORY, 2),
  434. HPI_NVMEMORY_WRITE_BYTE = HPI_FUNC_ID(NVMEMORY, 3),
  435. #define HPI_NVMEMORY_FUNCTION_COUNT 3
  436. HPI_GPIO_OPEN = HPI_FUNC_ID(GPIO, 1),
  437. HPI_GPIO_READ_BIT = HPI_FUNC_ID(GPIO, 2),
  438. HPI_GPIO_WRITE_BIT = HPI_FUNC_ID(GPIO, 3),
  439. HPI_GPIO_READ_ALL = HPI_FUNC_ID(GPIO, 4),
  440. HPI_GPIO_WRITE_STATUS = HPI_FUNC_ID(GPIO, 5),
  441. #define HPI_GPIO_FUNCTION_COUNT 5
  442. HPI_ASYNCEVENT_OPEN = HPI_FUNC_ID(ASYNCEVENT, 1),
  443. HPI_ASYNCEVENT_CLOSE = HPI_FUNC_ID(ASYNCEVENT, 2),
  444. HPI_ASYNCEVENT_WAIT = HPI_FUNC_ID(ASYNCEVENT, 3),
  445. HPI_ASYNCEVENT_GETCOUNT = HPI_FUNC_ID(ASYNCEVENT, 4),
  446. HPI_ASYNCEVENT_GET = HPI_FUNC_ID(ASYNCEVENT, 5),
  447. HPI_ASYNCEVENT_SENDEVENTS = HPI_FUNC_ID(ASYNCEVENT, 6),
  448. #define HPI_ASYNCEVENT_FUNCTION_COUNT 6
  449. HPI_WATCHDOG_OPEN = HPI_FUNC_ID(WATCHDOG, 1),
  450. HPI_WATCHDOG_SET_TIME = HPI_FUNC_ID(WATCHDOG, 2),
  451. HPI_WATCHDOG_PING = HPI_FUNC_ID(WATCHDOG, 3),
  452. HPI_CLOCK_OPEN = HPI_FUNC_ID(CLOCK, 1),
  453. HPI_CLOCK_SET_TIME = HPI_FUNC_ID(CLOCK, 2),
  454. HPI_CLOCK_GET_TIME = HPI_FUNC_ID(CLOCK, 3),
  455. HPI_PROFILE_OPEN_ALL = HPI_FUNC_ID(PROFILE, 1),
  456. HPI_PROFILE_START_ALL = HPI_FUNC_ID(PROFILE, 2),
  457. HPI_PROFILE_STOP_ALL = HPI_FUNC_ID(PROFILE, 3),
  458. HPI_PROFILE_GET = HPI_FUNC_ID(PROFILE, 4),
  459. HPI_PROFILE_GET_IDLECOUNT = HPI_FUNC_ID(PROFILE, 5),
  460. HPI_PROFILE_GET_NAME = HPI_FUNC_ID(PROFILE, 6),
  461. HPI_PROFILE_GET_UTILIZATION = HPI_FUNC_ID(PROFILE, 7)
  462. #define HPI_PROFILE_FUNCTION_COUNT 7
  463. };
  464. /* ////////////////////////////////////////////////////////////////////// */
  465. /* STRUCTURES */
  466. #ifndef DISABLE_PRAGMA_PACK1
  467. #pragma pack(push, 1)
  468. #endif
  469. /** PCI bus resource */
  470. struct hpi_pci {
  471. u32 __iomem *ap_mem_base[HPI_MAX_ADAPTER_MEM_SPACES];
  472. struct pci_dev *pci_dev;
  473. };
  474. struct hpi_resource {
  475. union {
  476. const struct hpi_pci *pci;
  477. const char *net_if;
  478. } r;
  479. #ifndef HPI64BIT /* keep structure size constant */
  480. u32 pad_to64;
  481. #endif
  482. u16 bus_type; /* HPI_BUS_PNPISA, _PCI, _USB etc */
  483. u16 padding;
  484. };
  485. /** Format info used inside struct hpi_message
  486. Not the same as public API struct hpi_format */
  487. struct hpi_msg_format {
  488. u32 sample_rate; /**< 11025, 32000, 44100 etc. */
  489. u32 bit_rate; /**< for MPEG */
  490. u32 attributes; /**< stereo/joint_stereo/mono */
  491. u16 channels; /**< 1,2..., (or ancillary mode or idle bit */
  492. u16 format; /**< HPI_FORMAT_PCM16, _MPEG etc. see \ref HPI_FORMATS. */
  493. };
  494. /** Buffer+format structure.
  495. Must be kept 7 * 32 bits to match public struct hpi_datastruct */
  496. struct hpi_msg_data {
  497. struct hpi_msg_format format;
  498. u8 *pb_data;
  499. #ifndef HPI64BIT
  500. u32 padding;
  501. #endif
  502. u32 data_size;
  503. };
  504. /** struct hpi_datastructure used up to 3.04 driver */
  505. struct hpi_data_legacy32 {
  506. struct hpi_format format;
  507. u32 pb_data;
  508. u32 data_size;
  509. };
  510. #ifdef HPI64BIT
  511. /* Compatibility version of struct hpi_data*/
  512. struct hpi_data_compat32 {
  513. struct hpi_msg_format format;
  514. u32 pb_data;
  515. u32 padding;
  516. u32 data_size;
  517. };
  518. #endif
  519. struct hpi_buffer {
  520. /** placehoder for backward compatibility (see dwBufferSize) */
  521. struct hpi_msg_format reserved;
  522. u32 command; /**< HPI_BUFFER_CMD_xxx*/
  523. u32 pci_address; /**< PCI physical address of buffer for DSP DMA */
  524. u32 buffer_size; /**< must line up with data_size of HPI_DATA*/
  525. };
  526. /*/////////////////////////////////////////////////////////////////////////// */
  527. /* This is used for background buffer bus mastering stream buffers. */
  528. struct hpi_hostbuffer_status {
  529. u32 samples_processed;
  530. u32 auxiliary_data_available;
  531. u32 stream_state;
  532. /* DSP index in to the host bus master buffer. */
  533. u32 dSP_index;
  534. /* Host index in to the host bus master buffer. */
  535. u32 host_index;
  536. u32 size_in_bytes;
  537. };
  538. struct hpi_streamid {
  539. u16 object_type;
  540. /**< Type of object, HPI_OBJ_OSTREAM or HPI_OBJ_ISTREAM. */
  541. u16 stream_index; /**< outstream or instream index. */
  542. };
  543. struct hpi_punchinout {
  544. u32 punch_in_sample;
  545. u32 punch_out_sample;
  546. };
  547. struct hpi_subsys_msg {
  548. struct hpi_resource resource;
  549. };
  550. struct hpi_subsys_res {
  551. u32 version;
  552. u32 data; /* extended version */
  553. u16 num_adapters;
  554. u16 adapter_index;
  555. u16 adapter_type;
  556. u16 pad16;
  557. };
  558. union hpi_adapterx_msg {
  559. struct {
  560. u32 dsp_address;
  561. u32 count_bytes;
  562. } debug_read;
  563. struct {
  564. u32 adapter_mode;
  565. u16 query_or_set;
  566. } mode;
  567. struct {
  568. u16 index;
  569. } module_info;
  570. struct {
  571. u32 checksum;
  572. u16 sequence;
  573. u16 length;
  574. u16 offset; /**< offset from start of msg to data */
  575. u16 unused;
  576. } program_flash;
  577. struct {
  578. u16 index;
  579. u16 what;
  580. u16 property_index;
  581. } property_enum;
  582. struct {
  583. u16 property;
  584. u16 parameter1;
  585. u16 parameter2;
  586. } property_set;
  587. struct {
  588. u32 offset;
  589. } query_flash;
  590. struct {
  591. u32 pad32;
  592. u16 key1;
  593. u16 key2;
  594. } restart;
  595. struct {
  596. u32 offset;
  597. u32 length;
  598. u32 key;
  599. } start_flash;
  600. struct {
  601. u32 pad32;
  602. u16 value;
  603. } test_assert;
  604. struct {
  605. u32 yes;
  606. } irq_query;
  607. };
  608. struct hpi_adapter_res {
  609. u32 serial_number;
  610. u16 adapter_type;
  611. u16 adapter_index;
  612. u16 num_instreams;
  613. u16 num_outstreams;
  614. u16 num_mixers;
  615. u16 version;
  616. u8 sz_adapter_assert[HPI_STRING_LEN];
  617. };
  618. union hpi_adapterx_res {
  619. struct hpi_adapter_res info;
  620. struct {
  621. u32 p1;
  622. u16 count;
  623. u16 dsp_index;
  624. u32 p2;
  625. u32 dsp_msg_addr;
  626. char sz_message[HPI_STRING_LEN];
  627. } assert;
  628. struct {
  629. u32 adapter_mode;
  630. } mode;
  631. struct {
  632. u16 sequence;
  633. } program_flash;
  634. struct {
  635. u16 parameter1;
  636. u16 parameter2;
  637. } property_get;
  638. struct {
  639. u32 checksum;
  640. u32 length;
  641. u32 version;
  642. } query_flash;
  643. struct {
  644. u32 yes;
  645. } irq_query;
  646. };
  647. struct hpi_stream_msg {
  648. union {
  649. struct hpi_msg_data data;
  650. struct hpi_data_legacy32 data32;
  651. u16 velocity;
  652. struct hpi_punchinout pio;
  653. u32 time_scale;
  654. struct hpi_buffer buffer;
  655. struct hpi_streamid stream;
  656. u32 threshold_bytes;
  657. } u;
  658. };
  659. struct hpi_stream_res {
  660. union {
  661. struct {
  662. /* size of hardware buffer */
  663. u32 buffer_size;
  664. /* OutStream - data to play,
  665. InStream - data recorded */
  666. u32 data_available;
  667. /* OutStream - samples played,
  668. InStream - samples recorded */
  669. u32 samples_transferred;
  670. /* Adapter - OutStream - data to play,
  671. InStream - data recorded */
  672. u32 auxiliary_data_available;
  673. u16 state; /* HPI_STATE_PLAYING, _STATE_STOPPED */
  674. u16 padding;
  675. } stream_info;
  676. struct {
  677. u32 buffer_size;
  678. u32 data_available;
  679. u32 samples_transfered;
  680. u16 state;
  681. u16 outstream_index;
  682. u16 instream_index;
  683. u16 padding;
  684. u32 auxiliary_data_available;
  685. } legacy_stream_info;
  686. struct {
  687. /* bitmap of grouped OutStreams */
  688. u32 outstream_group_map;
  689. /* bitmap of grouped InStreams */
  690. u32 instream_group_map;
  691. } group_info;
  692. struct {
  693. /* pointer to the buffer */
  694. u8 *p_buffer;
  695. /* pointer to the hostbuffer status */
  696. struct hpi_hostbuffer_status *p_status;
  697. } hostbuffer_info;
  698. } u;
  699. };
  700. struct hpi_mixer_msg {
  701. u16 control_index;
  702. u16 control_type; /* = HPI_CONTROL_METER _VOLUME etc */
  703. u16 padding1; /* Maintain alignment of subsequent fields */
  704. u16 node_type1; /* = HPI_SOURCENODE_LINEIN etc */
  705. u16 node_index1; /* = 0..N */
  706. u16 node_type2;
  707. u16 node_index2;
  708. u16 padding2; /* round to 4 bytes */
  709. };
  710. struct hpi_mixer_res {
  711. u16 src_node_type; /* = HPI_SOURCENODE_LINEIN etc */
  712. u16 src_node_index; /* = 0..N */
  713. u16 dst_node_type;
  714. u16 dst_node_index;
  715. /* Also controlType for MixerGetControlByIndex */
  716. u16 control_index;
  717. /* may indicate which DSP the control is located on */
  718. u16 dsp_index;
  719. };
  720. union hpi_mixerx_msg {
  721. struct {
  722. u16 starting_index;
  723. u16 flags;
  724. u32 length_in_bytes; /* length in bytes of p_data */
  725. u32 p_data; /* pointer to a data array */
  726. } gcabi;
  727. struct {
  728. u16 command;
  729. u16 index;
  730. } store; /* for HPI_MIXER_STORE message */
  731. };
  732. union hpi_mixerx_res {
  733. struct {
  734. u32 bytes_returned; /* size of items returned */
  735. u32 p_data; /* pointer to data array */
  736. u16 more_to_do; /* indicates if there is more to do */
  737. } gcabi;
  738. struct {
  739. u32 total_controls; /* count of controls in the mixer */
  740. u32 cache_controls; /* count of controls in the cac */
  741. u32 cache_bytes; /* size of cache */
  742. } cache_info;
  743. };
  744. struct hpi_control_msg {
  745. u16 attribute; /* control attribute or property */
  746. u16 saved_index;
  747. u32 param1; /* generic parameter 1 */
  748. u32 param2; /* generic parameter 2 */
  749. short an_log_value[HPI_MAX_CHANNELS];
  750. };
  751. struct hpi_control_union_msg {
  752. u16 attribute; /* control attribute or property */
  753. u16 saved_index; /* only used in ctrl save/restore */
  754. union {
  755. struct {
  756. u32 param1; /* generic parameter 1 */
  757. u32 param2; /* generic parameter 2 */
  758. short an_log_value[HPI_MAX_CHANNELS];
  759. } old;
  760. union {
  761. u32 frequency;
  762. u32 gain;
  763. u32 band;
  764. u32 deemphasis;
  765. u32 program;
  766. struct {
  767. u32 mode;
  768. u32 value;
  769. } mode;
  770. u32 blend;
  771. } tuner;
  772. } u;
  773. };
  774. struct hpi_control_res {
  775. /* Could make union. dwParam, anLogValue never used in same response */
  776. u32 param1;
  777. u32 param2;
  778. short an_log_value[HPI_MAX_CHANNELS];
  779. };
  780. union hpi_control_union_res {
  781. struct {
  782. u32 param1;
  783. u32 param2;
  784. short an_log_value[HPI_MAX_CHANNELS];
  785. } old;
  786. union {
  787. u32 band;
  788. u32 frequency;
  789. u32 gain;
  790. u32 deemphasis;
  791. struct {
  792. u32 data[2];
  793. u32 bLER;
  794. } rds;
  795. short s_level;
  796. struct {
  797. u16 value;
  798. u16 mask;
  799. } status;
  800. } tuner;
  801. struct {
  802. char sz_data[8];
  803. u32 remaining_chars;
  804. } chars8;
  805. char c_data12[12];
  806. };
  807. /* HPI_CONTROLX_STRUCTURES */
  808. /* Message */
  809. /** Used for all HMI variables where max length <= 8 bytes
  810. */
  811. struct hpi_controlx_msg_cobranet_data {
  812. u32 hmi_address;
  813. u32 byte_count;
  814. u32 data[2];
  815. };
  816. /** Used for string data, and for packet bridge
  817. */
  818. struct hpi_controlx_msg_cobranet_bigdata {
  819. u32 hmi_address;
  820. u32 byte_count;
  821. u8 *pb_data;
  822. #ifndef HPI64BIT
  823. u32 padding;
  824. #endif
  825. };
  826. /** Used for PADS control reading of string fields.
  827. */
  828. struct hpi_controlx_msg_pad_data {
  829. u32 field;
  830. u32 byte_count;
  831. u8 *pb_data;
  832. #ifndef HPI64BIT
  833. u32 padding;
  834. #endif
  835. };
  836. /** Used for generic data
  837. */
  838. struct hpi_controlx_msg_generic {
  839. u32 param1;
  840. u32 param2;
  841. };
  842. struct hpi_controlx_msg {
  843. u16 attribute; /* control attribute or property */
  844. u16 saved_index;
  845. union {
  846. struct hpi_controlx_msg_cobranet_data cobranet_data;
  847. struct hpi_controlx_msg_cobranet_bigdata cobranet_bigdata;
  848. struct hpi_controlx_msg_generic generic;
  849. struct hpi_controlx_msg_pad_data pad_data;
  850. /*struct param_value universal_value; */
  851. /* nothing extra to send for status read */
  852. } u;
  853. };
  854. /* Response */
  855. /**
  856. */
  857. struct hpi_controlx_res_cobranet_data {
  858. u32 byte_count;
  859. u32 data[2];
  860. };
  861. struct hpi_controlx_res_cobranet_bigdata {
  862. u32 byte_count;
  863. };
  864. struct hpi_controlx_res_cobranet_status {
  865. u32 status;
  866. u32 readable_size;
  867. u32 writeable_size;
  868. };
  869. struct hpi_controlx_res_generic {
  870. u32 param1;
  871. u32 param2;
  872. };
  873. struct hpi_controlx_res {
  874. union {
  875. struct hpi_controlx_res_cobranet_bigdata cobranet_bigdata;
  876. struct hpi_controlx_res_cobranet_data cobranet_data;
  877. struct hpi_controlx_res_cobranet_status cobranet_status;
  878. struct hpi_controlx_res_generic generic;
  879. /*struct param_info universal_info; */
  880. /*struct param_value universal_value; */
  881. } u;
  882. };
  883. struct hpi_nvmemory_msg {
  884. u16 address;
  885. u16 data;
  886. };
  887. struct hpi_nvmemory_res {
  888. u16 size_in_bytes;
  889. u16 data;
  890. };
  891. struct hpi_gpio_msg {
  892. u16 bit_index;
  893. u16 bit_data;
  894. };
  895. struct hpi_gpio_res {
  896. u16 number_input_bits;
  897. u16 number_output_bits;
  898. u16 bit_data[4];
  899. };
  900. struct hpi_async_msg {
  901. u32 events;
  902. u16 maximum_events;
  903. u16 padding;
  904. };
  905. struct hpi_async_res {
  906. union {
  907. struct {
  908. u16 count;
  909. } count;
  910. struct {
  911. u32 events;
  912. u16 number_returned;
  913. u16 padding;
  914. } get;
  915. struct hpi_async_event event;
  916. } u;
  917. };
  918. struct hpi_watchdog_msg {
  919. u32 time_ms;
  920. };
  921. struct hpi_watchdog_res {
  922. u32 time_ms;
  923. };
  924. struct hpi_clock_msg {
  925. u16 hours;
  926. u16 minutes;
  927. u16 seconds;
  928. u16 milli_seconds;
  929. };
  930. struct hpi_clock_res {
  931. u16 size_in_bytes;
  932. u16 hours;
  933. u16 minutes;
  934. u16 seconds;
  935. u16 milli_seconds;
  936. u16 padding;
  937. };
  938. struct hpi_profile_msg {
  939. u16 bin_index;
  940. u16 padding;
  941. };
  942. struct hpi_profile_res_open {
  943. u16 max_profiles;
  944. };
  945. struct hpi_profile_res_time {
  946. u32 total_tick_count;
  947. u32 call_count;
  948. u32 max_tick_count;
  949. u32 ticks_per_millisecond;
  950. u16 profile_interval;
  951. };
  952. struct hpi_profile_res_name {
  953. u8 sz_name[32];
  954. };
  955. struct hpi_profile_res {
  956. union {
  957. struct hpi_profile_res_open o;
  958. struct hpi_profile_res_time t;
  959. struct hpi_profile_res_name n;
  960. } u;
  961. };
  962. struct hpi_message_header {
  963. u16 size; /* total size in bytes */
  964. u8 type; /* HPI_TYPE_MESSAGE */
  965. u8 version; /* message version */
  966. u16 object; /* HPI_OBJ_* */
  967. u16 function; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
  968. u16 adapter_index; /* the adapter index */
  969. u16 obj_index; /* */
  970. };
  971. struct hpi_message {
  972. /* following fields must match HPI_MESSAGE_HEADER */
  973. u16 size; /* total size in bytes */
  974. u8 type; /* HPI_TYPE_MESSAGE */
  975. u8 version; /* message version */
  976. u16 object; /* HPI_OBJ_* */
  977. u16 function; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
  978. u16 adapter_index; /* the adapter index */
  979. u16 obj_index; /* */
  980. union {
  981. struct hpi_subsys_msg s;
  982. union hpi_adapterx_msg ax;
  983. struct hpi_stream_msg d;
  984. struct hpi_mixer_msg m;
  985. union hpi_mixerx_msg mx; /* extended mixer; */
  986. struct hpi_control_msg c; /* mixer control; */
  987. /* identical to struct hpi_control_msg,
  988. but field naming is improved */
  989. struct hpi_control_union_msg cu;
  990. struct hpi_controlx_msg cx; /* extended mixer control; */
  991. struct hpi_nvmemory_msg n;
  992. struct hpi_gpio_msg l; /* digital i/o */
  993. struct hpi_watchdog_msg w;
  994. struct hpi_clock_msg t; /* dsp time */
  995. struct hpi_profile_msg p;
  996. struct hpi_async_msg as;
  997. char fixed_size[32];
  998. } u;
  999. };
  1000. #define HPI_MESSAGE_SIZE_BY_OBJECT { \
  1001. sizeof(struct hpi_message_header) , /* Default, no object type 0 */ \
  1002. sizeof(struct hpi_message_header) + sizeof(struct hpi_subsys_msg),\
  1003. sizeof(struct hpi_message_header) + sizeof(union hpi_adapterx_msg),\
  1004. sizeof(struct hpi_message_header) + sizeof(struct hpi_stream_msg),\
  1005. sizeof(struct hpi_message_header) + sizeof(struct hpi_stream_msg),\
  1006. sizeof(struct hpi_message_header) + sizeof(struct hpi_mixer_msg),\
  1007. sizeof(struct hpi_message_header) , /* no node message */ \
  1008. sizeof(struct hpi_message_header) + sizeof(struct hpi_control_msg),\
  1009. sizeof(struct hpi_message_header) + sizeof(struct hpi_nvmemory_msg),\
  1010. sizeof(struct hpi_message_header) + sizeof(struct hpi_gpio_msg),\
  1011. sizeof(struct hpi_message_header) + sizeof(struct hpi_watchdog_msg),\
  1012. sizeof(struct hpi_message_header) + sizeof(struct hpi_clock_msg),\
  1013. sizeof(struct hpi_message_header) + sizeof(struct hpi_profile_msg),\
  1014. sizeof(struct hpi_message_header) + sizeof(struct hpi_controlx_msg),\
  1015. sizeof(struct hpi_message_header) + sizeof(struct hpi_async_msg) \
  1016. }
  1017. /*
  1018. Note that the wSpecificError error field should be inspected and potentially
  1019. reported whenever HPI_ERROR_DSP_COMMUNICATION or HPI_ERROR_DSP_BOOTLOAD is
  1020. returned in wError.
  1021. */
  1022. struct hpi_response_header {
  1023. u16 size;
  1024. u8 type; /* HPI_TYPE_RESPONSE */
  1025. u8 version; /* response version */
  1026. u16 object; /* HPI_OBJ_* */
  1027. u16 function; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
  1028. u16 error; /* HPI_ERROR_xxx */
  1029. u16 specific_error; /* adapter specific error */
  1030. };
  1031. struct hpi_response {
  1032. /* following fields must match HPI_RESPONSE_HEADER */
  1033. u16 size;
  1034. u8 type; /* HPI_TYPE_RESPONSE */
  1035. u8 version; /* response version */
  1036. u16 object; /* HPI_OBJ_* */
  1037. u16 function; /* HPI_SUBSYS_xxx, HPI_ADAPTER_xxx */
  1038. u16 error; /* HPI_ERROR_xxx */
  1039. u16 specific_error; /* adapter specific error */
  1040. union {
  1041. struct hpi_subsys_res s;
  1042. union hpi_adapterx_res ax;
  1043. struct hpi_stream_res d;
  1044. struct hpi_mixer_res m;
  1045. union hpi_mixerx_res mx; /* extended mixer; */
  1046. struct hpi_control_res c; /* mixer control; */
  1047. /* identical to hpi_control_res, but field naming is improved */
  1048. union hpi_control_union_res cu;
  1049. struct hpi_controlx_res cx; /* extended mixer control; */
  1050. struct hpi_nvmemory_res n;
  1051. struct hpi_gpio_res l; /* digital i/o */
  1052. struct hpi_watchdog_res w;
  1053. struct hpi_clock_res t; /* dsp time */
  1054. struct hpi_profile_res p;
  1055. struct hpi_async_res as;
  1056. u8 bytes[52];
  1057. } u;
  1058. };
  1059. #define HPI_RESPONSE_SIZE_BY_OBJECT { \
  1060. sizeof(struct hpi_response_header) ,/* Default, no object type 0 */ \
  1061. sizeof(struct hpi_response_header) + sizeof(struct hpi_subsys_res),\
  1062. sizeof(struct hpi_response_header) + sizeof(union hpi_adapterx_res),\
  1063. sizeof(struct hpi_response_header) + sizeof(struct hpi_stream_res),\
  1064. sizeof(struct hpi_response_header) + sizeof(struct hpi_stream_res),\
  1065. sizeof(struct hpi_response_header) + sizeof(struct hpi_mixer_res),\
  1066. sizeof(struct hpi_response_header) , /* no node response */ \
  1067. sizeof(struct hpi_response_header) + sizeof(struct hpi_control_res),\
  1068. sizeof(struct hpi_response_header) + sizeof(struct hpi_nvmemory_res),\
  1069. sizeof(struct hpi_response_header) + sizeof(struct hpi_gpio_res),\
  1070. sizeof(struct hpi_response_header) + sizeof(struct hpi_watchdog_res),\
  1071. sizeof(struct hpi_response_header) + sizeof(struct hpi_clock_res),\
  1072. sizeof(struct hpi_response_header) + sizeof(struct hpi_profile_res),\
  1073. sizeof(struct hpi_response_header) + sizeof(struct hpi_controlx_res),\
  1074. sizeof(struct hpi_response_header) + sizeof(struct hpi_async_res) \
  1075. }
  1076. /*********************** version 1 message/response **************************/
  1077. #define HPINET_ETHERNET_DATA_SIZE (1500)
  1078. #define HPINET_IP_HDR_SIZE (20)
  1079. #define HPINET_IP_DATA_SIZE (HPINET_ETHERNET_DATA_SIZE - HPINET_IP_HDR_SIZE)
  1080. #define HPINET_UDP_HDR_SIZE (8)
  1081. #define HPINET_UDP_DATA_SIZE (HPINET_IP_DATA_SIZE - HPINET_UDP_HDR_SIZE)
  1082. #define HPINET_ASI_HDR_SIZE (2)
  1083. #define HPINET_ASI_DATA_SIZE (HPINET_UDP_DATA_SIZE - HPINET_ASI_HDR_SIZE)
  1084. #define HPI_MAX_PAYLOAD_SIZE (HPINET_ASI_DATA_SIZE - 2)
  1085. /* New style message/response, but still V0 compatible */
  1086. struct hpi_msg_adapter_get_info {
  1087. struct hpi_message_header h;
  1088. };
  1089. struct hpi_res_adapter_get_info {
  1090. struct hpi_response_header h; /*v0 */
  1091. struct hpi_adapter_res p;
  1092. };
  1093. /* padding is so these are same size as v0 hpi_message */
  1094. struct hpi_msg_adapter_query_flash {
  1095. struct hpi_message_header h;
  1096. u32 offset;
  1097. u8 pad_to_version0_size[sizeof(struct hpi_message) - /* V0 res */
  1098. sizeof(struct hpi_message_header) - 1 * sizeof(u32)];
  1099. };
  1100. /* padding is so these are same size as v0 hpi_response */
  1101. struct hpi_res_adapter_query_flash {
  1102. struct hpi_response_header h;
  1103. u32 checksum;
  1104. u32 length;
  1105. u32 version;
  1106. u8 pad_to_version0_size[sizeof(struct hpi_response) - /* V0 res */
  1107. sizeof(struct hpi_response_header) - 3 * sizeof(u32)];
  1108. };
  1109. struct hpi_msg_adapter_start_flash {
  1110. struct hpi_message_header h;
  1111. u32 offset;
  1112. u32 length;
  1113. u32 key;
  1114. u8 pad_to_version0_size[sizeof(struct hpi_message) - /* V0 res */
  1115. sizeof(struct hpi_message_header) - 3 * sizeof(u32)];
  1116. };
  1117. struct hpi_res_adapter_start_flash {
  1118. struct hpi_response_header h;
  1119. u8 pad_to_version0_size[sizeof(struct hpi_response) - /* V0 res */
  1120. sizeof(struct hpi_response_header)];
  1121. };
  1122. struct hpi_msg_adapter_program_flash_payload {
  1123. u32 checksum;
  1124. u16 sequence;
  1125. u16 length;
  1126. u16 offset; /**< offset from start of msg to data */
  1127. u16 unused;
  1128. /* ensure sizeof(header + payload) == sizeof(hpi_message_V0)
  1129. because old firmware expects data after message of this size */
  1130. u8 pad_to_version0_size[sizeof(struct hpi_message) - /* V0 message */
  1131. sizeof(struct hpi_message_header) - sizeof(u32) -
  1132. 4 * sizeof(u16)];
  1133. };
  1134. struct hpi_msg_adapter_program_flash {
  1135. struct hpi_message_header h;
  1136. struct hpi_msg_adapter_program_flash_payload p;
  1137. u32 data[256];
  1138. };
  1139. struct hpi_res_adapter_program_flash {
  1140. struct hpi_response_header h;
  1141. u16 sequence;
  1142. u8 pad_to_version0_size[sizeof(struct hpi_response) - /* V0 res */
  1143. sizeof(struct hpi_response_header) - sizeof(u16)];
  1144. };
  1145. struct hpi_msg_adapter_debug_read {
  1146. struct hpi_message_header h;
  1147. u32 dsp_address;
  1148. u32 count_bytes;
  1149. };
  1150. struct hpi_res_adapter_debug_read {
  1151. struct hpi_response_header h;
  1152. u8 bytes[256];
  1153. };
  1154. #if 1
  1155. #define hpi_message_header_v1 hpi_message_header
  1156. #define hpi_response_header_v1 hpi_response_header
  1157. #else
  1158. /* V1 headers in Addition to v0 headers */
  1159. struct hpi_message_header_v1 {
  1160. struct hpi_message_header h0;
  1161. /* struct {
  1162. } h1; */
  1163. };
  1164. struct hpi_response_header_v1 {
  1165. struct hpi_response_header h0;
  1166. struct {
  1167. u16 adapter_index; /* the adapter index */
  1168. u16 obj_index; /* object index */
  1169. } h1;
  1170. };
  1171. #endif
  1172. struct hpi_msg_payload_v0 {
  1173. struct hpi_message_header h;
  1174. union {
  1175. struct hpi_subsys_msg s;
  1176. union hpi_adapterx_msg ax;
  1177. struct hpi_stream_msg d;
  1178. struct hpi_mixer_msg m;
  1179. union hpi_mixerx_msg mx;
  1180. struct hpi_control_msg c;
  1181. struct hpi_control_union_msg cu;
  1182. struct hpi_controlx_msg cx;
  1183. struct hpi_nvmemory_msg n;
  1184. struct hpi_gpio_msg l;
  1185. struct hpi_watchdog_msg w;
  1186. struct hpi_clock_msg t;
  1187. struct hpi_profile_msg p;
  1188. struct hpi_async_msg as;
  1189. } u;
  1190. };
  1191. struct hpi_res_payload_v0 {
  1192. struct hpi_response_header h;
  1193. union {
  1194. struct hpi_subsys_res s;
  1195. union hpi_adapterx_res ax;
  1196. struct hpi_stream_res d;
  1197. struct hpi_mixer_res m;
  1198. union hpi_mixerx_res mx;
  1199. struct hpi_control_res c;
  1200. union hpi_control_union_res cu;
  1201. struct hpi_controlx_res cx;
  1202. struct hpi_nvmemory_res n;
  1203. struct hpi_gpio_res l;
  1204. struct hpi_watchdog_res w;
  1205. struct hpi_clock_res t;
  1206. struct hpi_profile_res p;
  1207. struct hpi_async_res as;
  1208. } u;
  1209. };
  1210. union hpi_message_buffer_v1 {
  1211. struct hpi_message m0; /* version 0 */
  1212. struct hpi_message_header_v1 h;
  1213. u8 buf[HPI_MAX_PAYLOAD_SIZE];
  1214. };
  1215. union hpi_response_buffer_v1 {
  1216. struct hpi_response r0; /* version 0 */
  1217. struct hpi_response_header_v1 h;
  1218. u8 buf[HPI_MAX_PAYLOAD_SIZE];
  1219. };
  1220. compile_time_assert((sizeof(union hpi_message_buffer_v1) <=
  1221. HPI_MAX_PAYLOAD_SIZE), message_buffer_ok);
  1222. compile_time_assert((sizeof(union hpi_response_buffer_v1) <=
  1223. HPI_MAX_PAYLOAD_SIZE), response_buffer_ok);
  1224. /*////////////////////////////////////////////////////////////////////////// */
  1225. /* declarations for compact control calls */
  1226. struct hpi_control_defn {
  1227. u8 type;
  1228. u8 channels;
  1229. u8 src_node_type;
  1230. u8 src_node_index;
  1231. u8 dest_node_type;
  1232. u8 dest_node_index;
  1233. };
  1234. /*////////////////////////////////////////////////////////////////////////// */
  1235. /* declarations for control caching (internal to HPI<->DSP interaction) */
  1236. /** indicates a cached u16 value is invalid. */
  1237. #define HPI_CACHE_INVALID_UINT16 0xFFFF
  1238. /** indicates a cached short value is invalid. */
  1239. #define HPI_CACHE_INVALID_SHORT -32768
  1240. /** A compact representation of (part of) a controls state.
  1241. Used for efficient transfer of the control state
  1242. between DSP and host or across a network
  1243. */
  1244. struct hpi_control_cache_info {
  1245. /** one of HPI_CONTROL_* */
  1246. u8 control_type;
  1247. /** The total size of cached information in 32-bit words. */
  1248. u8 size_in32bit_words;
  1249. /** The original index of the control on the DSP */
  1250. u16 control_index;
  1251. };
  1252. struct hpi_control_cache_vol {
  1253. struct hpi_control_cache_info i;
  1254. short an_log[2];
  1255. unsigned short flags;
  1256. char padding[2];
  1257. };
  1258. struct hpi_control_cache_meter {
  1259. struct hpi_control_cache_info i;
  1260. short an_log_peak[2];
  1261. short an_logRMS[2];
  1262. };
  1263. struct hpi_control_cache_channelmode {
  1264. struct hpi_control_cache_info i;
  1265. u16 mode;
  1266. char temp_padding[6];
  1267. };
  1268. struct hpi_control_cache_mux {
  1269. struct hpi_control_cache_info i;
  1270. u16 source_node_type;
  1271. u16 source_node_index;
  1272. char temp_padding[4];
  1273. };
  1274. struct hpi_control_cache_level {
  1275. struct hpi_control_cache_info i;
  1276. short an_log[2];
  1277. char temp_padding[4];
  1278. };
  1279. struct hpi_control_cache_tuner {
  1280. struct hpi_control_cache_info i;
  1281. u32 freq_ink_hz;
  1282. u16 band;
  1283. short s_level_avg;
  1284. };
  1285. struct hpi_control_cache_aes3rx {
  1286. struct hpi_control_cache_info i;
  1287. u32 error_status;
  1288. u32 format;
  1289. };
  1290. struct hpi_control_cache_aes3tx {
  1291. struct hpi_control_cache_info i;
  1292. u32 format;
  1293. char temp_padding[4];
  1294. };
  1295. struct hpi_control_cache_tonedetector {
  1296. struct hpi_control_cache_info i;
  1297. u16 state;
  1298. char temp_padding[6];
  1299. };
  1300. struct hpi_control_cache_silencedetector {
  1301. struct hpi_control_cache_info i;
  1302. u32 state;
  1303. char temp_padding[4];
  1304. };
  1305. struct hpi_control_cache_sampleclock {
  1306. struct hpi_control_cache_info i;
  1307. u16 source;
  1308. u16 source_index;
  1309. u32 sample_rate;
  1310. };
  1311. struct hpi_control_cache_microphone {
  1312. struct hpi_control_cache_info i;
  1313. u16 phantom_state;
  1314. char temp_padding[6];
  1315. };
  1316. struct hpi_control_cache_generic {
  1317. struct hpi_control_cache_info i;
  1318. u32 dw1;
  1319. u32 dw2;
  1320. };
  1321. struct hpi_control_cache_single {
  1322. union {
  1323. struct hpi_control_cache_info i;
  1324. struct hpi_control_cache_vol vol;
  1325. struct hpi_control_cache_meter meter;
  1326. struct hpi_control_cache_channelmode mode;
  1327. struct hpi_control_cache_mux mux;
  1328. struct hpi_control_cache_level level;
  1329. struct hpi_control_cache_tuner tuner;
  1330. struct hpi_control_cache_aes3rx aes3rx;
  1331. struct hpi_control_cache_aes3tx aes3tx;
  1332. struct hpi_control_cache_tonedetector tone;
  1333. struct hpi_control_cache_silencedetector silence;
  1334. struct hpi_control_cache_sampleclock clk;
  1335. struct hpi_control_cache_microphone microphone;
  1336. struct hpi_control_cache_generic generic;
  1337. } u;
  1338. };
  1339. struct hpi_control_cache_pad {
  1340. struct hpi_control_cache_info i;
  1341. u32 field_valid_flags;
  1342. u8 c_channel[8];
  1343. u8 c_artist[40];
  1344. u8 c_title[40];
  1345. u8 c_comment[200];
  1346. u32 pTY;
  1347. u32 pI;
  1348. u32 traffic_supported;
  1349. u32 traffic_anouncement;
  1350. };
  1351. /* 2^N sized FIFO buffer (internal to HPI<->DSP interaction) */
  1352. struct hpi_fifo_buffer {
  1353. u32 size;
  1354. u32 dSP_index;
  1355. u32 host_index;
  1356. };
  1357. #ifndef DISABLE_PRAGMA_PACK1
  1358. #pragma pack(pop)
  1359. #endif
  1360. /* skip host side function declarations for DSP
  1361. compile and documentation extraction */
  1362. char hpi_handle_object(const u32 handle);
  1363. void hpi_handle_to_indexes(const u32 handle, u16 *pw_adapter_index,
  1364. u16 *pw_object_index);
  1365. u32 hpi_indexes_to_handle(const char c_object, const u16 adapter_index,
  1366. const u16 object_index);
  1367. /*////////////////////////////////////////////////////////////////////////// */
  1368. /* main HPI entry point */
  1369. void hpi_send_recv(struct hpi_message *phm, struct hpi_response *phr);
  1370. /* used in PnP OS/driver */
  1371. u16 hpi_subsys_create_adapter(const struct hpi_resource *p_resource,
  1372. u16 *pw_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_6000;
  1390. hpi_handler_func HPI_6205;
  1391. #endif /* _HPI_INTERNAL_H_ */