43#ifndef __DEV_CAN_CAN_QUEUE_H
44#define __DEV_CAN_CAN_QUEUE_H
50#include <rtems/timespec.h>
51#include <rtems/status-checks.h>
52#include <rtems/thread.h>
80#define RTEMS_CAN_SLOTF_CMD ( 0x00ff )
145#define RTEMS_CAN_FIFOF_DESTROY ( 1 << 15 )
149#define RTEMS_CAN_FIFOF_ERROR ( 1 << 14 )
153#define RTEMS_CAN_FIFOF_ERR2BLOCK ( 1 << 13 )
157#define RTEMS_CAN_FIFOF_BLOCK ( 1 << 12 )
161#define RTEMS_CAN_FIFOF_OVERRUN ( 1 << 11 )
165#define RTEMS_CAN_FIFOF_FULL ( 1 << 10 )
169#define RTEMS_CAN_FIFOF_EMPTY ( 1 << 9 )
173#define RTEMS_CAN_FIFOF_DEAD ( 1 << 8 )
177#define RTEMS_CAN_FIFOF_INACTIVE ( 1 << 7 )
181#define RTEMS_CAN_FIFOF_FREEONEMPTY ( 1 << 6 )
185#define RTEMS_CAN_FIFOF_READY ( 1 << 5 )
189#define RTEMS_CAN_FIFOF_NOTIFYPEND ( 1 << 4 )
304 struct rtems_can_queue_edges_list
active[ RTEMS_CAN_QUEUE_PRIO_NR ];
309 struct rtems_can_queue_edges_list
idle;
313 struct rtems_can_queue_edges_list
inlist;
365#define RTEMS_CAN_QUEUE_NOTIFY_EMPTY ( 1 )
369#define RTEMS_CAN_QUEUE_NOTIFY_SPACE ( 2 )
373#define RTEMS_CAN_QUEUE_NOTIFY_PROC ( 3 )
378#define RTEMS_CAN_QUEUE_NOTIFY_NOUSR ( 4 )
382#define RTEMS_CAN_QUEUE_NOTIFY_DEAD ( 5 )
386#define RTEMS_CAN_QUEUE_NOTIFY_DEAD_WANTED ( 6 )
390#define RTEMS_CAN_QUEUE_NOTIFY_ATTACH ( 7 )
518 unsigned int flags2add
759 int allocated_slot_count,
784 int allocated_slot_countm,
820 rtems_interval timeout
This header file is part of CAN/CAN FD bus common support. It implements structure that represents fi...
This header file is part of CAN/CAN FD bus common support. It implements CAN frame structure and rela...
int rtems_can_queue_ends_init(struct rtems_can_queue_ends *qends)
This function implements subsystem independent routine to initialize ends state.
Definition: can-queue.c:564
int rtems_can_queue_pending_outslot_prio(struct rtems_can_queue_ends *qends, int prio_min)
This function tests ready outslot with minimum priority.
Definition: can-queue.c:430
int rtems_can_queue_get_inslot(struct rtems_can_queue_ends *qends, struct rtems_can_queue_edge **qedgep, struct rtems_can_queue_slot **slotp, int cmd)
This function finds one outgoing edge and allocates slot from it.
Definition: can-queue.c:106
int rtems_can_queue_filter_frame_to_edges(struct rtems_can_queue_ends *qends, struct rtems_can_queue_edge *src_edge, struct can_frame *frame, unsigned int flags2add)
This function sends message into all edges which accept its ID.
Definition: can-queue.c:268
int rtems_can_queue_disconnect_edge(struct rtems_can_queue_edge *qedge)
This function disconnects edge from communication entities.
Definition: can-queue.c:632
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.
Definition: can-quekern.c:420
int rtems_can_queue_kern_initialize(void)
This function provides initialization of kernel queue side.
Definition: can-quekern.c:452
int rtems_can_queue_get_inslot_for_prio(struct rtems_can_queue_ends *qends, struct rtems_can_queue_edge **qedgep, struct rtems_can_queue_slot **slotp, const struct can_frame_header *header, int cmd, int prio)
This function finds best outgoing edge and slot for given priority.
Definition: can-queue.c:136
int rtems_can_queue_fifo_done_kern(struct rtems_can_queue_fifo *fifo)
This function frees slots allocated for CAN FIFO.
Definition: can-quekern.c:319
int rtems_can_queue_fifo_flush_slots(struct rtems_can_queue_fifo *fifo)
This function frees all ready slots from the FIFO.
Definition: can-queue.c:48
int rtems_can_queue_connect_edge(struct rtems_can_queue_edge *qedge, struct rtems_can_queue_ends *input_ends, struct rtems_can_queue_ends *output_ends)
This function connects edge between two communication entities.
Definition: can-queue.c:578
int rtems_can_queue_test_outslot(struct rtems_can_queue_ends *qends, struct rtems_can_queue_edge **qedgep, struct rtems_can_queue_slot **slotp)
This function tests and retrieves ready slot for given ends.
Definition: can-queue.c:357
void rtems_can_queue_edge_do_dead(struct rtems_can_queue_edge *qedge)
This function disconnects the edge.
Definition: can-quekern.c:139
int rtems_can_queue_free_outslot(struct rtems_can_queue_ends *qends, struct rtems_can_queue_edge *qedge, struct rtems_can_queue_slot *slot)
This function frees processed output slot.
Definition: can-queue.c:476
int rtems_can_queue_abort_inslot(struct rtems_can_queue_ends *qends, struct rtems_can_queue_edge *qedge, struct rtems_can_queue_slot *slot)
This function aborts preparation of the message in the slot.
Definition: can-queue.c:247
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.
Definition: can-quekern.c:292
int rtems_can_queue_fifo_init_slots(struct rtems_can_queue_fifo *fifo)
This function initializes slot chain of one CAN FIFO.
Definition: can-queue.c:76
int rtems_can_queue_ends_kill_outlist(struct rtems_can_queue_ends *qends)
This function sends request to die to all incomming edges.
Definition: can-queue.c:761
int rtems_can_queue_put_inslot(struct rtems_can_queue_ends *qends, struct rtems_can_queue_edge *qedge, struct rtems_can_queue_slot *slot)
This function schedules filled slot for processing.
Definition: can-queue.c:227
void rtems_can_queue_do_edge_decref(struct rtems_can_queue_edge *edge)
This function decrements the edge user counter.
Definition: can-queue.c:101
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.
Definition: can-quekern.c:367
int rtems_can_queue_ends_kill_inlist(struct rtems_can_queue_ends *qends, int send_rest)
This function sends request to die to all outgoing edges.
Definition: can-queue.c:722
int rtems_can_queue_push_back_outslot(struct rtems_can_queue_ends *qends, struct rtems_can_queue_edge *qedge, struct rtems_can_queue_slot *slot)
This function reschedules output slot to process it again later.
Definition: can-queue.c:508
int rtems_can_queue_ends_flush_inlist(struct rtems_can_queue_ends *qends)
This function flushes all messages in incoming edges.
Definition: can-queue.c:776
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.
Definition: can-quekern.c:329
void rtems_can_queue_block_inlist(struct rtems_can_queue_ends *qends)
This function blocks slot allocation of all outgoing edges of specified ends.
Definition: can-queue.c:702
int rtems_can_queue_flush(struct rtems_can_queue_edge *qedge)
This function flushes all ready slots in the edge.
Definition: can-queue.c:540
int rtems_can_queue_ends_flush_outlist(struct rtems_can_queue_ends *qends)
This function flushes all messages in outgoing edges.
Definition: can-queue.c:787
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.
Definition: can-quekern.c:247
void rtems_can_queue_block_outlist(struct rtems_can_queue_ends *qends)
This function blocks slot allocation of all incoming edges of specified ends.
Definition: can-queue.c:712
int rtems_can_queue_test_inslot(struct rtems_can_queue_ends *qends)
This function tests whether there is a free space in any outgoing edge.
Definition: can-queue.c:203
This structure represents one CAN frame. It consists of CAN header and data.
Definition: can-frame.h:534
This structure is used to represent CAN ID and flags in one unified structure.
Definition: can-filter.h:50
This structure represents one direction connection from messages source ( input_ends) to message cons...
Definition: can-queue.h:231
struct rtems_can_queue_edges_list * peershead
This member holds the pointer to the activepeers head.
Definition: can-queue.h:263
int edge_prio
This member holds the the assigned queue priority from the range 0 to RTEMS_CAN_QUEUE_PRIO_NR - 1.
Definition: can-queue.h:283
struct rtems_can_queue_ends * output_ends
This member holds the pointer to the FIFO output side terminal ( rtems_can_queue_ends ).
Definition: can-queue.h:273
atomic_uint edge_used
This member holds the atomic usage counter, mainly used for safe destruction of the edge.
Definition: can-queue.h:278
TAILQ_ENTRY(rtems_can_queue_edge) input_peers
This member holds the lists of all peers FIFOs connected by their input side ( input_ends ) to the sa...
struct rtems_can_queue_ends * input_ends
This member holds the pointer to the FIFO input side terminal ( rtems_can_queue_ends ).
Definition: can-queue.h:268
struct rtems_can_queue_fifo fifo
This member holds place where primitive rtems_can_queue_fifo FIFO is located.
Definition: can-queue.h:236
TAILQ_ENTRY(rtems_can_queue_edge) output_peers
This member holds the lists of all peers FIFOs connected by their output side ( output_ends ) to the ...
int edge_num
This member holds the edge sequential number intended for debugging purposes only.
Definition: can-queue.h:288
TAILQ_ENTRY(rtems_can_queue_edge) activepeers
This member holds the lists of peers FIFOs connected by their output side ( output_ends ) to the same...
struct rtems_can_filter filter
This member holds place where primitive rtems_can_filter is located.
Definition: can-queue.h:241
This structure represents place to connect edges to for CAN communication entity. The zero,...
Definition: can-queue.h:299
struct rtems_can_queue_edges_list active[RTEMS_CAN_QUEUE_PRIO_NR]
This member holds the array of the lists of active edges directed to the ends structure.
Definition: can-queue.h:304
struct rtems_can_queue_edges_list outlist
This member holds the list of all incoming edges output sides. Each of there edges is listed on one o...
Definition: can-queue.h:318
TAILQ_ENTRY(rtems_can_queue_ends) dead_peers
This member is used to chain ends wanting for postponed destruction.
struct rtems_can_queue_edges_list idle
This member holds the list of the edges directed to the ends structure with empty FIFOs.
Definition: can-queue.h:309
rtems_mutex ends_lock
This member holds the lock synchronizing operations between threads accessing the ends.
Definition: can-queue.h:323
struct rtems_can_queue_edges_list inlist
This member holds the list of outgoing edges input sides.
Definition: can-queue.h:313
void(* notify)(struct rtems_can_queue_ends *qends, struct rtems_can_queue_edge *qedge, int what)
pointer to notify procedure. The next state changes are notified.
Definition: can-queue.h:350
This structure represents CAN FIFO queue. It is implemented as a single linked list of slots prepared...
Definition: can-queue.h:88
int allocated_slot_count
This member holds the number of allocated slots.
Definition: can-queue.h:134
unsigned int out_taken
This member holds the number of elements in the fifo.
Definition: can-queue.h:103
struct rtems_can_queue_slot * free_list
This member holds the pointer to list of the free slots associated with queue.
Definition: can-queue.h:121
rtems_mutex fifo_lock
This member holds the lock to ensure atomicity of slot manipulation operations.
Definition: can-queue.h:139
int max_data_length
This member holds maximum data length of one CAN frame.
Definition: can-queue.h:130
struct rtems_can_queue_slot * entry
This member holds the pointer to the memory allocated for the list slots.
Definition: can-queue.h:126
unsigned long error_code
This member holds futher description of error condition.
Definition: can-queue.h:107
struct rtems_can_queue_slot * head
This member holds the pointer to the FIFO head, oldest slot.
Definition: can-queue.h:111
atomic_uint fifo_flags
This field holds global flags describing state of the FIFO.
Definition: can-queue.h:92
struct rtems_can_queue_slot ** tail
This member holds the pointer to the location, where pointer to newly inserted slot should be added.
Definition: can-queue.h:116
This structure represents one CAN message slot in the CAN FIFO queue.
Definition: can-queue.h:60
atomic_uint slot_flags
Space for flags and optional command describing action associated with slot data.
Definition: can-queue.h:69
struct can_frame frame
This member holds can_frame structure representing one CAN frame/message.
Definition: can-queue.h:74
struct rtems_can_queue_slot * next
Pointer to next/younger slot.
Definition: can-queue.h:64