Event Source
Kernel-space event source declarations.
Event sources are used to wake up user-space tasks when a specific event (such as a hardware interrupt from a specific peripheral device) occurs.
This part of the API is only applicable to kernel-space code.
Note that the comments in this file regarding Linux UIO and Xenomai UDD implementations are based on linux-cip-4.19.94-cip18 and xenomai-3.1, but other versions are probably very similar.
-
enum cuddlk_eventsrc_flags
Event source flags for kernel space.
Constants
CUDDLK_EVENTSRCF_SHAREDIndicates that the associated event source may be claimed by more than one user-space application simultaneously.
Description
Flags that describe the properties of an event source. These may be used
in the flags member of the cuddlk_eventsrc struct.
-
struct cuddlk_eventsrc_kernel
Kernel-managed event source data members.
Definition
struct cuddlk_eventsrc_kernel {
int ref_count;
};
Members
ref_countNumber of user-space applications that have claimed this event source. This should be either
0or1unless the event source has theCUDDLK_EVENTSRCF_SHAREDflag set.
Description
Kernel-managed cuddlk_eventsrc data members that are available for use
by Cuddl drivers.
-
struct cuddlk_eventsrc
Event source information (kernel-space).
Definition
struct cuddlk_eventsrc {
char *name;
int flags;
struct cuddlk_interrupt intr;
struct cuddlk_eventsrc_kernel kernel;
struct cuddlki_eventsrc_priv priv;
};
Members
nameName used to identify the event source.
flagsFlags that describe the properties of the event source. This field may be a set of
cuddlk_eventsrc_flagsORed together.intrData structure for managing the interrupt handler and enable/disable functions.
kernelKernel-managed memory region data that is available for use by Cuddl drivers.
privPrivate memory region data reserved for internal use by the Cuddl implementation.
Description
Represents an event source (usually triggered by an interrupt) that may be monitored by user-space applications.
Unused members of this data structure must be set to zero. This is
typically done by allocating this structure via kzalloc() or using
memset() to zeroize the structure after allocation.
-
void cuddlk_eventsrc_notify(struct cuddlk_eventsrc *eventsrc)
Programmatically trigger a user-space event.
Parameters
struct cuddlk_eventsrc *eventsrcEvent source to notify.
Description
Trigger a user-space interrupt event for the specified device. This
routine is typically not called directly unless the event source’s
intr.irq field is set to CUDDLK_IRQ_CUSTOM. If the event source
is directly associated with a hardware interrupt (i.e. int.irq >
0), then user-space events are triggered automatically without calling
this function.
Linux UIO equivalent in linux/uio_driver.h:
void uio_event_notify(struct uio_info *info);
Xenomai UDD equivalent in rtdm/udd.h:
void udd_notify_event(struct udd_device *udd)