csp_queue.h
Go to the documentation of this file.
1 /*
2 Cubesat Space Protocol - A small network-layer protocol designed for Cubesats
3 Copyright (C) 2012 Gomspace ApS (http://www.gomspace.com)
4 Copyright (C) 2012 AAUSAT3 Project (http://aausat3.space.aau.dk)
5 
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10 
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15 
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20 
27 #ifndef _CSP_QUEUE_H_
28 #define _CSP_QUEUE_H_
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 
39 #define CSP_QUEUE_FULL 0
40 
45 #define CSP_QUEUE_ERROR 0
46 
51 #define CSP_QUEUE_OK 1
52 
57 typedef void * csp_queue_handle_t;
58 
59 #include <stdint.h>
60 #include <csp/csp.h>
61 
66 csp_queue_handle_t csp_queue_create(int length, size_t item_size);
67 
72 void csp_queue_remove(csp_queue_handle_t queue);
73 
78 int csp_queue_enqueue(csp_queue_handle_t handle, void *value, uint32_t timeout);
79 
84 int csp_queue_enqueue_isr(csp_queue_handle_t handle, void * value, CSP_BASE_TYPE * task_woken);
85 
90 int csp_queue_dequeue(csp_queue_handle_t handle, void *buf, uint32_t timeout);
91 
96 int csp_queue_dequeue_isr(csp_queue_handle_t handle, void * buf, CSP_BASE_TYPE * task_woken);
97 
102 int csp_queue_size(csp_queue_handle_t handle);
103 
108 int csp_queue_size_isr(csp_queue_handle_t handle);
109 
110 #ifdef __cplusplus
111 } /* extern "C" */
112 #endif
113 
114 #endif // _CSP_QUEUE_H_
115 
116 /* @} */
int csp_queue_size_isr(csp_queue_handle_t handle)
int csp_queue_enqueue_isr(csp_queue_handle_t handle, void *value, CSP_BASE_TYPE *task_woken)
csp_queue_handle_t csp_queue_create(int length, size_t item_size)
void * csp_queue_handle_t
Definition: csp_queue.h:57
int csp_queue_dequeue_isr(csp_queue_handle_t handle, void *buf, CSP_BASE_TYPE *task_woken)
void csp_queue_remove(csp_queue_handle_t queue)
int csp_queue_dequeue(csp_queue_handle_t handle, void *buf, uint32_t timeout)
int csp_queue_size(csp_queue_handle_t handle)
int csp_queue_enqueue(csp_queue_handle_t handle, void *value, uint32_t timeout)