|
CO_ReturnError_t | CO_epoll_create (CO_epoll_t *ep, uint32_t timerInterval_us) |
| Create Linux epoll, timerfd and eventfd. More...
|
|
void | CO_epoll_close (CO_epoll_t *ep) |
| Close epoll, timerfd and eventfd. More...
|
|
void | CO_epoll_wait (CO_epoll_t *ep) |
| Wait for an epoll event. More...
|
|
void | CO_epoll_processLast (CO_epoll_t *ep) |
| Closing function for an epoll event. More...
|
|
void | CO_epoll_initCANopenMain (CO_epoll_t *ep, CO_t *co) |
| Initialization of functions in CANopen reset-communication section. More...
|
|
void | CO_epoll_processMain (CO_epoll_t *ep, CO_t *co, bool_t enableGateway, CO_NMT_reset_cmd_t *reset) |
| Process CANopen mainline functions. More...
|
|
void | CO_epoll_processRT (CO_epoll_t *ep, CO_t *co, bool_t realtime) |
| Process CAN receive and realtime functions. More...
|
|
CO_ReturnError_t | CO_epoll_createGtw (CO_epoll_gtw_t *epGtw, int epoll_fd, int32_t commandInterface, uint32_t socketTimeout_ms, char *localSocketPath) |
| Create socket for gateway-ascii command interface and add it to epoll. More...
|
|
void | CO_epoll_closeGtw (CO_epoll_gtw_t *epGtw) |
| Close gateway-ascii sockets. More...
|
|
void | CO_epoll_initCANopenGtw (CO_epoll_gtw_t *epGtw, CO_t *co) |
| Initialization of gateway functions in CANopen reset-communication section. More...
|
|
void | CO_epoll_processGtw (CO_epoll_gtw_t *epGtw, CO_t *co, CO_epoll_t *ep) |
| Process CANopen gateway functions. More...
|
|
Linux epoll interface to CANopenNode.
The Linux epoll API performs a monitoring multiple file descriptors to see if I/O is possible on any of them.
CANopenNode uses epoll interface to provide an event based mechanism. Epoll waits for multiple different events, such as: interval timer event, notification event, CAN receive event or socket based event for gateway. CANopenNode non-blocking functions are processed after each event.
CANopenNode itself offers functionality for calculation of time, when next interval timer event should trigger the processing. It can also trigger notification events in case of multi-thread operation.
◆ CO_epoll_create()
Create Linux epoll, timerfd and eventfd.
Create and configure multiple Linux notification facilities, which trigger execution of the task. Epoll blocks and monitors multiple file descriptors, timerfd triggers in constant timer intervals and eventfd triggers on external signal.
- Parameters
-
ep | This object |
timerInterval_us | Timer interval in microseconds |
- Returns
- CO_ReturnError_t CO_ERROR_NO, CO_ERROR_ILLEGAL_ARGUMENT or CO_ERROR_SYSCALL.
◆ CO_epoll_close()
Close epoll, timerfd and eventfd.
- Parameters
-
◆ CO_epoll_wait()
Wait for an epoll event.
This function blocks until event registered on epoll: timerfd, eventfd, or application specified event. Function also calculates timeDifference_us since last call and prepares timerNext_us.
- Parameters
-
◆ CO_epoll_processLast()
Closing function for an epoll event.
This function must be called after CO_epoll_wait(). Between them should be application specified processing functions, which can check for own events and do own processing. Application may also lower timerNext_us variable. If lowered, then interval timer will be reconfigured and CO_epoll_wait() will be triggered earlier.
- Parameters
-
◆ CO_epoll_initCANopenMain()
Initialization of functions in CANopen reset-communication section.
Configure callbacks for CANopen objects.
- Parameters
-
ep | This object |
co | CANopen object |
◆ CO_epoll_processMain()
Process CANopen mainline functions.
This function calls CO_process(). It is non-blocking and should execute cyclically. It should be between CO_epoll_wait() and CO_epoll_processLast() functions.
- Parameters
-
| ep | This object |
| co | CANopen object |
| enableGateway | If true, gateway to external world will be enabled. |
[out] | reset | Return from CO_process(). |
◆ CO_epoll_processRT()
Process CAN receive and realtime functions.
This function checks epoll for CAN receive event and processes CANopen realtime functions: CO_process_SYNC(), CO_process_RPDO() and CO_process_TPDO(). It is non-blocking and should execute cyclically. It should be between CO_epoll_wait() and CO_epoll_processLast() functions.
Function can be used in the mainline thread or in own realtime thread.
Processing of CANopen realtime functions is protected with CO_LOCK_OD. Also Node-Id must be configured and CANmodule must be in CANnormal for processing.
- Parameters
-
ep | Pointer to CO_epoll_t object. |
co | CANopen object |
realtime | Set to true, if function is called from the own realtime thread, and is executed at short constant interval. |
◆ CO_epoll_createGtw()
Create socket for gateway-ascii command interface and add it to epoll.
Depending on arguments function configures stdio interface or local socket or IP socket.
- Parameters
-
epGtw | This object |
epoll_fd | Already configured epoll file descriptor |
commandInterface | Command interface type from CO_commandInterface_t |
socketTimeout_ms | Timeout for established socket connection in [ms] |
localSocketPath | File path, if commandInterface is local socket |
- Returns
- CO_ReturnError_t CO_ERROR_NO, CO_ERROR_ILLEGAL_ARGUMENT or CO_ERROR_SYSCALL.
◆ CO_epoll_closeGtw()
Close gateway-ascii sockets.
- Parameters
-
◆ CO_epoll_initCANopenGtw()
Initialization of gateway functions in CANopen reset-communication section.
- Parameters
-
epGtw | This object |
co | CANopen object |
◆ CO_epoll_processGtw()
Process CANopen gateway functions.
This function checks for epoll events and verifies socket connection timeout. It is non-blocking and should execute cyclically. It should be between CO_epoll_wait() and CO_epoll_processLast() functions.
- Parameters
-
epGtw | This object |
co | CANopen object |
ep | Pointer to CO_epoll_t object. |