Lely core libraries
2.3.4
|
Go to the documentation of this file.
25 #define LELY_CAN_BUF_INLINE extern inline
35 #ifndef LELY_CAN_BUF_SIZE
36 #define LELY_CAN_BUF_SIZE 16
72 realloc(buf->
ptr, (size + 1) *
sizeof(
struct can_msg));
84 size_t end = buf->
end & buf->
size;
88 begin += size - buf->
size;
90 memmove(dstptr, srcptr,
91 (endptr - srcptr) *
sizeof(
struct can_msg));
size_t size
The total size (in number of frames) of the buffer, excluding the unused frame used to distinguish be...
A CAN or CAN FD format frame.
struct can_msg * ptr
A pointer to the allocated memory for the buffer.
@ ERRNUM_NOMEM
Not enough space.
void can_buf_fini(struct can_buf *buf)
Finalizes a CAN frame buffer.
int errno2c(int errnum)
Transforms a standard C error number to a native error code.
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.
#define LELY_CAN_BUF_SIZE
The minimum size (in number of frames) of a CAN frame buffer.
void set_errnum(errnum_t errnum)
Sets the current (thread-specific) platform-independent error number to errnum.
void set_errc(int errc)
Sets the current (thread-specific) native error code to errc.
LELY_CAN_BUF_INLINE size_t can_buf_capacity(const struct can_buf *buf)
Returns the number of frames available for writing in a CAN buffer.
size_t begin
The offset (with respect to ptr) of the first value available for reading (and two past the last avai...
size_t end
The offset (with respect to ptr) of one past the last value available for reading (and the first avai...
LELY_CAN_BUF_INLINE size_t can_buf_size(const struct can_buf *buf)
Returns the number of frames available for reading in a CAN buffer.