hpi_internal.h 45 KB

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