*(rp++)=cpu_to_le32(sg_dma_address(sg)); 
*(rp++)=cpu_to_le32(sg_dma_address(sg)); 
bttv_risc_packed(struct bttv *btv, struct btcx_riscmem *risc,		 struct scatterlist *sglist,		 unsigned int offset, unsigned int bpl,		 unsigned int padding, unsigned int lines){	u32 instructions,line,todo;	struct scatterlist *sg;	u32 *rp;	int rc;	/* estimate risc mem: worst case is one write per page border +	   one write per scan line + sync + jump (all 2 dwords) */	instructions  = (bpl * lines) / PAGE_SIZE + lines;	instructions += 2;	if ((rc = btcx_riscmem_alloc(btv->c.pci,risc,instructions*8)) < 0)		return rc;	/* sync instruction */	rp = risc->cpu;	*(rp++) = cpu_to_le32(BT848_RISC_SYNC|BT848_FIFO_STATUS_FM1);	*(rp++) = cpu_to_le32(0);	/* scan lines */	sg = sglist;	for (line = 0; line < lines; line++) {		if ((btv->opt_vcr_hack) &&		    (line >= (lines - VCR_HACK_LINES)))			continue;		while (offset && offset >= sg_dma_len(sg)) {			offset -= sg_dma_len(sg);			sg++;		}		if (bpl <= sg_dma_len(sg)-offset) {			/* fits into current chunk */			*(rp++)=cpu_to_le32(BT848_RISC_WRITE|BT848_RISC_SOL|					    BT848_RISC_EOL|bpl);			*(rp++)=cpu_to_le32(sg_dma_address(sg)+offset);			offset+=bpl;		} else {			/* scanline needs to be splitted */			todo = bpl;			*(rp++)=cpu_to_le32(BT848_RISC_WRITE|BT848_RISC_SOL|					    (sg_dma_len(sg)-offset));			*(rp++)=cpu_to_le32(sg_dma_address(sg)+offset);			todo -= (sg_dma_len(sg)-offset);			offset = 0;			sg++;			while (todo > sg_dma_len(sg)) {			        *(rp++)=cpu_to_le32(BT848_RISC_WRITE|						    sg_dma_len(sg));			        *(rp++)=cpu_to_le32(sg_dma_address(sg));				todo -= sg_dma_len(sg);				sg++;			}			*(rp++)=cpu_to_le32(BT848_RISC_WRITE|BT848_RISC_EOL|					    todo);			*(rp++)=cpu_to_le32(sg_dma_address(sg));			offset += todo;		}		offset += padding;	}	/* save pointer to jmp instruction address */	risc->jmp = rp;	BUG_ON((risc->jmp - risc->cpu + 2) / 4 > risc->size);	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/f2421ca3383ed35bc634aa29416a3229dc603fa4/bttv-risc.c/clean/drivers/media/video/bttv-risc.c