Linux/Xenomai User/Kernel Space

Base Declarations

Common user/kernel-space declarations for the Linux implementation.

These declarations apply to both Linux UIO and Xenomai UDD.

These declarations are technically available to both user-space and kernel-space code, however the only intended kernel-space usage of these declarations is to convey information to user-space applications.

struct cuddlci_memregion_info_priv

Private memory region information.

Definition

struct cuddlci_memregion_info_priv {
  unsigned long pa_mmap_offset;
  cuddlci_size_t pa_len;
  cuddlci_size_t start_offset;
  struct cuddlci_token token;
  char device_name[CUDDLCI_MAX_STR_LEN];
};

Members

pa_mmap_offset

Page-aligned mmap offset.

Value to be used as the offset argument when mapping this memory region via the mmap() system call on the device named device_name. This value is expressed in bytes, and will be a multiple of CUDDLK_PAGE_SIZE.

Under Linux UIO, this value will be N * getpagesize(), where N is the memory region number.

This value will always be zero under Xenomai UDD (because a separate device node is created for each memory region), but should still be used for portability reasons.

pa_len

Page-aligned length of the memory region. This field represents the size of the memory region to be mapped, in bytes. This value will be a multiple of CUDDLK_PAGE_SIZE.

This value will be used as the length argument when mapping this memory region via the POSIX mmap() system call on the device node specified by the device_name field.

start_offset

Starting offset of the memory region to be mapped, in bytes. This value does NOT need to be CUDDLK_PAGE_SIZE-aligned, so it is used when defining non-CUDDLK_PAGE_SIZE-aligned memory regions.

The start offset is relative to the page-aligned address returned by the mmap() system call.

token

Opaque token used (internally) when releasing ownership of the associated memory region.

device_name

Name of the device node that will be used to map the memory region via the mmap() system call.

Under Xenomai UDD, the value of this field will be something like:

/dev/rtdm/mydevname,mapper0

where 0 indicates the memory region number and mydevname indicates the name of the associated Cuddl device.

Under Linux UIO, the value of this field will be something like:

/dev/uio0

Note that UIO device names are based solely on the device registration order, so in this case the 0 has nothing to do with the memory region number (or Cuddl device name) at all. Instead, the mmap() offset argument is used to select which memory region of a device is to be mapped.

Description

This data structure contains private, platform-specific data members reserved for internal use by the Cuddl implementation.

struct cuddlci_eventsrc_info_priv

Private event source information.

Definition

struct cuddlci_eventsrc_info_priv {
  struct cuddlci_token token;
  char device_name[CUDDLCI_MAX_STR_LEN];
};

Members

token

Opaque token used (internally) when releasing ownership of the associated memory region.

device_name

Name of the device that will be used to receive interrupt events.

Under Xenomai UDD, the value of this field will be something like:

/dev/rtdm/mydevname

where mydevname indicates the name of the associated Cuddl device.

Under Linux UIO, the value of this field will be something like:

/dev/uio0

Note that UIO device names are based solely on the device registration order, so in this case the 0 has nothing to do with the Cuddl device name at all.

Description

This data structure contains private, platform-specific data members reserved for internal use by the Cuddl implementation.

IOCTL Declarations

Common user/kernel-space declarations for the Linux IOTCL calls.

These declarations apply to both Linux UIO and Xenomai UDD, and are used to transfer information between user-space and kernel-space code.

CUDDLCI_MEMREGION_CLAIM_UIO_IOCTL

IOCTL associated with cuddl_memregion_claim() for Linux UIO.

CUDDLCI_MEMREGION_CLAIM_UDD_IOCTL

IOCTL associated with cuddl_memregion_claim() for Xenomai UDD.

CUDDLCI_EVENTSRC_CLAIM_UIO_IOCTL

IOCTL associated with cuddl_eventsrc_claim() for Linux UIO.

CUDDLCI_EVENTSRC_CLAIM_UDD_IOCTL

IOCTL associated with cuddl_eventsrc_claim() for Xenomai UDD.

