aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/isdbt/fc8150/fc8150_isr.c
blob: 259576bcc22b4d4a963d62ca121b82e30801a713 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*****************************************************************************
 Copyright(c) 2012 FCI Inc. All Rights Reserved

 File name : fc8150_isr.c

 Description : fc8150 interrupt service routine

*******************************************************************************/
#include "fci_types.h"
#include "fci_hal.h"
#include "fci_oal.h"
#include "fc8150_regs.h"

int (*pTSCallback)(u32 userdata, u8 *data, int length) = NULL;
int (*pACCallback)(u32 userdata, u8 *data, int length) = NULL;

u32 gTSUserData;
u32 gACUserData;

/* static u8 acBuffer[AC_BUF_THR]; */
static u8 tsBuffer[TS_BUF_SIZE];

static void fc8150_data(HANDLE hDevice, u8 bufIntStatus)
{
	if (bufIntStatus & 0x01) { /* TS */
		bbm_data(hDevice, BBM_TS_DATA, &tsBuffer[0], TS_BUF_SIZE/2);

		if (pTSCallback)
			(*pTSCallback)(gTSUserData
			, &tsBuffer[0], TS_BUF_SIZE/2);
	}
}

void fc8150_isr(HANDLE hDevice)
{
	u8 IntStatus = 0;
	u8 bufIntStatus = 0;

	bbm_read(hDevice, BBM_INT_STATUS, &IntStatus);
	bbm_write(hDevice, BBM_INT_STATUS, IntStatus);

	bbm_read(hDevice, BBM_BUF_STATUS, &bufIntStatus);
	if (bufIntStatus) {
		bbm_write(hDevice, BBM_BUF_STATUS, bufIntStatus);
		fc8150_data(hDevice, bufIntStatus);
	}
}