hc
2024-11-01 2f529f9b558ca1c1bd74be7437a84e4711743404
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/**
 * @file
 * This file is part of the Xenomai project.
 *
 * @author Copyright (C) 2014 Philippe Gerum <rpm@xenomai.org>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
 */
#ifndef _RTDM_UAPI_UDD_H
#define _RTDM_UAPI_UDD_H
 
/**
 * @addtogroup rtdm_udd
 *
 * @{
 */
 
/**
 * @anchor udd_signotify
 * @brief UDD event notification descriptor
 *
 * This structure shall be used to pass the information required to
 * enable/disable the notification by signal upon interrupt receipt.
 *
 * If PID is zero or negative, the notification is disabled.
 * Otherwise, the Cobalt thread whose PID is given will receive the
 * Cobalt signal also mentioned, along with the count of interrupts at
 * the time of the receipt stored in siginfo.si_int. A Cobalt thread
 * must explicitly wait for notifications using the sigwaitinfo() or
 * sigtimedwait() services (no asynchronous mode available).
 */
struct udd_signotify {
   /**
    * PID of the Cobalt thread to notify upon interrupt
    * receipt. If @a pid is zero or negative, the notification is
    * disabled.
    */
   pid_t pid;
   /**
    * Signal number to send to PID for notifying, which must be
    * in the range [SIGRTMIN .. SIGRTMAX] inclusive. This value
    * is not considered if @a pid is zero or negative.
    */
   int sig;
};
 
/**
 * @anchor udd_ioctl_codes @name UDD_IOCTL
 * IOCTL requests
 *
 * @{
 */
 
/**
 * Enable the interrupt line. The UDD-class mini-driver should handle
 * this request when received through its ->ioctl() handler if
 * provided. Otherwise, the UDD core enables the interrupt line in the
 * interrupt controller before returning to the caller.
 */
#define UDD_RTIOC_IRQEN        _IO(RTDM_CLASS_UDD, 0)
/**
 * Disable the interrupt line. The UDD-class mini-driver should handle
 * this request when received through its ->ioctl() handler if
 * provided. Otherwise, the UDD core disables the interrupt line in
 * the interrupt controller before returning to the caller.
 *
 * @note The mini-driver must handle the UDD_RTIOC_IRQEN request for a
 * custom IRQ from its ->ioctl() handler, otherwise such request
 * receives -EIO from the UDD core.
 */
#define UDD_RTIOC_IRQDIS    _IO(RTDM_CLASS_UDD, 1)
/**
 * Enable/Disable signal notification upon interrupt event. A valid
 * @ref udd_signotify "notification descriptor" must be passed along
 * with this request, which is handled by the UDD core directly.
 *
 * @note The mini-driver must handle the UDD_RTIOC_IRQDIS request for
 * a custom IRQ from its ->ioctl() handler, otherwise such request
 * receives -EIO from the UDD core.
 */
#define UDD_RTIOC_IRQSIG    _IOW(RTDM_CLASS_UDD, 2, struct udd_signotify)
 
/** @} */
/** @} */
 
#endif /* !_RTDM_UAPI_UDD_H */