CUDDLCI_MEMREGION_RELEASE_UIO_IOCTL

IOCTL associated with cuddl_memregion_release() for Linux UIO.

CUDDLCI_MEMREGION_RELEASE_UDD_IOCTL

IOCTL associated with cuddl_memregion_release() for Xenomai UDD.

CUDDLCI_EVENTSRC_RELEASE_UIO_IOCTL

IOCTL associated with cuddl_eventsrc_release() for Linux UIO.

CUDDLCI_EVENTSRC_RELEASE_UDD_IOCTL

IOCTL associated with cuddl_eventsrc_release() for Xenomai UDD.

CUDDLCI_GET_MAX_MANAGED_DEVICES_IOCTL

IOCTL associated with cuddl_get_max_managed_devices().

CUDDLCI_GET_MAX_DEV_MEM_REGIONS_IOCTL

IOCTL associated with cuddl_get_max_dev_mem_regions().

CUDDLCI_GET_MAX_DEV_EVENTS_IOCTL

IOCTL associated with cuddl_get_max_dev_events().

CUDDLCI_GET_MEMREGION_ID_IOCTL

IOCTL associated with cuddl_get_memregion_id_for_slot().

CUDDLCI_GET_EVENTSRC_ID_IOCTL

IOCTL associated with cuddl_get_eventsrc_id_for_slot().

CUDDLCI_GET_MEMREGION_INFO_IOCTL

IOCTL associated with cuddl_get_memregion_info_for_id().

CUDDLCI_GET_EVENTSRC_INFO_IOCTL

IOCTL associated with cuddl_get_eventsrc_info_for_id().

CUDDLCI_GET_MEMREGION_REF_COUNT_IOCTL

IOCTL associated with cuddl_get_memregion_ref_count_for_id().

CUDDLCI_GET_EVENTSRC_REF_COUNT_IOCTL

IOCTL associated with cuddl_get_eventsrc_ref_count_for_id().

CUDDLCI_DECREMENT_MEMREGION_REF_COUNT_IOCTL

IOCTL associated with cuddl_decrement_memregion_info_for_id().

CUDDLCI_DECREMENT_EVENTSRC_REF_COUNT_IOCTL

IOCTL associated with cuddl_decrement_eventsrc_info_for_id().

CUDDLCI_JANITOR_REGISTER_PID_IOCTL

IOCTL associated with implicit cuddl_startup() call.

CUDDLCI_GET_KERNEL_COMMIT_ID_IOCTL

IOCTL associated with cuddl_get_kernel_commit_id().

CUDDLCI_GET_DRIVER_INFO_IOCTL

IOCTL associated with cuddl_memregion_get_driver_info(), cuddl_eventsrc_get_driver_info(), and cuddl_get_driver_info_for_slot().

CUDDLCI_GET_HW_INFO_IOCTL

IOCTL associated with cuddl_memregion_get_hw_info(), cuddl_eventsrc_get_hw_info() and cuddl_get_hw_info_for_slot().

CUDDLCI_GET_KERNEL_VERSION_CODE_IOCTL

IOCTL associated with cuddl_get_kernel_version_code().

CUDDLCI_GET_KERNEL_VARIANT_IOCTL

IOCTL associated with cuddl_get_kernel_variant().

CUDDLCI_EVENTSRC_IS_ENABLED_IOCTL

IOCTL associated with cuddl_eventsrc_is_enabled().

struct cuddlci_void_ioctl_data

IOCTL struct for calls without data.

Definition

struct cuddlci_void_ioctl_data {
  int version_code;
};

Members

version_code

Cuddl version code passed in from user space.

struct cuddlci_memregion_claim_ioctl_data

Memory region claim IOCTL data.

Definition

struct cuddlci_memregion_claim_ioctl_data {
  int version_code;
  struct cuddl_resource_id id;
  struct cuddl_memregion_info info;
  pid_t pid;
  int options;
};

Members

version_code

Cuddl version code passed in from user space.

id

