Xenomai  3.1
Asynchronous Procedure Calls

Services for scheduling function calls in the Linux domain. More...

Collaboration diagram for Asynchronous Procedure Calls:

Functions

int xnapc_alloc (const char *name, void(*handler)(void *cookie), void *cookie)
 

Allocate an APC slot. More...
 
void xnapc_free (int apc)
 

Releases an APC slot. More...
 
static void xnapc_schedule (int apc)
 Schedule an APC invocation. More...
 

Detailed Description

Services for scheduling function calls in the Linux domain.

APC is the acronym for Asynchronous Procedure Call, a mean by which activities from the Xenomai domain can schedule deferred invocations of handlers to be run into the Linux domain, as soon as possible when the Linux kernel gets back in control.

Up to BITS_PER_LONG APC slots can be active at any point in time.

APC support is built upon the interrupt pipeline's virtual interrupt support.

Function Documentation

◆ xnapc_alloc()

int xnapc_alloc ( const char *  name,
void(*)(void *cookie)  handler,
void *  cookie 
)



Allocate an APC slot.

APC is the acronym for Asynchronous Procedure Call, a mean by which activities from the Xenomai domain can schedule deferred invocations of handlers to be run into the Linux domain, as soon as possible when the Linux kernel gets back in control. Up to BITS_PER_LONG APC slots can be active at any point in time. APC support is built upon the interrupt pipeline's virtual interrupt support.

Any Linux kernel service which is callable from a regular Linux interrupt handler is in essence available to APC handlers.

Parameters
nameis a symbolic name identifying the APC which will get reported through the /proc/xenomai/apc interface. Passing NULL to create an anonymous APC is allowed.
handlerThe address of the fault handler to call upon exception condition. The handle will be passed the cookie value unmodified.
cookieA user-defined opaque pointer the APC handler receives as its sole argument.
Returns
a valid APC identifier is returned upon success, or a negative error code otherwise:
  • -EINVAL is returned if handler is invalid.
  • -EBUSY is returned if no more APC slots are available.
Tags
unrestricted

◆ xnapc_free()

void xnapc_free ( int  apc)



Releases an APC slot.

This service deallocates an APC slot obtained by xnapc_alloc().

Parameters
apcThe APC id. to release, as returned by a successful call to the xnapc_alloc() service.
Tags
unrestricted

◆ xnapc_schedule()

static inline int xnapc_schedule ( int  apc)
inlinestatic

Schedule an APC invocation.

This service marks the APC as pending for the Linux domain, so that its handler will be called as soon as possible, when the Linux domain gets back in control.

When posted from the Linux domain, the APC handler is fired as soon as the interrupt mask is explicitly cleared by some kernel code. When posted from the Xenomai domain, the APC handler is fired as soon as the Linux domain is resumed, i.e. after Xenomai has completed all its pending duties.

Parameters
apcThe APC id. to schedule.

This service can be called from:

  • Any domain context, albeit the usual calling place is from the Xenomai domain.