version 1.14, 2001/05/15 12:40:21
|
version 1.15, 2001/06/01 16:43:07
|
Line 189 void DACSetFrequency(struct cvdv_cards *
|
Line 189 void DACSetFrequency(struct cvdv_cards *
|
|
|
} |
} |
|
|
int MargiFreeBuffers(struct cvdv_cards *card) |
int MargiFreeBuffers(struct cvdv_cards *card, int isB) |
{ |
{ |
MDEBUG(1, ": -- MargiFreeBuffers\n"); |
MDEBUG(1, ": -- MargiFreeBuffers\n"); |
|
|
ring_destroy(&(card->rbufA)); |
if(isB){ |
card->use_ringA = 0; |
ring_destroy(&(card->rbufB)); |
ring_destroy(&(card->rbufB)); |
card->use_ringB = 0; |
card->use_ringB = 0; |
} |
|
if (isB == 2 || isB == 0){ |
|
ring_destroy(&(card->rbufA)); |
|
card->use_ringA = 0; |
|
} |
|
|
return 0; |
return 0; |
} |
} |
|
|
|
|
int MargiSetABuffers(struct cvdv_cards *card, uint32_t size) |
int MargiSetBuffers(struct cvdv_cards *card, uint32_t size, int isB) |
{ |
{ |
MargiFreeBuffers(card); |
int err = 0; |
MDEBUG(1, ": -- MargiSetABuffers(%d)\n", |
|
size); |
|
|
|
ring_init(&(card->rbufA),size); |
MargiFreeBuffers(card,isB); |
card->use_ringA = 1; |
MDEBUG(0, ": -- MargiSetBuffers(%d) %d\n", |
return 0; |
size, isB); |
} |
|
|
|
int MargiSetBBuffers(struct cvdv_cards *card, uint32_t size) |
if (isB){ |
{ |
err = ring_init(&(card->rbufB),size); |
MargiFreeBuffers(card); |
if (!err) card->use_ringB = 1; |
MDEBUG(1, ": -- MargiSetBBuffers(%d)\n", |
} else { |
size); |
err = ring_init(&(card->rbufA),size); |
|
if (!err) card->use_ringA = 1; |
ring_init(&(card->rbufB),size); |
} |
card->use_ringB = 1; |
|
return 0; |
MDEBUG(0,"error: %d use_ringA: %d use_ringB: %d\n",err, |
|
card->use_ringA,card->use_ringB); |
|
return err; |
} |
} |
|
|
|
|
int MargiFlush (struct cvdv_cards *card) |
int MargiFlush (struct cvdv_cards *card) |
{ |
{ |
int co = 0; |
int co = 0; |
Line 259 int MargiPushA(struct cvdv_cards *card,
|
Line 264 int MargiPushA(struct cvdv_cards *card,
|
|
|
if (!card->use_ringA) |
if (!card->use_ringA) |
return 0; |
return 0; |
|
if ((count>fill || fill > 3*card->rbufA.size/4) |
if (fill > 3*card->rbufA.size/4 && !card->channelrun){ |
&& !card->channelrun){ |
DecoderStartChannel(card); |
DecoderStartChannel(card); |
card->DMAABusy = 1; |
card->DMAABusy = 1; |
} |
} |
|
|
count = ring_write(&(card->rbufA),data,count); |
count = ring_write(&(card->rbufA),data,count); |
|
|
return count; |
return count; |
} |
} |
|
|
Line 278 int MargiPushB(struct cvdv_cards *card,
|
Line 283 int MargiPushB(struct cvdv_cards *card,
|
|
|
if (!card->use_ringB) |
if (!card->use_ringB) |
return 0; |
return 0; |
|
if ((count>fill || fill > 3*card->rbufB.size/4) |
if (fill > 3*card->rbufB.size/4 && !card->channelrun){ |
&& !card->channelrun){ |
DecoderStartChannel(card); |
DecoderStartChannel(card); |
card->DMABBusy = 1; |
card->DMABBusy = 1; |
} |
} |
|
|
count = ring_write(&(card->rbufB),data,count); |
count = ring_write(&(card->rbufB),data,count); |
|
|
return count; |
return count; |
} |
} |
|
|
Line 353 uint32_t DecoderGetBufferSpace(struct cv
|
Line 358 uint32_t DecoderGetBufferSpace(struct cv
|
} |
} |
|
|
|
|
static int ringDMA_PES (struct cvdv_cards *card){ |
|
|
|
uint32_t size = 0; |
|
u_char stat; |
|
dev_link_t *link = &(((margi_info_t *) card->margi)->link); |
|
uint32_t count=0; |
|
uint8_t data; |
|
|
|
return 0; |
|
} |
|
|
|
|
|
|
|
static int ringDMA (struct cvdv_cards *card){ |
static int ringDMA (struct cvdv_cards *card){ |
|
|
uint32_t size = 0; |
uint32_t size = 0; |
u_char stat; |
u_char stat; |
dev_link_t *link = &(((margi_info_t *) card->margi)->link); |
dev_link_t *link = &(((margi_info_t *) card->margi)->link); |
uint32_t count=0; |
uint32_t acount=0; |
|
uint32_t vcount=0; |
uint8_t data; |
uint8_t data; |
|
ringbuffy *buffy; |
count = ring_read_rest(&(card->rbufA)); |
int stype; |
if (count < 2048) { |
wait_queue_head_t *wq; |
wake_up_interruptible(&(card->wqA)); |
|
return 0; |
|
} |
|
|
|
stat = read_lsi_status(card); |
stat = read_lsi_status(card); |
|
|
MDEBUG( 3, ": -- stat: %d readpos: %d writepos: %d \n", |
|
stat,(int) card->rbufA.read_pos,(int) card->rbufA.write_pos); |
stype = card->setup.streamtype; |
|
|
if (stat & LSI_ARQ) { |
if (stat & LSI_ARQ) { |
stat = read_lsi_status(card); |
stat = read_lsi_status(card); |
} |
} |
Line 396 static int ringDMA (struct cvdv_cards *c
|
Line 387 static int ringDMA (struct cvdv_cards *c
|
} |
} |
|
|
if ((stat & LSI_ARQ) == 0) { |
if ((stat & LSI_ARQ) == 0) { |
size = DecoderGetBufferSpace(card); |
switch(stype){ |
if (count > size) count = size & 0xfffffffc; |
case stream_PES: |
if (count>=2048) count &=0xfffff800; |
case stream_ES: |
count &=0xfffffffc; |
MDEBUG(0,"write audio\n"); |
|
data = read_indexed_register(card, IIO_LSI_CONTROL); |
|
data &= ~DSVC; |
|
write_indexed_register(card, IIO_LSI_CONTROL, data); |
|
buffy = &card->rbufB; |
|
wq = &(card->wqB); |
|
acount = ring_read_rest(buffy); |
|
size = DecoderGetAudioBufferSpace(card); |
|
if (size > 2048) size -= 2048; |
|
break; |
|
default: |
|
buffy = &card->rbufA; |
|
wq = &(card->wqA); |
|
acount = ring_read_rest(buffy); |
|
size = DecoderGetBufferSpace(card); |
|
break; |
|
} |
|
if (acount > size) acount = size & 0xfffffffc; |
|
if (acount>=2048) acount &=0xfffff800; |
|
acount &=0xfffffffc; |
|
|
if (count > size) count = size & 0xfffffffc; |
if (acount > size) acount = size & 0xfffffffc; |
MDEBUG(3,": -- stat: %d length: %d size: %d startV: %d startA: %d\n", |
if (acount) { |
stat,count,size, card->startingV, card->startingA); |
ring_read_direct(buffy, |
|
link->io.BasePort1+DIO_LSI_STATUS, |
|
acount); |
|
} else { |
|
wake_up_interruptible(wq); |
|
acount = 0; |
|
} |
|
} else { |
|
acount = 0; |
|
} |
|
|
if (count) { |
if ((stat & LSI_VRQ) == 0 && |
ring_read_direct(&(card->rbufA), |
(stype == stream_PES || stype == stream_ES)) { |
|
data = read_indexed_register(card, IIO_LSI_CONTROL); |
|
data |= DSVC; |
|
write_indexed_register(card, IIO_LSI_CONTROL, data); |
|
buffy = &card->rbufA; |
|
wq = &(card->wqA); |
|
vcount = ring_read_rest(buffy); |
|
|
|
size = DecoderGetVideoBufferSpace(card); |
|
if (size > 2048) size -= 2048; |
|
if (vcount > size) vcount = size & 0xfffffffc; |
|
if (vcount>=2048) vcount &=0xfffff800; |
|
vcount &=0xfffffffc; |
|
|
|
if (vcount > size) vcount = size & 0xfffffffc; |
|
if (vcount) { |
|
ring_read_direct(buffy, |
link->io.BasePort1+DIO_LSI_STATUS, |
link->io.BasePort1+DIO_LSI_STATUS, |
count); |
vcount); |
} |
} else { |
|
wake_up_interruptible(wq); |
|
vcount = 0; |
|
} |
} else { |
} else { |
count = 0; |
vcount = 0; |
} |
} |
|
|
return count; |
return vcount+acount; |
} |
} |
|
|
|
|
Line 492 void MaskByte(struct cvdv_cards *card, i
|
Line 530 void MaskByte(struct cvdv_cards *card, i
|
|
|
|
|
#define MAXWRITE CHANNELBUFFERSIZE/2 |
#define MAXWRITE CHANNELBUFFERSIZE/2 |
#define MAX_COUNT 40 |
#define MAX_COUNT 400 |
|
|
#ifdef USE_BH |
#ifdef USE_BH |
struct cvdv_cards *bh_card; |
struct cvdv_cards *bh_card; |
Line 506 static void do_margi(struct cvdv_cards *
|
Line 544 static void do_margi(struct cvdv_cards *
|
{ |
{ |
|
|
#endif |
#endif |
int countA, countB; |
int countA; |
int try; |
int try; |
int stype = card->setup.streamtype; |
int stype = card->setup.streamtype; |
|
|
countA = 0; |
countA = 0; |
countB = 0; |
|
|
|
card->currentType = 0; |
card->currentType = 0; |
for ( try = 0; try < MAX_COUNT ;try++) |
for ( try = 0; try < MAX_COUNT ;try++) |
Line 520 static void do_margi(struct cvdv_cards *
|
Line 557 static void do_margi(struct cvdv_cards *
|
switch (stype){ |
switch (stype){ |
case stream_PES: |
case stream_PES: |
case stream_ES: |
case stream_ES: |
// count = ringDMA_PES(card); |
|
count = ringDMA(card); |
count = ringDMA(card); |
countA += count; |
countA += count; |
if (!count) |
if (!count) |
Line 575 void L64014Intr_function(struct cvdv_car
|
Line 611 void L64014Intr_function(struct cvdv_car
|
if(card->use_ringA || card->use_ringB){ |
if(card->use_ringA || card->use_ringB){ |
L64021Intr(card); |
L64021Intr(card); |
} |
} |
} else { |
} |
wake_up_interruptible(&(card->wqA)); |
|
wake_up_interruptible(&(card->wqB)); |
|
} |
|
} |
} |
|
|
if (stat & DEC_INT) { |
if (stat & DEC_INT) { |
Line 604 void Timerfunction(unsigned long data)
|
Line 637 void Timerfunction(unsigned long data)
|
{ |
{ |
struct cvdv_cards *card = (struct cvdv_cards *) data; |
struct cvdv_cards *card = (struct cvdv_cards *) data; |
|
|
|
|
L64014Intr_function(card); |
L64014Intr_function(card); |
|
|
card->timer.function = Timerfunction; |
card->timer.function = Timerfunction; |
card->timer.data=(unsigned long) card; |
card->timer.data=(unsigned long) card; |
card->timer.expires=jiffies+1; |
card->timer.expires=jiffies+10; |
if ( card->open) |
if ( card->open) |
add_timer(&card->timer); |
add_timer(&card->timer); |
|
|
Line 673 void l64020Reset(struct cvdv_cards *card
|
Line 705 void l64020Reset(struct cvdv_cards *card
|
write_indexed_register(card,IIO_GPIO_PINS,data); |
write_indexed_register(card,IIO_GPIO_PINS,data); |
|
|
//write_indexed_register(card, IIO_LSI_CONTROL, DR); |
//write_indexed_register(card, IIO_LSI_CONTROL, DR); |
|
|
|
data = read_indexed_register(card, IIO_LSI_CONTROL); |
|
data &= ~DSVC; |
|
write_indexed_register(card, IIO_LSI_CONTROL, data); |
|
|
} |
} |
|
|
void ZV_init(struct cvdv_cards *card) |
void ZV_init(struct cvdv_cards *card) |
Line 801 void CardDeInit(struct cvdv_cards *card)
|
Line 838 void CardDeInit(struct cvdv_cards *card)
|
{ |
{ |
CloseCard(card); |
CloseCard(card); |
MargiFlush(card); |
MargiFlush(card); |
MargiFreeBuffers(card); |
MargiFreeBuffers(card,2); |
|
|
L64014RemoveIntr(card); |
L64014RemoveIntr(card); |
card_init(card, 0); |
card_init(card, 0); |