CAN memory allocation module. More...
CAN memory allocation module.
Definition in file pkt.h.
Go to the source code of this file.
Data Structures | |
struct | can_pkt_t |
A CAN packet. More... | |
void | can_pkt_init (void) |
Initialize the CAN packet module. | |
can_pkt_t * | can_pkt_alloc_tx (int ifnum, const struct can_frame *frame, kernel_pid_t tx_pid) |
Allocate a CAN packet to transmit. | |
can_pkt_t * | can_pkt_alloc_rx (int ifnum, const struct can_frame *frame) |
Allocate an incoming CAN packet. | |
can_pkt_t * | can_pkt_alloc_mbox_tx (int ifnum, const struct can_frame *frame, mbox_t *mbox) |
Allocate a CAN packet for a mbox to transmit. | |
void | can_pkt_free (can_pkt_t *pkt) |
Free a CAN packet. | |
can_rx_data_t * | can_pkt_alloc_rx_data (void *data, size_t len, void *arg) |
Allocate a can_rx_data_t and initialize it with gieven parameters. | |
void | can_pkt_free_rx_data (can_rx_data_t *data) |
Free rx data previously allocated by can_pkt_alloc_rx_data() | |
void * | can_pkt_buf_alloc (size_t size) |
Allocate size bytes and return the pointer. | |
void | can_pkt_buf_free (void *data, size_t size) |
Free the data allocated by can_pkt_buf_alloc() | |
Allocate a CAN packet for a mbox to transmit.
This function allocates a CAN packet and associate it to the ifnum
and mbox
. The provided frame
is copied into the CAN packet and a unique handle is set.
[in] | ifnum | the interface number |
[in] | frame | the frame to copy |
[in] | mbox | the pointer to the sender's mbox |
Allocate an incoming CAN packet.
[in] | ifnum | the interface number |
[in] | frame | the received frame |
can_rx_data_t * can_pkt_alloc_rx_data | ( | void * | data, |
size_t | len, | ||
void * | arg | ||
) |
Allocate a can_rx_data_t
and initialize it with gieven parameters.
This is used to allocate a return value to the upper layer
[in] | data | data which will be returned |
[in] | len | length of data |
[in] | arg | optional argument for the upper layer |
can_rx_data_t
pointer, NULL if out of memory can_pkt_t * can_pkt_alloc_tx | ( | int | ifnum, |
const struct can_frame * | frame, | ||
kernel_pid_t | tx_pid | ||
) |
Allocate a CAN packet to transmit.
This function allocates a CAN packet and associates it to the ifnum
and tx_pid
. The provided frame
is copied into the CAN packet and a unique handle is set.
[in] | ifnum | the interface number |
[in] | frame | the frame to copy |
[in] | tx_pid | the pid of the sender's device thread |
void * can_pkt_buf_alloc | ( | size_t | size | ) |
Allocate size
bytes and return the pointer.
This function has been copied from gnrc_pktbuf_static
[in] | size | the number of bytes to allocate |
void can_pkt_buf_free | ( | void * | data, |
size_t | size | ||
) |
Free the data allocated by can_pkt_buf_alloc()
[in] | data | the pointer to free |
[in] | size | the size of the data to free |
void can_pkt_free | ( | can_pkt_t * | pkt | ) |
Free a CAN packet.
[in] | pkt | the packet to free, it must be a pointer returned by can_pkt_alloc_tx or can_pkt_alloc_rx |
void can_pkt_free_rx_data | ( | can_rx_data_t * | data | ) |
Free rx data previously allocated by can_pkt_alloc_rx_data()
[in] | data | the pointer to free |
void can_pkt_init | ( | void | ) |
Initialize the CAN packet module.
This must be called by the DLL to initialize the module