Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the source code of this file.
Data Structures | |
struct | MsgQueue |
Typedefs | |
typedef struct MsgQueue | MsgQueue |
Enumerations | |
enum | MsgQueueStatus { MsgQueue_MAILBOX_FULL = -100, MsgQueue_MAILBOX_FAIL, MsgQueue_MAILBOX_TIMEOUT, MsgQueue_MAILBOX_NOT_EMPTY, MsgQueue_INVALID_PTR, MsgQueue_OK = 0 } |
enum | MsgQueueUrgency { MsgQueue_REGULAR, MsgQueue_OUT_OF_BAND } |
Functions | |
void | msgqueue_init (MsgQueue *que, tlsf_memory_heap_t *heap, msg_t *mb_buf, const cnt_t mb_size) |
initialise MsgQueue More... | |
bool | msgqueue_is_full (MsgQueue *que) |
test if queue is full More... | |
bool | msgqueue_is_empty (MsgQueue *que) |
test if queue is empty More... | |
int32_t | msgqueue_send (MsgQueue *que, void *msg, const uint16_t msgLen, const MsgQueueUrgency urgency) |
send a buffer previously allocated by msgqueue_malloc_before_send More... | |
int32_t | msgqueue_send_timeout (MsgQueue *que, void *msg, const uint16_t msgLen, const MsgQueueUrgency urgency, const systime_t timout) |
send a buffer previously allocated by msgqueue_malloc_before_send More... | |
int32_t | msgqueue_copy_send (MsgQueue *que, const void *msg, const uint16_t msgLen, const MsgQueueUrgency urgency) |
send a buffer NOT previously allocated More... | |
int32_t | msgqueue_copy_send_timeout (MsgQueue *que, const void *msg, const uint16_t msgLen, const MsgQueueUrgency urgency, const systime_t timout) |
send a buffer NOT previously allocated More... | |
int32_t | msgqueue_pop (MsgQueue *que, void **msgPtr) |
wait then receive message More... | |
int32_t | msgqueue_pop_timeout (MsgQueue *que, void **msgPtr, const systime_t timout) |
receive message specifying timeout More... | |
const char * | msgqueue_strerror (const MsgQueueStatus errno) |
debug api More... | |
struct MsgQueue |
Definition at line 225 of file msg_queue.h.
Data Fields | ||
---|---|---|
tlsf_memory_heap_t * | heap | |
mailbox_t | mb |
Definition at line 49 of file msg_queue.h.
enum MsgQueueStatus |
Enumerator | |
---|---|
MsgQueue_MAILBOX_FULL | |
MsgQueue_MAILBOX_FAIL | |
MsgQueue_MAILBOX_TIMEOUT | |
MsgQueue_MAILBOX_NOT_EMPTY | |
MsgQueue_INVALID_PTR | |
MsgQueue_OK |
Definition at line 38 of file msg_queue.h.
enum MsgQueueUrgency |
Enumerator | |
---|---|
MsgQueue_REGULAR | |
MsgQueue_OUT_OF_BAND |
Definition at line 47 of file msg_queue.h.
int32_t msgqueue_copy_send | ( | MsgQueue * | que, |
const void * | msg, | ||
const uint16_t | msgLen, | ||
const MsgQueueUrgency | urgency | ||
) |
send a buffer NOT previously allocated
buffer is copied before beeing sent, buffer is still valid after this function returns. Less effective that zero copy alternatives which has been to be preferably used Non blocking, if queue is full, report error and immediately return
[in] | que | pointer to opaque MsgQueue object |
[in] | msg | pointer to buffer |
[in] | msgLen | length of buffer (the same param that has been given to msgqueue_malloc_before_send) |
[in] | urgency | regular=queued at end of fifo or out_of_band queued at start of fifo |
Definition at line 127 of file msg_queue.c.
References msg, and msgqueue_copy_send_timeout().
int32_t msgqueue_copy_send_timeout | ( | MsgQueue * | que, |
const void * | msg, | ||
const uint16_t | msgLen, | ||
const MsgQueueUrgency | urgency, | ||
const systime_t | timout | ||
) |
send a buffer NOT previously allocated
buffer is copied before beeing sent, buffer is still valid after this function returns. Less effective that zero copy alternatives which has been to be preferably used
[in] | que | pointer to opaque MsgQueue object |
[in] | msg | pointer to buffer |
[in] | msgLen | length of buffer (the same param that has been given to msgqueue_malloc_before_send) |
[in] | urgency | regular=queued at end of fifo or out_of_band queued at start of fifo |
[in] | timout | : time to wait for MailBox avaibility (can be TIME_INFINITE or TIME_IMMEDIATE) |
Definition at line 114 of file msg_queue.c.
References msg, MSGQ_HEAP, MsgQueue_MAILBOX_FULL, msgqueue_send_timeout(), and tlsf_malloc_r().
Referenced by msgqueue_copy_send().
void msgqueue_init | ( | MsgQueue * | que, |
tlsf_memory_heap_t * | heap, | ||
msg_t * | mb_buf, | ||
const cnt_t | mb_size | ||
) |
initialise MsgQueue
init sdQueue objet, tie memory pool buffer, tie mailbox buffer initialize mailbox
[out] | que | opaque object to be initialized |
[in] | heap | reference to the tlsf heap object (needed if module should free memory) |
[in] | mb_buff | internal buffer used by MailBox (see Chibios Doc) |
[in] | mb_size | size of previous buffer (length of MailBox queue) |
Definition at line 42 of file msg_queue.c.
References MsgQueue::heap, and MsgQueue::mb.
Referenced by sdLogInit().
bool msgqueue_is_empty | ( | MsgQueue * | que | ) |
test if queue is empty
[in] | que | pointer to opaque MsgQueue object |
Definition at line 59 of file msg_queue.c.
References MsgQueue::mb.
bool msgqueue_is_full | ( | MsgQueue * | que | ) |
test if queue is full
[in] | que | pointer to opaque MsgQueue object |
Definition at line 50 of file msg_queue.c.
References MsgQueue::mb.
wait then receive message
this is zero copy api, blocking call usage : struct MyStruct *msg msgqueue_pop (&que, void (void **) &msg); use msg->myField etc etc tlsf_free(MSGQ_HEAP, msg);
[in] | que | pointer to opaque MsgQueue object |
[out] | msgPtr | pointer to pointer to buffer |
Definition at line 134 of file msg_queue.c.
References msgqueue_pop_timeout().
receive message specifying timeout
this is zero copy api, blocking call usage : struct MyStruct *msg msgqueue_pop (&que, void (void **) &msg); use msg->myField etc etc msgqueue_free_after_pop (&que, msg);
[in] | que | pointer to opaque MsgQueue object |
[out] | msgPtr | pointer to pointer to buffer |
[in] | timout | : time to wait for MailBox avaibility (can be TIME_INFINITE or TIME_IMMEDIATE) |
Definition at line 139 of file msg_queue.c.
References MsgQueue::mb, MsgPtrLen::msg_ptr_len, MSGQ_HEAP, MsgQueue_MAILBOX_TIMEOUT, status, and tlsf_get_heap_addr().
Referenced by msgqueue_pop().
int32_t msgqueue_send | ( | MsgQueue * | que, |
void * | msg, | ||
const uint16_t | msgLen, | ||
const MsgQueueUrgency | urgency | ||
) |
send a buffer previously allocated by msgqueue_malloc_before_send
deallocation is done by the caching thread which actually write data to sd card from the sender point of view, ptr should be considered invalid after beeing sent. Even if msgqueue_send fail, deallocation is done Non blocking, if queue is full, report error and immediately return usage : msg = tlsf_malloc(MSGQ_HEAP, msg, msgLen); msgqueue_send (que, msg, msgLen, urgency);
[in] | que | pointer to opaque MsgQueue object |
[in] | msg | pointer to buffer given by msgqueue_malloc_before_send |
[in] | msgLen | length of buffer (the same param that has been given to msgqueue_malloc_before_send) |
[in] | urgency | regular=queued at end of fifo or out_of_band queued at start of fifo |
Definition at line 69 of file msg_queue.c.
References msg, and msgqueue_send_timeout().
int32_t msgqueue_send_timeout | ( | MsgQueue * | que, |
void * | msg, | ||
const uint16_t | msgLen, | ||
const MsgQueueUrgency | urgency, | ||
const systime_t | timout | ||
) |
send a buffer previously allocated by msgqueue_malloc_before_send
deallocation is done by the caching thread which actually write data to sd card from the sender point of view, ptr should be considered invalid after beeing sent. Even if msgqueue_send fail, deallocation is done usage : msg = tlsf_malloc(MSGQ_HEAP, msg, msgLen); msgqueue_send (que, msg, msgLen, urgency);
[in] | que | pointer to opaque MsgQueue object |
[in] | msg | pointer to buffer given by msgqueue_malloc_before_send |
[in] | msgLen | length of buffer (the same param that has been given to msgqueue_malloc_before_send) |
[in] | urgency | regular=queued at end of fifo or out_of_band queued at start of fifo |
[in] | timout | : time to wait for MailBox avaibility (can be TIME_INFINITE or TIME_IMMEDIATE) |
Definition at line 76 of file msg_queue.c.
References MsgQueue::heap, MsgQueue::mb, msg, MsgPtrLen::msg_ptr_len, MSGQ_HEAP, MsgQueue_INVALID_PTR, MsgQueue_MAILBOX_FULL, MsgQueue_REGULAR, tlsf_free_r(), and tlsf_get_heap_addr().
Referenced by msgqueue_copy_send_timeout(), and msgqueue_send().
const char* msgqueue_strerror | ( | const MsgQueueStatus | errno | ) |
debug api
give ascii string corresponding to the given errno
[in] | errno | : staus |
Definition at line 168 of file msg_queue.c.
References _strerror, and MsgQueue_MAILBOX_FULL.