diff options
author | Davor Emard <devnull@localhost> | 2003-02-12 16:44:53 +0000 |
---|---|---|
committer | Davor Emard <devnull@localhost> | 2003-02-12 16:44:53 +0000 |
commit | 8a41c9688c1224f01bfebc06e796e973f79eaf29 (patch) | |
tree | 8757be9ee572cf8e9e92830acef9e5fb92896e79 /linux/drivers/media | |
parent | 38ccec7fa983cc87c208209a2cb25d168ed2e5e2 (diff) | |
download | mediapointer-dvb-s2-8a41c9688c1224f01bfebc06e796e973f79eaf29.tar.gz mediapointer-dvb-s2-8a41c9688c1224f01bfebc06e796e973f79eaf29.tar.bz2 |
Vpeirq is rewritten for readability, keeping all the logic and functionality
the same. Now it will be easier for someone to review it and understand what
vpeirq() does.
Diffstat (limited to 'linux/drivers/media')
-rw-r--r-- | linux/drivers/media/dvb/ttpci-budget/budget-core.c | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/linux/drivers/media/dvb/ttpci-budget/budget-core.c b/linux/drivers/media/dvb/ttpci-budget/budget-core.c index 1d899c3d9..87642fc3f 100644 --- a/linux/drivers/media/dvb/ttpci-budget/budget-core.c +++ b/linux/drivers/media/dvb/ttpci-budget/budget-core.c @@ -107,30 +107,32 @@ static void vpeirq (unsigned long data) { struct budget_s *budget = (struct budget_s*) data; u8 *mem=(u8 *)(budget->grabbing); - int num; - u32 dmapos; + u32 olddma = budget->ttbp; + u32 newdma = saa7146_read(budget->dev, PCI_VDP3); - dmapos=saa7146_read(budget->dev, PCI_VDP3); - dmapos-=(dmapos%188); + /* nearest lower position divisible by 188 */ + newdma -= newdma % 188; - if (dmapos >= TS_BUFLEN) + if (newdma >= TS_BUFLEN) return; - if (dmapos > budget->ttbp) { - mem+=budget->ttbp; - num=(dmapos-budget->ttbp)/188; - } else { - if (budget->feeding && mem[budget->ttbp]==0x47) - dvb_dmx_swfilter_packets(&budget->demux, - mem+budget->ttbp, 1024-budget->ttbp/188); + budget->ttbp = newdma; + + if(budget->feeding == 0 || newdma == olddma) + return; - num=dmapos/188; + if (newdma > olddma) { /* no wraparound, dump olddma..newdma */ + if(mem[olddma] == 0x47) + dvb_dmx_swfilter_packets(&budget->demux, + mem+olddma, (newdma-olddma) / 188); + } else { /* wraparound, dump olddma..buflen and 0..newdma */ + if(mem[olddma] == 0x47) + dvb_dmx_swfilter_packets(&budget->demux, + mem+olddma, (TS_BUFLEN-olddma) / 188); + if(mem[0] == 0x47) + dvb_dmx_swfilter_packets(&budget->demux, + mem, newdma / 188); } - - budget->ttbp=dmapos; - - if (budget->feeding && mem[0]==0x47) - dvb_dmx_swfilter_packets(&budget->demux, mem, num); } /* TS_PACKETS is minumum number of accumulated 188-byte packets |