Resource identifier passed in from user space.

info

Memory region information returned from kernel space.

pid

Process id passed in from user space.

options

Memregion claim options passed in from user space.

struct cuddlci_eventsrc_claim_ioctl_data

Event source claim IOCTL data.

Definition

struct cuddlci_eventsrc_claim_ioctl_data {
  int version_code;
  struct cuddl_resource_id id;
  struct cuddl_eventsrc_info info;
  pid_t pid;
  int options;
};

Members

version_code

Cuddl version code passed in from user space.

id

Resource identifier passed in from user space.

info

Event source information returned from kernel space.

pid

Process id passed in from user space.

options

Eventsrc claim options passed in from user space.

struct cuddlci_memregion_release_ioctl_data

Memregion release IOCTL data.

Definition

struct cuddlci_memregion_release_ioctl_data {
  int version_code;
  struct cuddlci_token token;
  pid_t pid;
};

Members

version_code

Cuddl version code passed in from user space.

token

Token for resource to be released (passed in from user space).

pid

Process id passed in from user space.

struct cuddlci_eventsrc_release_ioctl_data

Eventsrc release IOCTL data.

Definition

struct cuddlci_eventsrc_release_ioctl_data {
  int version_code;
  struct cuddlci_token token;
  pid_t pid;
};

Members

version_code

Cuddl version code passed in from user space.

token

Token for resource to be released (passed in from user space).

pid

Process id passed in from user space.

struct cuddlci_get_resource_id_ioctl_data

Get event id IOCTL data.

Definition

struct cuddlci_get_resource_id_ioctl_data {
  int version_code;
  int device_slot;
  int resource_slot;
  struct cuddl_resource_id id;
};

Members

version_code

Cuddl version code passed in from user space.

device_slot

Manager device slot number to query (input).

resource_slot

Device memregion or eventsrc slot number to query (input).

id

Resource identifier returned from kernel space (output).

Description

Used for both cuddl_get_memregion_id_for_slot() and cuddl_get_eventsrc_id_for_slot() implementations.

struct cuddlci_ref_count_ioctl_data

Get/decr ref count IOCTL data.

Definition

struct cuddlci_ref_count_ioctl_data {
  int version_code;
  struct cuddl_resource_id id;
};

Members

version_code

Cuddl version code passed in from user space.

id

Resource identifier passed in from user space.

Description

Used for cuddl_get_memregion_ref_count_for_id(), cuddl_get_eventsrc_ref_count_for_id(), cuddl_decrement_memregion_ref_count_for_id(), and cuddl_decrement_eventsrc_ref_count_for_id() implementations.

struct cuddlci_janitor_pid_ioctl_data

Janitor registration data.

Definition

struct cuddlci_janitor_pid_ioctl_data {
  int version_code;
  pid_t pid;
};

Members

version_code

Cuddl version code passed in from user space.

pid

Process id passed in from user space.

struct cuddlci_get_kernel_commit_id_ioctl_data

Kernel commit IOCTL data.

Definition

struct cuddlci_get_kernel_commit_id_ioctl_data {
  int version_code;
  char id_str[CUDDLCI_MAX_STR_LEN];
};

Members

version_code

Cuddl version code passed in from user space.

id_str

Kernel commit id string returned from kernel space.

struct cuddlci_get_driver_info_ioctl_data

Get driver info string data.

Definition

struct cuddlci_get_driver_info_ioctl_data {
  int version_code;
  int device_slot;
  char info_str[CUDDLCI_MAX_STR_LEN];
};

Members

version_code

Cuddl version code passed in from user space.

device_slot

Manager device slot number to query (input).

info_str

Driver info string returned from kernel space.

struct cuddlci_eventsrc_is_enabled_ioctl_data

IOCTL data for is_enabled.

Definition

struct cuddlci_eventsrc_is_enabled_ioctl_data {
  int version_code;
  struct cuddlci_token token;
};

Members

version_code

Cuddl version code passed in from user space.

token

Token for event source to be queried (passed in from user space).