bbm.c 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. /*****************************************************************************
  2. Copyright(c) 2013 FCI Inc. All Rights Reserved
  3. File name : bbm.c
  4. Description : API source of ISDB-T 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 "fc8300_bb.h"
  23. #include "fc8300_isr.h"
  24. s32 bbm_com_reset(HANDLE handle, DEVICEID devid)
  25. {
  26. s32 res;
  27. res = fc8300_reset(handle, devid);
  28. return res;
  29. }
  30. s32 bbm_com_probe(HANDLE handle, DEVICEID devid)
  31. {
  32. s32 res;
  33. res = fc8300_probe(handle, devid);
  34. return res;
  35. }
  36. s32 bbm_com_init(HANDLE handle, DEVICEID devid)
  37. {
  38. s32 res;
  39. res = fc8300_init(handle, devid);
  40. return res;
  41. }
  42. s32 bbm_com_deinit(HANDLE handle, DEVICEID devid)
  43. {
  44. s32 res;
  45. res = fc8300_deinit(handle, devid);
  46. return res;
  47. }
  48. s32 bbm_com_read(HANDLE handle, DEVICEID devid, u16 addr, u8 *data)
  49. {
  50. s32 res;
  51. res = bbm_read(handle, devid, addr, data);
  52. return res;
  53. }
  54. s32 bbm_com_byte_read(HANDLE handle, DEVICEID devid, u16 addr, u8 *data)
  55. {
  56. s32 res;
  57. res = bbm_byte_read(handle, devid, addr, data);
  58. return res;
  59. }
  60. s32 bbm_com_word_read(HANDLE handle, DEVICEID devid, u16 addr, u16 *data)
  61. {
  62. s32 res;
  63. res = bbm_word_read(handle, devid, addr, data);
  64. return res;
  65. }
  66. s32 bbm_com_long_read(HANDLE handle, DEVICEID devid, u16 addr, u32 *data)
  67. {
  68. s32 res;
  69. res = bbm_long_read(handle, devid, addr, data);
  70. return res;
  71. }
  72. s32 bbm_com_bulk_read(HANDLE handle, DEVICEID devid, u16 addr,
  73. u8 *data, u16 size)
  74. {
  75. s32 res;
  76. res = bbm_bulk_read(handle, devid, addr, data, size);
  77. return res;
  78. }
  79. s32 bbm_com_data(HANDLE handle, DEVICEID devid, u16 addr, u8 *data, u32 size)
  80. {
  81. s32 res;
  82. res = bbm_data(handle, devid, addr, data, size);
  83. return res;
  84. }
  85. s32 bbm_com_write(HANDLE handle, DEVICEID devid, u16 addr, u8 data)
  86. {
  87. s32 res;
  88. res = bbm_write(handle, devid, addr, data);
  89. return res;
  90. }
  91. s32 bbm_com_byte_write(HANDLE handle, DEVICEID devid, u16 addr, u8 data)
  92. {
  93. s32 res;
  94. res = bbm_byte_write(handle, devid, addr, data);
  95. return res;
  96. }
  97. s32 bbm_com_word_write(HANDLE handle, DEVICEID devid, u16 addr, u16 data)
  98. {
  99. s32 res;
  100. res = bbm_word_write(handle, devid, addr, data);
  101. return res;
  102. }
  103. s32 bbm_com_long_write(HANDLE handle, DEVICEID devid, u16 addr, u32 data)
  104. {
  105. s32 res;
  106. res = bbm_long_write(handle, devid, addr, data);
  107. return res;
  108. }
  109. s32 bbm_com_bulk_write(HANDLE handle, DEVICEID devid,
  110. u16 addr, u8 *data, u16 size)
  111. {
  112. s32 res;
  113. res = bbm_bulk_write(handle, devid, addr, data, size);
  114. return res;
  115. }
  116. s32 bbm_com_i2c_init(HANDLE handle, u32 type)
  117. {
  118. s32 res;
  119. res = tuner_ctrl_select(handle, DIV_BROADCAST, (enum I2C_TYPE) type);
  120. return res;
  121. }
  122. s32 bbm_com_i2c_deinit(HANDLE handle)
  123. {
  124. s32 res;
  125. res = tuner_ctrl_deselect(handle, DIV_BROADCAST);
  126. return res;
  127. }
  128. s32 bbm_com_tuner_select(HANDLE handle, DEVICEID devid, u32 product,
  129. u32 brodcast)
  130. {
  131. s32 res;
  132. res = tuner_select(handle, devid, product, brodcast);
  133. return res;
  134. }
  135. s32 bbm_com_tuner_deselect(HANDLE handle, DEVICEID devid)
  136. {
  137. s32 res;
  138. res = tuner_deselect(handle, devid);
  139. return res;
  140. }
  141. s32 bbm_com_tuner_read(HANDLE handle, DEVICEID devid, u8 addr, u8 alen,
  142. u8 *buffer, u8 len)
  143. {
  144. s32 res;
  145. res = tuner_i2c_read(handle, devid, addr, alen, buffer, len);
  146. return res;
  147. }
  148. s32 bbm_com_tuner_write(HANDLE handle, DEVICEID devid, u8 addr, u8 alen,
  149. u8 *buffer, u8 len)
  150. {
  151. s32 res;
  152. res = tuner_i2c_write(handle, devid, addr, alen, buffer, len);
  153. return res;
  154. }
  155. s32 bbm_com_tuner_set_freq(HANDLE handle, DEVICEID devid, u32 freq, u8 subch)
  156. {
  157. s32 res;
  158. res = tuner_set_freq(handle, devid, freq, subch);
  159. return res;
  160. }
  161. s32 bbm_com_tuner_get_rssi(HANDLE handle, DEVICEID devid, s32 *rssi)
  162. {
  163. s32 res;
  164. res = tuner_get_rssi(handle, devid, rssi);
  165. return res;
  166. }
  167. s32 bbm_com_scan_status(HANDLE handle, DEVICEID devid)
  168. {
  169. s32 res;
  170. res = fc8300_scan_status(handle, devid);
  171. return res;
  172. }
  173. s32 bbm_com_hostif_select(HANDLE handle, u8 hostif)
  174. {
  175. s32 res;
  176. res = bbm_hostif_select(handle, hostif);
  177. return res;
  178. }
  179. s32 bbm_com_hostif_deselect(HANDLE handle)
  180. {
  181. s32 res;
  182. res = bbm_hostif_deselect(handle);
  183. return res;
  184. }
  185. s32 bbm_com_ts_callback_register(u32 userdata,
  186. s32 (*callback)(u32 userdata, u8 bufid, u8 *data, s32 length))
  187. {
  188. fc8300_ts_user_data = userdata;
  189. fc8300_ts_callback = callback;
  190. return BBM_OK;
  191. }
  192. s32 bbm_com_ts_callback_deregister(void)
  193. {
  194. fc8300_ts_user_data = 0;
  195. fc8300_ts_callback = NULL;
  196. return BBM_OK;
  197. }
  198. s32 bbm_com_ac_callback_register(u32 userdata,
  199. s32 (*callback)(u32 userdata, u8 bufid, u8 *data, s32 length))
  200. {
  201. fc8300_ac_user_data = userdata;
  202. fc8300_ac_callback = callback;
  203. return BBM_OK;
  204. }
  205. s32 bbm_com_ac_callback_deregister(void)
  206. {
  207. fc8300_ac_user_data = 0;
  208. fc8300_ac_callback = NULL;
  209. return BBM_OK;
  210. }
  211. void bbm_com_isr(HANDLE handle)
  212. {
  213. fc8300_isr(handle);
  214. }