bbm.c 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. /*****************************************************************************
  2. Copyright(c) 2013 FCI Inc. All Rights Reserved
  3. File name : bbm.c
  4. Description : API source file of dmb baseband module
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. History :
  17. ----------------------------------------------------------------------
  18. *******************************************************************************/
  19. #include "fci_types.h"
  20. #include "fci_tun.h"
  21. #include "fci_hal.h"
  22. #include "fc8080_regs.h"
  23. #include "fc8080_bb.h"
  24. #include "fc8080_isr.h"
  25. s32 bbm_com_reset(HANDLE handle)
  26. {
  27. s32 res;
  28. res = fc8080_reset(handle);
  29. return res;
  30. }
  31. s32 bbm_com_probe(HANDLE handle)
  32. {
  33. s32 res;
  34. res = fc8080_probe(handle);
  35. return res;
  36. }
  37. s32 bbm_com_init(HANDLE handle)
  38. {
  39. s32 res;
  40. res = fc8080_init(handle);
  41. return res;
  42. }
  43. s32 bbm_com_deinit(HANDLE handle)
  44. {
  45. s32 res;
  46. res = fc8080_deinit(handle);
  47. return res;
  48. }
  49. s32 bbm_com_read(HANDLE handle, u16 addr, u8 *data)
  50. {
  51. s32 res;
  52. res = bbm_read(handle, addr, data);
  53. return res;
  54. }
  55. s32 bbm_com_byte_read(HANDLE handle, u16 addr, u8 *data)
  56. {
  57. s32 res;
  58. res = bbm_byte_read(handle, addr, data);
  59. return res;
  60. }
  61. s32 bbm_com_word_read(HANDLE handle, u16 addr, u16 *data)
  62. {
  63. s32 res;
  64. res = bbm_word_read(handle, addr, data);
  65. return res;
  66. }
  67. s32 bbm_com_long_read(HANDLE handle, u16 addr, u32 *data)
  68. {
  69. s32 res;
  70. res = bbm_long_read(handle, addr, data);
  71. return res;
  72. }
  73. s32 bbm_com_bulk_read(HANDLE handle, u16 addr, u8 *data, u16 size)
  74. {
  75. s32 res;
  76. res = bbm_bulk_read(handle, addr, data, size);
  77. return res;
  78. }
  79. s32 bbm_com_data(HANDLE handle, u16 addr, u8 *data, u32 size)
  80. {
  81. s32 res;
  82. res = bbm_data(handle, addr, data, size);
  83. return res;
  84. }
  85. s32 bbm_com_write(HANDLE handle, u16 addr, u8 data)
  86. {
  87. s32 res;
  88. res = bbm_write(handle, addr, data);
  89. return res;
  90. }
  91. s32 bbm_com_byte_write(HANDLE handle, u16 addr, u8 data)
  92. {
  93. s32 res;
  94. res = bbm_byte_write(handle, addr, data);
  95. return res;
  96. }
  97. s32 bbm_com_word_write(HANDLE handle, u16 addr, u16 data)
  98. {
  99. s32 res;
  100. res = bbm_word_write(handle, addr, data);
  101. return res;
  102. }
  103. s32 bbm_com_long_write(HANDLE handle, u16 addr, u32 data)
  104. {
  105. s32 res;
  106. res = bbm_long_write(handle, addr, data);
  107. return res;
  108. }
  109. s32 bbm_com_bulk_write(HANDLE handle, u16 addr, u8 *data, u16 size)
  110. {
  111. s32 res;
  112. res = bbm_bulk_write(handle, addr, data, size);
  113. return res;
  114. }
  115. s32 bbm_com_tuner_read(HANDLE handle, u8 addr, u8 addr_len, u8 *buffer,
  116. u8 len)
  117. {
  118. s32 res;
  119. res = tuner_i2c_read(handle, addr, addr_len, buffer, len);
  120. return res;
  121. }
  122. s32 bbm_com_tuner_write(HANDLE handle, u8 addr, u8 addr_len, u8 *buffer, u8 len)
  123. {
  124. s32 res;
  125. res = tuner_i2c_write(handle, addr, addr_len, buffer, len);
  126. return res;
  127. }
  128. s32 bbm_com_tuner_set_freq(HANDLE handle, u32 freq)
  129. {
  130. s32 res = BBM_OK;
  131. res = tuner_set_freq(handle, freq);
  132. return res;
  133. }
  134. s32 bbm_com_tuner_select(HANDLE handle, u32 product, u32 band)
  135. {
  136. s32 res = BBM_OK;
  137. res = tuner_select(handle, product, band);
  138. return res;
  139. }
  140. s32 bbm_com_tuner_get_rssi(HANDLE handle, s32 *rssi)
  141. {
  142. s32 res = BBM_OK;
  143. res = tuner_get_rssi(handle, rssi);
  144. return res;
  145. }
  146. s32 bbm_com_scan_status(HANDLE handle)
  147. {
  148. s32 res = BBM_OK;
  149. res = fc8080_scan_status(handle);
  150. return res;
  151. }
  152. s32 bbm_com_channel_select(HANDLE handle, u8 subch_id, u8 buf_id)
  153. {
  154. s32 res;
  155. res = fc8080_channel_select(handle, subch_id, buf_id);
  156. return res;
  157. }
  158. s32 bbm_com_video_select(HANDLE handle, u8 subch_id, u8 buf_id, u8 cdi_id)
  159. {
  160. s32 res;
  161. res = fc8080_video_select(handle, subch_id, buf_id, cdi_id);
  162. return res;
  163. }
  164. s32 bbm_com_audio_select(HANDLE handle, u8 subch_id, u8 buf_id)
  165. {
  166. s32 res;
  167. res = fc8080_audio_select(handle, subch_id, buf_id);
  168. return res;
  169. }
  170. s32 bbm_com_data_select(HANDLE handle, u8 subch_id, u8 buf_id)
  171. {
  172. s32 res;
  173. res = fc8080_data_select(handle, subch_id, buf_id);
  174. return res;
  175. }
  176. s32 bbm_com_channel_deselect(HANDLE handle, u8 subch_id, u8 buf_id)
  177. {
  178. s32 res;
  179. res = fc8080_channel_deselect(handle, subch_id, buf_id);
  180. return res;
  181. }
  182. s32 bbm_com_video_deselect(HANDLE handle, u8 subch_id, u8 buf_id, u8 cdi_id)
  183. {
  184. s32 res;
  185. res = fc8080_video_deselect(handle, subch_id, buf_id, cdi_id);
  186. return res;
  187. }
  188. s32 bbm_com_audio_deselect(HANDLE handle, u8 subch_id, u8 buf_id)
  189. {
  190. s32 res;
  191. res = fc8080_audio_deselect(handle, subch_id, buf_id);
  192. return res;
  193. }
  194. s32 bbm_com_data_deselect(HANDLE handle, u8 subch_id, u8 buf_id)
  195. {
  196. s32 res;
  197. res = fc8080_data_deselect(handle, subch_id, buf_id);
  198. return res;
  199. }
  200. void bbm_com_isr(HANDLE handle)
  201. {
  202. fc8080_isr(handle);
  203. }
  204. s32 bbm_com_hostif_select(HANDLE handle, u8 hostif, u32 param)
  205. {
  206. s32 res = BBM_NOK;
  207. res = bbm_hostif_select(handle, hostif, param);
  208. return res;
  209. }
  210. s32 bbm_com_hostif_deselect(HANDLE handle)
  211. {
  212. s32 res = BBM_NOK;
  213. res = bbm_hostif_deselect(handle);
  214. return res;
  215. }
  216. s32 bbm_com_fic_callback_register(u32 userdata, s32 (*callback)(u32 userdata,
  217. u8 *data, s32 length))
  218. {
  219. fic_user_data = userdata;
  220. fic_callback = callback;
  221. return BBM_OK;
  222. }
  223. s32 bbm_com_msc_callback_register(u32 userdata, s32 (*callback)(u32 userdata,
  224. u8 subch_id, u8 *data, s32 length))
  225. {
  226. msc_user_data = userdata;
  227. msc_callback = callback;
  228. return BBM_OK;
  229. }
  230. s32 bbm_com_fic_callback_deregister(HANDLE handle)
  231. {
  232. fic_user_data = 0;
  233. fic_callback = NULL;
  234. return BBM_OK;
  235. }
  236. s32 bbm_com_msc_callback_deregister(HANDLE handle)
  237. {
  238. msc_user_data = 0;
  239. msc_callback = NULL;
  240. return BBM_OK;
  241. }