diff options
| author | Grissiom <[email protected]> | 2015-01-06 18:50:22 +0800 |
|---|---|---|
| committer | Grissiom <[email protected]> | 2015-01-07 17:15:49 +0800 |
| commit | f7415e595e613e37c5f7c4cebbc9a67a8eb68592 (patch) | |
| tree | 885822b76b9259de5b5ef288b369ed44d34d5da6 /components/vbus/prio_queue.h | |
| parent | fcff552626079f87889ef4d03cbc25a909b6c71b (diff) | |
VBus: added
Currently only lpc43xx is supported.
Diffstat (limited to 'components/vbus/prio_queue.h')
| -rw-r--r-- | components/vbus/prio_queue.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/components/vbus/prio_queue.h b/components/vbus/prio_queue.h new file mode 100644 index 0000000000..09bc3c7e63 --- /dev/null +++ b/components/vbus/prio_queue.h @@ -0,0 +1,44 @@ +#ifndef __PRIO_QUEUE_H__ +#define __PRIO_QUEUE_H__ + +#include <rtthread.h> + +#define RT_PRIO_QUEUE_PRIO_MAX 32 + +struct rt_prio_queue_item; + +struct rt_prio_queue { + rt_uint32_t bitmap; + struct rt_prio_queue_item *head[RT_PRIO_QUEUE_PRIO_MAX]; + struct rt_prio_queue_item *tail[RT_PRIO_QUEUE_PRIO_MAX]; + /* push thread suspend on the mempool, not queue */ + rt_list_t suspended_pop_list; + rt_size_t item_sz; + + struct rt_mempool pool; +}; + +rt_err_t rt_prio_queue_init(struct rt_prio_queue *que, + const char *name, + void *buf, + rt_size_t bufsz, + rt_size_t itemsz); +void rt_prio_queue_detach(struct rt_prio_queue *que); + +rt_err_t rt_prio_queue_push(struct rt_prio_queue *que, + rt_uint8_t prio, + void *data, + rt_int32_t timeout); +rt_err_t rt_prio_queue_pop(struct rt_prio_queue *que, + void *data, + rt_int32_t timeout); +#ifdef RT_USING_HEAP +struct rt_prio_queue* rt_prio_queue_create(const char *name, + rt_size_t item_nr, + rt_size_t item_sz); +void rt_prio_queue_delete(struct rt_prio_queue *que); +#endif + +void rt_prio_queue_dump(struct rt_prio_queue *que); + +#endif /* end of include guard: __PRIO_QUEUE_H__ */ |
