RTEMS CAN/CAN FD Stack
Loading...
Searching...
No Matches
Macros | Functions
can-quekern.c File Reference

This file is part of CAN/CAN FD bus common support and implements CAN FIFOs and generic hubs/ends for chip and caracter driver interface sides. More...

#include <string.h>
#include <stdlib.h>
#include <rtems/malloc.h>
#include <rtems/timespec.h>
#include <dev/can/can.h>
#include <dev/can/can-helpers.h>
#include <dev/can/can-devcommon.h>
#include <dev/can/can-impl.h>
Include dependency graph for can-quekern.c:

Macros

#define CAN_DEAD_FUNC_PRIORITY   120
 
#define CAN_KERN_INITIALIZED   ( 1 << 0 )
 

Functions

void rtems_can_queue_edge_do_dead (struct rtems_can_queue_edge *qedge)
 This function disconnects the edge.
 
int rtems_can_queue_ends_init_user (struct rtems_can_queue_ends_user_t *qends_user)
 Userspace clients specific ends initialization.
 
int rtems_can_queue_sync_wait_kern (struct rtems_can_queue_ends *qends, struct rtems_can_queue_edge *qedge, bool nowait, rtems_interval timeout)
 This function waits for all slots processing.
 
int rtems_can_queue_fifo_init_kern (struct rtems_can_queue_fifo *fifo, int allocated_slot_count, int max_data_length)
 This function initializes one CAN FIFO.
 
int rtems_can_queue_fifo_done_kern (struct rtems_can_queue_fifo *fifo)
 This function frees slots allocated for CAN FIFO.
 
struct rtems_can_queue_edgertems_can_queue_new_edge_kern (int allocated_slot_count, int max_data_length)
 This function allocates new edge structure.
 
int rtems_can_queue_ends_sync_all_kern (struct rtems_can_queue_ends *qends, struct timespec *ts)
 This function waits for all ends to TX their messages.
 
int rtems_can_queue_ends_dispose_kern (struct rtems_can_queue_ends *qends, bool nonblock)
 This function provides finalizing of the ends structure for clients.
 
int rtems_can_queue_kern_initialize (void)
 This function provides initialization of kernel queue side.
 

Detailed Description

This file is part of CAN/CAN FD bus common support and implements CAN FIFOs and generic hubs/ends for chip and caracter driver interface sides.

Function Documentation

◆ rtems_can_queue_edge_do_dead()

void rtems_can_queue_edge_do_dead ( struct rtems_can_queue_edge qedge)

This function disconnects the edge.

Parameters
qedgePointer to the edge to be disconnected.
Returns
None

◆ rtems_can_queue_ends_dispose_kern()

int rtems_can_queue_ends_dispose_kern ( struct rtems_can_queue_ends qends,
bool  nonblock 
)

This function provides finalizing of the ends structure for clients.

Parameters
qendsPointer to ends structure.
nonblockFlag indicating that user does not want to wait for processing of all remaining messages.
Returns
Function should be designed such way to not fail.

◆ rtems_can_queue_ends_init_user()

int rtems_can_queue_ends_init_user ( struct rtems_can_queue_ends_user_t qends)

Userspace clients specific ends initialization.

Parameters
qends_userPointer to rtems_can_queue_ends_user_t structure.
Returns
Zero on success; -1 otherwise.

◆ rtems_can_queue_ends_sync_all_kern()

int rtems_can_queue_ends_sync_all_kern ( struct rtems_can_queue_ends qends,
struct timespec *  ts 
)

This function waits for all ends to TX their messages.

Parameters
qendsPointer to ends structure.
tsAbsolute time againts CLOCK_MONOTONIC that informs rtems_can_queue_sync_wait_kern how long to wait.
Returns
0 on success, -ETIME in case of timeout.

◆ rtems_can_queue_fifo_done_kern()

int rtems_can_queue_fifo_done_kern ( struct rtems_can_queue_fifo fifo)

This function frees slots allocated for CAN FIFO.

Parameters
fifoPointer to the FIFO structure.
Returns
This function should not fail.

◆ rtems_can_queue_fifo_init_kern()

int rtems_can_queue_fifo_init_kern ( struct rtems_can_queue_fifo fifo,
int  allocated_slot_count,
int  max_data_length 
)

This function initializes one CAN FIFO.

Parameters
fifoPointer to the FIFO structure.
allocated_slot_countNumber of requested slots.
max_data_lengthMaximum size of data in one slot/frame.
Returns
The negative value indicates, that there is no memory to allocate space for the requested number of the slots.

◆ rtems_can_queue_kern_initialize()

int rtems_can_queue_kern_initialize ( void  )

This function provides initialization of kernel queue side.

Returns
Zero on success.

◆ rtems_can_queue_new_edge_kern()

struct rtems_can_queue_edge * rtems_can_queue_new_edge_kern ( int  allocated_slot_countm,
int  max_data_length 
)

This function allocates new edge structure.

Parameters
allocated_slot_countRequired number of slots in the newly allocated edge structure.
max_data_lengthMaximul data length of one CAN frame.
Returns
Pointer to rtems_can_queue_edge structure on success, NULL on error.

◆ rtems_can_queue_sync_wait_kern()

int rtems_can_queue_sync_wait_kern ( struct rtems_can_queue_ends qends,
struct rtems_can_queue_edge qedge,
bool  nowait,
rtems_interval  timeout 
)

This function waits for all slots processing.

Parameters
qendsEnds structure belonging to calling communication object.
qedgePointer to edge.
nowaitTrue if semaphore should not wait
timeoutNumber of clock ticks to wait for semaphore. Passing zero indicates an infinite timeout.
Returns
Positive value indicates, that edge empty state has been reached. Negative or zero value informs the semaphore timeouted.