version 1.10, 2001/03/19 23:49:15
|
version 1.11, 2001/03/29 23:12:01
|
Line 169 static dev_link_t *dev_list = NULL;
|
Line 169 static dev_link_t *dev_list = NULL;
|
(inb, outb, readb, writeb, etc) for card IO. |
(inb, outb, readb, writeb, etc) for card IO. |
*/ |
*/ |
|
|
|
|
void DACSetFrequency(struct cvdv_cards *card, int khz, int multiple) { |
void DACSetFrequency(struct cvdv_cards *card, int khz, int multiple) { |
u8 b = read_indexed_register(card, IIO_OSC_AUD); |
uint8_t b = read_indexed_register(card, IIO_OSC_AUD); |
|
|
b &= 0xf8; |
b &= 0xf8; |
|
|
Line 206 int MargiFreeBuffers(struct cvdv_cards *
|
Line 205 int MargiFreeBuffers(struct cvdv_cards *
|
} |
} |
|
|
|
|
int MargiSetBuffers(struct cvdv_cards *card, u32 size) |
int MargiSetBuffers(struct cvdv_cards *card, uint32_t size) |
{ |
{ |
MargiFreeBuffers(card); |
MargiFreeBuffers(card); |
printk(KERN_DEBUG LOGNAME ": -- MargiSetBuffers(%d)\n", |
printk(KERN_DEBUG LOGNAME ": -- MargiSetBuffers(%d)\n", |
Line 243 int MargiFlush (struct cvdv_cards *card)
|
Line 242 int MargiFlush (struct cvdv_cards *card)
|
|
|
int MargiPush(struct cvdv_cards *card, int count, const char *data) |
int MargiPush(struct cvdv_cards *card, int count, const char *data) |
{ |
{ |
// printk(KERN_DEBUG LOGNAME ": -- MargiPush(%d,0x%08lX)\n",count,(long)data); |
int fill; |
|
|
|
fill = ring_read_rest(&(card->rbuf)); |
|
|
if (!card->use_ring) |
if (!card->use_ring) |
return 0; |
return 0; |
|
|
if (!card->channelrun){ |
if (fill > 3*card->rbuf.size/4 && !card->channelrun){ |
DecoderStartChannel(card); |
DecoderStartChannel(card); |
|
card->DMAABusy = 1; |
} |
} |
|
|
card->DMAABusy = 1; |
|
count = ring_write(&(card->rbuf),data,count); |
count = ring_write(&(card->rbuf),data,count); |
|
|
return count; |
return count; |
} |
} |
|
|
int DecoderStartChannel(struct cvdv_cards *card) |
int DecoderStartChannel(struct cvdv_cards *card) |
{ |
{ |
//DecoderSetByte(card,0x007,0x01); // channel start |
|
DecoderMaskByte(card, 0x007, 0xC3, 0xC3); // channel start |
DecoderMaskByte(card, 0x007, 0xC3, 0xC3); // channel start |
//DecoderSetByte(card,0x005,0x01); // invert channel clock on |
|
//DecoderDelByte(card,0x005,0x02); // channel request mode off |
|
//DecoderDelByte(card,0x005,0x04); // channel pause off |
|
//DecoderDelByte(card,0x005,0x08); // channel bypass enable off |
|
#ifdef BYPASS |
#ifdef BYPASS |
DecoderMaskByte(card,0x005,0x0F,0x08); |
DecoderMaskByte(card,0x005,0x0F,0x08); |
#else |
#else |
Line 275 int DecoderStartChannel(struct cvdv_card
|
Line 274 int DecoderStartChannel(struct cvdv_card
|
|
|
int DecoderStopChannel(struct cvdv_cards *card) |
int DecoderStopChannel(struct cvdv_cards *card) |
{ |
{ |
// DecoderDelByte(card,0x007,0x01); // channel reset |
|
DecoderMaskByte(card, 0x007, 0xC3, 0xC2); // channel reset |
DecoderMaskByte(card, 0x007, 0xC3, 0xC2); // channel reset |
DecoderSetByte(card, 0x005, 0x04); // channel pause |
DecoderSetByte(card, 0x005, 0x04); // channel pause |
card->channelrun = 0; |
card->channelrun = 0; |
return 0; |
return 0; |
} |
} |
|
|
u32 DecoderGetAudioBufferSpace(struct cvdv_cards *card) |
uint32_t DecoderGetAudioBufferSpace(struct cvdv_cards *card) |
{ |
{ |
|
|
u32 MaxSize, Size; |
uint32_t MaxSize, Size; |
|
|
MaxSize = card->AudioESSize; |
MaxSize = card->AudioESSize; |
Size = DecoderGetAudioESLevel(card); |
Size = DecoderGetAudioESLevel(card); |
Line 296 u32 DecoderGetAudioBufferSpace(struct cv
|
Line 294 u32 DecoderGetAudioBufferSpace(struct cv
|
|
|
} |
} |
|
|
u32 DecoderGetVideoBufferSpace(struct cvdv_cards *card) |
uint32_t DecoderGetVideoBufferSpace(struct cvdv_cards *card) |
{ |
{ |
|
|
u32 MaxSize, Size; |
uint32_t MaxSize, Size; |
|
|
MaxSize = card->VideoESSize; |
MaxSize = card->VideoESSize; |
Size = DecoderGetVideoESLevel(card); |
Size = DecoderGetVideoESLevel(card); |
Line 310 u32 DecoderGetVideoBufferSpace(struct cv
|
Line 308 u32 DecoderGetVideoBufferSpace(struct cv
|
|
|
} |
} |
|
|
u32 DecoderGetBufferSpace(struct cvdv_cards *card) |
uint32_t DecoderGetBufferSpace(struct cvdv_cards *card) |
{ |
{ |
u32 audio,video; |
uint32_t audio,video; |
|
|
audio = DecoderGetAudioBufferSpace(card); |
audio = DecoderGetAudioBufferSpace(card); |
video = DecoderGetVideoBufferSpace(card); |
video = DecoderGetVideoBufferSpace(card); |
|
|
if (audio > 2048) audio -= 2048; |
if (audio > 2048) audio -= 2048; |
if (video > 16384) video -= 16384; |
if (video > 2048) video -= 2048; |
|
|
if (audio < video) return audio; |
if (audio < video) return audio; |
return video; |
return video; |
} |
} |
|
|
int MargiWriteDirect(struct cvdv_cards *card, u32 count, const char *buf) |
int MargiWriteDirect(struct cvdv_cards *card, uint32_t count, const char *buf) |
{ |
{ |
u32 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); |
u8 data; |
uint8_t data; |
|
|
stat = read_lsi_status(card); |
stat = read_lsi_status(card); |
if (stat & LSI_ARQ) { |
if (stat & LSI_ARQ) { |
Line 367 int MargiWriteDirect(struct cvdv_cards *
|
Line 365 int MargiWriteDirect(struct cvdv_cards *
|
|
|
static int ringDMA (struct cvdv_cards *card){ |
static int ringDMA (struct cvdv_cards *card){ |
|
|
u32 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); |
u32 count=0; |
uint32_t count=0; |
u8 data; |
uint8_t data; |
|
|
|
|
count = ring_read_rest(&(card->rbuf)); |
count = ring_read_rest(&(card->rbuf)); |
Line 382 static int ringDMA (struct cvdv_cards *c
|
Line 380 static int ringDMA (struct cvdv_cards *c
|
|
|
stat = read_lsi_status(card); |
stat = read_lsi_status(card); |
|
|
/* |
#if 0 |
printk(KERN_DEBUG LOGNAME |
printk(KERN_ERR LOGNAME |
": -- stat: %d readpos: %d writepos: %d \n", |
": -- stat: %d readpos: %d writepos: %d \n", |
stat,card->rbuf.read_pos,card->rbuf.write_pos); |
stat,card->rbuf.read_pos,card->rbuf.write_pos); |
*/ |
#endif |
if (stat & LSI_ARQ) { |
if (stat & LSI_ARQ) { |
stat = read_lsi_status(card); |
stat = read_lsi_status(card); |
} |
} |
Line 406 static int ringDMA (struct cvdv_cards *c
|
Line 404 static int ringDMA (struct cvdv_cards *c
|
|
|
if (!size && |
if (!size && |
!card->DecoderOpen ){ |
!card->DecoderOpen ){ |
printk(KERN_DEBUG LOGNAME |
printk(KERN_ERR LOGNAME |
": -- PREPARE IT ALREADY\n"); |
": -- PREPARE IT ALREADY\n"); |
Prepare(card); |
Prepare(card); |
card->startingV = 1; |
card->startingV = 1; |
card->startingA = 1; |
card->startingA = 1; |
} |
} |
/* |
|
if (count > size) count = size & 0xfffffffc; |
if (count > size) count = size & 0xfffffffc; |
printk(KERN_DEBUG LOGNAME |
#if 0 |
|
printk(KERN_ERR LOGNAME |
": -- stat: %d length: %d size: %d startV: %d startA: %d\n", |
": -- stat: %d length: %d size: %d startV: %d startA: %d\n", |
stat,count,size, card->startingV, card->startingA); |
stat,count,size, card->startingV, card->startingA); |
*/ |
#endif |
|
|
if (count) { |
if (count) { |
ring_read_direct(&(card->rbuf), |
ring_read_direct(&(card->rbuf), |
link->io.BasePort1+DIO_LSI_STATUS, |
link->io.BasePort1+DIO_LSI_STATUS, |
Line 504 void MaskByte(struct cvdv_cards *card, i
|
Line 504 void MaskByte(struct cvdv_cards *card, i
|
|
|
|
|
|
|
#define MAXWRITE 1024 * 100 |
#define MAXWRITE CHANNELBUFFERSIZE |
#define MAX_COUNT 20 |
#define MAX_COUNT 10 |
|
|
#ifdef USE_BH |
#ifdef USE_BH |
struct cvdv_cards *bh_card; |
struct cvdv_cards *bh_card; |
Line 543 static void do_margi(struct cvdv_cards *
|
Line 543 static void do_margi(struct cvdv_cards *
|
|
|
void L64014Intr_function(struct cvdv_cards *card) |
void L64014Intr_function(struct cvdv_cards *card) |
{ |
{ |
u8 control,mask,stat; |
uint8_t control,mask,stat; |
int try; |
int try; |
int count; |
|
|
|
control= read_indexed_register(card, IIO_IRQ_CONTROL); |
control= read_indexed_register(card, IIO_IRQ_CONTROL); |
if (control & IRQ_EN){ |
if (control & IRQ_EN){ |
Line 555 void L64014Intr_function(struct cvdv_car
|
Line 554 void L64014Intr_function(struct cvdv_car
|
stat = read_indexed_register(card, IIO_IRQ_STATUS); |
stat = read_indexed_register(card, IIO_IRQ_STATUS); |
try = 0; |
try = 0; |
while ( (try++ < 100) && (stat & mask) ){ |
while ( (try++ < 100) && (stat & mask) ){ |
|
|
if (stat & DEC_INT) { |
if (stat & VSYNC_INT) { |
write_indexed_register(card,IIO_IRQ_CONTROL, |
|
control & (~DEC_EN)); |
|
write_indexed_register(card,IIO_IRQ_CONTROL, |
|
control); |
|
|
|
if(card->use_ring){ |
|
L64021Intr(card); |
|
} |
|
} |
|
if (stat & VSYNC_INT) { |
|
|
|
write_indexed_register(card,IIO_IRQ_CONTROL, |
write_indexed_register(card,IIO_IRQ_CONTROL, |
control & (~VSYNC_EN)); |
control & (~VSYNC_EN)); |
write_indexed_register(card,IIO_IRQ_CONTROL, |
write_indexed_register(card,IIO_IRQ_CONTROL, |
control); |
control); |
if(card->use_ring){ |
|
L64021Intr(card); |
|
} |
|
|
|
count = ring_read_rest(&(card->rbuf)); |
|
if (count) card->DMAABusy = 1; |
|
|
|
if (card->DMAABusy){ |
if (card->DMAABusy){ |
|
|
Line 587 void L64014Intr_function(struct cvdv_car
|
Line 571 void L64014Intr_function(struct cvdv_car
|
#else |
#else |
do_margi(card); |
do_margi(card); |
#endif |
#endif |
} |
if(card->use_ring){ |
|
L64021Intr(card); |
|
} |
|
} |
|
} |
|
|
|
if (stat & DEC_INT) { |
|
write_indexed_register(card,IIO_IRQ_CONTROL, |
|
control & (~DEC_EN)); |
|
write_indexed_register(card,IIO_IRQ_CONTROL, |
|
control); |
|
|
|
if(card->use_ring){ |
|
L64021Intr(card); |
|
} |
} |
} |
|
|
stat = read_indexed_register(card, IIO_IRQ_STATUS); |
stat = read_indexed_register(card, IIO_IRQ_STATUS); |
Line 653 int L64014RemoveIntr(struct cvdv_cards *
|
Line 651 int L64014RemoveIntr(struct cvdv_cards *
|
} |
} |
|
|
void l64020Reset(struct cvdv_cards *card){ |
void l64020Reset(struct cvdv_cards *card){ |
u8 data; |
uint8_t data; |
|
|
|
|
data = read_indexed_register(card, IIO_LSI_CONTROL); |
data = read_indexed_register(card, IIO_LSI_CONTROL); |
Line 675 void l64020Reset(struct cvdv_cards *card
|
Line 673 void l64020Reset(struct cvdv_cards *card
|
|
|
void ZV_init(struct cvdv_cards *card) |
void ZV_init(struct cvdv_cards *card) |
{ |
{ |
u32 delay, activel; |
uint32_t delay, activel; |
u8 reg; |
uint8_t reg; |
delay = 235; |
delay = 235; |
activel = delay + 1448; |
activel = delay + 1448; |
|
|
// init delay and active lines |
// init delay and active lines |
write_indexed_register(card, IIO_VIDEO_HOR_DELAY, |
write_indexed_register(card, IIO_VIDEO_HOR_DELAY, |
(u8)(delay & 0x00FF)); |
(uint8_t)(delay & 0x00FF)); |
write_indexed_register(card, IIO_VIDEO_HOR_ACTIVE, |
write_indexed_register(card, IIO_VIDEO_HOR_ACTIVE, |
(u8)(activel & 0x00FF)); |
(uint8_t)(activel & 0x00FF)); |
reg = ((u8)((activel >> 4) & 0x0070))|((u8)((delay >> 8) & 0x0007)); |
reg = ((uint8_t)((activel >> 4) & 0x0070))|((uint8_t)((delay >> 8) & 0x0007)); |
write_indexed_register(card, IIO_VIDEO_HOR_HIGH, reg); |
write_indexed_register(card, IIO_VIDEO_HOR_HIGH, reg); |
|
|
//init video |
//init video |
Line 699 void ZV_init(struct cvdv_cards *card)
|
Line 697 void ZV_init(struct cvdv_cards *card)
|
|
|
int L64014Init(struct cvdv_cards *card) |
int L64014Init(struct cvdv_cards *card) |
{ |
{ |
u16 testram[16]; |
uint16_t testram[16]; |
int i, err; |
int i, err; |
|
|
printk(KERN_DEBUG LOGNAME ": -- L64014Init\n"); |
printk(KERN_DEBUG LOGNAME ": -- L64014Init\n"); |