fc8150_isr.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*****************************************************************************
  2. Copyright(c) 2012 FCI Inc. All Rights Reserved
  3. File name : fc8150_isr.c
  4. Description : fc8150 interrupt service routine
  5. *******************************************************************************/
  6. #include "fci_types.h"
  7. #include "fci_hal.h"
  8. #include "fci_oal.h"
  9. #include "fc8150_regs.h"
  10. int (*pTSCallback)(u32 userdata, u8 *data, int length) = NULL;
  11. int (*pACCallback)(u32 userdata, u8 *data, int length) = NULL;
  12. u32 gTSUserData;
  13. u32 gACUserData;
  14. /* static u8 acBuffer[AC_BUF_THR]; */
  15. static u8 tsBuffer[TS_BUF_SIZE];
  16. static void fc8150_data(HANDLE hDevice, u8 bufIntStatus)
  17. {
  18. if (bufIntStatus & 0x01) { /* TS */
  19. bbm_data(hDevice, BBM_TS_DATA, &tsBuffer[0], TS_BUF_SIZE/2);
  20. if (pTSCallback)
  21. (*pTSCallback)(gTSUserData
  22. , &tsBuffer[0], TS_BUF_SIZE/2);
  23. }
  24. }
  25. void fc8150_isr(HANDLE hDevice)
  26. {
  27. #ifdef FEATURE_INT_AUTO_MODE
  28. fc8150_data(hDevice, 1);
  29. #else
  30. u8 bufIntStatus = 0;
  31. bbm_read(hDevice, BBM_BUF_STATUS, &bufIntStatus);
  32. if (bufIntStatus) {
  33. bbm_write(hDevice, BBM_BUF_STATUS, bufIntStatus);
  34. fc8150_data(hDevice, bufIntStatus);
  35. }
  36. /* Overrun */
  37. bufIntStatus = 0;
  38. bbm_read(hDevice, BBM_BUF_STATUS, &bufIntStatus);
  39. if (bufIntStatus) {
  40. bbm_write(hDevice, BBM_BUF_STATUS, bufIntStatus);
  41. fc8150_data(hDevice, bufIntStatus);
  42. }
  43. #endif
  44. }