^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) VME Device Drivers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) ==================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) Driver registration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) -------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) As with other subsystems within the Linux kernel, VME device drivers register
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) with the VME subsystem, typically called from the devices init routine. This is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) achieved via a call to :c:func:`vme_register_driver`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) A pointer to a structure of type :c:type:`struct vme_driver <vme_driver>` must
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) be provided to the registration function. Along with the maximum number of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) devices your driver is able to support.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) At the minimum, the '.name', '.match' and '.probe' elements of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) :c:type:`struct vme_driver <vme_driver>` should be correctly set. The '.name'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) element is a pointer to a string holding the device driver's name.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) The '.match' function allows control over which VME devices should be registered
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) with the driver. The match function should return 1 if a device should be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) probed and 0 otherwise. This example match function (from vme_user.c) limits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) the number of devices probed to one:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) .. code-block:: c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #define USER_BUS_MAX 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) static int vme_user_match(struct vme_dev *vdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) if (vdev->id.num >= USER_BUS_MAX)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) The '.probe' element should contain a pointer to the probe routine. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) probe routine is passed a :c:type:`struct vme_dev <vme_dev>` pointer as an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) argument.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) Here, the 'num' field refers to the sequential device ID for this specific
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) driver. The bridge number (or bus number) can be accessed using
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) dev->bridge->num.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) A function is also provided to unregister the driver from the VME core called
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) :c:func:`vme_unregister_driver` and should usually be called from the device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) driver's exit routine.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) Resource management
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) -------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) Once a driver has registered with the VME core the provided match routine will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) be called the number of times specified during the registration. If a match
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) succeeds, a non-zero value should be returned. A zero return value indicates
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) failure. For all successful matches, the probe routine of the corresponding
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) driver is called. The probe routine is passed a pointer to the devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) device structure. This pointer should be saved, it will be required for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) requesting VME resources.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) The driver can request ownership of one or more master windows
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) (:c:func:`vme_master_request`), slave windows (:c:func:`vme_slave_request`)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) and/or dma channels (:c:func:`vme_dma_request`). Rather than allowing the device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) driver to request a specific window or DMA channel (which may be used by a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) different driver) the API allows a resource to be assigned based on the required
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) attributes of the driver in question. For slave windows these attributes are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) split into the VME address spaces that need to be accessed in 'aspace' and VME
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) bus cycle types required in 'cycle'. Master windows add a further set of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) attributes in 'width' specifying the required data transfer widths. These
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) attributes are defined as bitmasks and as such any combination of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) attributes can be requested for a single window, the core will assign a window
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) that meets the requirements, returning a pointer of type vme_resource that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) should be used to identify the allocated resource when it is used. For DMA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) controllers, the request function requires the potential direction of any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) transfers to be provided in the route attributes. This is typically VME-to-MEM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) and/or MEM-to-VME, though some hardware can support VME-to-VME and MEM-to-MEM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) transfers as well as test pattern generation. If an unallocated window fitting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) the requirements can not be found a NULL pointer will be returned.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) Functions are also provided to free window allocations once they are no longer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) required. These functions (:c:func:`vme_master_free`, :c:func:`vme_slave_free`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) and :c:func:`vme_dma_free`) should be passed the pointer to the resource
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) provided during resource allocation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) Master windows
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) --------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) Master windows provide access from the local processor[s] out onto the VME bus.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) The number of windows available and the available access modes is dependent on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) the underlying chipset. A window must be configured before it can be used.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) Master window configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) ~~~~~~~~~~~~~~~~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) Once a master window has been assigned :c:func:`vme_master_set` can be used to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) configure it and :c:func:`vme_master_get` to retrieve the current settings. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) address spaces, transfer widths and cycle types are the same as described
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) under resource management, however some of the options are mutually exclusive.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) For example, only one address space may be specified.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) Master window access
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) ~~~~~~~~~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) The function :c:func:`vme_master_read` can be used to read from and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) :c:func:`vme_master_write` used to write to configured master windows.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) In addition to simple reads and writes, :c:func:`vme_master_rmw` is provided to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) do a read-modify-write transaction. Parts of a VME window can also be mapped
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) into user space memory using :c:func:`vme_master_mmap`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) Slave windows
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) -------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) Slave windows provide devices on the VME bus access into mapped portions of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) local memory. The number of windows available and the access modes that can be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) used is dependent on the underlying chipset. A window must be configured before
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) it can be used.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) Slave window configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) ~~~~~~~~~~~~~~~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) Once a slave window has been assigned :c:func:`vme_slave_set` can be used to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) configure it and :c:func:`vme_slave_get` to retrieve the current settings.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) The address spaces, transfer widths and cycle types are the same as described
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) under resource management, however some of the options are mutually exclusive.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) For example, only one address space may be specified.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) Slave window buffer allocation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) Functions are provided to allow the user to allocate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) (:c:func:`vme_alloc_consistent`) and free (:c:func:`vme_free_consistent`)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) contiguous buffers which will be accessible by the VME bridge. These functions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) do not have to be used, other methods can be used to allocate a buffer, though
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) care must be taken to ensure that they are contiguous and accessible by the VME
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) bridge.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) Slave window access
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) ~~~~~~~~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) Slave windows map local memory onto the VME bus, the standard methods for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) accessing memory should be used.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) DMA channels
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) ------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) The VME DMA transfer provides the ability to run link-list DMA transfers. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) API introduces the concept of DMA lists. Each DMA list is a link-list which can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) be passed to a DMA controller. Multiple lists can be created, extended,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) executed, reused and destroyed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) List Management
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) ~~~~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) The function :c:func:`vme_new_dma_list` is provided to create and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) :c:func:`vme_dma_list_free` to destroy DMA lists. Execution of a list will not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) automatically destroy the list, thus enabling a list to be reused for repetitive
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) tasks.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) List Population
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) ~~~~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) An item can be added to a list using :c:func:`vme_dma_list_add` (the source and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) destination attributes need to be created before calling this function, this is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) covered under "Transfer Attributes").
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) .. note::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) The detailed attributes of the transfers source and destination
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) are not checked until an entry is added to a DMA list, the request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) for a DMA channel purely checks the directions in which the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) controller is expected to transfer data. As a result it is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) possible for this call to return an error, for example if the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) source or destination is in an unsupported VME address space.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) Transfer Attributes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) ~~~~~~~~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) The attributes for the source and destination are handled separately from adding
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) an item to a list. This is due to the diverse attributes required for each type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) of source and destination. There are functions to create attributes for PCI, VME
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) and pattern sources and destinations (where appropriate):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) - PCI source or destination: :c:func:`vme_dma_pci_attribute`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) - VME source or destination: :c:func:`vme_dma_vme_attribute`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) - Pattern source: :c:func:`vme_dma_pattern_attribute`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) The function :c:func:`vme_dma_free_attribute` should be used to free an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) attribute.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) List Execution
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) ~~~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) The function :c:func:`vme_dma_list_exec` queues a list for execution and will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) return once the list has been executed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) Interrupts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) ----------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) The VME API provides functions to attach and detach callbacks to specific VME
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) level and status ID combinations and for the generation of VME interrupts with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) specific VME level and status IDs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) Attaching Interrupt Handlers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) The function :c:func:`vme_irq_request` can be used to attach and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) :c:func:`vme_irq_free` to free a specific VME level and status ID combination.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) Any given combination can only be assigned a single callback function. A void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) pointer parameter is provided, the value of which is passed to the callback
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) function, the use of this pointer is user undefined. The callback parameters are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) as follows. Care must be taken in writing a callback function, callback
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) functions run in interrupt context:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) .. code-block:: c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) void callback(int level, int statid, void *priv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) Interrupt Generation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) ~~~~~~~~~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) The function :c:func:`vme_irq_generate` can be used to generate a VME interrupt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) at a given VME level and VME status ID.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) Location monitors
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) -----------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) The VME API provides the following functionality to configure the location
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) monitor.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) Location Monitor Management
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) ~~~~~~~~~~~~~~~~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) The function :c:func:`vme_lm_request` is provided to request the use of a block
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) of location monitors and :c:func:`vme_lm_free` to free them after they are no
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) longer required. Each block may provide a number of location monitors,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) monitoring adjacent locations. The function :c:func:`vme_lm_count` can be used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) to determine how many locations are provided.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) Location Monitor Configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) Once a bank of location monitors has been allocated, the function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) :c:func:`vme_lm_set` is provided to configure the location and mode of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) location monitor. The function :c:func:`vme_lm_get` can be used to retrieve
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) existing settings.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) Location Monitor Use
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) ~~~~~~~~~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) The function :c:func:`vme_lm_attach` enables a callback to be attached and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) :c:func:`vme_lm_detach` allows on to be detached from each location monitor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) location. Each location monitor can monitor a number of adjacent locations. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) callback function is declared as follows.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) .. code-block:: c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) void callback(void *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) Slot Detection
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) --------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) The function :c:func:`vme_slot_num` returns the slot ID of the provided bridge.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) Bus Detection
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) -------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) The function :c:func:`vme_bus_num` returns the bus ID of the provided bridge.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) VME API
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) -------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) .. kernel-doc:: include/linux/vme.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) :internal:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) .. kernel-doc:: drivers/vme/vme.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) :export: