au88x0_xtalk.c 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796
  1. /***************************************************************************
  2. * au88x0_cxtalk.c
  3. *
  4. * Wed Nov 19 16:29:47 2003
  5. * Copyright 2003 mjander
  6. * mjander@users.sourceforge.org
  7. ****************************************************************************/
  8. /*
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Library General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  22. */
  23. #include "au88x0_xtalk.h"
  24. /* Data (a whole lot of data.... ) */
  25. static short const sXtalkWideKLeftEq = 0x269C;
  26. static short const sXtalkWideKRightEq = 0x269C;
  27. static short const sXtalkWideKLeftXt = 0xF25E;
  28. static short const sXtalkWideKRightXt = 0xF25E;
  29. static short const sXtalkWideShiftLeftEq = 1;
  30. static short const sXtalkWideShiftRightEq = 1;
  31. static short const sXtalkWideShiftLeftXt = 0;
  32. static short const sXtalkWideShiftRightXt = 0;
  33. static unsigned short const wXtalkWideLeftDelay = 0xd;
  34. static unsigned short const wXtalkWideRightDelay = 0xd;
  35. static short const sXtalkNarrowKLeftEq = 0x468D;
  36. static short const sXtalkNarrowKRightEq = 0x468D;
  37. static short const sXtalkNarrowKLeftXt = 0xF82E;
  38. static short const sXtalkNarrowKRightXt = 0xF82E;
  39. static short const sXtalkNarrowShiftLeftEq = 0x3;
  40. static short const sXtalkNarrowShiftRightEq = 0x3;
  41. static short const sXtalkNarrowShiftLeftXt = 0;
  42. static short const sXtalkNarrowShiftRightXt = 0;
  43. static unsigned short const wXtalkNarrowLeftDelay = 0x7;
  44. static unsigned short const wXtalkNarrowRightDelay = 0x7;
  45. static xtalk_gains_t const asXtalkGainsDefault = {
  46. 0x4000, 0x4000, 0x4000, 0x4000, 0x4000,
  47. 0x4000, 0x4000, 0x4000, 0x4000, 0x4000
  48. };
  49. static xtalk_gains_t const asXtalkGainsTest = {
  50. 0x7fff, 0x8000, 0x0000, 0x0000, 0x0001,
  51. 0xffff, 0x4000, 0xc000, 0x0002, 0xfffe
  52. };
  53. static xtalk_gains_t const asXtalkGains1Chan = {
  54. 0x7FFF, 0, 0, 0, 0,
  55. 0x7FFF, 0, 0, 0, 0,
  56. };
  57. // Input gain for 4 A3D slices. One possible input pair is left zero.
  58. static xtalk_gains_t const asXtalkGainsAllChan = {
  59. 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0,
  60. 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0
  61. };
  62. static xtalk_gains_t const asXtalkGainsZeros = {
  63. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
  64. };
  65. static xtalk_dline_t const alXtalkDlineZeros = {
  66. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  67. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
  68. };
  69. static xtalk_dline_t const alXtalkDlineTest = {
  70. 0x0000fc18, 0xfff03e8, 0x000186a0, 0xfffe7960, 1, 0xffffffff, 0, 0,
  71. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  72. 0, 0, 0, 0, 0, 0, 0, 0
  73. };
  74. static xtalk_instate_t const asXtalkInStateZeros = {
  75. 0, 0, 0, 0
  76. };
  77. static xtalk_instate_t const asXtalkInStateTest = {
  78. 0x0080, 0xff80, 0x0001, 0xffff
  79. };
  80. static xtalk_state_t const asXtalkOutStateZeros = {
  81. {0, 0, 0, 0},
  82. {0, 0, 0, 0},
  83. {0, 0, 0, 0},
  84. {0, 0, 0, 0},
  85. {0, 0, 0, 0}
  86. };
  87. static short const sDiamondKLeftEq = 0x401d;
  88. static short const sDiamondKRightEq = 0x401d;
  89. static short const sDiamondKLeftXt = 0xF90E;
  90. static short const sDiamondKRightXt = 0xF90E;
  91. static short const sDiamondShiftLeftEq = 1;
  92. static short const sDiamondShiftRightEq = 1;
  93. static short const sDiamondShiftLeftXt = 0;
  94. static short const sDiamondShiftRightXt = 0;
  95. static unsigned short const wDiamondLeftDelay = 0xb;
  96. static unsigned short const wDiamondRightDelay = 0xb;
  97. static xtalk_coefs_t const asXtalkWideCoefsLeftEq = {
  98. {0xEC4C, 0xDCE9, 0xFDC2, 0xFEEC, 0},
  99. {0x5F60, 0xCBCB, 0xFC26, 0x0305, 0},
  100. {0x340B, 0xe8f5, 0x236c, 0xe40d, 0},
  101. {0x76d5, 0xc78d, 0x05ac, 0xfa5b, 0},
  102. {0x7F04, 0xC0FA, 0x0263, 0xFDA2, 0}
  103. };
  104. static xtalk_coefs_t const asXtalkWideCoefsRightEq = {
  105. {0xEC4C, 0xDCE9, 0xFDC2, 0xFEEC, 0},
  106. {0x5F60, 0xCBCB, 0xFC26, 0x0305, 0},
  107. {0x340B, 0xe8f5, 0x236c, 0xe40d, 0},
  108. {0x76d5, 0xc78d, 0x05ac, 0xfa5b, 0},
  109. {0x7F04, 0xC0FA, 0x0263, 0xFDA2, 0}
  110. };
  111. static xtalk_coefs_t const asXtalkWideCoefsLeftXt = {
  112. {0x55c6, 0xc97b, 0x005b, 0x0047, 0},
  113. {0x6a60, 0xca20, 0xffc6, 0x0040, 0},
  114. {0x6411, 0xd711, 0xfca1, 0x0190, 0},
  115. {0x77dc, 0xc79e, 0xffb8, 0x000a, 0},
  116. {0, 0, 0, 0, 0}
  117. };
  118. static xtalk_coefs_t const asXtalkWideCoefsRightXt = {
  119. {0x55c6, 0xc97b, 0x005b, 0x0047, 0},
  120. {0x6a60, 0xca20, 0xffc6, 0x0040, 0},
  121. {0x6411, 0xd711, 0xfca1, 0x0190, 0},
  122. {0x77dc, 0xc79e, 0xffb8, 0x000a, 0},
  123. {0, 0, 0, 0, 0}
  124. };
  125. static xtalk_coefs_t const asXtalkNarrowCoefsLeftEq = {
  126. {0x50B5, 0xD07C, 0x026D, 0xFD21, 0},
  127. {0x460F, 0xE44F, 0xF75E, 0xEFA6, 0},
  128. {0x556D, 0xDCAB, 0x2098, 0xF0F2, 0},
  129. {0x7E03, 0xC1F0, 0x007D, 0xFF89, 0},
  130. {0x383E, 0xFD9D, 0xB278, 0x4547, 0}
  131. };
  132. static xtalk_coefs_t const asXtalkNarrowCoefsRightEq = {
  133. {0x50B5, 0xD07C, 0x026D, 0xFD21, 0},
  134. {0x460F, 0xE44F, 0xF75E, 0xEFA6, 0},
  135. {0x556D, 0xDCAB, 0x2098, 0xF0F2, 0},
  136. {0x7E03, 0xC1F0, 0x007D, 0xFF89, 0},
  137. {0x383E, 0xFD9D, 0xB278, 0x4547, 0}
  138. };
  139. static xtalk_coefs_t const asXtalkNarrowCoefsLeftXt = {
  140. {0x3CB2, 0xDF49, 0xF6EA, 0x095B, 0},
  141. {0x6777, 0xC915, 0xFEAF, 0x00B1, 0},
  142. {0x7762, 0xC7D9, 0x025B, 0xFDA6, 0},
  143. {0x6B7A, 0xD2AA, 0xF2FB, 0x0B64, 0},
  144. {0, 0, 0, 0, 0}
  145. };
  146. static xtalk_coefs_t const asXtalkNarrowCoefsRightXt = {
  147. {0x3CB2, 0xDF49, 0xF6EA, 0x095B, 0},
  148. {0x6777, 0xC915, 0xFEAF, 0x00B1, 0},
  149. {0x7762, 0xC7D9, 0x025B, 0xFDA6, 0},
  150. {0x6B7A, 0xD2AA, 0xF2FB, 0x0B64, 0},
  151. {0, 0, 0, 0, 0}
  152. };
  153. static xtalk_coefs_t const asXtalkCoefsZeros = {
  154. {0, 0, 0, 0, 0},
  155. {0, 0, 0, 0, 0},
  156. {0, 0, 0, 0, 0},
  157. {0, 0, 0, 0, 0},
  158. {0, 0, 0, 0, 0}
  159. };
  160. static xtalk_coefs_t const asXtalkCoefsPipe = {
  161. {0, 0, 0x0FA0, 0, 0},
  162. {0, 0, 0x0FA0, 0, 0},
  163. {0, 0, 0x0FA0, 0, 0},
  164. {0, 0, 0x0FA0, 0, 0},
  165. {0, 0, 0x1180, 0, 0},
  166. };
  167. static xtalk_coefs_t const asXtalkCoefsNegPipe = {
  168. {0, 0, 0xF380, 0, 0},
  169. {0, 0, 0xF380, 0, 0},
  170. {0, 0, 0xF380, 0, 0},
  171. {0, 0, 0xF380, 0, 0},
  172. {0, 0, 0xF200, 0, 0}
  173. };
  174. static xtalk_coefs_t const asXtalkCoefsNumTest = {
  175. {0, 0, 0xF380, 0x8000, 0x6D60},
  176. {0, 0, 0, 0, 0},
  177. {0, 0, 0, 0, 0},
  178. {0, 0, 0, 0, 0},
  179. {0, 0, 0, 0, 0}
  180. };
  181. static xtalk_coefs_t const asXtalkCoefsDenTest = {
  182. {0xC000, 0x2000, 0x4000, 0, 0},
  183. {0, 0, 0, 0, 0},
  184. {0, 0, 0, 0, 0},
  185. {0, 0, 0, 0, 0},
  186. {0, 0, 0, 0, 0}
  187. };
  188. static xtalk_state_t const asXtalkOutStateTest = {
  189. {0x7FFF, 0x0004, 0xFFFC, 0},
  190. {0xFE00, 0x0008, 0xFFF8, 0x4000},
  191. {0x0200, 0x0010, 0xFFF0, 0xC000},
  192. {0x8000, 0x0020, 0xFFE0, 0},
  193. {0, 0, 0, 0}
  194. };
  195. static xtalk_coefs_t const asDiamondCoefsLeftEq = {
  196. {0x0F1E, 0x2D05, 0xF8E3, 0x07C8, 0},
  197. {0x45E2, 0xCA51, 0x0448, 0xFCE7, 0},
  198. {0xA93E, 0xDBD5, 0x022C, 0x028A, 0},
  199. {0, 0, 0, 0, 0},
  200. {0, 0, 0, 0, 0}
  201. };
  202. static xtalk_coefs_t const asDiamondCoefsRightEq = {
  203. {0x0F1E, 0x2D05, 0xF8E3, 0x07C8, 0},
  204. {0x45E2, 0xCA51, 0x0448, 0xFCE7, 0},
  205. {0xA93E, 0xDBD5, 0x022C, 0x028A, 0},
  206. {0, 0, 0, 0, 0},
  207. {0, 0, 0, 0, 0}
  208. };
  209. static xtalk_coefs_t const asDiamondCoefsLeftXt = {
  210. {0x3B50, 0xFE08, 0xF959, 0x0060, 0},
  211. {0x9FCB, 0xD8F1, 0x00A2, 0x003A, 0},
  212. {0, 0, 0, 0, 0},
  213. {0, 0, 0, 0, 0},
  214. {0, 0, 0, 0, 0}
  215. };
  216. static xtalk_coefs_t const asDiamondCoefsRightXt = {
  217. {0x3B50, 0xFE08, 0xF959, 0x0060, 0},
  218. {0x9FCB, 0xD8F1, 0x00A2, 0x003A, 0},
  219. {0, 0, 0, 0, 0},
  220. {0, 0, 0, 0, 0},
  221. {0, 0, 0, 0, 0}
  222. };
  223. /**/
  224. /* XTalk EQ and XT */
  225. static void
  226. vortex_XtalkHw_SetLeftEQ(vortex_t * vortex, short arg_0, short arg_4,
  227. xtalk_coefs_t const coefs)
  228. {
  229. int i;
  230. for (i = 0; i < 5; i++) {
  231. hwwrite(vortex->mmio, 0x24200 + i * 0x24, coefs[i][0]);
  232. hwwrite(vortex->mmio, 0x24204 + i * 0x24, coefs[i][1]);
  233. hwwrite(vortex->mmio, 0x24208 + i * 0x24, coefs[i][2]);
  234. hwwrite(vortex->mmio, 0x2420c + i * 0x24, coefs[i][3]);
  235. hwwrite(vortex->mmio, 0x24210 + i * 0x24, coefs[i][4]);
  236. }
  237. hwwrite(vortex->mmio, 0x24538, arg_0 & 0xffff);
  238. hwwrite(vortex->mmio, 0x2453C, arg_4 & 0xffff);
  239. }
  240. static void
  241. vortex_XtalkHw_SetRightEQ(vortex_t * vortex, short arg_0, short arg_4,
  242. xtalk_coefs_t const coefs)
  243. {
  244. int i;
  245. for (i = 0; i < 5; i++) {
  246. hwwrite(vortex->mmio, 0x242b4 + i * 0x24, coefs[i][0]);
  247. hwwrite(vortex->mmio, 0x242b8 + i * 0x24, coefs[i][1]);
  248. hwwrite(vortex->mmio, 0x242bc + i * 0x24, coefs[i][2]);
  249. hwwrite(vortex->mmio, 0x242c0 + i * 0x24, coefs[i][3]);
  250. hwwrite(vortex->mmio, 0x242c4 + i * 0x24, coefs[i][4]);
  251. }
  252. hwwrite(vortex->mmio, 0x24540, arg_0 & 0xffff);
  253. hwwrite(vortex->mmio, 0x24544, arg_4 & 0xffff);
  254. }
  255. static void
  256. vortex_XtalkHw_SetLeftXT(vortex_t * vortex, short arg_0, short arg_4,
  257. xtalk_coefs_t const coefs)
  258. {
  259. int i;
  260. for (i = 0; i < 5; i++) {
  261. hwwrite(vortex->mmio, 0x24368 + i * 0x24, coefs[i][0]);
  262. hwwrite(vortex->mmio, 0x2436c + i * 0x24, coefs[i][1]);
  263. hwwrite(vortex->mmio, 0x24370 + i * 0x24, coefs[i][2]);
  264. hwwrite(vortex->mmio, 0x24374 + i * 0x24, coefs[i][3]);
  265. hwwrite(vortex->mmio, 0x24378 + i * 0x24, coefs[i][4]);
  266. }
  267. hwwrite(vortex->mmio, 0x24548, arg_0 & 0xffff);
  268. hwwrite(vortex->mmio, 0x2454C, arg_4 & 0xffff);
  269. }
  270. static void
  271. vortex_XtalkHw_SetRightXT(vortex_t * vortex, short arg_0, short arg_4,
  272. xtalk_coefs_t const coefs)
  273. {
  274. int i;
  275. for (i = 0; i < 5; i++) {
  276. hwwrite(vortex->mmio, 0x2441C + i * 0x24, coefs[i][0]);
  277. hwwrite(vortex->mmio, 0x24420 + i * 0x24, coefs[i][1]);
  278. hwwrite(vortex->mmio, 0x24424 + i * 0x24, coefs[i][2]);
  279. hwwrite(vortex->mmio, 0x24428 + i * 0x24, coefs[i][3]);
  280. hwwrite(vortex->mmio, 0x2442C + i * 0x24, coefs[i][4]);
  281. }
  282. hwwrite(vortex->mmio, 0x24550, arg_0 & 0xffff);
  283. hwwrite(vortex->mmio, 0x24554, arg_4 & 0xffff);
  284. }
  285. static void
  286. vortex_XtalkHw_SetLeftEQStates(vortex_t * vortex,
  287. xtalk_instate_t const arg_0,
  288. xtalk_state_t const coefs)
  289. {
  290. int i;
  291. for (i = 0; i < 5; i++) {
  292. hwwrite(vortex->mmio, 0x24214 + i * 0x24, coefs[i][0]);
  293. hwwrite(vortex->mmio, 0x24218 + i * 0x24, coefs[i][1]);
  294. hwwrite(vortex->mmio, 0x2421C + i * 0x24, coefs[i][2]);
  295. hwwrite(vortex->mmio, 0x24220 + i * 0x24, coefs[i][3]);
  296. }
  297. hwwrite(vortex->mmio, 0x244F8, arg_0[0]);
  298. hwwrite(vortex->mmio, 0x244FC, arg_0[1]);
  299. hwwrite(vortex->mmio, 0x24500, arg_0[2]);
  300. hwwrite(vortex->mmio, 0x24504, arg_0[3]);
  301. }
  302. static void
  303. vortex_XtalkHw_SetRightEQStates(vortex_t * vortex,
  304. xtalk_instate_t const arg_0,
  305. xtalk_state_t const coefs)
  306. {
  307. int i;
  308. for (i = 0; i < 5; i++) {
  309. hwwrite(vortex->mmio, 0x242C8 + i * 0x24, coefs[i][0]);
  310. hwwrite(vortex->mmio, 0x242CC + i * 0x24, coefs[i][1]);
  311. hwwrite(vortex->mmio, 0x242D0 + i * 0x24, coefs[i][2]);
  312. hwwrite(vortex->mmio, 0x244D4 + i * 0x24, coefs[i][3]);
  313. }
  314. hwwrite(vortex->mmio, 0x24508, arg_0[0]);
  315. hwwrite(vortex->mmio, 0x2450C, arg_0[1]);
  316. hwwrite(vortex->mmio, 0x24510, arg_0[2]);
  317. hwwrite(vortex->mmio, 0x24514, arg_0[3]);
  318. }
  319. static void
  320. vortex_XtalkHw_SetLeftXTStates(vortex_t * vortex,
  321. xtalk_instate_t const arg_0,
  322. xtalk_state_t const coefs)
  323. {
  324. int i;
  325. for (i = 0; i < 5; i++) {
  326. hwwrite(vortex->mmio, 0x2437C + i * 0x24, coefs[i][0]);
  327. hwwrite(vortex->mmio, 0x24380 + i * 0x24, coefs[i][1]);
  328. hwwrite(vortex->mmio, 0x24384 + i * 0x24, coefs[i][2]);
  329. hwwrite(vortex->mmio, 0x24388 + i * 0x24, coefs[i][3]);
  330. }
  331. hwwrite(vortex->mmio, 0x24518, arg_0[0]);
  332. hwwrite(vortex->mmio, 0x2451C, arg_0[1]);
  333. hwwrite(vortex->mmio, 0x24520, arg_0[2]);
  334. hwwrite(vortex->mmio, 0x24524, arg_0[3]);
  335. }
  336. static void
  337. vortex_XtalkHw_SetRightXTStates(vortex_t * vortex,
  338. xtalk_instate_t const arg_0,
  339. xtalk_state_t const coefs)
  340. {
  341. int i;
  342. for (i = 0; i < 5; i++) {
  343. hwwrite(vortex->mmio, 0x24430 + i * 0x24, coefs[i][0]);
  344. hwwrite(vortex->mmio, 0x24434 + i * 0x24, coefs[i][1]);
  345. hwwrite(vortex->mmio, 0x24438 + i * 0x24, coefs[i][2]);
  346. hwwrite(vortex->mmio, 0x2443C + i * 0x24, coefs[i][3]);
  347. }
  348. hwwrite(vortex->mmio, 0x24528, arg_0[0]);
  349. hwwrite(vortex->mmio, 0x2452C, arg_0[1]);
  350. hwwrite(vortex->mmio, 0x24530, arg_0[2]);
  351. hwwrite(vortex->mmio, 0x24534, arg_0[3]);
  352. }
  353. #if 0
  354. static void
  355. vortex_XtalkHw_GetLeftEQ(vortex_t * vortex, short *arg_0, short *arg_4,
  356. xtalk_coefs_t coefs)
  357. {
  358. int i;
  359. for (i = 0; i < 5; i++) {
  360. coefs[i][0] = hwread(vortex->mmio, 0x24200 + i * 0x24);
  361. coefs[i][1] = hwread(vortex->mmio, 0x24204 + i * 0x24);
  362. coefs[i][2] = hwread(vortex->mmio, 0x24208 + i * 0x24);
  363. coefs[i][3] = hwread(vortex->mmio, 0x2420c + i * 0x24);
  364. coefs[i][4] = hwread(vortex->mmio, 0x24210 + i * 0x24);
  365. }
  366. *arg_0 = hwread(vortex->mmio, 0x24538) & 0xffff;
  367. *arg_4 = hwread(vortex->mmio, 0x2453c) & 0xffff;
  368. }
  369. static void
  370. vortex_XtalkHw_GetRightEQ(vortex_t * vortex, short *arg_0, short *arg_4,
  371. xtalk_coefs_t coefs)
  372. {
  373. int i;
  374. for (i = 0; i < 5; i++) {
  375. coefs[i][0] = hwread(vortex->mmio, 0x242b4 + i * 0x24);
  376. coefs[i][1] = hwread(vortex->mmio, 0x242b8 + i * 0x24);
  377. coefs[i][2] = hwread(vortex->mmio, 0x242bc + i * 0x24);
  378. coefs[i][3] = hwread(vortex->mmio, 0x242c0 + i * 0x24);
  379. coefs[i][4] = hwread(vortex->mmio, 0x242c4 + i * 0x24);
  380. }
  381. *arg_0 = hwread(vortex->mmio, 0x24540) & 0xffff;
  382. *arg_4 = hwread(vortex->mmio, 0x24544) & 0xffff;
  383. }
  384. static void
  385. vortex_XtalkHw_GetLeftXT(vortex_t * vortex, short *arg_0, short *arg_4,
  386. xtalk_coefs_t coefs)
  387. {
  388. int i;
  389. for (i = 0; i < 5; i++) {
  390. coefs[i][0] = hwread(vortex->mmio, 0x24368 + i * 0x24);
  391. coefs[i][1] = hwread(vortex->mmio, 0x2436C + i * 0x24);
  392. coefs[i][2] = hwread(vortex->mmio, 0x24370 + i * 0x24);
  393. coefs[i][3] = hwread(vortex->mmio, 0x24374 + i * 0x24);
  394. coefs[i][4] = hwread(vortex->mmio, 0x24378 + i * 0x24);
  395. }
  396. *arg_0 = hwread(vortex->mmio, 0x24548) & 0xffff;
  397. *arg_4 = hwread(vortex->mmio, 0x2454C) & 0xffff;
  398. }
  399. static void
  400. vortex_XtalkHw_GetRightXT(vortex_t * vortex, short *arg_0, short *arg_4,
  401. xtalk_coefs_t coefs)
  402. {
  403. int i;
  404. for (i = 0; i < 5; i++) {
  405. coefs[i][0] = hwread(vortex->mmio, 0x2441C + i * 0x24);
  406. coefs[i][1] = hwread(vortex->mmio, 0x24420 + i * 0x24);
  407. coefs[i][2] = hwread(vortex->mmio, 0x24424 + i * 0x24);
  408. coefs[i][3] = hwread(vortex->mmio, 0x24428 + i * 0x24);
  409. coefs[i][4] = hwread(vortex->mmio, 0x2442C + i * 0x24);
  410. }
  411. *arg_0 = hwread(vortex->mmio, 0x24550) & 0xffff;
  412. *arg_4 = hwread(vortex->mmio, 0x24554) & 0xffff;
  413. }
  414. static void
  415. vortex_XtalkHw_GetLeftEQStates(vortex_t * vortex, xtalk_instate_t arg_0,
  416. xtalk_state_t coefs)
  417. {
  418. int i;
  419. for (i = 0; i < 5; i++) {
  420. coefs[i][0] = hwread(vortex->mmio, 0x24214 + i * 0x24);
  421. coefs[i][1] = hwread(vortex->mmio, 0x24218 + i * 0x24);
  422. coefs[i][2] = hwread(vortex->mmio, 0x2421C + i * 0x24);
  423. coefs[i][3] = hwread(vortex->mmio, 0x24220 + i * 0x24);
  424. }
  425. arg_0[0] = hwread(vortex->mmio, 0x244F8);
  426. arg_0[1] = hwread(vortex->mmio, 0x244FC);
  427. arg_0[2] = hwread(vortex->mmio, 0x24500);
  428. arg_0[3] = hwread(vortex->mmio, 0x24504);
  429. }
  430. static void
  431. vortex_XtalkHw_GetRightEQStates(vortex_t * vortex, xtalk_instate_t arg_0,
  432. xtalk_state_t coefs)
  433. {
  434. int i;
  435. for (i = 0; i < 5; i++) {
  436. coefs[i][0] = hwread(vortex->mmio, 0x242C8 + i * 0x24);
  437. coefs[i][1] = hwread(vortex->mmio, 0x242CC + i * 0x24);
  438. coefs[i][2] = hwread(vortex->mmio, 0x242D0 + i * 0x24);
  439. coefs[i][3] = hwread(vortex->mmio, 0x242D4 + i * 0x24);
  440. }
  441. arg_0[0] = hwread(vortex->mmio, 0x24508);
  442. arg_0[1] = hwread(vortex->mmio, 0x2450C);
  443. arg_0[2] = hwread(vortex->mmio, 0x24510);
  444. arg_0[3] = hwread(vortex->mmio, 0x24514);
  445. }
  446. static void
  447. vortex_XtalkHw_GetLeftXTStates(vortex_t * vortex, xtalk_instate_t arg_0,
  448. xtalk_state_t coefs)
  449. {
  450. int i;
  451. for (i = 0; i < 5; i++) {
  452. coefs[i][0] = hwread(vortex->mmio, 0x2437C + i * 0x24);
  453. coefs[i][1] = hwread(vortex->mmio, 0x24380 + i * 0x24);
  454. coefs[i][2] = hwread(vortex->mmio, 0x24384 + i * 0x24);
  455. coefs[i][3] = hwread(vortex->mmio, 0x24388 + i * 0x24);
  456. }
  457. arg_0[0] = hwread(vortex->mmio, 0x24518);
  458. arg_0[1] = hwread(vortex->mmio, 0x2451C);
  459. arg_0[2] = hwread(vortex->mmio, 0x24520);
  460. arg_0[3] = hwread(vortex->mmio, 0x24524);
  461. }
  462. static void
  463. vortex_XtalkHw_GetRightXTStates(vortex_t * vortex, xtalk_instate_t arg_0,
  464. xtalk_state_t coefs)
  465. {
  466. int i;
  467. for (i = 0; i < 5; i++) {
  468. coefs[i][0] = hwread(vortex->mmio, 0x24430 + i * 0x24);
  469. coefs[i][1] = hwread(vortex->mmio, 0x24434 + i * 0x24);
  470. coefs[i][2] = hwread(vortex->mmio, 0x24438 + i * 0x24);
  471. coefs[i][3] = hwread(vortex->mmio, 0x2443C + i * 0x24);
  472. }
  473. arg_0[0] = hwread(vortex->mmio, 0x24528);
  474. arg_0[1] = hwread(vortex->mmio, 0x2452C);
  475. arg_0[2] = hwread(vortex->mmio, 0x24530);
  476. arg_0[3] = hwread(vortex->mmio, 0x24534);
  477. }
  478. #endif
  479. /* Gains */
  480. static void
  481. vortex_XtalkHw_SetGains(vortex_t * vortex, xtalk_gains_t const gains)
  482. {
  483. int i;
  484. for (i = 0; i < XTGAINS_SZ; i++) {
  485. hwwrite(vortex->mmio, 0x244D0 + (i * 4), gains[i]);
  486. }
  487. }
  488. static void
  489. vortex_XtalkHw_SetGainsAllChan(vortex_t * vortex)
  490. {
  491. vortex_XtalkHw_SetGains(vortex, asXtalkGainsAllChan);
  492. }
  493. #if 0
  494. static void vortex_XtalkHw_GetGains(vortex_t * vortex, xtalk_gains_t gains)
  495. {
  496. int i;
  497. for (i = 0; i < XTGAINS_SZ; i++)
  498. gains[i] = hwread(vortex->mmio, 0x244D0 + i * 4);
  499. }
  500. #endif
  501. /* Delay parameters */
  502. static void
  503. vortex_XtalkHw_SetDelay(vortex_t * vortex, unsigned short right,
  504. unsigned short left)
  505. {
  506. u32 esp0 = 0;
  507. esp0 &= 0x1FFFFFFF;
  508. esp0 |= 0xA0000000;
  509. esp0 = (esp0 & 0xffffE0ff) | ((right & 0x1F) << 8);
  510. esp0 = (esp0 & 0xfffc1fff) | ((left & 0x1F) << 0xd);
  511. hwwrite(vortex->mmio, 0x24660, esp0);
  512. }
  513. static void
  514. vortex_XtalkHw_SetLeftDline(vortex_t * vortex, xtalk_dline_t const dline)
  515. {
  516. int i;
  517. for (i = 0; i < 0x20; i++) {
  518. hwwrite(vortex->mmio, 0x24000 + (i << 2), dline[i] & 0xffff);
  519. hwwrite(vortex->mmio, 0x24080 + (i << 2), dline[i] >> 0x10);
  520. }
  521. }
  522. static void
  523. vortex_XtalkHw_SetRightDline(vortex_t * vortex, xtalk_dline_t const dline)
  524. {
  525. int i;
  526. for (i = 0; i < 0x20; i++) {
  527. hwwrite(vortex->mmio, 0x24100 + (i << 2), dline[i] & 0xffff);
  528. hwwrite(vortex->mmio, 0x24180 + (i << 2), dline[i] >> 0x10);
  529. }
  530. }
  531. #if 0
  532. static void
  533. vortex_XtalkHw_GetDelay(vortex_t * vortex, unsigned short *right,
  534. unsigned short *left)
  535. {
  536. int esp0;
  537. esp0 = hwread(vortex->mmio, 0x24660);
  538. *right = (esp0 >> 8) & 0x1f;
  539. *left = (esp0 >> 0xd) & 0x1f;
  540. }
  541. static void vortex_XtalkHw_GetLeftDline(vortex_t * vortex, xtalk_dline_t dline)
  542. {
  543. int i;
  544. for (i = 0; i < 0x20; i++) {
  545. dline[i] =
  546. (hwread(vortex->mmio, 0x24000 + (i << 2)) & 0xffff) |
  547. (hwread(vortex->mmio, 0x24080 + (i << 2)) << 0x10);
  548. }
  549. }
  550. static void vortex_XtalkHw_GetRightDline(vortex_t * vortex, xtalk_dline_t dline)
  551. {
  552. int i;
  553. for (i = 0; i < 0x20; i++) {
  554. dline[i] =
  555. (hwread(vortex->mmio, 0x24100 + (i << 2)) & 0xffff) |
  556. (hwread(vortex->mmio, 0x24180 + (i << 2)) << 0x10);
  557. }
  558. }
  559. #endif
  560. /* Control/Global stuff */
  561. #if 0
  562. static void vortex_XtalkHw_SetControlReg(vortex_t * vortex, u32 ctrl)
  563. {
  564. hwwrite(vortex->mmio, 0x24660, ctrl);
  565. }
  566. static void vortex_XtalkHw_GetControlReg(vortex_t * vortex, u32 *ctrl)
  567. {
  568. *ctrl = hwread(vortex->mmio, 0x24660);
  569. }
  570. #endif
  571. static void vortex_XtalkHw_SetSampleRate(vortex_t * vortex, u32 sr)
  572. {
  573. u32 temp;
  574. temp = (hwread(vortex->mmio, 0x24660) & 0x1FFFFFFF) | 0xC0000000;
  575. temp = (temp & 0xffffff07) | ((sr & 0x1f) << 3);
  576. hwwrite(vortex->mmio, 0x24660, temp);
  577. }
  578. #if 0
  579. static void vortex_XtalkHw_GetSampleRate(vortex_t * vortex, u32 *sr)
  580. {
  581. *sr = (hwread(vortex->mmio, 0x24660) >> 3) & 0x1f;
  582. }
  583. #endif
  584. static void vortex_XtalkHw_Enable(vortex_t * vortex)
  585. {
  586. u32 temp;
  587. temp = (hwread(vortex->mmio, 0x24660) & 0x1FFFFFFF) | 0xC0000000;
  588. temp |= 1;
  589. hwwrite(vortex->mmio, 0x24660, temp);
  590. }
  591. static void vortex_XtalkHw_Disable(vortex_t * vortex)
  592. {
  593. u32 temp;
  594. temp = (hwread(vortex->mmio, 0x24660) & 0x1FFFFFFF) | 0xC0000000;
  595. temp &= 0xfffffffe;
  596. hwwrite(vortex->mmio, 0x24660, temp);
  597. }
  598. static void vortex_XtalkHw_ZeroIO(vortex_t * vortex)
  599. {
  600. int i;
  601. for (i = 0; i < 20; i++)
  602. hwwrite(vortex->mmio, 0x24600 + (i << 2), 0);
  603. for (i = 0; i < 4; i++)
  604. hwwrite(vortex->mmio, 0x24650 + (i << 2), 0);
  605. }
  606. static void vortex_XtalkHw_ZeroState(vortex_t * vortex)
  607. {
  608. vortex_XtalkHw_ZeroIO(vortex); // inlined
  609. vortex_XtalkHw_SetLeftEQ(vortex, 0, 0, asXtalkCoefsZeros);
  610. vortex_XtalkHw_SetRightEQ(vortex, 0, 0, asXtalkCoefsZeros);
  611. vortex_XtalkHw_SetLeftXT(vortex, 0, 0, asXtalkCoefsZeros);
  612. vortex_XtalkHw_SetRightXT(vortex, 0, 0, asXtalkCoefsZeros);
  613. vortex_XtalkHw_SetGains(vortex, asXtalkGainsZeros); // inlined
  614. vortex_XtalkHw_SetDelay(vortex, 0, 0); // inlined
  615. vortex_XtalkHw_SetLeftDline(vortex, alXtalkDlineZeros); // inlined
  616. vortex_XtalkHw_SetRightDline(vortex, alXtalkDlineZeros); // inlined
  617. vortex_XtalkHw_SetLeftDline(vortex, alXtalkDlineZeros); // inlined
  618. vortex_XtalkHw_SetRightDline(vortex, alXtalkDlineZeros); // inlined
  619. vortex_XtalkHw_SetLeftEQStates(vortex, asXtalkInStateZeros,
  620. asXtalkOutStateZeros);
  621. vortex_XtalkHw_SetRightEQStates(vortex, asXtalkInStateZeros,
  622. asXtalkOutStateZeros);
  623. vortex_XtalkHw_SetLeftXTStates(vortex, asXtalkInStateZeros,
  624. asXtalkOutStateZeros);
  625. vortex_XtalkHw_SetRightXTStates(vortex, asXtalkInStateZeros,
  626. asXtalkOutStateZeros);
  627. }
  628. static void vortex_XtalkHw_ProgramPipe(vortex_t * vortex)
  629. {
  630. vortex_XtalkHw_SetLeftEQ(vortex, 0, 1, asXtalkCoefsPipe);
  631. vortex_XtalkHw_SetRightEQ(vortex, 0, 1, asXtalkCoefsPipe);
  632. vortex_XtalkHw_SetLeftXT(vortex, 0, 0, asXtalkCoefsZeros);
  633. vortex_XtalkHw_SetRightXT(vortex, 0, 0, asXtalkCoefsZeros);
  634. vortex_XtalkHw_SetDelay(vortex, 0, 0); // inlined
  635. }
  636. static void vortex_XtalkHw_ProgramXtalkWide(vortex_t * vortex)
  637. {
  638. vortex_XtalkHw_SetLeftEQ(vortex, sXtalkWideKLeftEq,
  639. sXtalkWideShiftLeftEq, asXtalkWideCoefsLeftEq);
  640. vortex_XtalkHw_SetRightEQ(vortex, sXtalkWideKRightEq,
  641. sXtalkWideShiftRightEq,
  642. asXtalkWideCoefsRightEq);
  643. vortex_XtalkHw_SetLeftXT(vortex, sXtalkWideKLeftXt,
  644. sXtalkWideShiftLeftXt, asXtalkWideCoefsLeftXt);
  645. vortex_XtalkHw_SetRightXT(vortex, sXtalkWideKLeftXt,
  646. sXtalkWideShiftLeftXt,
  647. asXtalkWideCoefsLeftXt);
  648. vortex_XtalkHw_SetDelay(vortex, wXtalkWideRightDelay, wXtalkWideLeftDelay); // inlined
  649. }
  650. static void vortex_XtalkHw_ProgramXtalkNarrow(vortex_t * vortex)
  651. {
  652. vortex_XtalkHw_SetLeftEQ(vortex, sXtalkNarrowKLeftEq,
  653. sXtalkNarrowShiftLeftEq,
  654. asXtalkNarrowCoefsLeftEq);
  655. vortex_XtalkHw_SetRightEQ(vortex, sXtalkNarrowKRightEq,
  656. sXtalkNarrowShiftRightEq,
  657. asXtalkNarrowCoefsRightEq);
  658. vortex_XtalkHw_SetLeftXT(vortex, sXtalkNarrowKLeftXt,
  659. sXtalkNarrowShiftLeftXt,
  660. asXtalkNarrowCoefsLeftXt);
  661. vortex_XtalkHw_SetRightXT(vortex, sXtalkNarrowKLeftXt,
  662. sXtalkNarrowShiftLeftXt,
  663. asXtalkNarrowCoefsLeftXt);
  664. vortex_XtalkHw_SetDelay(vortex, wXtalkNarrowRightDelay, wXtalkNarrowLeftDelay); // inlined
  665. }
  666. static void vortex_XtalkHw_ProgramDiamondXtalk(vortex_t * vortex)
  667. {
  668. //sDiamondKLeftEq,sDiamondKRightXt,asDiamondCoefsLeftEq
  669. vortex_XtalkHw_SetLeftEQ(vortex, sDiamondKLeftEq,
  670. sDiamondShiftLeftEq, asDiamondCoefsLeftEq);
  671. vortex_XtalkHw_SetRightEQ(vortex, sDiamondKRightEq,
  672. sDiamondShiftRightEq, asDiamondCoefsRightEq);
  673. vortex_XtalkHw_SetLeftXT(vortex, sDiamondKLeftXt,
  674. sDiamondShiftLeftXt, asDiamondCoefsLeftXt);
  675. vortex_XtalkHw_SetRightXT(vortex, sDiamondKLeftXt,
  676. sDiamondShiftLeftXt, asDiamondCoefsLeftXt);
  677. vortex_XtalkHw_SetDelay(vortex, wDiamondRightDelay, wDiamondLeftDelay); // inlined
  678. }
  679. static void vortex_XtalkHw_init(vortex_t * vortex)
  680. {
  681. vortex_XtalkHw_ZeroState(vortex);
  682. }
  683. /* End of file */