Annotation of margi2/spu.c, revision 1.2
1.1 cvs 1: /*
2: spu.c
3:
4: Copyright (C) Christian Wolff for convergence integrated media.
5:
6: This program is free software; you can redistribute it and/or modify
7: it under the terms of the GNU General Public License as published by
8: the Free Software Foundation; either version 2 of the License, or
9: (at your option) any later version.
10:
11: This program is distributed in the hope that it will be useful,
12: but WITHOUT ANY WARRANTY; without even the implied warranty of
13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: GNU General Public License for more details.
15:
16: You should have received a copy of the GNU General Public License
17: along with this program; if not, write to the Free Software
18: Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19: */
20:
21: #define __NO_VERSION__
22:
23: #include "spu.h"
24: #include "l64021.h"
25:
26: int DecoderHighlight(struct cvdv_cards *card, int active, u8 * coli,
27: u8 * btn_posi)
28: {
29: int i;
30: if ((coli == NULL) || (btn_posi == NULL))
31: return 1;
1.2 ! mocm 32: MDEBUG(0,": -- DecoderHighlight: col 0x%02X%02X, contr 0x%02X%02X, act %d, %d,%d - %d,%d\n",
1.1 cvs 33: coli[0], coli[1], coli[2], coli[3], active,
34: (((int) btn_posi[0] & 0x3F) << 4) | (btn_posi[1] >> 4),
35: (((int) btn_posi[3] & 0x3F) << 4) | (btn_posi[4] >> 4),
36: (((int) btn_posi[1] & 0x03) << 8) | btn_posi[2],
37: (((int) btn_posi[4] & 0x03) << 8) | btn_posi[5]);
38: //for (i=0; i<4; i++) DecoderWriteByte(card,0x1C0+i,coli[i]);
39: // DecoderWriteByte(card,0x1C0,coli[1]);
40: // DecoderWriteByte(card,0x1C1,coli[0]);
41: // DecoderWriteByte(card,0x1C2,coli[3]);
42: // DecoderWriteByte(card,0x1C3,coli[2]);
43: //for (i=0; i<6; i++) DecoderWriteByte(card,0x1C4+i,btn_posi[i]);
44: // for (i=0; i<6; i++) DecoderWriteByte(card,0x1C4+i,btn_posi[5-i]);
45: //if (active) DecoderSetByte(card,0x1BF,0x01);
46: //else DecoderDelByte(card,0x1BF,0x01);
47:
48: //for (i=0; i<4; i++) card->highlight[i]=coli[3-i];
49: card->highlight[0] = coli[1];
50: card->highlight[1] = coli[0];
51: card->highlight[2] = coli[3];
52: card->highlight[3] = coli[2];
53: for (i = 0; i < 6; i++)
54: card->highlight[4 + i] = btn_posi[5 - i];
55: card->highlight_valid = 1;
56: if (active)
57: DecoderWriteByte(card, 0x1BF, 0x01);
58: else
59: DecoderWriteByte(card, 0x1BF, 0x00);
60: //DecoderSetByte(card,0x135,0x02); // Enable SPU Mix
61: //DecoderWriteByte(card,0x1A0,0x01); // decode start, display on
62: return 0;
63: }
64:
65: int DecoderSPUPalette(struct cvdv_cards *card, int length, u8 * palette)
66: {
67: int i;
1.2 ! mocm 68: MDEBUG(1,": -- DecoderSPUPalette: setting up %d bytes of SPU palette(Y,Cr,Cb):", length);
1.1 cvs 69: for (i = 0; i < (length / 3); i++)
1.2 ! mocm 70: MDEBUG(1," %d=(%d,%d,%d)", i, palette[i * 3],palette[i * 3 + 1],
! 71: palette[i * 3 + 2]);
! 72: MDEBUG(1,"\n");
1.1 cvs 73: DecoderDelByte(card, 0x1A0, 0x01); // SPU decode stop
74: DecoderSetByte(card, 0x1A0, 0x10);
75: for (i = 0; i < length; i++)
76: DecoderWriteByte(card, 0x1BE, palette[i]);
77: DecoderSetByte(card, 0x1A0, 0x01); // SPU decode start
78: return 0;
79: }
80:
81: int DecoderSPUStream(struct cvdv_cards *card, int stream, int active)
82: {
1.2 ! mocm 83: MDEBUG(1,": -- DecoderSPUStream: stream %d, active %d\n", stream,
1.1 cvs 84: active);
85: if (stream < 32) {
86: card->reg092 |= (0x20 | (stream & 0x1F)); // stream ID and select
87: DecoderWriteByte(card, 0x092, card->reg092);
88: DecoderMaskByte(card, 0x112, 0x20, 0x20); // chroma filter enable
89: DecoderMaskByte(card, 0x1A1, 0x0F, 0x00); // SPU timeout
90: DecoderWriteByte(card, 0x1BF, 0x00); // HighLight off
91: DecoderSetByte(card, 0x135, 0x02); // Enable SPU Mix
92: if (active)
93: DecoderWriteByte(card, 0x1A0, 0x01); // decode start, display on
94: else
95: DecoderWriteByte(card, 0x1A0, 0x05); // decode start, display off
96: } else {
97: DecoderWriteByte(card, 0x1A0, 0x04); // decode stop, display off
98: card->reg092 &= (~0x20); // stream select off
99: DecoderWriteByte(card, 0x092, card->reg092);
100: DecoderDelByte(card, 0x135, 0x02); // Disable SPU Mix
101: }
102: return 0;
103: }
LinuxTV legacy CVS <linuxtv.org/cvs>