fc8300_isr.c 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. /*****************************************************************************
  2. Copyright(c) 2013 FCI Inc. All Rights Reserved
  3. File name : fc8300_isr.c
  4. Description : source of interrupt service routine
  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 "fc8300_regs.h"
  21. #include "fci_hal.h"
  22. #include "fci_oal.h"
  23. s32 (*fc8300_ac_callback)(u32 userdata, u8 bufid, u8 *data, s32 length) = NULL;
  24. s32 (*fc8300_ts_callback)(u32 userdata, u8 bufid, u8 *data, s32 length) = NULL;
  25. u32 fc8300_ac_user_data;
  26. u32 fc8300_ts_user_data;
  27. #ifndef BBM_I2C_TSIF
  28. static u8 ts_buffer[188 * 320];
  29. static u8 ac_buffer[2040];
  30. static void fc8300_data(HANDLE handle, DEVICEID devid, u8 buf_int_status)
  31. {
  32. u32 size = 0;
  33. s32 i;
  34. print_log(0,"%s status=%d\n",__func__,buf_int_status);
  35. for (i = 0; (i < 4) && (buf_int_status & 0x0f); i++) {
  36. if (buf_int_status & (1 << i)) {
  37. bbm_word_read(handle, devid,
  38. BBM_BUF_TS0_THR + (i << 1),
  39. (u16 *) &size);
  40. if (size == 0)
  41. continue;
  42. size = (size + 1) << 1;
  43. bbm_data(handle, devid,
  44. BBM_TS0_DATA + i, &ts_buffer[0], size);
  45. if (fc8300_ts_callback)
  46. {
  47. print_log(0,"fc8300_ts_callback\n");
  48. (*fc8300_ts_callback)(fc8300_ts_user_data,
  49. i, &ts_buffer[0], size);
  50. }
  51. }
  52. }
  53. for (i = 4; i < 8 && (buf_int_status & 0xf0); i++) {
  54. if (buf_int_status & (1 << i)) {
  55. bbm_word_read(handle, devid,
  56. BBM_BUF_TS0_THR + (i << 1),
  57. (u16 *) &size);
  58. if (size == 0)
  59. continue;
  60. size = (size + 1) << 1;
  61. bbm_data(handle, devid,
  62. BBM_TS0_DATA + i, &ac_buffer[0], size);
  63. if (fc8300_ac_callback)
  64. {
  65. print_log(0,"fc8300_ac_callback\n");
  66. (*fc8300_ac_callback)(fc8300_ac_user_data,
  67. i, &ac_buffer[0], size);
  68. }
  69. }
  70. }
  71. }
  72. #endif
  73. #ifdef BBM_AUX_INT
  74. static void fc8300_aux_int(HANDLE handle, DEVICEID devid, u8 aux_int_status)
  75. {
  76. if (aux_int_status & AUX_INT_TMCC_INT_SRC)
  77. ;
  78. if (aux_int_status & AUX_INT_TMCC_INDTPS_SRC)
  79. ;
  80. if (aux_int_status & AUX_INT_AC_PREFRM_SRC)
  81. ;
  82. if (aux_int_status & AUX_INT_AC_EWISTAFLAG_SRC)
  83. ;
  84. if (aux_int_status & AUX_INT_SYNC_RELATED_INT) {
  85. u8 sync = 0;
  86. bbm_byte_read(handle, DIV_MASTER, BBM_SYS_MD_INT_CLR, &sync);
  87. if (sync) {
  88. bbm_byte_write(handle, DIV_MASTER, BBM_SYS_MD_INT_CLR,
  89. sync);
  90. if (sync & SYS_MD_NO_OFDM_DETECT)
  91. ;
  92. if (sync & SYS_MD_RESYNC_OCCUR)
  93. ;
  94. if (sync & SYS_MD_TMCC_LOCK)
  95. ;
  96. if (sync & SYS_MD_A_LAYER_BER_UPDATE)
  97. ;
  98. if (sync & SYS_MD_B_LAYER_BER_UPDATE)
  99. ;
  100. if (sync & SYS_MD_C_LAYER_BER_UPDATE)
  101. ;
  102. if (sync & SYS_MD_BER_UPDATE)
  103. ;
  104. }
  105. }
  106. if (aux_int_status & AUX_INT_GPIO_INT_CLEAR)
  107. ;
  108. if (aux_int_status & AUX_INT_FEC_RELATED_INT) {
  109. u8 fec = 0;
  110. bbm_byte_read(handle, DIV_MASTER, BBM_FEC_INT_CLR, &fec);
  111. if (fec) {
  112. bbm_byte_write(handle, DIV_MASTER, BBM_FEC_INT_CLR,
  113. fec);
  114. if (fec & FEC_INT_IRQ_A_TS_ERROR)
  115. ;
  116. if (fec & FEC_INT_IRQ_B_TS_ERROR)
  117. ;
  118. if (fec & FEC_INT_IRQ_C_TS_ERROR)
  119. ;
  120. }
  121. }
  122. if (aux_int_status & AUX_INT_AUTO_SWITCH) {
  123. u8 auto_switch = 0;
  124. bbm_byte_read(handle, DIV_MASTER, BBM_OSS_MNT, &auto_switch);
  125. if (auto_switch & AUTO_SWITCH_1_SEG) /* 1-SEG */
  126. ;
  127. else /* 12-SEG */
  128. ;
  129. }
  130. }
  131. #endif
  132. void fc8300_isr(HANDLE handle)
  133. {
  134. #ifndef BBM_I2C_TSIF
  135. u8 buf_int_status = 0;
  136. #endif
  137. #ifdef BBM_AUX_INT
  138. u8 aux_int_status = 0;
  139. #endif
  140. print_log(0,"%s \n",__func__);
  141. #ifndef BBM_I2C_TSIF
  142. bbm_byte_read(handle, DIV_MASTER, BBM_BUF_STATUS_CLEAR,
  143. &buf_int_status);
  144. if (buf_int_status) {
  145. bbm_byte_write(handle, DIV_MASTER,
  146. BBM_BUF_STATUS_CLEAR, buf_int_status);
  147. fc8300_data(handle, DIV_MASTER, buf_int_status);
  148. }
  149. buf_int_status = 0;
  150. bbm_byte_read(handle, DIV_MASTER, BBM_BUF_STATUS_CLEAR,
  151. &buf_int_status);
  152. if (buf_int_status) {
  153. bbm_byte_write(handle, DIV_MASTER,
  154. BBM_BUF_STATUS_CLEAR, buf_int_status);
  155. fc8300_data(handle, DIV_MASTER, buf_int_status);
  156. }
  157. #endif
  158. #ifdef BBM_AUX_INT
  159. bbm_byte_read(handle, DIV_MASTER, BBM_AUX_STATUS_CLEAR,
  160. &aux_int_status);
  161. if (aux_int_status) {
  162. bbm_byte_write(handle, DIV_MASTER,
  163. BBM_AUX_STATUS_CLEAR, aux_int_status);
  164. fc8300_aux_int(handle, DIV_MASTER, aux_int_status);
  165. }
  166. #endif
  167. }