42#ifndef __DEV_CAN_CAN_QUEUE_H
43#define __DEV_CAN_CAN_QUEUE_H
49#include <rtems/timespec.h>
50#include <rtems/status-checks.h>
51#include <rtems/thread.h>
79#define RTEMS_CAN_SLOTF_CMD ( 0x00ff )
144#define RTEMS_CAN_FIFOF_DESTROY ( 1 << 15 )
148#define RTEMS_CAN_FIFOF_ERROR ( 1 << 14 )
152#define RTEMS_CAN_FIFOF_ERR2BLOCK ( 1 << 13 )
156#define RTEMS_CAN_FIFOF_BLOCK ( 1 << 12 )
160#define RTEMS_CAN_FIFOF_OVERRUN ( 1 << 11 )
164#define RTEMS_CAN_FIFOF_FULL ( 1 << 10 )
168#define RTEMS_CAN_FIFOF_EMPTY ( 1 << 9 )
172#define RTEMS_CAN_FIFOF_DEAD ( 1 << 8 )
176#define RTEMS_CAN_FIFOF_INACTIVE ( 1 << 7 )
180#define RTEMS_CAN_FIFOF_FREEONEMPTY ( 1 << 6 )
184#define RTEMS_CAN_FIFOF_READY ( 1 << 5 )
188#define RTEMS_CAN_FIFOF_NOTIFYPEND ( 1 << 4 )
303 struct rtems_can_queue_edges_list
active[RTEMS_CAN_QUEUE_PRIO_NR];
308 struct rtems_can_queue_edges_list
idle;
312 struct rtems_can_queue_edges_list
inlist;
364#define RTEMS_CAN_QUEUE_NOTIFY_EMPTY ( 1 )
368#define RTEMS_CAN_QUEUE_NOTIFY_SPACE ( 2 )
372#define RTEMS_CAN_QUEUE_NOTIFY_PROC ( 3 )
377#define RTEMS_CAN_QUEUE_NOTIFY_NOUSR ( 4 )
381#define RTEMS_CAN_QUEUE_NOTIFY_DEAD ( 5 )
385#define RTEMS_CAN_QUEUE_NOTIFY_DEAD_WANTED ( 6 )
389#define RTEMS_CAN_QUEUE_NOTIFY_ATTACH ( 7 )
517 unsigned int flags2add
758 int allocated_slot_count,
783 int allocated_slot_countm,
819 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:517
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:393
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:103
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:245
int rtems_can_queue_disconnect_edge(struct rtems_can_queue_edge *qedge)
This function disconnects edge from communication entities.
Definition: can-queue.c:582
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:398
int rtems_can_queue_kern_initialize(void)
This function provides initialization of kernel queue side.
Definition: can-quekern.c:430
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:131
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:301
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:47
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:531
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:323
void rtems_can_queue_edge_do_dead(struct rtems_can_queue_edge *qedge)
This function disconnects the edge.
Definition: can-quekern.c:135
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:435
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:226
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:275
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:73
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:705
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:206
void rtems_can_queue_do_edge_decref(struct rtems_can_queue_edge *edge)
This function decrements the edge user counter.
Definition: can-queue.c:98
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:346
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:670
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:467
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:719
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:311
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:652
int rtems_can_queue_flush(struct rtems_can_queue_edge *qedge)
This function flushes all ready slots in the edge.
Definition: can-queue.c:495
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:729
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:233
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:661
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:187
This structure represents one CAN frame. It consists of CAN header and data.
Definition: can-frame.h:533
This structure is used to represent CAN ID and flags in one unified structure.
Definition: can-filter.h:49
This structure represents one direction connection from messages source ( input_ends) to message cons...
Definition: can-queue.h:230
struct rtems_can_queue_edges_list * peershead
This member holds the pointer to the activepeers head.
Definition: can-queue.h:262
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:282
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:272
atomic_uint edge_used
This member holds the atomic usage counter, mainly used for safe destruction of the edge.
Definition: can-queue.h:277
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:267
struct rtems_can_queue_fifo fifo
This member holds place where primitive rtems_can_queue_fifo FIFO is located.
Definition: can-queue.h:235
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:287
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:240
This structure represents place to connect edges to for CAN communication entity. The zero,...
Definition: can-queue.h:298
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:303
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:317
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:308
rtems_mutex ends_lock
This member holds the lock synchronizing operations between threads accessing the ends.
Definition: can-queue.h:322
struct rtems_can_queue_edges_list inlist
This member holds the list of outgoing edges input sides.
Definition: can-queue.h:312
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:349
This structure represents CAN FIFO queue. It is implemented as a single linked list of slots prepared...
Definition: can-queue.h:87
int allocated_slot_count
This member holds the number of allocated slots.
Definition: can-queue.h:133
unsigned int out_taken
This member holds the number of elements in the fifo.
Definition: can-queue.h:102
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:120
rtems_mutex fifo_lock
This member holds the lock to ensure atomicity of slot manipulation operations.
Definition: can-queue.h:138
int max_data_length
This member holds maximum data length of one CAN frame.
Definition: can-queue.h:129
struct rtems_can_queue_slot * entry
This member holds the pointer to the memory allocated for the list slots.
Definition: can-queue.h:125
unsigned long error_code
This member holds futher description of error condition.
Definition: can-queue.h:106
struct rtems_can_queue_slot * head
This member holds the pointer to the FIFO head, oldest slot.
Definition: can-queue.h:110
atomic_uint fifo_flags
This field holds global flags describing state of the FIFO.
Definition: can-queue.h:91
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:115
This structure represents one CAN message slot in the CAN FIFO queue.
Definition: can-queue.h:59
atomic_uint slot_flags
Space for flags and optional command describing action associated with slot data.
Definition: can-queue.h:68
struct can_frame frame
This member holds can_frame structure representing one CAN frame/message.
Definition: can-queue.h:73
struct rtems_can_queue_slot * next
Pointer to next/younger slot.
Definition: can-queue.h:63