hpi_internal.h 52 KB

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