Xenomai API  2.6.5
Collaboration diagram for Inter-Driver API:

Functions

struct rtdm_dev_contextrtdm_context_get (int fd)
 Retrieve and lock a device context. More...
 
int rtdm_select_bind (int fd, rtdm_selector_t *selector, enum rtdm_selecttype type, unsigned fd_index)
 Bind a selector to specified event types of a given file descriptor. More...
 
void rtdm_context_lock (struct rtdm_dev_context *context)
 Increment context reference counter. More...
 
void rtdm_context_unlock (struct rtdm_dev_context *context)
 Decrement context reference counter. More...
 
void rtdm_context_put (struct rtdm_dev_context *context)
 Release a device context obtained via rtdm_context_get() More...
 
int rtdm_open (const char *path, int oflag,...)
 Open a device. More...
 
int rtdm_socket (int protocol_family, int socket_type, int protocol)
 Create a socket. More...
 
int rtdm_close (int fd)
 Close a device or socket. More...
 
int rtdm_ioctl (int fd, int request,...)
 Issue an IOCTL. More...
 
ssize_t rtdm_read (int fd, void *buf, size_t nbyte)
 Read from device. More...
 
ssize_t rtdm_write (int fd, const void *buf, size_t nbyte)
 Write to device. More...
 
ssize_t rtdm_recvmsg (int fd, struct user_msghdr *msg, int flags)
 Receive message from socket. More...
 
ssize_t rtdm_recvfrom (int fd, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen)
 Receive message from socket. More...
 
ssize_t rtdm_recv (int fd, void *buf, size_t len, int flags)
 Receive message from socket. More...
 
ssize_t rtdm_sendmsg (int fd, const struct user_msghdr *msg, int flags)
 Transmit message to socket. More...
 
ssize_t rtdm_sendto (int fd, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen)
 Transmit message to socket. More...
 
ssize_t rtdm_send (int fd, const void *buf, size_t len, int flags)
 Transmit message to socket. More...
 
int rtdm_bind (int fd, const struct sockaddr *my_addr, socklen_t addrlen)
 Bind to local address. More...
 
int rtdm_connect (int fd, const struct sockaddr *serv_addr, socklen_t addrlen)
 Connect to remote address. More...
 
int rtdm_listen (int fd, int backlog)
 Listen for incomming connection requests. More...
 
int rtdm_accept (int fd, struct sockaddr *addr, socklen_t *addrlen)
 Accept a connection requests. More...
 
int rtdm_shutdown (int fd, int how)
 Shut down parts of a connection. More...
 
int rtdm_getsockopt (int fd, int level, int optname, void *optval, socklen_t *optlen)
 Get socket option. More...
 
int rtdm_setsockopt (int fd, int level, int optname, const void *optval, socklen_t optlen)
 Set socket option. More...
 
int rtdm_getsockname (int fd, struct sockaddr *name, socklen_t *namelen)
 Get local socket address. More...
 
int rtdm_getpeername (int fd, struct sockaddr *name, socklen_t *namelen)
 Get socket destination address. More...
 

Detailed Description

Function Documentation

int rtdm_accept ( int  fd,
struct sockaddr *  addr,
socklen_t *  addrlen 
)

Accept a connection requests.

Refer to rt_dev_accept() for parameters and return values

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

int rtdm_bind ( int  fd,
const struct sockaddr *  my_addr,
socklen_t  addrlen 
)

Bind to local address.

Refer to rt_dev_bind() for parameters and return values

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

int rtdm_close ( int  fd)

Close a device or socket.

Refer to rt_dev_close() for parameters and return values

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

int rtdm_connect ( int  fd,
const struct sockaddr *  serv_addr,
socklen_t  addrlen 
)

Connect to remote address.

Refer to rt_dev_connect() for parameters and return values

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

struct rtdm_dev_context* rtdm_context_get ( int  fd)

Retrieve and lock a device context.

Parameters
[in]fdFile descriptor
Returns
Pointer to associated device context, or NULL on error
Note
The device context has to be unlocked using rtdm_context_put() when it is no longer referenced.

Environments:

This service can be called from:

  • Kernel module initialization/cleanup code
  • Interrupt service routine
  • Kernel-based task
  • User-space task (RT, non-RT)

Rescheduling: never.

References rtdm_dev_context::close_lock_count, and rtdm_dev_context::fd.

Referenced by rtdm_select_bind().

void rtdm_context_lock ( struct rtdm_dev_context context)

Increment context reference counter.

Parameters
[in]contextDevice context
Note
rtdm_context_get() automatically increments the lock counter. You only need to call this function in special scenarios, e.g. when keeping additional references to the context structure that have different lifetimes. Only use rtdm_context_lock() on contexts that are currently locked via an earlier rtdm_context_get()/rtdm_contex_lock() or while running a device operation handler.

Environments:

This service can be called from:

  • Kernel module initialization/cleanup code
  • Interrupt service routine
  • Kernel-based task
  • User-space task (RT, non-RT)

Rescheduling: never.

void rtdm_context_put ( struct rtdm_dev_context context)

