|
int | can_buf_init (struct can_buf *buf, size_t size) |
| Initializes a CAN frame buffer. More...
|
|
void | can_buf_fini (struct can_buf *buf) |
| Finalizes a CAN frame buffer. More...
|
|
struct can_buf * | can_buf_create (size_t size) |
| Allocates and initializes a CAN frame buffer. More...
|
|
void | can_buf_clear (struct can_buf *buf) |
| Clears a CAN frame buffer.
|
|
size_t | can_buf_size (const struct can_buf *buf) |
| Returns the number of frames available for reading in a CAN buffer. More...
|
|
size_t | can_buf_capacity (const struct can_buf *buf) |
| Returns the number of frames available for writing in a CAN buffer. More...
|
|
size_t | can_buf_reserve (struct can_buf *buf, size_t n) |
| Resizes a CAN frame buffer, if necessary, to make room for at least n additional frames. More...
|
|
size_t | can_buf_peek (struct can_buf *buf, struct can_msg *ptr, size_t n) |
| Reads, but does not remove, frames from a CAN frame buffer. More...
|
|
size_t | can_buf_read (struct can_buf *buf, struct can_msg *ptr, size_t n) |
| Reads, and removes, frames from a CAN frame buffer. More...
|
|
size_t | can_buf_write (struct can_buf *buf, const struct can_msg *ptr, size_t n) |
| Writes frames to a CAN frame buffer. More...
|
|
This header file is part of the CAN library; it contains the CAN frame buffer declarations.
The CAN frame buffer is implemented as a circular buffer. Apart from can_buf_clear() and can_buf_reserve() (an obviously can_buf_init() and can_buf_fini()), all buffer functions are thread-safe and lock-free, provided there are at most two threads accessing the buffer at the same time (single-reader single-writer).
- Copyright
- 2016-2018 Lely Industries N.V.
- Author
- J. S. Seldenthuis jseld.nosp@m.enth.nosp@m.uis@l.nosp@m.ely..nosp@m.com
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Definition in file buf.h.