source: titan/titan/i386port.h @ 38669

Last change on this file since 38669 was 31051, checked in by obi, 9 years ago

fix simulate i386 building

File size: 6.2 KB
Line 
1#ifndef I386PORT_H
2#define I386PORT_H
3
4int setmixer(struct dvbdev* node, int left, int right)
5{
6        return 0;
7}
8
9int setvmpegrect(struct dvbdev* node, int posx, int posy, int wh, int flag)
10{
11        int ret = 0;
12        return ret;
13}
14
15int cagetslotinfo(struct dvbdev* node, ca_slot_info_t* info)
16{
17        int ret = 0;
18        return 0;
19}
20
21int resettvpic()
22{
23        int ret = 0;
24
25        return ret;
26}
27
28int setencoding(struct channel* chnode, struct dvbdev* videonode)
29{
30        int ret = 1;
31        if(chnode == NULL) return ret;
32       
33        switch(chnode->videocodec)
34        {
35                case MPEGV:
36                        ret = videosetencoding(videonode, 2);
37                        break;
38                case MPEG4V:
39                        ret = videosetencoding(videonode, 7);
40                        break;
41                case H264:
42                        ret = videosetencoding(videonode, 8);
43                        break;
44                case VC1:
45                        ret = videosetencoding(videonode, 10);
46                        break;
47                default:
48                        ret = videosetencoding(videonode, 0);
49        }
50        return ret;
51}
52
53int videodiscontinuityskip(struct dvbdev* node, int flag)
54{
55        return 0;
56}
57
58void fbsave()
59{
60}
61
62void fbrestore()
63{
64}
65
66void setfbvarsize(struct fb* newnode)
67{
68        if(newnode != NULL)
69                newnode->varfbsize = newnode->width * newnode->height * newnode->colbytes;
70}
71
72void enablemanualblit()
73{
74}
75
76//flag 0 = no animation
77//flag 1 = animation
78void blitfb2(struct fb* fbnode, int flag)
79{
80        int i = 0;
81
82        if(fbnode == NULL) return;
83
84#ifdef NOFB
85        if(status.rguidfd > -1)
86        {
87                unsigned char* buf = NULL;
88                buf = scale(fbnode->fb, fbnode->width, fbnode->height, 4, 320, 240, 0);
89                if(buf != NULL)
90                {
91                        socksend(&status.rguidfd, (unsigned char*)buf, 320 * 240 * 4, 5000 * 1000);
92                        free(buf); buf = NULL;
93                }
94        }
95        if(status.write_png == 1 && status.infobaraktiv == 0)
96        {
97                unsigned char* buf = NULL;
98                buf = scale(fbnode->fb, fbnode->width, fbnode->height, 4, 320, 240, 0);
99                if(buf != NULL)
100                {
101                        if(writeFBfile.ActBuf == NULL)
102                        {
103                                writeFBfile.buf1 = malloc(4 * 320 * 240);
104                                writeFBfile.ActBuf = writeFBfile.buf1;
105                                memcpy(writeFBfile.buf1, (unsigned char*)buf, 4 * 320 * 240);
106                                addtimer(&fb2png_thread, START, 10000, 1, NULL, NULL, NULL);
107                        }
108                        else if(writeFBfile.buf1 == writeFBfile.ActBuf)
109                        {
110                                if(writeFBfile.buf2 == NULL)
111                                        writeFBfile.buf2 = malloc(4 * 320 * 240);
112                                memcpy(writeFBfile.buf2, (unsigned char*)buf, 4 * 320 * 240);
113                        }
114                        else if(writeFBfile.buf2 == writeFBfile.ActBuf)
115                        {
116                                if(writeFBfile.buf1 == NULL)
117                                        writeFBfile.buf1 = malloc(4 * 320 * 240);
118                                memcpy(writeFBfile.buf1, (unsigned char*)buf, 4 * 320 * 240);
119                        }
120                        //fb2png((unsigned char*)buf, 320, 240, "/tmp/titanlcd.png");
121                        free(buf); buf = NULL;
122                }
123        }
124
125        if(fbnode != fb)
126        {
127                for(i = 0; i < fbnode->height; i++)
128                {
129                        memcpy(fb->fb + (i * fb->pitch), fbnode->fb + (i * fbnode->pitch), fbnode->width * fbnode->colbytes);
130                }
131        }
132        system("killall -9 xloadimage");
133
134        FILE *fd;
135        fd=fopen("titan.png", "w");
136        fwrite(fb->fb, fb->varfbsize, 1, fd);
137        fclose(fd);
138
139        system("fbgrab -f titan.png -w 1280 -h 720 -b 32 titan1.png > /dev/null");
140        system("xloadimage titan1.png > /dev/null &");
141#endif
142}
143
144void setfbtransparent(int value)
145{
146}
147
148int allocbpamem(size_t size, int *memfd, unsigned char **mem)
149{
150        return -1;
151}
152
153void freebpamem(int memfd, unsigned char* mem, size_t len)
154{
155}
156
157//mode 0: with fill (draw to skinfb)
158//mode 1: without fill (draw to skinfb)
159//mode 2: with fill (draw to fb)
160//mode 3: without fill (draw to fb)
161void blitrect(int posx, int posy, int width, int height, long color, int transparent, int mode)
162{
163        int y, x;
164        unsigned long tmpcol;
165       
166        if(posx < 0) posx = 0;
167        if(posx > skinfb->width) posx = skinfb->width;
168        if(posy < 0) posy = 0;
169        if(posy > skinfb->height) posy = skinfb->height;
170        if(posx + width > skinfb->width) width = skinfb->width - posx;
171        if(posy + height > skinfb->height) height = skinfb->height - posy;
172
173        if(width <= 0 || height <= 0) return;
174
175        transparent = (transparent - 255) * -1;
176        tmpcol = color | ((transparent & 0xff) << 24);
177
178        if(mode == 0 || mode == 2)
179        {
180                for(y = 0; y < height; y++)
181                {
182                        for(x = 0; x < width; x++)
183                        {
184                                drawpixel(posx + x, posy + y, tmpcol);
185                        }
186                }
187        }
188        else if(mode == 1 || mode == 3)
189        {
190                //topline
191                for(x = 0; x < width; x++)
192                        drawpixel(posx + x, posy, tmpcol);
193                //bottomline
194                for(x = 0; x < width; x++)
195                        drawpixel(posx + x, posy + height - 1, tmpcol);
196                //leftline
197                for(y = 0; y < height; y++)
198                        drawpixel(posx, posy + y, tmpcol);
199                //rightline
200                for(y = 0; y < height; y++)
201                        drawpixel(posx + width - 1, posy + y, tmpcol);
202        }
203}
204
205int readjpg(const char* filename, unsigned long* width, unsigned long* height, unsigned long* rowbytes, int* channels, unsigned char **mem, int *memfd)
206{
207        return -1;
208}
209
210//flag 0: blit from accelfb to skinfb
211//flag 1: blit from skinfb to accelfb
212void blitscale(int posx, int posy, int width, int height, int scalewidth, int scaleheight, int flag)
213{
214}
215
216void blitjpg(unsigned char* buf, int posx, int posy, int width, int height, int scalewidth, int scaleheight, int mwidth, int mheight, int halign, int valign)
217{
218}
219
220void initsignal(struct sigaction* sa)
221{
222        sigaction(SIGILL, sa, NULL);
223        sigaction(SIGBUS, sa, NULL);
224        sigaction(SIGFPE, sa, NULL);
225        sigaction(SIGUSR1, sa, NULL);
226        sigaction(SIGSEGV, sa, NULL);
227        sigaction(SIGUSR2, sa, NULL);
228        sigaction(SIGPIPE, sa, NULL);
229        sigaction(SIGALRM, sa, NULL);
230        sigaction(SIGSTKFLT, sa, NULL);
231        sigaction(SIGABRT, sa, NULL);
232
233        signal(SIGHUP, SIG_IGN);
234        signal(SIGINT, SIG_IGN);
235        signal(SIGTRAP, SIG_IGN);
236        signal(SIGTERM, SIG_IGN);
237        signal(SIGXCPU, SIG_IGN);
238        signal(SIGXFSZ, SIG_IGN);
239        signal(SIGVTALRM, SIG_IGN);
240        signal(SIGPROF, SIG_IGN);
241        signal(SIGPOLL, SIG_IGN);
242        signal(SIGRTMAX, SIG_IGN);
243        signal(SIGPWR, SIG_IGN);
244        signal(SIGSYS, SIG_IGN);
245}
246
247void sighandler(int sig, struct sigcontext ctx)
248{
249        switch(sig)
250        {
251                case SIGALRM:
252                {
253                        err("got signal sigalrm but ignore it");
254                        break;
255                }
256                case SIGPIPE:
257                {
258                        err("got signal sigpipe but ignore it");
259                        break;
260                }
261                case SIGUSR1:
262                {
263                        //todo all configs
264                        reloadconfig(status.configfile);
265                        reloadconfig(getconfig("ownconfig", NULL));
266                        break;
267                }
268                case SIGUSR2: //called if hanging mainthread detect
269                {
270                        debugstack(sig, NULL, NULL);
271                        break;
272                }
273                case SIGILL:
274                case SIGBUS:
275                case SIGFPE:
276                case SIGSEGV:
277                case SIGSTKFLT:
278                {
279                        //intel
280                        debugstack(sig, (void *)ctx.eip, NULL);
281                        err("got signal %d (%s), fault address 0x%lx from 0x%lx", sig, strsignal(sig), ctx.cr2, ctx.eip);
282
283                        if(getconfigint("saverun", NULL) == 1 && status.longjumpbuf != NULL)
284                                siglongjmp(status.longjumpbuf, 999);
285                        else
286                                exit(100);
287                        break;
288                }
289        }
290}
291
292#endif
Note: See TracBrowser for help on using the repository browser.