include/can/pkt.h¶
CAN memory allocation module.
-
void
can_pkt_init
(void)¶ Initialize the CAN packet module.
This must be called by the DLL to initialize the module
-
can_pkt_t *
can_pkt_alloc_tx
(int ifnum, const struct can_frame * frame,kernel_types.h::kernel_pid_t
tx_pid)¶ Allocate a CAN packet to transmit.
This function allocates a CAN packet and associates it to the
ifnum
andtx_pid
. The providedframe
is copied into the CAN packet and a unique handle is set.Parameters
ifnum: the interface number frame: the frame to copy tx_pid: the pid of the sender’s device thread Return values
- an allocated CAN packet, NULL if an error occured
-
can_pkt_t *
can_pkt_alloc_rx
(int ifnum, const struct can_frame * frame)¶ Allocate an incoming CAN packet.
Parameters
ifnum: the interface number frame: the received frame Return values
- an allocated CAN packet, NULL if an error occured
-
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.
This function allocates a CAN packet and associate it to the
ifnum
andmbox
. The providedframe
is copied into the CAN packet and a unique handle is set.Parameters
ifnum: the interface number frame: the frame to copy mbox: the pointer to the sender’s mbox Return values
- an allocated CAN packet, NULL if an error occured
-
void
can_pkt_free
(can_pkt_t * pkt)¶ Free a CAN packet.
Parameters
pkt: the packet to free, it must be a pointer returned by include/can/pkt.h::can_pkt_alloc_tx()
orinclude/can/pkt.h::can_pkt_alloc_rx()
-
sys/include/can/common.h::can_rx_data_t
*can_pkt_alloc_rx_data
(void * data,msp430_types.h::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
Parameters
data: data which will be returned len: length of data
arg: optional argument for the upper layer Return values
- a
can_rx_data_t
pointer, NULL if out of memory
- a
-
void
can_pkt_free_rx_data
(sys/include/can/common.h::can_rx_data_t
* data)¶ Free rx data previously allocated by
include/can/pkt.h::can_pkt_alloc_rx_data()
Parameters
data: the pointer to free
-
void *
can_pkt_buf_alloc
(msp430_types.h::size_t
size)¶ Allocate
size
bytes and return the pointer.This function has been copied from gnrc_pktbuf_static
Parameters
size: the number of bytes to allocate Return values
- the pointer to thje allocated data, NULL if out of memory
-
void
can_pkt_buf_free
(void * data,msp430_types.h::size_t
size)¶ Free the data allocated by
include/can/pkt.h::can_pkt_buf_alloc()
Parameters
data: the pointer to free size: the size of the data to free
-
struct
can_pkt_t
¶ A CAN packet.
A CAN packet is used to add stack-related data around a CAN frame
-
sys/include/can/common.h::can_reg_entry_t
entry
¶ entry containing ifnum and upper layer info
-
atomic_uint
ref_count
¶ Reference counter (for rx frames)
-
int
handle
¶ handle (for tx frames
-
include/net/gnrc/pkt.h::gnrc_pktsnip_t
*snip
¶ Pointer to the allocated snip.
-