Release a device context obtained via rtdm_context_get()

Parameters
[in]contextDevice context
Note
Every successful call to rtdm_context_get() must be matched by a rtdm_context_put() invocation.

Environments:

This service can be called from:

  • Kernel module initialization/cleanup code
  • Interrupt service routine
  • Kernel-based task
  • User-space task (RT, non-RT)

Rescheduling: never.

void rtdm_context_unlock ( struct rtdm_dev_context context)

Decrement context reference counter.

Parameters
[in]contextDevice context
Note
Every call to rtdm_context_locked() must be matched by a rtdm_context_unlock() invocation.

Environments:

This service can be called from:

  • Kernel module initialization/cleanup code
  • Interrupt service routine
  • Kernel-based task
  • User-space task (RT, non-RT)

Rescheduling: never.

Referenced by rtdm_select_bind().

int rtdm_getpeername ( int  fd,
struct sockaddr *  name,
socklen_t *  namelen 
)

Get socket destination address.

Refer to rt_dev_getpeername() for parameters and return values

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

int rtdm_getsockname ( int  fd,
struct sockaddr *  name,
socklen_t *  namelen 
)

Get local socket address.

Refer to rt_dev_getsockname() for parameters and return values

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

int rtdm_getsockopt ( int  fd,
int  level,
int  optname,
void *  optval,
socklen_t *  optlen 
)

Get socket option.

Refer to rt_dev_getsockopt() for parameters and return values

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

int rtdm_ioctl ( int  fd,
int  request,
  ... 
)

Issue an IOCTL.

Refer to rt_dev_ioctl() for parameters and return values

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

int rtdm_listen ( int  fd,
int  backlog 
)

Listen for incomming connection requests.

Refer to rt_dev_listen() for parameters and return values

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

int rtdm_open ( const char *  path,
int  oflag,
  ... 
)

Open a device.

Refer to rt_dev_open() for parameters and return values

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

ssize_t rtdm_read ( int  fd,
void *  buf,
size_t  nbyte 
)

Read from device.

Refer to rt_dev_read() for parameters and return values

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

ssize_t rtdm_recv ( int  fd,
void *  buf,
size_t  len,
int  flags 
)

Receive message from socket.

Refer to rt_dev_recv() for parameters and return values

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

ssize_t rtdm_recvfrom ( int  fd,
void *  buf,
size_t  len,
int  flags,
struct sockaddr *  from,
socklen_t *  fromlen 
)

Receive message from socket.

Refer to rt_dev_recvfrom() for parameters and return values

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

ssize_t rtdm_recvmsg ( int  fd,
struct user_msghdr *  msg,
int  flags 
)

Receive message from socket.

Refer to rt_dev_recvmsg() for parameters and return values

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

int rtdm_select_bind ( int  fd,
rtdm_selector_t *  selector,
enum rtdm_selecttype  type,
unsigned  fd_index 
)

Bind a selector to specified event types of a given file descriptor.

This function is invoked by higher RTOS layers implementing select-like services. It shall not be called directly by RTDM drivers.

Parameters
[in]fdFile descriptor to bind to
[in,out]selectorSelector object that shall be bound to the given event
[in]typeEvent type the caller is interested in
[in]fd_indexIndex in the file descriptor set of the caller
Returns
0 on success, otherwise:
  • -EBADF is returned if the file descriptor fd cannot be resolved.
  • -EINVAL is returned if type or fd_index are invalid.

Environments:

This service can be called from:

  • Kernel module initialization/cleanup code
  • Kernel-based task
  • User-space task (RT, non-RT)

Rescheduling: never.

References rtdm_dev_context::ops, rtdm_context_get(), rtdm_context_unlock(), and rtdm_operations::select_bind.

ssize_t rtdm_send ( int  fd,
const void *  buf,
size_t  len,
int  flags 
)

Transmit message to socket.

Refer to rt_dev_send() for parameters and return values

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

ssize_t rtdm_sendmsg ( int  fd,
const struct user_msghdr *  msg,
int  flags 
)

Transmit message to socket.

Refer to rt_dev_sendmsg() for parameters and return values

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

ssize_t rtdm_sendto ( int  fd,
const void *  buf,
size_t  len,
int  flags,
const struct sockaddr *  to,
socklen_t  tolen 
)

Transmit message to socket.

Refer to rt_dev_sendto() for parameters and return values

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

int rtdm_setsockopt ( int  fd,
int  level,
int  optname,
const void *  optval,
socklen_t  optlen 
)

Set socket option.

Refer to rt_dev_setsockopt() for parameters and return values

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

int rtdm_shutdown ( int  fd,
int  how 
)

Shut down parts of a connection.

Refer to rt_dev_shutdown() for parameters and return values

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

int rtdm_socket ( int  protocol_family,
int  socket_type,
int  protocol 
)

Create a socket.

Refer to rt_dev_socket() for parameters and return values

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

ssize_t rtdm_write ( int  fd,
const void *  buf,
size_t  nbyte 
)

Write to device.

Refer to rt_dev_write() for parameters and return values

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.