![]() |
RTEMS 7.0-rc1
|
This file is part of CAN/CAN FD bus common support and implements CAN FIFOs and generic hubs/ends for chip and character driver interface sides. More...
Macros | |
| #define | RTEMS_CAN_QUEUE_ROUND_ROBIN 1 |
Functions | |
| int | rtems_can_queue_fifo_flush_slots (struct rtems_can_queue_fifo *fifo) |
| This function frees all ready slots from the FIFO. | |
| int | rtems_can_queue_fifo_init_slots (struct rtems_can_queue_fifo *fifo) |
| This function initializes slot chain of one CAN FIFO. | |
| void | rtems_can_queue_do_edge_decref (struct rtems_can_queue_edge *qedge) |
| This function decrements the edge user counter. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| int | rtems_can_queue_pending_outslot_prio (struct rtems_can_queue_ends *qends, int prio_min) |
| This function tests ready outslot with minimum priority. | |
| 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. | |
| 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. | |
| int | rtems_can_queue_flush (struct rtems_can_queue_edge *qedge) |
| This function flushes all ready slots in the edge. | |
| int | rtems_can_queue_ends_init (struct rtems_can_queue_ends *qends) |
| This function implements subsystem independent routine to initialize ends state. | |
| 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. | |
| int | rtems_can_queue_disconnect_edge (struct rtems_can_queue_edge *qedge) |
| This function disconnects edge from communication entities. | |
| void | rtems_can_queue_block_inlist (struct rtems_can_queue_ends *qends) |
| This function blocks slot allocation of all outgoing edges of specified ends. | |
| void | rtems_can_queue_block_outlist (struct rtems_can_queue_ends *qends) |
| This function blocks slot allocation of all incoming edges of specified ends. | |
| 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. | |
| int | rtems_can_queue_ends_kill_outlist (struct rtems_can_queue_ends *qends) |
| This function sends request to die to all incomming edges. | |
| int | rtems_can_queue_ends_flush_inlist (struct rtems_can_queue_ends *qends) |
| This function flushes all messages in incoming edges. | |
| int | rtems_can_queue_ends_flush_outlist (struct rtems_can_queue_ends *qends) |
| This function flushes all messages in outgoing edges. | |
This file is part of CAN/CAN FD bus common support and implements CAN FIFOs and generic hubs/ends for chip and character driver interface sides.
Implementation is based on original LinCAN - Linux CAN bus driver Part of OrtCAN project https://ortcan.sourceforge.net/
| 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.
Frees slot previously acquired by rtems_can_queue_get_inslot or rtems_can_queue_get_inslot_for_prio function call. Used when message copying into slot fails.
| qends | Ends structure belonging to calling communication object. |
| qedge | Edge the slot belongs to. |
| slot | Pointer to the preprared slot. |
| void rtems_can_queue_block_inlist | ( | struct rtems_can_queue_ends * | qends | ) |
This function blocks slot allocation of all outgoing edges of specified ends.
| qends | Pointer to ends structure. |
| void rtems_can_queue_block_outlist | ( | struct rtems_can_queue_ends * | qends | ) |
This function blocks slot allocation of all incoming edges of specified ends.
| qends | Pointer to ends structure. |
| 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.
| qedge | Pointer to edge. |
| input_ends | Pointer to ends the input of the edge should be connected to. |
| output_ends | Pointer to ends the output of the edge should be connected to. |
| int rtems_can_queue_disconnect_edge | ( | struct rtems_can_queue_edge * | qedge | ) |
This function disconnects edge from communication entities.
| qedge | Pointer to edge. |
| void rtems_can_queue_do_edge_decref | ( | struct rtems_can_queue_edge * | edge | ) |
This function decrements the edge user counter.
| qedge | Pointer to the edge to be disconnected. |
| int rtems_can_queue_ends_flush_inlist | ( | struct rtems_can_queue_ends * | qends | ) |
This function flushes all messages in incoming edges.
| qends | pointer to ends structure |
Return Value: Negative value informs about unsuccessful result
| int rtems_can_queue_ends_flush_outlist | ( | struct rtems_can_queue_ends * | qends | ) |
This function flushes all messages in outgoing edges.
| qends | Pointer to ends structure. |
| int rtems_can_queue_ends_init | ( | struct rtems_can_queue_ends * | qends | ) |
This function implements subsystem independent routine to initialize ends state.
| qends | Pointer to the end. |
| 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.
| qends | Pointer to ends structure. |
| send_rest | Select, whether already allocated slots should be processed by FIFO output side. |
| int rtems_can_queue_ends_kill_outlist | ( | struct rtems_can_queue_ends * | qends | ) |
This function sends request to die to all incomming edges.
| qends | Pointer to ends structure. |
| int rtems_can_queue_fifo_flush_slots | ( | struct rtems_can_queue_fifo * | fifo | ) |
This function frees all ready slots from the FIFO.
The caller should be prepared to handle situations, when some slots are held by input or output side slots processing. These slots cannot be flushed or their processing interrupted.
| fifo | Pointer to the FIFO structure. |
| int rtems_can_queue_fifo_init_slots | ( | struct rtems_can_queue_fifo * | fifo | ) |
This function initializes slot chain of one CAN FIFO.
The caller should be prepared to handle situations, when some slots are held by input or output side slots processing. These slots cannot be flushed or their processing interrupted.
| fifo | Pointer to the FIFO structure. |
| 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.
Sends message to all outgoing edges connected to the given ends, which accepts message communication ID.
| qends | Ends structure belonging to calling communication object |
| src_edge | Optional source edge for echo detection |
| frame | Pointer to CAN frame. |
| flags2add | Optional additional CAN Frame flags. |
| int rtems_can_queue_flush | ( | struct rtems_can_queue_edge * | qedge | ) |
This function flushes all ready slots in the edge.
Tries to flush all allocated slots from the edge, but there could exist some slots associated to edge which are processed by input or output side and cannot be flushed at this moment
| qedge | Pointer to the edge. |
| 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.
Function releases processed slot previously acquired by rtems_can_queue_test_outslot function call.
| qends | Ends structure belonging to calling communication object. |
| qedge | Edge the slot belongs to. |
| slot | Pointer to the processed slot. |
| 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.
Function looks for the first non-blocked outgoing edge in @qends structure and tries to allocate slot from it.
| qends | Ends structure belonging to calling communication object. |
| qedgep | Place to store pointer to found edge. |
| slotp | Place to store pointer to allocated slot. |
| cmd | Command type for slot. |
| 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.
Function looks for the non-blocked outgoing edge accepting messages with given ID. If edge is found, slot is allocated from that edge. The edges with non-zero mask are preferred over edges open to all messages. If more edges with mask accepts given message ID, the edge with highest priority below or equal to required priority is selected.
| qends | Ends structure belonging to calling communication object. |
| qedgep | Place to store pointer to found edge. |
| slotp | Place to store pointer to allocated slot. |
| cmd | Command type for slot. |
| can_frame_header | Pointer to CAN frame header. |
| prio | Optional priority of message, |
| int rtems_can_queue_pending_outslot_prio | ( | struct rtems_can_queue_ends * | qends, |
| int | prio_min | ||
| ) |
This function tests ready outslot with minimum priority.
Function searches for ready slot in active incoming edge. The difference from rtems_can_queue_test_outslot function is that this function does not retreive the slot from FIFO, it just checks its existence. This can be used to determined whether there is a slot with higher priority class in the infrastruce.
| qends | Ends structure belonging to calling communication object. |
| prio_min | Minimum slot priority to be considered |
| 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.
Function reschedules slot previously acquired by rtems_can_queue_test_outslot function call for second time processing.
| qends | Ends structure belonging to calling communication object. |
| qedge | Edge the slot belongs to. |
| slot | Pointer to the processed slot. |
| 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.
Puts slot previously acquired by rtems_can_queue_get_inslot or rtems_can_queue_get_inslot_for_prio function call into FIFO queue and activates edge processing if needed.
| qends | Ends structure belonging to calling communication object. |
| qedge | Edge the slot belongs to. |
| slot | Pointer to the preprared slot. |
| 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.
Function looks for the first non-blocked outgoing edge in @qends structure with free space for slot.
| qends | Ends structure belonging to calling communication object. |
| 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.
Function takes highest priority active incoming edge and retrieves oldest ready slot from it.
| qends | Ends structure belonging to calling communication object. |
| qedgep | Place to store pointer to found edge. |
| slotp | Place to store pointer to received slot. |