can_resmgr_attach_intr()

Associate an IRQ and pulse code with the CAN pulse handler

Synopisis

#include <hw/libcan.h>

int can_resmgr_attach_intr( void* const hdl,
                            const int irq,
                            const short pulse_code );

Arguments

hdl

An arbitrary handle to associate with data for the defined message range.

irq

An IRQ number.

pulse_code

A pulse code associated with the irq.

Description

The can_resmgr_attach_intr() function associates an IRQ and pulse code with the CAN pulse handler. The pulse handler calls the event_handler() callback function specified with the can_resmgr_init() function when the interrupt occurs.

Returns

An interrupt ID on success, or -1 on error (errno is set).

Errors

EAGAIN

One of the following errors occurred:

  • All kernel connection objects are in use.
  • A pulse code couldn't be allocated.
  • Not enough memory is available.
  • The maximum number (32) of threads or events that can be attached to an interrupt has been exceeded.
EINVAL

One of the following errors occurred:

  • The pulse_code is out of range, or it's already registered.
  • The value of irq isn't a valid interrupt number.
ENOMEM

Insufficient memory to allocate internal data structures.

EBUSY

One of the following errors occurred:

  • You tried to attach a thread to an interrupt, but a thread with the _NTO_INTR_FLAGS_EXCLUSIVE flag was already attached to the interrupt.
  • You tried to attach a thread with the _NTO_INTR_FLAGS_EXCLUSIVE flag to an interrupt, but a thread was already attached to the interrupt.
EFAULT

A fault occurred when the kernel tried to access the buffers provided.

EPERM

The process doesn't have the required permission; refer to procmgr_ability().

Page updated: