Tiny protocol  0.7.0
Tiny communication protocol for microcontrollers
tiny_proto_types.h
Go to the documentation of this file.
1 /*
2  Copyright 2016-2018 (C) Alexey Dynda
3 
4  This file is part of Tiny Protocol Library.
5 
6  Protocol Library is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  Protocol 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
14  GNU Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public License
17  along with Protocol Library. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
26 #ifndef _TINY_PROTO_TYPES_H_
27 #define _TINY_PROTO_TYPES_H_
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #include <stdint.h>
34 #include "tiny_defines.h"
35 
37 #ifdef CONFIG_ENABLE_FCS32
38  typedef uint32_t fcs_t;
39 #else
40  typedef uint16_t fcs_t;
41 #endif
42 
48 #define TINY_SUCCESS (1)
50 #define TINY_NO_ERROR (0)
52 #define TINY_ERR_FAILED (-1)
54 #define TINY_ERR_TIMEOUT (-2)
56 #define TINY_ERR_DATA_TOO_LARGE (-3)
58 #define TINY_ERR_INVALID_DATA (-4)
60 #define TINY_ERR_BUSY (-5)
62 #define TINY_ERR_OUT_OF_SYNC (-6)
64 #define TINY_ERR_AGAIN (-7)
66 
74 #define TINY_FLAG_NO_WAIT (0)
76 #define TINY_FLAG_READ_ALL (1)
78 #define TINY_FLAG_LOCK_SEND (2)
80 #define TINY_FLAG_WAIT_FOREVER (0x80)
82 
89 typedef struct
90 {
92  uint32_t oosyncBytes;
94  uint32_t bytesSent;
96  uint32_t bytesReceived;
98  uint32_t framesSent;
100  uint32_t framesReceived;
102  uint32_t framesBroken;
103 } STinyStats;
104 
114 typedef int (*write_block_cb_t)(void *pdata, const void *buffer, int size);
115 
125 typedef int (*read_block_cb_t)(void *pdata, void *buffer, int size);
126 
127 
138 typedef void (*on_frame_cb_t)(void *handle, uint16_t uid, uint8_t *pdata, int size);
139 
140 #ifdef __cplusplus
141 }
142 #endif
143 
144 #endif
int(* write_block_cb_t)(void *pdata, const void *buffer, int size)
Definition: tiny_proto_types.h:114
uint32_t framesBroken
Number of broken frames received.
Definition: tiny_proto_types.h:102
uint32_t bytesReceived
Number of payload bytes totally received through the channel.
Definition: tiny_proto_types.h:96
uint32_t framesSent
Number of frames, successfully sent through the channel.
Definition: tiny_proto_types.h:98
Definition: tiny_proto_types.h:89
uint32_t framesReceived
Number of frames, successfully received through the communication channel.
Definition: tiny_proto_types.h:100
uint32_t oosyncBytes
Number of bytes received out of frame bytes.
Definition: tiny_proto_types.h:92
int(* read_block_cb_t)(void *pdata, void *buffer, int size)
Definition: tiny_proto_types.h:125
uint32_t bytesSent
Number of payload bytes totally sent through the channel.
Definition: tiny_proto_types.h:94
void(* on_frame_cb_t)(void *handle, uint16_t uid, uint8_t *pdata, int size)
Definition: tiny_proto_types.h:138