Thread: [Linux1394-cvslog] rev 780 - branches/linux-2.4
Brought to you by:
aeb,
bencollins
From: SVN U. <ben...@li...> - 2003-02-11 18:03:42
|
Author: bencollins Date: 2003-02-11 13:03:06 -0500 (Tue, 11 Feb 2003) New Revision: 780 Added: branches/linux-2.4/ieee1394-ioctl.h Modified: branches/linux-2.4/amdtp.h branches/linux-2.4/dv1394.c branches/linux-2.4/dv1394.h branches/linux-2.4/video1394.c branches/linux-2.4/video1394.h Log: Part 1: Conversion of video1349 to dma routines. Backported from trunk. Part 2: Conversion of ioctl's to a portable base. Modified: branches/linux-2.4/dv1394.h ============================================================================== --- branches/linux-2.4/dv1394.h (original) +++ branches/linux-2.4/dv1394.h 2003-02-11 13:03:07.000000000 -0500 @@ -242,6 +242,7 @@ DV1394_GET_STATUS, }; +#include "ieee1394-ioctl.h" enum pal_or_ntsc { Added: branches/linux-2.4/ieee1394-ioctl.h ============================================================================== --- branches/linux-2.4/ieee1394-ioctl.h (original) +++ branches/linux-2.4/ieee1394-ioctl.h 2003-02-11 13:03:07.000000000 -0500 @@ -0,0 +1,71 @@ +/* Base file for all ieee1394 ioctl's. Linux-1394 has allocated base '#' + * with a range of 0x00-0x3f. */ + +#ifndef __IEEE1394_IOCTL_H +#define __IEEE1394_IOCTL_H + +#include <asm/ioctl.h> +#include <asm/types.h> + + +/* AMDTP Gets 6 */ +#define AMDTP_IOC_CHANNEL _IOW('#', 0x00, struct amdtp_ioctl) +#define AMDTP_IOC_PLUG _IOW('#', 0x01, struct amdtp_ioctl) +#define AMDTP_IOC_PING _IOW('#', 0x02, struct amdtp_ioctl) +#define AMDTP_IOC_ZAP _IO ('#', 0x03) + + +/* DV1394 Gets 10 */ + +/* Get the driver ready to transmit video. pass a struct dv1394_init* as + * the parameter (see below), or NULL to get default parameters */ +#define DV1394_IOC_INIT _IOW('#', 0x06, struct dv1394_init) + +/* Stop transmitting video and free the ringbuffer */ +#define DV1394_IOC_SHUTDOWN _IO ('#', 0x07) + +/* Submit N new frames to be transmitted, where the index of the first new + * frame is first_clear_buffer, and the index of the last new frame is + * (first_clear_buffer + N) % n_frames */ +#define DV1394_IOC_SUBMIT_FRAMES _IO ('#', 0x08) + +/* Block until N buffers are clear (pass N as the parameter) Because we + * re-transmit the last frame on underrun, there will at most be n_frames + * - 1 clear frames at any time */ +#define DV1394_IOC_WAIT_FRAMES _IO ('#', 0x09) + +/* Capture new frames that have been received, where the index of the + * first new frame is first_clear_buffer, and the index of the last new + * frame is (first_clear_buffer + N) % n_frames */ +#define DV1394_IOC_RECEIVE_FRAMES _IO ('#', 0x0a) + +/* Tell card to start receiving DMA */ +#define DV1394_IOC_START_RECEIVE _IO ('#', 0x0b) + +/* Pass a struct dv1394_status* as the parameter */ +#define DV1394_IOC_GET_STATUS _IOR('#', 0x0c, struct dv1394_status) + + +/* Video1394 Gets 10 */ + +#define VIDEO1394_IOC_LISTEN_CHANNEL \ + _IOWR('#', 0x10, struct video1394_mmap) +#define VIDEO1394_IOC_UNLISTEN_CHANNEL \ + _IOW ('#', 0x11, int) +#define VIDEO1394_IOC_LISTEN_QUEUE_BUFFER \ + _IOW ('#', 0x12, struct video1394_wait) +#define VIDEO1394_IOC_LISTEN_WAIT_BUFFER \ + _IOWR('#', 0x13, struct video1394_wait) +#define VIDEO1394_IOC_TALK_CHANNEL \ + _IOWR('#', 0x14, struct video1394_mmap) +#define VIDEO1394_IOC_UNTALK_CHANNEL \ + _IOW ('#', 0x15, int) +#define VIDEO1394_IOC_TALK_QUEUE_BUFFER \ + _IOW ('#', 0x16, sizeof (struct video1394_wait) + \ + sizeof (struct video1394_queue_variable)) +#define VIDEO1394_IOC_TALK_WAIT_BUFFER \ + _IOW ('#', 0x17, struct video1394_wait) +#define VIDEO1394_IOC_LISTEN_POLL_BUFFER \ + _IOWR('#', 0x18, struct video1394_wait) + +#endif /* __IEEE1394_IOCTL_H */ Modified: branches/linux-2.4/amdtp.h ============================================================================== --- branches/linux-2.4/amdtp.h (original) +++ branches/linux-2.4/amdtp.h 2003-02-11 13:03:07.000000000 -0500 @@ -3,8 +3,8 @@ #ifndef __AMDTP_H #define __AMDTP_H -#include <asm/ioctl.h> #include <asm/types.h> +#include "ieee1394-ioctl.h" /* The userspace interface for the Audio & Music Data Transmission * Protocol driver is really simple. First, open /dev/amdtp, use the @@ -57,13 +57,6 @@ * */ -/* We use '#' for our ioctl magic number because it's cool. */ - -#define AMDTP_IOC_CHANNEL _IOW('#', 0, sizeof (struct amdtp_ioctl)) -#define AMDTP_IOC_PLUG _IOW('#', 1, sizeof (struct amdtp_ioctl)) -#define AMDTP_IOC_PING _IOW('#', 2, sizeof (struct amdtp_ioctl)) -#define AMDTP_IOC_ZAP _IO('#', 3) - enum { AMDTP_FORMAT_RAW, AMDTP_FORMAT_IEC958_PCM, Modified: branches/linux-2.4/video1394.c ============================================================================== --- branches/linux-2.4/video1394.c (original) +++ branches/linux-2.4/video1394.c 2003-02-11 13:03:07.000000000 -0500 @@ -51,6 +51,7 @@ #include "ieee1394_core.h" #include "highlevel.h" #include "video1394.h" +#include "dma.h" #include "ohci1394.h" @@ -90,9 +91,14 @@ unsigned int packet_size; unsigned int left_size; unsigned int nb_cmd; - unsigned char *buf; + + struct dma_region dma; + + struct dma_prog_region *prg_reg; + struct dma_cmd **ir_prg; struct it_dma_prg **it_prg; + unsigned int *buffer_status; struct timeval *buffer_time; /* time when the buffer was received */ unsigned int *last_used_cmd; /* For ISO Transmit with @@ -155,74 +161,6 @@ static devfs_handle_t devfs_handle; static struct hpsb_highlevel *hl_handle = NULL; -/* Code taken from bttv.c */ - -/*******************************/ -/* Memory management functions */ -/*******************************/ - -static inline unsigned long kvirt_to_bus(unsigned long adr) -{ - unsigned long kva, ret; - - kva = (unsigned long) page_address(vmalloc_to_page((void *)adr)); - kva |= adr & (PAGE_SIZE-1); /* restore the offset */ - ret = virt_to_bus((void *)kva); - return ret; -} - -/* Here we want the physical address of the memory. - * This is used when initializing the contents of the area. - */ -static inline unsigned long kvirt_to_pa(unsigned long adr) -{ - unsigned long kva, ret; - - kva = (unsigned long) page_address(vmalloc_to_page((void *)adr)); - kva |= adr & (PAGE_SIZE-1); /* restore the offset */ - ret = __pa(kva); - return ret; -} - -static void * rvmalloc(unsigned long size) -{ - void * mem; - unsigned long adr; - - size=PAGE_ALIGN(size); - mem=vmalloc_32(size); - if (mem) - { - memset(mem, 0, size); /* Clear the ram out, - no junk to the user */ - adr=(unsigned long) mem; - while (size > 0) - { - mem_map_reserve(vmalloc_to_page((void *)adr)); - adr+=PAGE_SIZE; - size-=PAGE_SIZE; - } - } - return mem; -} - -static void rvfree(void * mem, unsigned long size) -{ - unsigned long adr; - - if (mem) - { - adr=(unsigned long) mem; - while ((long) size > 0) - { - mem_map_unreserve(vmalloc_to_page((void *)adr)); - adr+=PAGE_SIZE; - size-=PAGE_SIZE; - } - vfree(mem); - } -} -/* End of code taken from bttv.c */ static int free_dma_iso_ctx(struct dma_iso_ctx *d) { @@ -234,20 +172,19 @@ if (d->iso_tasklet.link.next != NULL) ohci1394_unregister_iso_tasklet(d->ohci, &d->iso_tasklet); - if (d->buf) - rvfree((void *)d->buf, d->num_desc * d->buf_size); + dma_region_free(&d->dma); - if (d->ir_prg) { - for (i=0;i<d->num_desc;i++) - if (d->ir_prg[i]) kfree(d->ir_prg[i]); - kfree(d->ir_prg); + if (d->prg_reg) { + for (i = 0; i < d->num_desc; i++) + dma_prog_region_free(&d->prg_reg[i]); + kfree(d->prg_reg); } - if (d->it_prg) { - for (i=0;i<d->num_desc;i++) - if (d->it_prg[i]) kfree(d->it_prg[i]); + if (d->ir_prg) + kfree(d->ir_prg); + + if (d->it_prg) kfree(d->it_prg); - } if (d->buffer_status) kfree(d->buffer_status); @@ -287,18 +224,17 @@ d->frame_size = buf_size; d->buf_size = PAGE_ALIGN(buf_size); d->last_buffer = -1; - d->buf = NULL; - d->ir_prg = NULL; init_waitqueue_head(&d->waitq); - d->buf = rvmalloc(d->num_desc * d->buf_size); + /* Init the regions for easy cleanup */ + dma_region_init(&d->dma); - if (d->buf == NULL) { + if (dma_region_alloc(&d->dma, d->num_desc * d->buf_size, ohci->dev, + PCI_DMA_BIDIRECTIONAL)) { PRINT(KERN_ERR, ohci->id, "Failed to allocate dma buffer"); free_dma_iso_ctx(d); return NULL; } - memset(d->buf, 0, d->num_desc * d->buf_size); if (type == OHCI_ISO_RECEIVE) ohci1394_init_iso_tasklet(&d->iso_tasklet, type, @@ -317,6 +253,17 @@ } d->ctx = d->iso_tasklet.context; + d->prg_reg = kmalloc(d->num_desc * sizeof(struct dma_prog_region), + GFP_KERNEL); + if (d->prg_reg == NULL) { + PRINT(KERN_ERR, ohci->id, "Failed to allocate ir prg regs"); + free_dma_iso_ctx(d); + return NULL; + } + /* Makes for easier cleanup */ + for (i = 0; i < d->num_desc; i++) + dma_prog_region_init(&d->prg_reg[i]); + if (type == OHCI_ISO_RECEIVE) { d->ctrlSet = OHCI1394_IsoRcvContextControlSet+32*d->ctx; d->ctrlClear = OHCI1394_IsoRcvContextControlClear+32*d->ctx; @@ -327,31 +274,27 @@ GFP_KERNEL); if (d->ir_prg == NULL) { - PRINT(KERN_ERR, ohci->id, - "Failed to allocate dma ir prg"); + PRINT(KERN_ERR, ohci->id, "Failed to allocate dma ir prg"); free_dma_iso_ctx(d); return NULL; } memset(d->ir_prg, 0, d->num_desc * sizeof(struct dma_cmd *)); - + d->nb_cmd = d->buf_size / PAGE_SIZE + 1; d->left_size = (d->frame_size % PAGE_SIZE) ? d->frame_size % PAGE_SIZE : PAGE_SIZE; - for (i=0;i<d->num_desc;i++) { - d->ir_prg[i] = kmalloc(d->nb_cmd * - sizeof(struct dma_cmd), - GFP_KERNEL); - if (d->ir_prg[i] == NULL) { - PRINT(KERN_ERR, ohci->id, - "Failed to allocate dma ir prg"); + for (i = 0;i < d->num_desc; i++) { + if (dma_prog_region_alloc(&d->prg_reg[i], d->nb_cmd * + sizeof(struct dma_cmd), ohci->dev)) { + PRINT(KERN_ERR, ohci->id, "Failed to allocate dma ir prg"); free_dma_iso_ctx(d); return NULL; } + d->ir_prg[i] = (struct dma_cmd *)d->prg_reg[i].kvirt; } - } - else { /* OHCI_ISO_TRANSMIT */ + } else { /* OHCI_ISO_TRANSMIT */ d->ctrlSet = OHCI1394_IsoXmitContextControlSet+16*d->ctx; d->ctrlClear = OHCI1394_IsoXmitContextControlClear+16*d->ctx; d->cmdPtr = OHCI1394_IsoXmitCommandPtr+16*d->ctx; @@ -382,20 +325,17 @@ if (d->frame_size % d->packet_size) { d->nb_cmd++; d->left_size = d->frame_size % d->packet_size; - } - else + } else d->left_size = d->packet_size; - for (i=0;i<d->num_desc;i++) { - d->it_prg[i] = kmalloc(d->nb_cmd * - sizeof(struct it_dma_prg), - GFP_KERNEL); - if (d->it_prg[i] == NULL) { - PRINT(KERN_ERR, ohci->id, - "Failed to allocate dma it prg"); + for (i = 0; i < d->num_desc; i++) { + if (dma_prog_region_alloc(&d->prg_reg[i], d->nb_cmd * + sizeof(struct it_dma_prg), ohci->dev)) { + PRINT(KERN_ERR, ohci->id, "Failed to allocate dma it prg"); free_dma_iso_ctx(d); return NULL; } + d->it_prg[i] = (struct it_dma_prg *)d->prg_reg[i].kvirt; } } @@ -448,7 +388,7 @@ int i; d->ir_prg[n][0].status = cpu_to_le32(4); d->ir_prg[n][1].status = cpu_to_le32(PAGE_SIZE-4); - for (i=2;i<d->nb_cmd-1;i++) + for (i = 2; i < d->nb_cmd - 1; i++) d->ir_prg[n][i].status = cpu_to_le32(PAGE_SIZE); d->ir_prg[n][i].status = cpu_to_le32(d->left_size); } @@ -456,7 +396,8 @@ static void initialize_dma_ir_prg(struct dma_iso_ctx *d, int n, int flags) { struct dma_cmd *ir_prg = d->ir_prg[n]; - unsigned long buf = (unsigned long)d->buf+n*d->buf_size; + struct dma_prog_region *ir_reg = &d->prg_reg[n]; + unsigned long buf = (unsigned long)d->dma.kvirt + n * d->buf_size; int i; /* the first descriptor will read only 4 bytes */ @@ -467,31 +408,37 @@ if (flags & VIDEO1394_SYNC_FRAMES) ir_prg[0].control |= cpu_to_le32(DMA_CTL_WAIT); - ir_prg[0].address = cpu_to_le32(kvirt_to_bus(buf)); - ir_prg[0].branchAddress = cpu_to_le32((virt_to_bus(&(ir_prg[1].control)) - & 0xfffffff0) | 0x1); + ir_prg[0].address = cpu_to_le32(dma_region_offset_to_bus(&d->dma, buf - + (unsigned long)d->dma.kvirt)); + ir_prg[0].branchAddress = cpu_to_le32((dma_prog_region_offset_to_bus(ir_reg, + 1 * sizeof(struct dma_cmd)) & 0xfffffff0) | 0x1); /* the second descriptor will read PAGE_SIZE-4 bytes */ ir_prg[1].control = cpu_to_le32(DMA_CTL_INPUT_MORE | DMA_CTL_UPDATE | DMA_CTL_BRANCH | (PAGE_SIZE-4)); - ir_prg[1].address = cpu_to_le32(kvirt_to_bus(buf+4)); - ir_prg[1].branchAddress = cpu_to_le32((virt_to_bus(&(ir_prg[2].control)) - & 0xfffffff0) | 0x1); + ir_prg[1].address = cpu_to_le32(dma_region_offset_to_bus(&d->dma, (buf + 4) - + (unsigned long)d->dma.kvirt)); + ir_prg[1].branchAddress = cpu_to_le32((dma_prog_region_offset_to_bus(ir_reg, + 2 * sizeof(struct dma_cmd)) & 0xfffffff0) | 0x1); for (i=2;i<d->nb_cmd-1;i++) { ir_prg[i].control = cpu_to_le32(DMA_CTL_INPUT_MORE | DMA_CTL_UPDATE | DMA_CTL_BRANCH | PAGE_SIZE); - ir_prg[i].address = cpu_to_le32(kvirt_to_bus(buf+(i-1)*PAGE_SIZE)); - - ir_prg[i].branchAddress = - cpu_to_le32((virt_to_bus(&(ir_prg[i+1].control)) - & 0xfffffff0) | 0x1); + ir_prg[i].address = cpu_to_le32(dma_region_offset_to_bus(&d->dma, + (buf+(i-1)*PAGE_SIZE) - + (unsigned long)d->dma.kvirt)); + + ir_prg[i].branchAddress = + cpu_to_le32((dma_prog_region_offset_to_bus(ir_reg, + (i + 1) * sizeof(struct dma_cmd)) & 0xfffffff0) | 0x1); } /* the last descriptor will generate an interrupt */ ir_prg[i].control = cpu_to_le32(DMA_CTL_INPUT_MORE | DMA_CTL_UPDATE | DMA_CTL_IRQ | DMA_CTL_BRANCH | d->left_size); - ir_prg[i].address = cpu_to_le32(kvirt_to_bus(buf+(i-1)*PAGE_SIZE)); + ir_prg[i].address = cpu_to_le32(dma_region_offset_to_bus(&d->dma, + (buf+(i-1)*PAGE_SIZE) - + (unsigned long)d->dma.kvirt)); } static void initialize_dma_ir_ctx(struct dma_iso_ctx *d, int tag, int flags) @@ -566,7 +513,7 @@ static inline void put_timestamp(struct ti_ohci *ohci, struct dma_iso_ctx * d, int n) { - unsigned char* buf = d->buf + n * d->buf_size; + unsigned char* buf = d->dma.kvirt + n * d->buf_size; u32 cycleTimer; u32 timeStamp; @@ -595,7 +542,7 @@ if (n == -1) { return; } - buf = d->buf + n * d->buf_size; + buf = d->dma.kvirt + n * d->buf_size; timeStamp += (d->last_used_cmd[n] << 12) & 0xffff; @@ -642,7 +589,8 @@ static void initialize_dma_it_prg(struct dma_iso_ctx *d, int n, int sync_tag) { struct it_dma_prg *it_prg = d->it_prg[n]; - unsigned long buf = (unsigned long)d->buf+n*d->buf_size; + struct dma_prog_region *it_reg = &d->prg_reg[n]; + unsigned long buf = (unsigned long)d->dma.kvirt + n * d->buf_size; int i; d->last_used_cmd[n] = d->nb_cmd - 1; for (i=0;i<d->nb_cmd;i++) { @@ -666,18 +614,18 @@ it_prg[i].end.control = cpu_to_le32(DMA_CTL_OUTPUT_LAST | DMA_CTL_BRANCH); it_prg[i].end.address = - cpu_to_le32(kvirt_to_bus(buf+i*d->packet_size)); + cpu_to_le32(dma_region_offset_to_bus(&d->dma, (buf+i*d->packet_size) - + (unsigned long)d->dma.kvirt)); if (i<d->nb_cmd-1) { it_prg[i].end.control |= cpu_to_le32(d->packet_size); it_prg[i].begin.branchAddress = - cpu_to_le32((virt_to_bus(&(it_prg[i+1].begin.control)) - & 0xfffffff0) | 0x3); + cpu_to_le32((dma_prog_region_offset_to_bus(it_reg, (i + 1) * + sizeof(struct it_dma_prg)) & 0xfffffff0) | 0x3); it_prg[i].end.branchAddress = - cpu_to_le32((virt_to_bus(&(it_prg[i+1].begin.control)) - & 0xfffffff0) | 0x3); - } - else { + cpu_to_le32((dma_prog_region_offset_to_bus(it_reg, (i + 1) * + sizeof(struct it_dma_prg)) & 0xfffffff0) | 0x3); + } else { /* the last prg generates an interrupt */ it_prg[i].end.control |= cpu_to_le32(DMA_CTL_UPDATE | DMA_CTL_IRQ | d->left_size); @@ -686,15 +634,6 @@ it_prg[i].end.branchAddress = 0; } it_prg[i].end.status = 0; - -#if 0 - printk("%d:%d: %08x-%08x ctrl %08x brch %08x d0 %08x d1 %08x\n",n,i, - virt_to_bus(&(it_prg[i].begin.control)), - virt_to_bus(&(it_prg[i].end.control)), - it_prg[i].end.control, - it_prg[i].end.branchAddress, - it_prg[i].data[0], it_prg[i].data[1]); -#endif } } @@ -703,6 +642,7 @@ struct ti_ohci *ohci) { struct it_dma_prg *it_prg = d->it_prg[n]; + struct dma_prog_region *it_reg = &d->prg_reg[n]; int i; #if 0 @@ -724,12 +664,12 @@ if (i < d->nb_cmd-1 && packet_sizes[i+1] != 0) { it_prg[i].end.control |= cpu_to_le32(size); - it_prg[i].begin.branchAddress = - cpu_to_le32((virt_to_bus(&(it_prg[i+1].begin.control)) - & 0xfffffff0) | 0x3); - it_prg[i].end.branchAddress = - cpu_to_le32((virt_to_bus(&(it_prg[i+1].begin.control)) - & 0xfffffff0) | 0x3); + it_prg[i].begin.branchAddress = + cpu_to_le32((dma_prog_region_offset_to_bus(it_reg, (i + 1) * + sizeof(struct it_dma_prg)) & 0xfffffff0) | 0x3); + it_prg[i].end.branchAddress = + cpu_to_le32((dma_prog_region_offset_to_bus(it_reg, (i + 1) * + sizeof(struct it_dma_prg)) & 0xfffffff0) | 0x3); } else { /* the last prg generates an interrupt */ it_prg[i].end.control |= cpu_to_le32(DMA_CTL_UPDATE | @@ -761,37 +701,6 @@ reg_write(ohci, OHCI1394_IsoXmitIntMaskSet, 1<<d->ctx); } -static int do_iso_mmap(struct ti_ohci *ohci, struct dma_iso_ctx *d, - struct vm_area_struct *vma) -{ - unsigned long start = vma->vm_start; - unsigned long size = vma->vm_end - vma->vm_start; - unsigned long page, pos; - - if (size > d->num_desc * d->buf_size) { - PRINT(KERN_ERR, ohci->id, - "iso context %d buf size is different from mmap size", - d->ctx); - return -EINVAL; - } - if (!d->buf) { - PRINT(KERN_ERR, ohci->id, - "iso context %d is not allocated", d->ctx); - return -EINVAL; - } - - pos = (unsigned long) d->buf; - while (size > 0) { - page = kvirt_to_pa(pos); - if (remap_page_range_1394(vma, start, page, PAGE_SIZE, PAGE_SHARED)) - return -EAGAIN; - start += PAGE_SIZE; - pos += PAGE_SIZE; - size -= PAGE_SIZE; - } - return 0; -} - static int video1394_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { @@ -804,6 +713,8 @@ { case VIDEO1394_LISTEN_CHANNEL: case VIDEO1394_TALK_CHANNEL: + case VIDEO1394_IOC_LISTEN_CHANNEL: + case VIDEO1394_IOC_TALK_CHANNEL: { struct video1394_mmap v; u64 mask; @@ -862,7 +773,7 @@ return -EFAULT; } - if (cmd == VIDEO1394_LISTEN_CHANNEL) { + if (cmd == VIDEO1394_IOC_LISTEN_CHANNEL || cmd == VIDEO1394_LISTEN_CHANNEL) { d = alloc_dma_iso_ctx(ohci, OHCI_ISO_RECEIVE, v.nb_buffers, v.buf_size, v.channel, 0); @@ -912,8 +823,10 @@ return 0; } - case VIDEO1394_UNLISTEN_CHANNEL: + case VIDEO1394_UNLISTEN_CHANNEL: case VIDEO1394_UNTALK_CHANNEL: + case VIDEO1394_IOC_UNLISTEN_CHANNEL: + case VIDEO1394_IOC_UNTALK_CHANNEL: { int channel; u64 mask; @@ -937,7 +850,7 @@ /* Mark this channel as unused */ ohci->ISO_channel_usage &= ~mask; - if (cmd == VIDEO1394_UNLISTEN_CHANNEL) + if (cmd == VIDEO1394_IOC_UNLISTEN_CHANNEL || cmd == VIDEO1394_UNLISTEN_CHANNEL) d = find_ctx(&ctx->context_list, OHCI_ISO_RECEIVE, channel); else d = find_ctx(&ctx->context_list, OHCI_ISO_TRANSMIT, channel); @@ -950,6 +863,7 @@ return 0; } case VIDEO1394_LISTEN_QUEUE_BUFFER: + case VIDEO1394_IOC_LISTEN_QUEUE_BUFFER: { struct video1394_wait v; struct dma_iso_ctx *d; @@ -976,10 +890,10 @@ d->buffer_status[v.buffer]=VIDEO1394_BUFFER_QUEUED; - if (d->last_buffer>=0) - d->ir_prg[d->last_buffer][d->nb_cmd-1].branchAddress = - cpu_to_le32((virt_to_bus(&(d->ir_prg[v.buffer][0].control)) - & 0xfffffff0) | 0x1); + if (d->last_buffer>=0) + d->ir_prg[d->last_buffer][d->nb_cmd-1].branchAddress = + cpu_to_le32((dma_prog_region_offset_to_bus(&d->prg_reg[v.buffer], 0) + & 0xfffffff0) | 0x1); d->last_buffer = v.buffer; @@ -992,9 +906,9 @@ DBGMSG(ohci->id, "Starting iso DMA ctx=%d",d->ctx); /* Tell the controller where the first program is */ - reg_write(ohci, d->cmdPtr, - virt_to_bus(&(d->ir_prg[v.buffer][0]))|0x1); - + reg_write(ohci, d->cmdPtr, + dma_prog_region_offset_to_bus(&d->prg_reg[v.buffer], 0) | 0x1); + /* Run IR context */ reg_write(ohci, d->ctrlSet, 0x8000); } @@ -1011,6 +925,8 @@ } case VIDEO1394_LISTEN_WAIT_BUFFER: case VIDEO1394_LISTEN_POLL_BUFFER: + case VIDEO1394_IOC_LISTEN_WAIT_BUFFER: + case VIDEO1394_IOC_LISTEN_POLL_BUFFER: { struct video1394_wait v; struct dma_iso_ctx *d; @@ -1037,7 +953,8 @@ d->buffer_status[v.buffer]=VIDEO1394_BUFFER_FREE; break; case VIDEO1394_BUFFER_QUEUED: - if (cmd == VIDEO1394_LISTEN_POLL_BUFFER) { + if (cmd == VIDEO1394_IOC_LISTEN_POLL_BUFFER || + cmd == VIDEO1394_LISTEN_POLL_BUFFER) { /* for polling, return error code EINTR */ spin_unlock_irqrestore(&d->lock, flags); return -EINTR; @@ -1092,6 +1009,7 @@ return 0; } case VIDEO1394_TALK_QUEUE_BUFFER: + case VIDEO1394_IOC_TALK_QUEUE_BUFFER: { struct video1394_wait v; struct video1394_queue_variable qv; @@ -1134,18 +1052,16 @@ d->buffer_status[v.buffer]=VIDEO1394_BUFFER_QUEUED; - if (d->last_buffer>=0) { + if (d->last_buffer >= 0) { d->it_prg[d->last_buffer] - [ d->last_used_cmd[d->last_buffer] - ].end.branchAddress = - cpu_to_le32((virt_to_bus(&(d->it_prg[v.buffer][0].begin.control)) - & 0xfffffff0) | 0x3); + [ d->last_used_cmd[d->last_buffer] ].end.branchAddress = + cpu_to_le32((dma_prog_region_offset_to_bus(&d->prg_reg[v.buffer], + 0) & 0xfffffff0) | 0x3); d->it_prg[d->last_buffer] - [d->last_used_cmd[d->last_buffer] - ].begin.branchAddress = - cpu_to_le32((virt_to_bus(&(d->it_prg[v.buffer][0].begin.control)) - & 0xfffffff0) | 0x3); + [ d->last_used_cmd[d->last_buffer] ].begin.branchAddress = + cpu_to_le32((dma_prog_region_offset_to_bus(&d->prg_reg[v.buffer], + 0) & 0xfffffff0) | 0x3); d->next_buffer[d->last_buffer] = v.buffer; } d->last_buffer = v.buffer; @@ -1162,9 +1078,9 @@ put_timestamp(ohci, d, d->last_buffer); /* Tell the controller where the first program is */ - reg_write(ohci, d->cmdPtr, - virt_to_bus(&(d->it_prg[v.buffer][0]))|0x3); - + reg_write(ohci, d->cmdPtr, + dma_prog_region_offset_to_bus(&d->prg_reg[v.buffer], 0) | 0x3); + /* Run IT context */ reg_write(ohci, d->ctrlSet, 0x8000); } @@ -1182,6 +1098,7 @@ } case VIDEO1394_TALK_WAIT_BUFFER: + case VIDEO1394_IOC_TALK_WAIT_BUFFER: { struct video1394_wait v; struct dma_iso_ctx *d; @@ -1250,7 +1167,7 @@ if (ctx->current_ctx == NULL) { PRINT(KERN_ERR, ohci->id, "Current iso context not set"); } else - res = do_iso_mmap(ohci, ctx->current_ctx, vma); + res = dma_region_mmap(&ctx->current_ctx->dma, file, vma); unlock_kernel(); return res; } Modified: branches/linux-2.4/dv1394.c ============================================================================== --- branches/linux-2.4/dv1394.c (original) +++ branches/linux-2.4/dv1394.c 2003-02-11 13:03:07.000000000 -0500 @@ -1608,7 +1608,8 @@ switch(cmd) { - case DV1394_SUBMIT_FRAMES: { + case DV1394_SUBMIT_FRAMES: + case DV1394_IOC_SUBMIT_FRAMES: { unsigned int n_submit; if( !video_card_initialized(video) ) { @@ -1661,8 +1662,8 @@ ret = 0; break; } - - case DV1394_WAIT_FRAMES: { + case DV1394_WAIT_FRAMES: + case DV1394_IOC_WAIT_FRAMES: { unsigned int n_wait; if( !video_card_initialized(video) ) { @@ -1710,8 +1711,8 @@ ret = 0; break; } - - case DV1394_RECEIVE_FRAMES: { + case DV1394_RECEIVE_FRAMES: + case DV1394_IOC_RECEIVE_FRAMES: { unsigned int n_recv; if( !video_card_initialized(video) ) { @@ -1743,8 +1744,8 @@ ret = 0; break; } - - case DV1394_START_RECEIVE: { + case DV1394_START_RECEIVE: + case DV1394_IOC_START_RECEIVE: { if( !video_card_initialized(video) ) { ret = do_dv1394_init_default(video); if(ret) @@ -1760,8 +1761,8 @@ ret = 0; break; } - - case DV1394_INIT: { + case DV1394_INIT: + case DV1394_IOC_INIT: { struct dv1394_init init; if(arg == (unsigned long) NULL) { ret = do_dv1394_init_default(video); @@ -1774,13 +1775,13 @@ } break; } - case DV1394_SHUTDOWN: + case DV1394_IOC_SHUTDOWN: ret = do_dv1394_shutdown(video, 0); break; - - case DV1394_GET_STATUS: { + case DV1394_GET_STATUS: + case DV1394_IOC_GET_STATUS: { struct dv1394_status status; if( !video_card_initialized(video) ) { Modified: branches/linux-2.4/video1394.h ============================================================================== --- branches/linux-2.4/video1394.h (original) +++ branches/linux-2.4/video1394.h 2003-02-11 13:03:07.000000000 -0500 @@ -21,6 +21,8 @@ #ifndef _VIDEO_1394_H #define _VIDEO_1394_H +#include "ieee1394-ioctl.h" + #define VIDEO1394_DRIVER_NAME "video1394" #define VIDEO1394_MAX_SIZE 0x4000000 |