summaryrefslogtreecommitdiff
path: root/recipes/aio-grab/aio-grab/aio-grab_vuplus.patch
blob: 88264b0edff257a0c6e9bbe2995434c0d3ce19a8 (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
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
diff --git a/main.c b/main.c
index ffff998..632a153 100644
--- a/main.c
+++ b/main.c
@@ -86,8 +86,8 @@ void (*resize)(unsigned char *source, unsigned char *dest, int xsource, int ysou
 void combine(unsigned char *output, unsigned char *video, unsigned char *osd, int xres, int yres);
 char* upcase(char* mixedstr);
 
-enum {UNKNOWN,PALLAS,VULCAN,XILLEON,BRCM7401,BRCM7400,BRCM7405};
-char *stb_name[]={"unknown","Pallas","Vulcan","Xilleon","Brcm7401","Brcm7400","Brcm7405"};
+enum {UNKNOWN,PALLAS,VULCAN,XILLEON,BRCM7401,BRCM7400,BRCM7405,BRCM7335,BRCM7325};
+char *stb_name[]={"unknown","Pallas","Vulcan","Xilleon","Brcm7401","Brcm7400","Brcm7405","Brcm7335","Brcm7325"};
 int stb_type=UNKNOWN;
 
 // main program
@@ -139,6 +139,31 @@ int main(int argc, char **argv) {
 				stb_type=BRCM7405;
 		}
 		pclose(pipe);
+
+		// CPU Detection. idea from pl
+		pipe=popen("cat /proc/stb/info/chipset","r");
+		if(pipe)
+		{
+			while (fgets(buf,sizeof(buf),pipe))
+			{
+				if (strstr(upcase(buf),"7335"))
+				{
+					stb_type=BRCM7335;
+					break;
+				}
+				else if (strstr(upcase(buf),"7325"))
+				{
+					stb_type=BRCM7325;
+					break;
+				}
+				else if (strstr(upcase(buf),"7405"))
+				{
+					stb_type=BRCM7405;
+					break;
+				}
+			}
+		}
+		pclose(pipe);
 	}
 
 	if (stb_type == UNKNOWN)
@@ -491,7 +516,7 @@ void getvideo(unsigned char *video, int *xres, int *yres)
 	char buf[256];
 	FILE *pipe;
 
-	if (stb_type == BRCM7401 || stb_type == BRCM7400 || stb_type == BRCM7405)
+	if (stb_type == BRCM7401 || stb_type == BRCM7400 || stb_type == BRCM7405 || stb_type == BRCM7335 || stb_type == BRCM7325)
 	{
 		// grab brcm7401 pic from decoder memory
 		
@@ -530,7 +555,7 @@ void getvideo(unsigned char *video, int *xres, int *yres)
 		chroma = (unsigned char *)malloc(stride*(ofs2+64));	
 
 		// grabbing luma & chroma plane from the decoder memory
-		if (stb_type == BRCM7401 || stb_type == BRCM7405)
+		if (stb_type == BRCM7401 || stb_type == BRCM7405 || stb_type == BRCM7325)
 		{
 			// on dm800/dm500hd we have direct access to the decoder memory
 			if(!(memory_tmp = (unsigned char*)mmap(0, offset + stride*(ofs2+64), PROT_READ, MAP_SHARED, mem_fd, adr)))
@@ -543,7 +568,7 @@ void getvideo(unsigned char *video, int *xres, int *yres)
 							// and hope we get a good timing. dont ask me why, but every DM800 i tested so far produced a good
 							// result with a 50ms delay
 			
-		} else if (stb_type == BRCM7400)
+		} else if (stb_type == BRCM7400 || stb_type == BRCM7335)
 		{
 			// on dm8000 we have to use dma, so dont change anything here until you really know what you are doing !
 			
@@ -553,7 +578,7 @@ void getvideo(unsigned char *video, int *xres, int *yres)
 				return;
 			}
 			volatile unsigned long *mem_dma;
-			if(!(mem_dma = (volatile unsigned long*)mmap(0, 0x1000, PROT_READ|PROT_WRITE, MAP_SHARED, mem_fd, 0x10c02000)))
+			if(!(mem_dma = (volatile unsigned long*)mmap(0, 0x1000, PROT_READ|PROT_WRITE, MAP_SHARED, mem_fd, (stb_type==BRCM7400)? 0x10c02000:0x10c01000)))
 			{
 				printf("Mainmemory: <Memmapping failed>\n");
 				return;
@@ -595,7 +620,7 @@ void getvideo(unsigned char *video, int *xres, int *yres)
 		int chr_luma_stride = 0x40;
  		int sw=1;
 
-		if (stb_type == BRCM7405)
+		if (stb_type == BRCM7405 || stb_type == BRCM7325)
 			chr_luma_stride *= 2;
 
 		xsub=chr_luma_stride;
@@ -630,9 +655,9 @@ void getvideo(unsigned char *video, int *xres, int *yres)
 			}
 		}
 
-		if (stb_type == BRCM7401 || stb_type == BRCM7405)
+		if (stb_type == BRCM7401 || stb_type == BRCM7405 || stb_type == BRCM7325)
 			munmap(memory_tmp, offset + stride*(ofs2+64));
-		else if (stb_type == BRCM7400)
+		else if (stb_type == BRCM7400 || stb_type == BRCM7335)
 			munmap(memory_tmp, DMA_BLOCKSIZE + 0x1000);
 
 		for (t=0; t< stride*ofs;t+=4)