Annotation of margi2/spu.c, revision 1.1.1.1

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;
                     32:        printk(KERN_ERR LOGNAME
                     33:               ": -- DecoderHighlight: col 0x%02X%02X, contr 0x%02X%02X, act %d, %d,%d - %d,%d\n",
                     34:               coli[0], coli[1], coli[2], coli[3], active,
                     35:               (((int) btn_posi[0] & 0x3F) << 4) | (btn_posi[1] >> 4),
                     36:               (((int) btn_posi[3] & 0x3F) << 4) | (btn_posi[4] >> 4),
                     37:               (((int) btn_posi[1] & 0x03) << 8) | btn_posi[2],
                     38:               (((int) btn_posi[4] & 0x03) << 8) | btn_posi[5]);
                     39:        //for (i=0; i<4; i++) DecoderWriteByte(card,0x1C0+i,coli[i]);
                     40: //  DecoderWriteByte(card,0x1C0,coli[1]);
                     41: //  DecoderWriteByte(card,0x1C1,coli[0]);
                     42: //  DecoderWriteByte(card,0x1C2,coli[3]);
                     43: //  DecoderWriteByte(card,0x1C3,coli[2]);
                     44:        //for (i=0; i<6; i++) DecoderWriteByte(card,0x1C4+i,btn_posi[i]);
                     45: //  for (i=0; i<6; i++) DecoderWriteByte(card,0x1C4+i,btn_posi[5-i]);
                     46:        //if (active) DecoderSetByte(card,0x1BF,0x01);
                     47:        //else        DecoderDelByte(card,0x1BF,0x01);
                     48: 
                     49:        //for (i=0; i<4; i++) card->highlight[i]=coli[3-i];
                     50:        card->highlight[0] = coli[1];
                     51:        card->highlight[1] = coli[0];
                     52:        card->highlight[2] = coli[3];
                     53:        card->highlight[3] = coli[2];
                     54:        for (i = 0; i < 6; i++)
                     55:                card->highlight[4 + i] = btn_posi[5 - i];
                     56:        card->highlight_valid = 1;
                     57:        if (active)
                     58:                DecoderWriteByte(card, 0x1BF, 0x01);
                     59:        else
                     60:                DecoderWriteByte(card, 0x1BF, 0x00);
                     61: //DecoderSetByte(card,0x135,0x02);  // Enable SPU Mix
                     62: //DecoderWriteByte(card,0x1A0,0x01);  // decode start, display on
                     63:        return 0;
                     64: }
                     65: 
                     66: int DecoderSPUPalette(struct cvdv_cards *card, int length, u8 * palette)
                     67: {
                     68:        int i;
                     69:        printk(KERN_DEBUG LOGNAME
                     70:               ": -- DecoderSPUPalette: setting up %d bytes of SPU palette(Y,Cr,Cb):",
                     71:               length);
                     72:        for (i = 0; i < (length / 3); i++)
                     73:                printk(" %d=(%d,%d,%d)", i, palette[i * 3],
                     74:                       palette[i * 3 + 1], palette[i * 3 + 2]);
                     75:        printk("\n");
                     76:        DecoderDelByte(card, 0x1A0, 0x01);      // SPU decode stop
                     77:        DecoderSetByte(card, 0x1A0, 0x10);
                     78:        for (i = 0; i < length; i++)
                     79:                DecoderWriteByte(card, 0x1BE, palette[i]);
                     80:        DecoderSetByte(card, 0x1A0, 0x01);      // SPU decode start
                     81:        return 0;
                     82: }
                     83: 
                     84: int DecoderSPUStream(struct cvdv_cards *card, int stream, int active)
                     85: {
                     86:        printk(KERN_DEBUG LOGNAME
                     87:               ": -- DecoderSPUStream: stream %d, active %d\n", stream,
                     88:               active);
                     89:        if (stream < 32) {
                     90:                card->reg092 |= (0x20 | (stream & 0x1F));       // stream ID and select
                     91:                DecoderWriteByte(card, 0x092, card->reg092);
                     92:                DecoderMaskByte(card, 0x112, 0x20, 0x20);       // chroma filter enable
                     93:                DecoderMaskByte(card, 0x1A1, 0x0F, 0x00);       // SPU timeout
                     94:                DecoderWriteByte(card, 0x1BF, 0x00);    // HighLight off
                     95:                DecoderSetByte(card, 0x135, 0x02);      // Enable SPU Mix
                     96:                if (active)
                     97:                        DecoderWriteByte(card, 0x1A0, 0x01);    // decode start, display on
                     98:                else
                     99:                        DecoderWriteByte(card, 0x1A0, 0x05);    // decode start, display off
                    100:        } else {
                    101:                DecoderWriteByte(card, 0x1A0, 0x04);    // decode stop, display off
                    102:                card->reg092 &= (~0x20);        // stream select off
                    103:                DecoderWriteByte(card, 0x092, card->reg092);
                    104:                DecoderDelByte(card, 0x135, 0x02);      // Disable SPU Mix
                    105:        }
                    106:        return 0;
                    107: }

LinuxTV legacy CVS <linuxtv.org/cvs>