hpi_internal.h 53 KB

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