Lines Matching +full:register +full:- +full:mapped

5 :Author: Hans-Jürgen Koch Linux developer, Linutronix
6 :Date: 2006-12-11
12 ------------
18 -------
39 - The device has memory that can be mapped. The device can be
42 - The device usually generates interrupts.
44 - The device does not fit into one of the standard kernel subsystems.
47 ---------------
54 --------
64 - only one small kernel module to write and maintain.
66 - develop the main part of your driver in user space, with all the
69 - bugs in your driver won't crash the kernel.
71 - updates of your driver can take place without recompiling the kernel.
74 -------------
95 register. In such a case, the kernel has to disable the IRQ completely
96 to leave the chip's register untouched. Now the userspace part can
97 determine the cause of the interrupt, but it cannot re-enable
98 interrupts. Another cornercase is chips where re-enabling interrupts is
99 a read-modify-write operation to a combined IRQ status/acknowledge
100 register. This would be racy if a new interrupt occurred simultaneously.
107 to write a 32-bit value that is usually either 0 or 1 to disable or
110 ``-ENOSYS``.
113 own interrupt handler. It will automatically be called by the built-in
130 - ``name``: The name of your device. It is recommended to use the name
133 - ``version``: A version string defined by your driver. This allows the
137 - ``event``: The total number of interrupts handled by the driver since
154 Each ``mapX/`` directory contains four read-only files that show
157 - ``name``: A string identifier for this mapping. This is optional, the
161 - ``addr``: The address of memory that can be mapped.
163 - ``size``: The size, in bytes, of the memory pointed to by addr.
165 - ``offset``: The offset, in bytes, that has to be added to the pointer
178 Sometimes there is hardware with memory-like regions that can not be
179 mapped with the technique described here, but there are still ways to
185 Since these ioport regions can not be mapped, they will not appear under
197 Each ``portX/`` directory contains four read-only files that show name,
200 - ``name``: A string identifier for this port region. The string is
204 - ``start``: The first port of this region.
206 - ``size``: The number of ports in this region.
208 - ``porttype``: A string describing the type of port.
217 ---------------
222 - ``const char *name``: Required. The name of your driver as it will
225 - ``const char *version``: Required. This string appears in
228 - ``struct uio_mem mem[ MAX_UIO_MAPS ]``: Required if you have memory
229 that can be mapped with :c:func:`mmap()`. For each mapping you
233 - ``struct uio_port port[ MAX_UIO_PORTS_REGIONS ]``: Required if you
238 - ``long irq``: Required. If your hardware generates an interrupt, it's
245 - ``unsigned long irq_flags``: Required if you've set ``irq`` to a
249 - ``int (*mmap)(struct uio_info *info, struct vm_area_struct *vma)``:
252 :c:func:`mmap()` will be called instead of the built-in one.
254 - ``int (*open)(struct uio_info *info, struct inode *inode)``:
258 - ``int (*release)(struct uio_info *info, struct inode *inode)``:
262 - ``int (*irqcontrol)(struct uio_info *info, s32 irq_on)``:
269 mapped to user space. For each region, you have to set up a
273 - ``const char *name``: Optional. Set this to help identify the memory
276 - ``int memtype``: Required if the mapping is used. Set this to
278 mapped. Use ``UIO_MEM_LOGICAL`` for logical memory (e.g. allocated
282 - ``phys_addr_t addr``: Required if the mapping is used. Fill in the
286 - ``resource_size_t size``: Fill in the size of the memory block that
291 - ``void *internal_addr``: If you have to access this memory region
294 this function cannot be mapped to user space, so you must not store
303 be mapped to userspace. But if there are other possibilities for
309 - ``char *porttype``: Required. Set this to one of the predefined
313 - ``unsigned long start``: Required if the port region is used. Fill in
316 - ``unsigned long size``: Fill in the number of ports in this region.
325 ---------------------------
347 not. This is usually done by looking at an interrupt status register. If
360 -----------------------------------
377 and register the device.
383 ------------------------------------------
411 When used in a device-tree enabled system, the driver needs to be
416 ``"linux,uio-name"`` may be specified in the DT node.
419 ------------------------------------------
424 dma-mapping API, may be particularly useful. The ``uio_dmem_genirq``
438 - ``struct uio_info uioinfo``: The same structure used as the
441 - ``unsigned int *dynamic_region_sizes``: Pointer to list of sizes of
442 dynamic memory regions to be mapped into user space.
444 - ``unsigned int num_dynamic_regions``: Number of elements in
469 -----------------------------------------
492 --------------------
507 mapped beginning with its start address.
510 ----------------------
512 After you successfully mapped your devices memory, you can access it
518 ``/dev/uioX`` is a read-only file. A :c:func:`read()` will always
535 driver, removing the need to write a hardware-specific kernel module.
538 --------------------------------------
552 echo -n 0000:00:19.0 > /sys/bus/pci/drivers/e1000e/unbind
553 echo -n 0000:00:19.0 > /sys/bus/pci/drivers/uio_pci_generic/bind
558 ls -l /sys/bus/pci/devices/0000:00:19.0/driver
562 .../0000:00:19.0/driver -> ../../../bus/pci/drivers/uio_pci_generic
572 ------------------------------------
575 command register and Interrupt Status bit in the PCI status register.
579 Interrupt Disable Bit in the command register.
587 ------------------------------------------------
590 wraps it, to talk to the device and to re-enable interrupts by writing
591 to the command register.
594 ----------------------------------
646 /* Re-enable interrupts. */
664 Generic Hyper-V UIO driver
668 supports devices on the Hyper-V VMBus similar to uio_pci_generic on
672 --------------------------------------
680 echo "f8615163-df3e-46c5-913f-f2d2f965ed0e" > /sys/bus/vmbus/drivers/uio_hv_generic/new_id
688 echo -n ed963694-e847-4b2a-85af-bc9cfc11d6f3 > /sys/bus/vmbus/drivers/hv_netvsc/unbind
689 echo -n ed963694-e847-4b2a-85af-bc9cfc11d6f3 > /sys/bus/vmbus/drivers/uio_hv_generic/bind
694 ls -l /sys/bus/vmbus/devices/ed963694-e847-4b2a-85af-bc9cfc11d6f3/driver
698 .../ed963694-e847-4b2a-85af-bc9cfc11d6f3/driver -> ../../../bus/vmbus/drivers/uio_hv_generic
701 -----------------------------------
709 and any reads of the interrupt file descriptor will return -EIO. Similar
712 The vmbus device regions are mapped into uio device resources:
720 device driver will create a sysfs binary file for the per-channel ring buffer.
723 /sys/bus/vmbus/devices/3811fe4d-0fa0-4b62-981a-74fc1084c757/channels/21/ring
728 - `OSADL homepage. <http://www.osadl.org>`_
730 - `Linutronix homepage. <http://www.linutronix.de>`_