bbm.c 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. /*****************************************************************************
  2. Copyright(c) 2009 FCI Inc. All Rights Reserved
  3. File name : bbm.c
  4. Description : API 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. 2009/08/29 jason initial
  19. *******************************************************************************/
  20. #include "fci_types.h"
  21. #include "fci_tun.h"
  22. #include "fc8050_regs.h"
  23. #include "fc8050_bb.h"
  24. #include "fci_hal.h"
  25. #include "fc8050_isr.h"
  26. int bbm_com_reset(HANDLE hDevice)
  27. {
  28. int res;
  29. res = fc8050_reset(hDevice);
  30. return res;
  31. }
  32. int bbm_com_probe(HANDLE hDevice)
  33. {
  34. int res;
  35. res = fc8050_probe(hDevice);
  36. return res;
  37. }
  38. int bbm_com_init(HANDLE hDevice)
  39. {
  40. int res;
  41. res = fc8050_init(hDevice);
  42. return res;
  43. }
  44. int bbm_com_deinit(HANDLE hDevice)
  45. {
  46. int res;
  47. res = fc8050_deinit(hDevice);
  48. return res;
  49. }
  50. int bbm_com_read(HANDLE hDevice, u16 addr, u8 *data)
  51. {
  52. int res;
  53. res = bbm_read(hDevice, addr, data);
  54. return res;
  55. }
  56. int bbm_com_byte_read(HANDLE hDevice, u16 addr, u8 *data)
  57. {
  58. int res;
  59. res = bbm_byte_read(hDevice, addr, data);
  60. return res;
  61. }
  62. int bbm_com_word_read(HANDLE hDevice, u16 addr, u16 *data)
  63. {
  64. int res;
  65. res = bbm_word_read(hDevice, addr, data);
  66. return res;
  67. }
  68. int bbm_com_long_read(HANDLE hDevice, u16 addr, u32 *data)
  69. {
  70. int res;
  71. res = bbm_long_read(hDevice, addr, data);
  72. return res;
  73. }
  74. int bbm_com_bulk_read(HANDLE hDevice, u16 addr, u8 *data, u16 size)
  75. {
  76. int res;
  77. res = bbm_bulk_read(hDevice, addr, data, size);
  78. return res;
  79. }
  80. int bbm_com_data(HANDLE hDevice, u16 addr, u8 *data, u16 size)
  81. {
  82. int res;
  83. res = bbm_data(hDevice, addr, data, size);
  84. return res;
  85. }
  86. int bbm_com_write(HANDLE hDevice, u16 addr, u8 data)
  87. {
  88. int res;
  89. res = bbm_write(hDevice, addr, data);
  90. return res;
  91. }
  92. int bbm_com_byte_write(HANDLE hDevice, u16 addr, u8 data)
  93. {
  94. int res;
  95. res = bbm_byte_write(hDevice, addr, data);
  96. return res;
  97. }
  98. int bbm_com_word_write(HANDLE hDevice, u16 addr, u16 data)
  99. {
  100. int res;
  101. res = bbm_word_write(hDevice, addr, data);
  102. return res;
  103. }
  104. int bbm_com_long_write(HANDLE hDevice, u16 addr, u32 data)
  105. {
  106. int res;
  107. res = bbm_long_write(hDevice, addr, data);
  108. return res;
  109. }
  110. int bbm_com_bulk_write(HANDLE hDevice, u16 addr, u8 *data, u16 size)
  111. {
  112. int res;
  113. res = bbm_bulk_write(hDevice, addr, data, size);
  114. return res;
  115. }
  116. int bbm_com_tuner_read(
  117. HANDLE hDevice, u8 addr, u8 address_len, u8 *buffer, u8 len)
  118. {
  119. int res;
  120. res = tuner_i2c_read(hDevice, addr, address_len, buffer, len);
  121. return res;
  122. }
  123. int bbm_com_tuner_write(
  124. HANDLE hDevice, u8 addr, u8 address_len, u8 *buffer, u8 len)
  125. {
  126. int res;
  127. res = tuner_i2c_write(hDevice, addr, address_len, buffer, len);
  128. return res;
  129. }
  130. int bbm_com_tuner_set_freq(HANDLE hDevice, u32 freq)
  131. {
  132. int res = BBM_OK;
  133. res = tuner_set_freq(hDevice, freq);
  134. return res;
  135. }
  136. int bbm_com_tuner_select(HANDLE hDevice, u32 product, u32 band)
  137. {
  138. int res = BBM_OK;
  139. res = tuner_select(hDevice, product, band);
  140. return res;
  141. }
  142. int bbm_com_tuner_get_rssi(HANDLE hDevice, s32 *rssi)
  143. {
  144. int res = BBM_OK;
  145. res = tuner_get_rssi(hDevice, rssi);
  146. return res;
  147. }
  148. int bbm_com_scan_status(HANDLE hDevice)
  149. {
  150. int res = BBM_OK;
  151. res = fc8050_scan_status(hDevice);
  152. return res;
  153. }
  154. int bbm_com_channel_select(
  155. HANDLE hDevice, u8 subchannel_id, u8 service_channel_id)
  156. {
  157. int res;
  158. res = fc8050_channel_select(hDevice, subchannel_id, service_channel_id);
  159. return res;
  160. }
  161. int bbm_com_video_select(
  162. HANDLE hDevice, u8 subchannel_id, u8 service_channel_id, u8 cdiId)
  163. {
  164. int res;
  165. res = fc8050_video_select(
  166. hDevice, subchannel_id, service_channel_id, cdiId);
  167. return res;
  168. }
  169. int bbm_com_audio_select(
  170. HANDLE hDevice, u8 subchannel_id, u8 service_channel_id)
  171. {
  172. int res;
  173. res = fc8050_audio_select(hDevice, subchannel_id, service_channel_id);
  174. return res;
  175. }
  176. int bbm_com_data_select(HANDLE hDevice, u8 subchannel_id, u8 service_channel_id)
  177. {
  178. int res;
  179. res = fc8050_data_select(hDevice, subchannel_id, service_channel_id);
  180. return res;
  181. }
  182. int bbm_com_channel_deselect(
  183. HANDLE hDevice, u8 subchannel_id, u8 service_channel_id)
  184. {
  185. int res;
  186. res = fc8050_channel_deselect(
  187. hDevice, subchannel_id, service_channel_id);
  188. return res;
  189. }
  190. int bbm_com_video_deselect(
  191. HANDLE hDevice, u8 subchannel_id, u8 service_channel_id, u8 cdiId)
  192. {
  193. int res;
  194. res = fc8050_video_deselect(
  195. hDevice, subchannel_id, service_channel_id, cdiId);
  196. return res;
  197. }
  198. int bbm_com_audio_deselect(
  199. HANDLE hDevice, u8 subchannel_id, u8 service_channel_id)
  200. {
  201. int res;
  202. res = fc8050_audio_deselect(hDevice, subchannel_id, service_channel_id);
  203. return res;
  204. }
  205. int bbm_com_data_deselect(
  206. HANDLE hDevice, u8 subchannel_id, u8 service_channel_id)
  207. {
  208. int res;
  209. res = fc8050_data_deselect(hDevice, subchannel_id, service_channel_id);
  210. return res;
  211. }
  212. void bbm_com_isr(HANDLE hDevice)
  213. {
  214. fc8050_isr(hDevice);
  215. }
  216. int bbm_com_hostif_select(HANDLE hDevice, u8 hostif, u32 param)
  217. {
  218. int res = BBM_NOK;
  219. res = bbm_hostif_select(hDevice, hostif, param);
  220. return res;
  221. }
  222. int bbm_com_hostif_deselect(HANDLE hDevice)
  223. {
  224. int res = BBM_NOK;
  225. res = bbm_hostif_deselect(hDevice);
  226. return res;
  227. }
  228. int bbm_com_fic_callback_register(
  229. u32 userdata
  230. , int (*callback)(u32 userdata, u8 *data, int length))
  231. {
  232. fic_user_data = userdata;
  233. fic_callback = callback;
  234. return BBM_OK;
  235. }
  236. int bbm_com_msc_callback_register(
  237. u32 userdata
  238. , int (*callback)(u32 userdata, u8 subchannel_id, u8 *data, int length))
  239. {
  240. msc_user_data = userdata;
  241. msc_callback = callback;
  242. return BBM_OK;
  243. }
  244. int bbm_com_fic_callback_deregister(HANDLE hDevice)
  245. {
  246. fic_user_data = 0;
  247. fic_callback = NULL;
  248. return BBM_OK;
  249. }
  250. int bbm_com_msc_callback_deregister(HANDLE hDevice)
  251. {
  252. msc_user_data = 0;
  253. msc_callback = NULL;
  254. return BBM_OK;
  255. }