csp_buffer.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_BUFFER_H_
28 #define _CSP_BUFFER_H_
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
44 int csp_buffer_init(int count, int size);
45 
53 void * csp_buffer_get(size_t size);
54 
62 void * csp_buffer_get_isr(size_t buf_size);
63 
68 void csp_buffer_free(void *packet);
69 
74 void csp_buffer_free_isr(void *packet);
75 
80 void * csp_buffer_clone(void *buffer);
81 
86 int csp_buffer_remaining(void);
87 
92 int csp_buffer_size(void);
93 
94 #ifdef __cplusplus
95 } /* extern "C" */
96 #endif
97 
98 #endif /* _CSP_BUFFER_H_ */
99 
100 /* @} */
int csp_buffer_remaining(void)
Return how many buffers that are currently free.
int csp_buffer_size(void)
Return the size of the CSP buffers.
void csp_buffer_free_isr(void *packet)
Free a buffer after use in ISR context.
void * csp_buffer_get_isr(size_t buf_size)
Get a reference to a free buffer.
void * csp_buffer_clone(void *buffer)
Clone an existing packet and increase/decrease cloned packet size.
void csp_buffer_free(void *packet)
Free a buffer after use.
void * csp_buffer_get(size_t size)
Get a reference to a free buffer.
int csp_buffer_init(int count, int size)
Start the buffer handling system You must specify the number for buffers and the size.