version 1.6, 2001/02/01 14:47:33
|
version 1.7, 2001/03/06 23:39:26
|
Line 79 MODULE_PARM(irq_list, "1-4i");
|
Line 79 MODULE_PARM(irq_list, "1-4i");
|
extern unsigned int major_device_number; |
extern unsigned int major_device_number; |
extern struct file_operations cvdv_fileops; |
extern struct file_operations cvdv_fileops; |
|
|
|
|
typedef struct margi_info_t { |
typedef struct margi_info_t { |
dev_link_t link; |
dev_link_t link; |
dev_node_t node; |
dev_node_t node; |
Line 242 int MargiFlush (struct cvdv_cards *card)
|
Line 241 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); |
// printk(KERN_DEBUG LOGNAME ": -- MargiPush(%d,0x%08lX)\n",count,(long)data); |
Line 336 u32 DecoderGetBufferSpace(struct cvdv_ca
|
Line 333 u32 DecoderGetBufferSpace(struct cvdv_ca
|
return video; |
return video; |
} |
} |
|
|
|
int MargiWriteDirect(struct cvdv_cards *card, u32 count, const char *buf) |
|
{ |
|
u32 size = 0; |
|
u_char stat; |
|
dev_link_t *link = &(((margi_info_t *) card->margi)->link); |
|
u8 data; |
|
|
|
stat = read_lsi_status(card); |
|
if (stat & LSI_ARQ) { |
|
stat = read_lsi_status(card); |
|
} |
|
printk(KERN_DEBUG LOGNAME ": -- stat: %d \n",stat); |
|
|
|
if (stat & LSI_READY){ |
|
data = read_indexed_register(card, IIO_LSI_CONTROL); |
|
data |= RR; |
|
write_indexed_register(card, IIO_LSI_CONTROL, data); |
|
return 0; |
|
} |
|
|
|
if ((stat & LSI_ARQ) == 0) { |
|
size = DecoderGetBufferSpace(card); |
|
if (count > size) count = size & 0xfffffffc; |
|
if (count>=2048) count &=0xfffff800; |
|
count &=0xfffffffc; |
|
|
|
if (count > size) count = size & 0xfffffffc; |
|
printk(KERN_DEBUG LOGNAME ": -- stat:%d length:%d size:%d\n", |
|
stat, count, size); |
|
if (count) { |
|
outsl_ns(link->io.BasePort1+DIO_LSI_STATUS, |
|
buf,count); |
|
|
|
} |
|
} else { |
|
count = 0; |
|
} |
|
|
|
return count; |
|
} |
|
|
static int ringDMA (struct cvdv_cards *card){ |
static int ringDMA (struct cvdv_cards *card){ |
|
|
u32 size = 0; |
u32 size = 0; |
Line 381 static int ringDMA (struct cvdv_cards *c
|
Line 419 static int ringDMA (struct cvdv_cards *c
|
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 |
/* printk(KERN_DEBUG 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); |
*/ |
*/ |
Line 448 void MaskByte(struct cvdv_cards *card, i
|
Line 485 void MaskByte(struct cvdv_cards *card, i
|
|
|
|
|
|
|
#define MAXWRITE 49000 |
#define MAXWRITE 65536 |
#define MAX_COUNT 10 |
#define MAX_COUNT 30 |
|
|
#ifdef USE_BH |
#ifdef USE_BH |
struct cvdv_cards *bh_card; |
struct cvdv_cards *bh_card; |
Line 482 static void do_margi(struct cvdv_cards *
|
Line 519 static void do_margi(struct cvdv_cards *
|
|
|
} |
} |
|
|
void L64014Intr(int irq, void *dev_id, struct pt_regs *regs) |
|
|
|
|
|
|
void L64014Intr_function(struct cvdv_cards *card) |
{ |
{ |
margi_info_t *margi = dev_id; |
|
struct cvdv_cards *card = &(margi->card); |
|
u_char dio_index, lsi_index_low, lsi_index_high; |
|
u8 control,mask,stat; |
u8 control,mask,stat; |
int try; |
int try; |
int count; |
int count; |
|
|
//save registers |
|
dio_index = inb(margi->link.io.BasePort1 + DIO_CONTROL_INDEX); |
|
lsi_index_low = inb(margi->link.io.BasePort1 + DIO_LSI_INDEX_LOW); |
|
lsi_index_high = |
|
inb(margi->link.io.BasePort1 + DIO_LSI_INDEX_HIGH); |
|
|
|
control= read_indexed_register(card, IIO_IRQ_CONTROL); |
control= read_indexed_register(card, IIO_IRQ_CONTROL); |
if (control & IRQ_EN){ |
if (control & IRQ_EN){ |
mask = 0; |
mask = 0; |
Line 542 void L64014Intr(int irq, void *dev_id, s
|
Line 573 void L64014Intr(int irq, void *dev_id, s
|
} |
} |
} |
} |
|
|
|
} |
|
|
|
|
|
#ifdef NOINT |
|
void Timerfunction(unsigned long data) |
|
{ |
|
struct cvdv_cards *card = (struct cvdv_cards *) data; |
|
int i; |
|
|
|
//spin_lock(&card->timelock); |
|
i = del_timer(&card->timer); |
|
L64014Intr_function(card); |
|
//spin_unlock(&card->timelock); |
|
// printk(KERN_DEBUG LOGNAME ": -- timer: %d \n", i); |
|
|
|
card->timer.function = Timerfunction; |
|
card->timer.data=(unsigned long) card; |
|
card->timer.expires=jiffies+1; |
|
add_timer(&card->timer); |
|
|
|
} |
|
#endif |
|
|
|
|
|
void L64014Intr(int irq, void *dev_id, struct pt_regs *regs) |
|
{ |
|
margi_info_t *margi = dev_id; |
|
struct cvdv_cards *card = &(margi->card); |
|
u_char dio_index, lsi_index_low, lsi_index_high; |
|
|
|
//save registers |
|
dio_index = inb(margi->link.io.BasePort1 + DIO_CONTROL_INDEX); |
|
lsi_index_low = inb(margi->link.io.BasePort1 + DIO_LSI_INDEX_LOW); |
|
lsi_index_high = |
|
inb(margi->link.io.BasePort1 + DIO_LSI_INDEX_HIGH); |
|
|
|
|
|
L64014Intr_function(card); |
|
|
//load registers |
//load registers |
outb(dio_index, margi->link.io.BasePort1 + DIO_CONTROL_INDEX); |
outb(dio_index, margi->link.io.BasePort1 + DIO_CONTROL_INDEX); |
outb(lsi_index_low, margi->link.io.BasePort1 + DIO_LSI_INDEX_LOW); |
outb(lsi_index_low, margi->link.io.BasePort1 + DIO_LSI_INDEX_LOW); |
Line 580 void l64020Reset(struct cvdv_cards *card
|
Line 650 void l64020Reset(struct cvdv_cards *card
|
//write_indexed_register(card, IIO_LSI_CONTROL, DR); |
//write_indexed_register(card, IIO_LSI_CONTROL, DR); |
} |
} |
|
|
|
void ZV_init(struct cvdv_cards *card) |
|
{ |
|
u32 delay, activel; |
|
u8 reg; |
|
delay = 235; |
|
activel = delay + 1448; |
|
|
|
// init delay and active lines |
|
write_indexed_register(card, IIO_VIDEO_HOR_DELAY, |
|
(u8)(delay & 0x00FF)); |
|
write_indexed_register(card, IIO_VIDEO_HOR_ACTIVE, |
|
(u8)(activel & 0x00FF)); |
|
reg = ((u8)((activel >> 4) & 0x0070))|((u8)((delay >> 8) & 0x0007)); |
|
write_indexed_register(card, IIO_VIDEO_HOR_HIGH, reg); |
|
|
|
//init video |
|
reg = read_indexed_register(card, IIO_VIDEO_CONTROL0); |
|
reg |= (ZVCLK13 | ZV16BIT | ZVCLKINV); |
|
write_indexed_register(card, IIO_VIDEO_CONTROL0, reg); |
|
reg = read_indexed_register(card, IIO_VIDEO_CONTROL1); |
|
reg |= (ZV_OVERRIDE | ZV_ENABLE); |
|
write_indexed_register(card, IIO_VIDEO_CONTROL1, reg); |
|
} |
|
|
int L64014Init(struct cvdv_cards *card) |
int L64014Init(struct cvdv_cards *card) |
{ |
{ |
u16 testram[16]; |
u16 testram[16]; |
Line 623 int L64014Init(struct cvdv_cards *card)
|
Line 717 int L64014Init(struct cvdv_cards *card)
|
printk("Decoder Status: %d\n", read_lsi_status(card)); |
printk("Decoder Status: %d\n", read_lsi_status(card)); |
printk("lsi stat %d\n", DecoderReadByte(card, 0x005)); |
printk("lsi stat %d\n", DecoderReadByte(card, 0x005)); |
|
|
|
#ifdef USE_ZV |
|
ZV_init(card); |
|
#endif |
L64021Init(card); |
L64021Init(card); |
|
|
// Find out how much DRAM we have |
// Find out how much DRAM we have |
Line 680 void CardDeInit(struct cvdv_cards *card)
|
Line 777 void CardDeInit(struct cvdv_cards *card)
|
CloseCard(card); |
CloseCard(card); |
MargiFlush(card); |
MargiFlush(card); |
MargiFreeBuffers(card); |
MargiFreeBuffers(card); |
|
|
L64014RemoveIntr(card); |
L64014RemoveIntr(card); |
card_init(card, 0); |
card_init(card, 0); |
} |
} |
Line 762 static dev_link_t *margi_attach(void)
|
Line 860 static dev_link_t *margi_attach(void)
|
*/ |
*/ |
link->conf.Attributes = 0; |
link->conf.Attributes = 0; |
link->conf.Vcc = 50; |
link->conf.Vcc = 50; |
|
|
|
#ifndef USE_ZV |
link->conf.IntType = INT_MEMORY_AND_IO; |
link->conf.IntType = INT_MEMORY_AND_IO; |
|
#else |
|
link->conf.IntType = INT_ZOOMED_VIDEO; |
|
#endif |
|
|
/* Register with Card Services */ |
/* Register with Card Services */ |
link->next = dev_list; |
link->next = dev_list; |
Line 947 static void margi_config(dev_link_t * li
|
Line 1050 static void margi_config(dev_link_t * li
|
link->conf.Vpp1 = link->conf.Vpp2 = |
link->conf.Vpp1 = link->conf.Vpp2 = |
dflt.vpp1.param[CISTPL_POWER_VNOM] / 10000; |
dflt.vpp1.param[CISTPL_POWER_VNOM] / 10000; |
|
|
/* Do we need to allocate an interrupt? */ |
|
// if (cfg->irq.IRQInfo1 || dflt.irq.IRQInfo1) |
|
//link->conf.Attributes |= CONF_ENABLE_IRQ; |
|
/* |
/* |
Allocate an interrupt line. Note that this does not assign a |
Allocate an interrupt line. Note that this does not assign a |
handler to the interrupt, unless the 'Handler' member of the |
handler to the interrupt, unless the 'Handler' member of the |
irq structure is initialized. |
irq structure is initialized. |
*/ |
*/ |
|
#ifndef NOINT |
link->irq.Attributes = |
link->irq.Attributes = |
IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; |
IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; |
link->irq.Handler = &L64014Intr; |
link->irq.Handler = &L64014Intr; |
link->irq.Instance = link; |
link->irq.Instance = link; |
link->conf.Attributes |= CONF_ENABLE_IRQ; |
link->conf.Attributes |= CONF_ENABLE_IRQ; |
|
|
#ifdef USE_BH |
#ifdef USE_BH |
init_bh(MARGI_BH, do_margi_bh); |
init_bh(MARGI_BH, do_margi_bh); |
#endif |
#endif |
if (link->conf.Attributes & CONF_ENABLE_IRQ) |
if (link->conf.Attributes & CONF_ENABLE_IRQ) |
CS_CHECK(RequestIRQ, link->handle, &link->irq); |
CS_CHECK(RequestIRQ, link->handle, &link->irq); |
|
#endif |
|
|
/* IO window settings */ |
/* IO window settings */ |
link->io.NumPorts1 = link->io.NumPorts2 = 0; |
link->io.NumPorts1 = link->io.NumPorts2 = 0; |
Line 1069 static void margi_config(dev_link_t * li
|
Line 1169 static void margi_config(dev_link_t * li
|
": ERROR: Failed to install Char-device %d, error %d\n", |
": ERROR: Failed to install Char-device %d, error %d\n", |
CVDV_MAJOR, i); |
CVDV_MAJOR, i); |
} |
} |
|
|
|
|
sprintf(dev->node.dev_name, "margi"); |
sprintf(dev->node.dev_name, "margi"); |
dev->node.major = major_device_number; |
dev->node.major = major_device_number; |
dev->node.minor = minor; |
dev->node.minor = minor; |
link->dev = &dev->node; |
link->dev = &dev->node; |
|
v4l_init(card); |
|
#ifdef DVB |
|
dvb_register(card); |
|
#endif |
/* Finally, report what we've done */ |
/* Finally, report what we've done */ |
printk(KERN_INFO "%s: index 0x%02x: Vcc %d.%d", |
printk(KERN_INFO "%s: index 0x%02x: Vcc %d.%d", |
dev->node.dev_name, link->conf.ConfigIndex, |
dev->node.dev_name, link->conf.ConfigIndex, |
Line 1102 static void margi_config(dev_link_t * li
|
Line 1207 static void margi_config(dev_link_t * li
|
write_indexed_register(card, IIO_GPIO_CONTROL, 0x07); |
write_indexed_register(card, IIO_GPIO_CONTROL, 0x07); |
|
|
L64014Init(card); |
L64014Init(card); |
|
|
// default: color bars |
// default: color bars |
VideoSetBackground(card, 1, 0, 0, 0); // black |
VideoSetBackground(card, 1, 0, 0, 0); // black |
SetVideoSystem(card); |
SetVideoSystem(card); |
Line 1113 static void margi_config(dev_link_t * li
|
Line 1218 static void margi_config(dev_link_t * li
|
write_indexed_register(card, IIO_IRQ_CONTROL, |
write_indexed_register(card, IIO_IRQ_CONTROL, |
IRQ_POL | IRQ_EN | VSYNC_EN); |
IRQ_POL | IRQ_EN | VSYNC_EN); |
// write_indexed_register(card, IIO_IRQ_CONTROL, 0x24); |
// write_indexed_register(card, IIO_IRQ_CONTROL, 0x24); |
|
|
OSDOpen(card, 50, 50, 150, 150, 2, 1); |
OSDOpen(card, 50, 50, 150, 150, 2, 1); |
OSDTest(card); |
OSDTest(card); |
} |
} |
Line 1164 static void margi_release(u_long arg)
|
Line 1270 static void margi_release(u_long arg)
|
unregister_chrdev(major_device_number, CVDV_PROCNAME); |
unregister_chrdev(major_device_number, CVDV_PROCNAME); |
CardDeInit(card); |
CardDeInit(card); |
|
|
|
#ifndef NOINT |
#ifdef USE_BH |
#ifdef USE_BH |
remove_bh(MARGI_BH); |
remove_bh(MARGI_BH); |
#endif |
#endif |
mdelay(100); |
mdelay(100); |
|
#endif |
|
CloseCard(card); |
|
video_unregister_device(&card->video); |
|
#ifdef DVB |
|
dvb_unregister(card); |
|
#endif |
/* Don't bother checking to see if these succeed or not */ |
/* Don't bother checking to see if these succeed or not */ |
if (link->win) |
if (link->win) |
CardServices(ReleaseWindow, link->win); |
CardServices(ReleaseWindow, link->win); |
CardServices(ReleaseConfiguration, link->handle); |
CardServices(ReleaseConfiguration, link->handle); |
if (link->io.NumPorts1) |
if (link->io.NumPorts1) |
CardServices(ReleaseIO, link->handle, &link->io); |
CardServices(ReleaseIO, link->handle, &link->io); |
|
#ifndef NOINT |
if (link->irq.AssignedIRQ) |
if (link->irq.AssignedIRQ) |
CardServices(ReleaseIRQ, link->handle, &link->irq); |
CardServices(ReleaseIRQ, link->handle, &link->irq); |
|
#endif |
link->state &= ~DEV_CONFIG; |
link->state &= ~DEV_CONFIG; |
|
|
if (link->state & DEV_STALE_LINK) |
if (link->state & DEV_STALE_LINK) |