Lines Matching +full:int +full:- +full:map +full:- +full:mask
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 -------------
92 but not separate IRQ mask and status registers, there might be
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
104 interrupt source or has separate IRQ mask and status registers. If you
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
172 the ``offset`` parameter of the :c:func:`mmap()` call. To map the
178 Sometimes there is hardware with memory-like regions that can not be
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
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)``:
273 - ``const char *name``: Optional. Set this to help identify the memory
276 - ``int memtype``: Required if the mapping is used. Set this to
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
292 from within your kernel module, you will want to map it internally by
298 Please do not touch the ``map`` element of ``struct uio_mem``! It is
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 ---------------------------
360 -----------------------------------
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
444 - ``unsigned int num_dynamic_regions``: Number of elements in
469 -----------------------------------------
492 --------------------
495 you need, all you have to do is to call :c:func:`mmap()` to map the
500 device you want to map. To map the memory of mapping N, you have to use
505 N starts from zero, so if you've got only one memory range to map, set
510 ----------------------
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 ------------------------------------
587 ------------------------------------------------
590 wraps it, to talk to the device and to re-enable interrupts by writing
594 ----------------------------------
606 int main()
608 int uiofd;
609 int configfd;
610 int err;
611 int i;
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
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>`_