hpi_internal.h 53 KB

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