Annotation of margi2/cardbase.h, revision 1.1

1.1     ! cvs         1: /* 
        !             2:     cardbase.h
        !             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: #ifndef CARDBASE_H
        !            22: #define CARDBASE_H
        !            23: 
        !            24: // all the internal structs
        !            25: 
        !            26: #include <pcmcia/config.h>
        !            27: #include <pcmcia/k_compat.h>
        !            28: #include "ringbuffy.h"
        !            29: 
        !            30: #include <linux/kernel.h>
        !            31: #include <linux/config.h>
        !            32: 
        !            33: #include <linux/malloc.h>
        !            34: #include <linux/vmalloc.h>
        !            35: #include <linux/mm.h>
        !            36: #include <linux/delay.h>
        !            37: #include <linux/poll.h>
        !            38: #include <linux/fs.h>
        !            39: #include <linux/interrupt.h>
        !            40: #include <linux/tqueue.h>
        !            41: #include <asm/io.h>
        !            42: #include <asm/byteorder.h>
        !            43: 
        !            44: 
        !            45: // List of pci cards in the system
        !            46: 
        !            47: #include "cvdvtypes.h"
        !            48: 
        !            49: #define DVERSION             "0.42"
        !            50: #define SHORTDEVNAME        "ConvDVD"
        !            51: #define MEDDEVNAME          "convergence DVD"
        !            52: #define LONGDEVNAME         "convergence DVD Video Decoder"
        !            53: #define LOGNAME             "convdvd"
        !            54: #define NBBUF 32
        !            55: 
        !            56: // Character device definitions
        !            57: // char dev name
        !            58: #define CVDV_PROCNAME     "msc"        // Media Stream Consumer
        !            59: // got to get another number
        !            60: #define CVDV_MAJOR        200  // 0=dynamic assignment
        !            61: 
        !            62: // Author definitions
        !            63: #define NAME                "Christian Wolff"
        !            64: #define EMAIL               "scarabaeus@convergence.de"
        !            65: #define COMPANY             "convergence integrated media GmbH"
        !            66: #define AUTHOR              NAME " <" EMAIL "> " COMPANY
        !            67: 
        !            68: #define MAXDEV            1    // maximum number of cards, distance between minor devices
        !            69: 
        !            70: #define MINORNUM          (256/MAXDEV) // number of minor devices
        !            71: 
        !            72: #define NAVISIZE 1024          // size of one navi block
        !            73: #define NAVIBUFFERSIZE NAVISIZE*10     // size of ten navi blocks
        !            74: 
        !            75: #define BLANK 0xFFFFFFFF
        !            76: 
        !            77: #define FIFO_MASK 1023
        !            78: 
        !            79: #define CCIR601Lines(system) (((system==NTSC) || (system==NTSC60) || (system==PALM) || (system==PALM60) || (system==PAL60))?525:625)
        !            80: 
        !            81: // default video mode
        !            82: #define VIDEO_MODE PAL
        !            83: //#define VIDEO_MODE NTSC
        !            84: 
        !            85: struct DRAMBlock {
        !            86:        u32 start;              // start address of the block; (21 bit word address, 64 bit aligned)
        !            87:        u32 length;             // length of the block (in 16 bit words)
        !            88:        struct DRAMBlock *next; // chain link
        !            89: };
        !            90: 
        !            91: struct CSS {
        !            92:        u8 status;              // interrupt status from Register 0x0B0
        !            93:        int ChallengeReady;     // 1 if challenge data valid
        !            94:        u8 challenge[10];       // challenge data
        !            95:        int ResponseReady;      // 1 if response data valid
        !            96:        u8 response[5];         // response data
        !            97:        int DiskKey;            // 1 if disk key extraction complete
        !            98:        int TitleKey;           // 1 if title key decryption complete
        !            99:        int Error;              // 1 if authentication or disc key extraction
        !           100:        int TitleKeyDiff;       // 1 if title key different from previous
        !           101: };
        !           102: 
        !           103: struct GOPHeader {
        !           104:        int valid;              // 1: struct contains valid data
        !           105:        int timecode;
        !           106:        int closedgop;
        !           107:        int brokenlink;
        !           108: };
        !           109: 
        !           110: struct SequenceHeader {
        !           111:        int valid;              // 1: struct contains valid data
        !           112:        int hsize;
        !           113:        int vsize;
        !           114:        int aspectratio;
        !           115:        int frameratecode;
        !           116:        int bitrate;
        !           117:        int vbvbuffersize;
        !           118:        int constrained;
        !           119: };
        !           120: 
        !           121: struct SequenceExtension {
        !           122:        int valid;              // 1: struct contains valid data
        !           123:        int profilelevel;
        !           124:        int progressive;
        !           125:        int chroma;
        !           126:        int hsizeext;
        !           127:        int vsizeext;
        !           128:        int bitrateext;
        !           129:        int vbvbuffersizeext;
        !           130:        int lowdelay;
        !           131:        int frextn;
        !           132:        int frextd;
        !           133: };
        !           134: 
        !           135: struct AudioMPEG {
        !           136:        int present;            // true: MPEG audio stream present
        !           137:        int MPEG2;              // 0:MPEG1 Audio
        !           138:        int layer;              // 1..3 (I..III)
        !           139:        int bitrate;            // 0=free, 32-448 kbps
        !           140:        int samplefreq;         // 32,44,48 (44 eq. 44.1)
        !           141:        int mode;               // 0=stereo 1=joint-stereo 2=dualchannel 3=single channel (just right channel)
        !           142:        int modeext;            // Layer I&II: intensity stereo subbands  Layer III: bit 0=intensity stereo, bit 1=ms-stereo
        !           143:        int copyright;          // true=copyrighted material
        !           144:        int original;           // 0=copy true=original
        !           145:        int emphasis;           // 0=no emph. 1=50/15usec 3=CCITT J.17
        !           146: };
        !           147: 
        !           148: struct AudioAC3 {
        !           149:        int present;            // 1: AC3 audio stream present
        !           150:        int acmod;              // parameters from the AC3 documentation
        !           151:        int bsmod;
        !           152:        int dialnorm;
        !           153:        int dialnorm2;
        !           154:        int surmixlev;
        !           155:        int mixlevel;
        !           156:        int cmixlev;
        !           157:        int mixlevel2;
        !           158:        int fscod;
        !           159:        int lfeon;
        !           160:        int bsid;
        !           161:        int dsurmod;
        !           162:        int frmsizecod;
        !           163:        int langcod;
        !           164:        int langcod2;
        !           165:        int timecod;
        !           166:        int roomtyp;
        !           167:        int timecod2;
        !           168:        int roomtyp2;
        !           169: };
        !           170: 
        !           171: struct AudioPCM {
        !           172:        int present;            // 1: PCM audio stream present
        !           173:        int audio_frm_num;
        !           174:        int num_of_audio_ch;
        !           175:        int Fs;
        !           176:        int quantization;
        !           177:        int emphasis;
        !           178:        int mute_bit;
        !           179: };
        !           180: 
        !           181: struct AudioParam {
        !           182:        int valid;
        !           183:        struct AudioMPEG mpeg;
        !           184:        struct AudioAC3 ac3;
        !           185:        struct AudioPCM pcm;
        !           186: };
        !           187: 
        !           188: struct OSDPicture {            // all u32 pointers are 21 bit word addresses 
        !           189:        int open;               // are the buffers initialized?
        !           190:        int width;              // frame width
        !           191:        int height;             // frame height
        !           192:        int bpp;                // bit per pixel
        !           193:        int evenfirst;          // first line is in even field
        !           194:        int aspectratio;        // pixel aspect ratio: 11/aspectratio
        !           195:        int oddheight;          // height of the odd field
        !           196:        u32 oddmem;             // DRAM address of allocated memory
        !           197:        u32 odddata;            // data (=header) pointer
        !           198:        u32 oddpalette;         // pointer to palette inside data
        !           199:        u32 oddbitmap;          // pointer to bitmap inside data
        !           200:        u32 oddterm;            // pointer to termination header
        !           201:        int evenheight;         // height of the even field
        !           202:        u32 evenmem;            // DRAM address of allocated memory
        !           203:        u32 evendata;           // data (=header) pointer
        !           204:        u32 evenpalette;        // pointer to palette inside data
        !           205:        u32 evenbitmap;         // pointer to bitmap inside data
        !           206:        u32 eventerm;           // pointer to termination header
        !           207: };
        !           208: 
        !           209: struct StreamInfo {
        !           210:        int valid;              // 1: struct contains valid data
        !           211:        int MPEG2;              // 0: MPEG1/ISO11172  1: MPEG2/ISO13818
        !           212:        int hsize;              // overall hsize (hsize&hsizeext)
        !           213:        int vsize;              // overall vsize (vsize&vsizeext)
        !           214:        int bitrate;            // overall bitrate (bitrate&bitrateext)
        !           215:        int vbvbuffersize;      // overall...
        !           216:        struct GOPHeader gop;
        !           217:        struct SequenceHeader sh;
        !           218:        struct SequenceExtension se;
        !           219:        struct AudioParam audio;
        !           220: };
        !           221: 
        !           222: struct StreamSetup {           // user selected parameters for the stream playback
        !           223:        stream_type streamtype; // what is the type of our input stream?
        !           224:        audio_type audioselect; // 0=auto/unknown 1=MPEG 2=LPCM 3=AC3
        !           225:        int videoID;            // stream ID of the video ES, -1 for any
        !           226:        int audioID;            // stream ID of the audio ES, -1 for any
        !           227:        int audioIDext;         // stream ID of the audio extension ES, -1 for none
        !           228:        int SPDIFmode;          // 0:MPEG/AC3 data on digital S/PDIF out 1:IEC956 data on digital S/PDIF out
        !           229: };
        !           230: 
        !           231: #define MAX_PTS 32
        !           232: 
        !           233: typedef struct PTSRecord {
        !           234:        int begin;
        !           235:        int end;
        !           236:        int size;
        !           237:        u32 LastAddr;
        !           238:        u32 AddrB[MAX_PTS];
        !           239:        u32 AddrE[MAX_PTS];
        !           240:        u32 PTS[MAX_PTS];
        !           241: } PTSStorage;
        !           242: 
        !           243: struct cvdv_cards {
        !           244:        struct cvdv_cards *next;
        !           245:        //  struct video_device       video;
        !           246:        void *margi;
        !           247:        struct bus_operations *bus;
        !           248:        u_char scl;
        !           249:        u_char sda;
        !           250:        int i2c_addr;
        !           251:        u32 VideoESSize;                
        !           252:        u32 AudioESSize;                
        !           253:        u32 VideoPESSize;               
        !           254:        u32 DataDumpSize;               
        !           255:        u32 AudioPESSize;               
        !           256:        u32 NaviBankSize;               
        !           257:        int currentAThread;
        !           258:        int currentBThread;
        !           259:        int currentType;
        !           260:        u32 lengthB[NBBUF];
        !           261:        u32 posB[NBBUF];
        !           262:        u32 lengthA[NBBUF];
        !           263:        u32 posA[NBBUF];
        !           264:        ringbuffy rbuf;
        !           265:        int use_ring;
        !           266: 
        !           267:        //  struct video_device   video;
        !           268:        u8 *addr;
        !           269:        unsigned int size;
        !           270:        unsigned int minor;
        !           271:        struct DRAMBlock *DRAMFirstBlock;
        !           272:        u32 DRAMSize;
        !           273:        struct OSDPicture OSD;
        !           274:        int DMAABusy;           // Is the DMA A currently in use?
        !           275:        int DMABBusy;           // Is the DMA B currently in use?
        !           276:        int IntInstalled;       // is the card interrupt routine installed?
        !           277:        int ChannelBuffersAllocated;    // Are the channel buffers for the decoder allocated?
        !           278:        u32 VideoES;            // 21 bit word address of the allocated channel
        !           279:        u32 AudioES;            // 21 bit word address of the allocated channel
        !           280:        u32 VideoPES;           // 21 bit word address of the allocated channel
        !           281:        u32 DataDump;           // 21 bit word address of the allocated channel
        !           282:        u32 AudioPES;           // 21 bit word address of the allocated channel
        !           283:        u32 NaviBank;           // 21 bit word address of the allocated channel
        !           284:        int FrameBuffersAllocated;      // Are the frame buffers for the decoder allocated?
        !           285:        u32 FrameStoreLuma1;    // 21 bit word address of the allocated frame
        !           286:        u32 FrameStoreChroma1;  // 21 bit word address of the allocated frame
        !           287:        u32 FrameStoreLuma2;    // 21 bit word address of the allocated frame
        !           288:        u32 FrameStoreChroma2;  // 21 bit word address of the allocated frame
        !           289:        u32 FrameStoreLumaB;    // 21 bit word address of the allocated frame
        !           290:        u32 FrameStoreChromaB;  // 21 bit word address of the allocated frame
        !           291:        int DecoderOpen;        // Is the Decoder initialized?
        !           292:        u16 AuxFifo[FIFO_MASK + 1];     // Auxiliary Fifo Data
        !           293:        int AuxFifoHead;        // Auxiliary Fifo Position
        !           294:        int AuxFifoTail;        // Auxiliary Fifo Position
        !           295:        u16 DataFifo[FIFO_MASK + 1];    // Data Fifo Data
        !           296:        int DataFifoHead;       // Data Fifo Position
        !           297:        int DataFifoTail;       // Data Fifo Position
        !           298:        int FifoALast;          // last used thread of FIFO A
        !           299:        int FifoBLast;          // last used thread of FIFO B
        !           300:        videosystem videomode;  // current video output mode, PAL or NTSC
        !           301:        struct StreamInfo stream;       // header information of the current stream
        !           302:        struct StreamSetup setup;       // should be filled bevor sending data, but default is OK
        !           303:        int AuxFifoExt;         // used by Aux FIFO parser
        !           304:        int AuxFifoLayer;       //  "   "   "   "     "
        !           305:        int AudioInitialized;   // Is the Audio set up?
        !           306:        int AudioOldMode;       // remainder of the previous mode while trickmodes, or -1
        !           307:        int open[MINORNUM];     // is the 64017 initialized and the video out active?
        !           308:        int closing;            // 1 if char device closed, but DMA still running
        !           309:        int startingV;          // 1 if card is waiting for the Video ES buffer to fill up, to start the decoder
        !           310:        int startingA;          // 1 if card is waiting for the Audio ES buffer to fill up, to start the decoder
        !           311:        int startingDVDV;       // 1 if card is waiting for the Video ES buffer to fill up, to start the decoder
        !           312:        int startingDVDA;       // 1 if card is waiting for the Audio ES buffer to fill up, to start the decoder
        !           313:        int channelrun;         // 1 if channel has been started by the host
        !           314:        u8 *channelA;           // Buffer for channel A
        !           315:        int channelAthread;     // currently filled thread
        !           316:        int channelApos;        // write position in buffer
        !           317:        u8 *channelB;           // Buffer for channel B
        !           318:        int channelBthread;     // currently filled thread
        !           319:        int channelBpos;        // write position in buffer
        !           320:        int fields;             // counter of video fields, debugging only
        !           321:        struct CSS css;         // CSS data
        !           322:        u32 NaviPackAddress;    // Read address of the Navi Pack Buffer
        !           323:        wait_queue_head_t wqA;
        !           324:        wait_queue_head_t wqB;
        !           325:        int threadAthreads;
        !           326:        u8 *threadA[NBBUF];
        !           327:        u32 threadAsize;
        !           328:        int threadBthreads;
        !           329:        u8 *threadB[NBBUF];
        !           330:        u32 threadBsize;
        !           331:        struct tq_struct tqueue_decoder;
        !           332:        struct tq_struct tqueue_dma;
        !           333:        u8 bt864reg[128];       // Bt864/865 register mirror
        !           334:        u8 navibuffer[NAVIBUFFERSIZE];
        !           335:        int navihead;
        !           336:        int navitail;
        !           337:        int intdecodestatus;
        !           338:        int showvideo;
        !           339:        int slowdown;
        !           340:        int lastslow;
        !           341:        int videosteps;
        !           342:        int videodelay;
        !           343:        int videorip;
        !           344:        int videosync;
        !           345:        PTSStorage VideoPTSStore;
        !           346:        PTSStorage AudioPTSStore;
        !           347:        u32 LastAddr;
        !           348:        u32 VPTS;
        !           349:        u32 oldVPTS;
        !           350:        long VSCR;
        !           351:        u32 APTS;
        !           352:        u32 oldAPTS;
        !           353:        long ASCR;
        !           354:        long SyncTime;
        !           355:        int paused;
        !           356:        u16 lastvattr;
        !           357:        u16 lastaattr;
        !           358:        u8 reg07B;              // mirrors of write-only register
        !           359:        u8 reg08F;
        !           360:        u8 reg090;
        !           361:        u8 reg091;
        !           362:        u8 reg092;
        !           363:        u8 reg093;
        !           364:        u8 highlight[10];       // content of registers 1C0 thru 1C0, to be written after next BAV int.
        !           365:        int highlight_valid;    // if 1
        !           366:        int do_flush;           // if 1, send flush packet after last transfer done
        !           367: };
        !           368: 
        !           369: extern u8 FlushPacket[32];
        !           370: 
        !           371: extern struct cvdv_cards *first_card;
        !           372: extern struct cvdv_cards *minorlist[MAXDEV];
        !           373: 
        !           374: void DecoderStreamReset(struct cvdv_cards *card);
        !           375: 
        !           376: void DecoderSetupReset(struct cvdv_cards *card);
        !           377: 
        !           378: void DecoderCSSReset(struct cvdv_cards *card);
        !           379: 
        !           380: void card_init(struct cvdv_cards *card, unsigned int minor);
        !           381: 
        !           382: #endif                         /* CARDBASE_H */

LinuxTV legacy CVS <linuxtv.org/cvs>