tinyproto
tiny_fd_frames_queue_int.h
1 /*
2  Copyright 2021-2024 (C) Alexey Dynda
3 
4  This file is part of Tiny Protocol Library.
5 
6  GNU General Public License Usage
7 
8  Protocol Library is free software: you can redistribute it and/or modify
9  it under the terms of the GNU Lesser General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  Protocol Library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public License
19  along with Protocol Library. If not, see <http://www.gnu.org/licenses/>.
20 
21  Commercial License Usage
22 
23  Licensees holding valid commercial Tiny Protocol licenses may use this file in
24  accordance with the commercial license agreement provided in accordance with
25  the terms contained in a written agreement between you and Alexey Dynda.
26  For further information contact via email on github account.
27 */
28 
29 #pragma once
30 
31 #ifndef DOXYGEN_SHOULD_SKIP_THIS
32 
33 #ifdef __cplusplus
34 extern "C"
35 {
36 #endif
37 
38 #include "tiny_fd_frames_int.h"
39 #include "hal/tiny_types.h"
40 #include <stdint.h>
41 #include <stdbool.h>
42 
43  typedef struct
44  {
46  int size;
48  int mtu;
50 
51 
62  int tiny_fd_queue_init(tiny_fd_queue_t *queue, uint8_t *buffer,
63  int max_size, int max_frames, int mtu);
64 
68  void tiny_fd_queue_reset(tiny_fd_queue_t *queue);
69 
73  void tiny_fd_queue_reset_for(tiny_fd_queue_t *queue, uint8_t address);
74 
78  bool tiny_fd_queue_has_free_slots(tiny_fd_queue_t *queue);
79 
83  int tiny_fd_queue_get_mtu(tiny_fd_queue_t *queue);
84 
89  tiny_fd_frame_info_t *tiny_fd_queue_allocate(tiny_fd_queue_t *queue, uint8_t type, const uint8_t *data, int len);
90 
100  tiny_fd_frame_info_t *tiny_fd_queue_get_next(tiny_fd_queue_t *queue, uint8_t type, uint8_t address, uint8_t arg);
101 
108  void tiny_fd_queue_free(tiny_fd_queue_t *queue, tiny_fd_frame_info_t *frame);
109 
116  void tiny_fd_queue_free_by_header(tiny_fd_queue_t *queue, const void *header);
117 
118 #ifdef __cplusplus
119 }
120 #endif
121 
122 #endif
int mtu
Maximum supported payload size.
Definition: tiny_fd_frames_queue_int.h:48
Definition: tiny_fd_frames_int.h:56
This is Tiny HAL implementation for microcontrollers.
int lookup_index
First index to start search from.
Definition: tiny_fd_frames_queue_int.h:47
int size
number of elements in the table
Definition: tiny_fd_frames_queue_int.h:46
Definition: tiny_fd_frames_queue_int.h:43
tiny_fd_frame_info_t ** frames
pointer to the frame table
Definition: tiny_fd_frames_queue_int.h:45