1 diff --git a/main.c b/main.c
2 index ffff998..4bf7327 100644
5 @@ -86,8 +86,8 @@ void (*resize)(unsigned char *source, unsigned char *dest, int xsource, int ysou
6 void combine(unsigned char *output, unsigned char *video, unsigned char *osd, int xres, int yres);
7 char* upcase(char* mixedstr);
9 -enum {UNKNOWN,PALLAS,VULCAN,XILLEON,BRCM7401,BRCM7400,BRCM7405};
10 -char *stb_name[]={"unknown","Pallas","Vulcan","Xilleon","Brcm7401","Brcm7400","Brcm7405"};
11 +enum {UNKNOWN,PALLAS,VULCAN,XILLEON,BRCM7401,BRCM7400,BRCM7405,BRCM7335,BRCM7325,BRCM7346,BRCM7425};
12 +char *stb_name[]={"unknown","Pallas","Vulcan","Xilleon","Brcm7401","Brcm7400","Brcm7405","Brcm7335","Brcm7325","Brcm7346","Brcm7425"};
16 @@ -139,6 +139,53 @@ int main(int argc, char **argv) {
21 + // CPU Detection. idea from pl
22 + pipe=popen("cat /proc/stb/info/chipset","r");
25 + while (fgets(buf,sizeof(buf),pipe))
27 + if (strstr(upcase(buf),"7335"))
32 + else if (strstr(upcase(buf),"7325"))
37 + else if (strstr(upcase(buf),"7405"))
42 + else if (strstr(upcase(buf),"7356"))
47 + else if (strstr(upcase(buf),"7346"))
53 + else if (strstr(upcase(buf),"7424"))
58 + else if (strstr(upcase(buf),"7425"))
69 if (stb_type == UNKNOWN)
70 @@ -491,15 +538,27 @@ void getvideo(unsigned char *video, int *xres, int *yres)
74 - if (stb_type == BRCM7401 || stb_type == BRCM7400 || stb_type == BRCM7405)
75 + if (stb_type == BRCM7401 || stb_type == BRCM7400 || stb_type == BRCM7405 || stb_type == BRCM7335 || stb_type == BRCM7325 || stb_type == BRCM7346 || stb_type == BRCM7425)
77 // grab brcm7401 pic from decoder memory
79 - if(!(memory = (unsigned char*)mmap(0, 100, PROT_READ, MAP_SHARED, mem_fd, 0x10100000)))
80 + if(stb_type == BRCM7401 || stb_type == BRCM7400 || stb_type == BRCM7405 || stb_type == BRCM7335 || stb_type == BRCM7325)
82 - printf("Mainmemory: <Memmapping failed>\n");
84 + if(!(memory = (unsigned char*)mmap(0, 100, PROT_READ, MAP_SHARED, mem_fd, 0x10100000)))
86 + printf("Mainmemory: <Memmapping failed>\n");
92 + if(!(memory = (unsigned char*)mmap(0, 100, PROT_READ, MAP_SHARED, mem_fd, 0x10600000)))
94 + printf("Mainmemory: <Memmapping failed>\n");
100 unsigned char data[100];
102 @@ -509,17 +568,31 @@ void getvideo(unsigned char *video, int *xres, int *yres)
103 memcpy(data,memory,100);
104 //vert_start=data[0x1B]<<8|data[0x1A];
105 //vert_end=data[0x19]<<8|data[0x18];
106 - stride=data[0x15]<<8|data[0x14];
107 - ofs=(data[0x28]<<8|data[0x27])>>4;
108 - ofs2=(data[0x2c]<<8|data[0x2b])>>4;
109 - adr=(data[0x1f]<<24|data[0x1e]<<16|data[0x1d]<<8|data[0x1c])&0xFFFFFF00;
110 - adr2=(data[0x23]<<24|data[0x22]<<16|data[0x21]<<8|data[0x20])&0xFFFFFF00;
112 + if(stb_type == BRCM7401 || stb_type == BRCM7400 || stb_type == BRCM7405 || stb_type == BRCM7335 || stb_type == BRCM7325)
114 + stride=data[0x15]<<8|data[0x14];
115 + ofs=(data[0x28]<<8|data[0x27])>>4;
116 + ofs2=(data[0x2c]<<8|data[0x2b])>>4;
117 + adr=(data[0x1f]<<24|data[0x1e]<<16|data[0x1d]<<8|data[0x1c])&0xFFFFFF00;
118 + adr2=(data[0x23]<<24|data[0x22]<<16|data[0x21]<<8|data[0x20])&0xFFFFFF00;
123 + stride=data[0x15]<<8|data[0x14];
124 + ofs=(data[0x3c]<<8|data[0x3b])>>4;
125 + ofs2=(data[0x40]<<8|data[0x3f])>>4;
126 + adr=(data[0x1f]<<24|data[0x1e]<<16|data[0x1d]<<8|data[0x1c])&0xFFFFFF00;
127 + adr2=(data[0x37]<<24|data[0x36]<<16|data[0x35]<<8|data[0x34])&0xFFFFFF00;
135 - // printf("Stride: %d Res: %d\n",stride,res);
136 - // printf("Adr: %X Adr2: %X OFS: %d %d\n",adr,adr2,ofs,ofs2);
137 + printf("Stride: %d Res: %d\n",stride,res);
138 + printf("Adr: %X Adr2: %X OFS: %d %d\n",adr,adr2,ofs,ofs2);
140 pipe=popen("cat /proc/stb/vmpeg/0/yres","r");
141 while (fgets(buf,sizeof(buf),pipe))
142 @@ -530,7 +603,7 @@ void getvideo(unsigned char *video, int *xres, int *yres)
143 chroma = (unsigned char *)malloc(stride*(ofs2+64));
145 // grabbing luma & chroma plane from the decoder memory
146 - if (stb_type == BRCM7401 || stb_type == BRCM7405)
147 + if (stb_type == BRCM7401 || stb_type == BRCM7405 || stb_type == BRCM7325 || stb_type == BRCM7346 || stb_type == BRCM7425)
149 // on dm800/dm500hd we have direct access to the decoder memory
150 if(!(memory_tmp = (unsigned char*)mmap(0, offset + stride*(ofs2+64), PROT_READ, MAP_SHARED, mem_fd, adr)))
151 @@ -543,7 +616,7 @@ void getvideo(unsigned char *video, int *xres, int *yres)
152 // and hope we get a good timing. dont ask me why, but every DM800 i tested so far produced a good
153 // result with a 50ms delay
155 - } else if (stb_type == BRCM7400)
156 + } else if (stb_type == BRCM7400 || stb_type == BRCM7335)
158 // on dm8000 we have to use dma, so dont change anything here until you really know what you are doing !
160 @@ -553,7 +626,7 @@ void getvideo(unsigned char *video, int *xres, int *yres)
163 volatile unsigned long *mem_dma;
164 - if(!(mem_dma = (volatile unsigned long*)mmap(0, 0x1000, PROT_READ|PROT_WRITE, MAP_SHARED, mem_fd, 0x10c02000)))
165 + if(!(mem_dma = (volatile unsigned long*)mmap(0, 0x1000, PROT_READ|PROT_WRITE, MAP_SHARED, mem_fd, (stb_type==BRCM7400)? 0x10c02000:0x10c01000)))
167 printf("Mainmemory: <Memmapping failed>\n");
169 @@ -595,7 +668,7 @@ void getvideo(unsigned char *video, int *xres, int *yres)
170 int chr_luma_stride = 0x40;
173 - if (stb_type == BRCM7405)
174 + if (stb_type == BRCM7405 || stb_type == BRCM7325 || stb_type == BRCM7346 || stb_type == BRCM7425)
175 chr_luma_stride *= 2;
177 xsub=chr_luma_stride;
178 @@ -630,9 +703,9 @@ void getvideo(unsigned char *video, int *xres, int *yres)
182 - if (stb_type == BRCM7401 || stb_type == BRCM7405)
183 + if (stb_type == BRCM7401 || stb_type == BRCM7405 || stb_type == BRCM7325 || stb_type == BRCM7346 || stb_type == BRCM7425)
184 munmap(memory_tmp, offset + stride*(ofs2+64));
185 - else if (stb_type == BRCM7400)
186 + else if (stb_type == BRCM7400 || stb_type == BRCM7335)
187 munmap(memory_tmp, DMA_BLOCKSIZE + 0x1000);
189 for (t=0; t< stride*ofs;t+=4)