Xenomai  3.0.8
udd.h
Go to the documentation of this file.
1 
19 #ifndef _COBALT_RTDM_UDD_H
20 #define _COBALT_RTDM_UDD_H
21 
22 #include <linux/list.h>
23 #include <rtdm/driver.h>
24 #include <rtdm/uapi/udd.h>
25 
65 #define UDD_IRQ_NONE 0
66 
72 #define UDD_IRQ_CUSTOM (-1)
73 
91 #define UDD_MEM_NONE 0
92 
97 #define UDD_MEM_PHYS 1
98 
102 #define UDD_MEM_LOGICAL 2
103 
108 #define UDD_MEM_VIRTUAL 3
109 
111 #define UDD_NR_MAPS 5
112 
171  const char *name;
177  unsigned long addr;
182  size_t len;
187  int type;
188 };
189 
197 struct udd_device {
202  const char *device_name;
215  struct {
223  int (*open)(struct rtdm_fd *fd, int oflags);
231  void (*close)(struct rtdm_fd *fd);
244  int (*ioctl)(struct rtdm_fd *fd,
245  unsigned int request, void *arg);
260  int (*mmap)(struct rtdm_fd *fd,
261  struct vm_area_struct *vma);
290  int (*interrupt)(struct udd_device *udd);
291  } ops;
298  int irq;
305  struct udd_memregion mem_regions[UDD_NR_MAPS];
307  struct udd_reserved {
308  rtdm_irq_t irqh;
309  atomic_t event;
310  struct udd_signotify signfy;
311  struct rtdm_event pulse;
312  struct rtdm_driver driver;
313  struct rtdm_device device;
314  struct rtdm_driver mapper_driver;
315  struct udd_mapper {
316  struct udd_device *udd;
317  struct rtdm_device dev;
318  } mapdev[UDD_NR_MAPS];
319  char *mapper_name;
320  int nr_maps;
321  } __reserved;
322 };
323 
324 int udd_register_device(struct udd_device *udd);
325 
326 int udd_unregister_device(struct udd_device *udd);
327 
328 struct udd_device *udd_get_device(struct rtdm_fd *fd);
329 
330 void udd_notify_event(struct udd_device *udd);
331 
332 void udd_enable_irq(struct udd_device *udd,
333  rtdm_event_t *done);
334 
335 void udd_disable_irq(struct udd_device *udd,
336  rtdm_event_t *done);
337 
340 #endif /* !_COBALT_RTDM_UDD_H */
int udd_register_device(struct udd_device *udd)
Register a UDD device.
Definition: udd.c:349
int(* mmap)(struct rtdm_fd *fd, struct vm_area_struct *vma)
Ancillary mmap() handler for the mapper device, optional.
Definition: udd.h:260
const char * name
Name of the region (informational but required)
Definition: udd.h:171
const char * device_name
Name of the device managed by the mini-driver, appears automatically in the /dev/rtdm namespace upon ...
Definition: udd.h:202
unsigned long addr
Start address of the region.
Definition: udd.h:177
Reserved to the UDD core.
Definition: udd.h:307
This file is part of the Xenomai project.
Definition: udd.h:169
struct udd_device * udd_get_device(struct rtdm_fd *fd)
RTDM file descriptor to target UDD device.
Definition: udd.c:645
void udd_disable_irq(struct udd_device *udd, rtdm_event_t *done)
Disable the device IRQ line.
Definition: udd.c:620
size_t len
Length (in bytes) of the region.
Definition: udd.h:182
Real-Time Driver Model for Xenomai, driver API header.
void udd_notify_event(struct udd_device *udd)
Notify an IRQ event for an unmanaged interrupt.
Definition: udd.c:500
int(* interrupt)(struct udd_device *udd)
Definition: udd.h:290
Definition: udd.h:197
void udd_enable_irq(struct udd_device *udd, rtdm_event_t *done)
Enable the device IRQ line.
Definition: udd.c:586
int irq
IRQ number.
Definition: udd.h:298
int device_subclass
Subclass code of the device managed by the mini-driver (see RTDM_SUBCLASS_xxx definition in the Devic...
Definition: udd.h:214
struct udd_memregion mem_regions[UDD_NR_MAPS]
Array of memory regions defined by the device.
Definition: udd.h:305
int(* ioctl)(struct rtdm_fd *fd, unsigned int request, void *arg)
Ancillary ioctl() handler, optional.
Definition: udd.h:244
int device_flags
Additional device flags (e.g.
Definition: udd.h:207
Copyright © 2011 Gilles Chanteperdrix gilles.chanteperdrix@xenomai.org.
Definition: atomic.h:24
int udd_unregister_device(struct udd_device *udd)
Unregister a UDD device.
Definition: udd.c:450
void(* close)(struct rtdm_fd *fd)
Ancillary close() handler, optional.
Definition: udd.h:231
int type
Type of the region.
Definition: udd.h:187
int(* open)(struct rtdm_fd *fd, int oflags)
Ancillary open() handler, optional.
Definition: udd.h:223
UDD event notification descriptor.
Definition: udd.h:44
RTDM device.
Definition: driver.h:338
RTDM driver.
Definition: driver.h:249