Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 178 → Rev 179

/shark/trunk/drivers/bttv/bttv-driver.c
55,6 → 55,7
 
int bttv_num; /* number of Bt848s in use */
int in_irq = 0;
DWORD oldpci_command;
struct bttv *btvirq;
struct bttv bttvs[BTTV_MAX];
 
143,28 → 144,7
free(ptr-4-*(unsigned long *)(ptr-4));
 
}
/*
* Create the giant waste of buffer space we need for now
* until we get DMA to user space sorted out (probably 2.3.x)
*
* We only create this as and when someone uses mmap
*/
static int fbuffer_alloc(struct bttv *btv)
{
if(!btv->fbuffer) {
btv->fbuffer=(unsigned char *) vmalloc_32(gbuffers*gbufsize);
memset(btv->fbuffer, 0, gbuffers*gbufsize);
} else
printk(KERN_ERR "bttv%d: Double alloc of fbuffer!\n",
btv->nr);
if(!btv->fbuffer)
return -ENOBUFS;
return 0;
}
 
/* ----------------------------------------------------------------------- */
 
void bttv_gpio_tracking(struct bttv *btv, char *comment)
{
unsigned int outbits, data;
998,10 → 978,7
unsigned int *vbuf;
 
if(btv->fbuffer==NULL)
{
if(fbuffer_alloc(btv))
return -ENOBUFS;
}
return -ENOBUFS;
 
if(mp->frame >= gbuffers || mp->frame < 0)
return -EINVAL;
1144,8 → 1121,9
unsigned long tmp;
int need_wait;
 
//bt848_dma(btv,0);
 
vfree_32(btv->fbuffer);
btv->fbuffer = NULL;
btv->user--;
need_wait = (-1 != btv->gq_grab);
btv->gq_start = 0;
1165,15 → 1143,13
* and the DMA control operations are posted PCI
* operations.
*/
tmp = btread(BT848_I2C); /* This fixes the PCI posting delay */
 
tmp = btread(BT848_I2C); /* This fixes the PCI posting delay */
if(btv->fbuffer)
vfree_32((void *) btv->fbuffer);
btv->fbuffer=0;
pci_write_config_dword(btv->dev,PCI_COMMAND,oldpci_command);
 
}
 
 
/***********************************/
/* ioctls and supporting functions */
/***********************************/
2111,7 → 2087,7
DWORD dw;
 
printk(KERN_INFO "Initializing PCI BUS...\n");
btv->dev = vmalloc_32(sizeof(struct pci_dev));
 
/* Scan the devices connected to the PCI bus */
2141,8 → 2117,9
 
pcibios_read_config_dword(bus, dv, PCI_BASE_ADDRESS_0, (DWORD *)&(btv->dev->base_address[0]));
pcibios_read_config_byte(bus, dv, PCI_INTERRUPT_LINE, (BYTE *)&(btv->dev->irq));
 
pcibios_read_config_dword(bus,dv,PCI_COMMAND,&dw);
oldpci_command = dw;
dw |= (PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
pcibios_write_config_dword(bus,dv,PCI_COMMAND,dw);