-
Philippe Gerum authored
The new ->mmap() handler is introduced in the device operation descriptor. This service is restricted to secondary mode, switching a primary mode caller accordingly when invoked from an application. The prototype is: int mmap_handler(struct rtdm_fd *fd, struct vm_area_struct *vma); The semantics are identical to the corresponding handler from the regular linux file operations. The only difference is about receiving a RTDM file descriptor (struct rtdm_fd) instead of a regular struct file pointer. As such, a valid vma descriptor covering the target user address space is passed to the handler, therefore common mapping operations may be performed on it. Two new convenience routines for mapping a chunk of kernel memory and a physical I/O address range are provided, i.e. rtdm_mmap_kmem() and rtdm_mmap_iomem() respectively. Both take a vma descriptor as received by the ->mmap() handler, and the appropriate virtual/physical start address of the memory range to map to the target address range in user-space. The existing rtdm_mmap_to_user() and rtdm_iomap_to_user() calls are kept unmodified. The ->mmap() introduction has no impact on existing drivers currently relying on these calls.
c8e9e166