Pasted as Plain Text [Remove this paste ]
Description: No description
URL: http://bcas.tv/paste/results/EQLRjk44.html
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
DMD_u32_t	DMD_CNR( DMD_SYSTEM_t sys , DMD_u32_t* cnr_i , DMD_u32_t* cnr_d ){
	DMD_u8_t	rd;
	DMD_s32_t	cnr;
	DMD_s32_t	sig,noise;
	switch( sys )
	{
		case DMD_E_DVBT:
			DMD_I2C_Read( DMD_BANK_T_ , DMD_CNRDU_T , &rd );
			cnr = rd * 0x100;
			DMD_I2C_Read( DMD_BANK_T_ , DMD_CNRDL_T , &rd );
			cnr += rd;
			if( cnr != 0 )
			{
				cnr = 65536 / cnr;
				cnr = log10_easy( cnr ) + 200;
				if( cnr < 0 ) cnr = 0;
			}
			else
				cnr = 0;
 
			*cnr_i = (DMD_u32_t ) cnr / 100;
			*cnr_d = (DMD_u32_t ) cnr % 100;
			break;
		case DMD_E_DVBT2:
			DMD_I2C_Read( DMD_BANK_T2_ , DMD_CNRDU , &rd );
			cnr = rd * 0x100;
			DMD_I2C_Read( DMD_BANK_T2_ , DMD_CNRDL , &rd );
			cnr += rd;
			DMD_I2C_Read( DMD_BANK_T2_ , DMD_CNFLG , &rd );
			if( cnr != 0 )
			{
				if( rd & 0x4 )
				{
					//MISO
					cnr = 16384 / cnr;
					cnr = log10_easy( cnr ) - 600;
					if( cnr < 0 ) cnr = 0;
					*cnr_i = (DMD_u32_t ) cnr / 100;
					*cnr_d = (DMD_u32_t ) cnr % 100;
				}
				else
				{
					//SISO
					cnr = 65536 / cnr;
					cnr = log10_easy( cnr ) + 200;
					if( cnr < 0 ) cnr = 0;
					*cnr_i = (DMD_u32_t ) cnr / 100;
					*cnr_d = (DMD_u32_t ) cnr % 100;
 
				}
			}
			else
			{
				*cnr_i = 0;
				*cnr_d = 0;
			}
			break;
		case DMD_E_DVBC:
			DMD_I2C_Read( DMD_BANK_C_ , DMD_CNMON1_C , &rd );
			sig = rd * 0x100;
			DMD_I2C_Read( DMD_BANK_C_ , DMD_CNMON2_C , &rd );
			sig += rd;
			DMD_I2C_Read( DMD_BANK_C_ , DMD_CNMON3_C , &rd );
			noise = rd * 0x100;
			DMD_I2C_Read( DMD_BANK_C_ , DMD_CNMON4_C , &rd );
			noise += rd;
 
			if( noise != 0 )
				cnr = log10_easy(sig * 8  / noise);
			else
				cnr = 0;
 
			if( cnr < 0 ) cnr = 0;
			*cnr_i = (DMD_u32_t ) cnr / 100;
			*cnr_d = (DMD_u32_t ) cnr % 100;
			break;
 
	}
	return 0;
}