Debian Codegraph @

3rdparty/rplidar_sdk/sdk/include/rptypes.h

raw symbols SCIP
1 /*
2 * RPLIDAR SDK
3 *
4 * Copyright (c) 2009 - 2014 RoboPeak Team
5 * http://www.robopeak.com
6 * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd.
7 * http://www.slamtec.com
8 *
9 */
10 /*
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions are met:
13 *
14 * 1. Redistributions of source code must retain the above copyright notice,
15 * this list of conditions and the following disclaimer.
16 *
17 * 2. Redistributions in binary form must reproduce the above copyright notice,
18 * this list of conditions and the following disclaimer in the documentation
19 * and/or other materials provided with the distribution.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
25 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
31 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 *
33 */
34
35 #pragma once
36
37
38 #ifdef _WIN32
39
40 //fake stdint.h for VC only
41
42 typedef signed char int8_t;
43 typedef unsigned char uint8_t;
44
45 typedef __int16 int16_t;
46 typedef unsigned __int16 uint16_t;
47
48 typedef __int32 int32_t;
49 typedef unsigned __int32 uint32_t;
50
51 typedef __int64 int64_t;
52 typedef unsigned __int64 uint64_t;
53
54 #else
55
56 #include <stdint.h>
57
58 #endif
59
60
61 //based on stdint.h
62 typedef int8_t _s8;
63 typedef uint8_t _u8;
64
65 typedef int16_t _s16;
66 typedef uint16_t _u16;
67
68 typedef int32_t _s32;
69 typedef uint32_t _u32;
70
71 typedef int64_t _s64;
72 typedef uint64_t _u64;
73
74 #define __small_endian
75
76 #ifndef __GNUC__
77 #define __attribute__(x)
78 #endif
79
80
81 // The _word_size_t uses actual data bus width of the current CPU
82 #ifdef _AVR_
83 typedef _u8 _word_size_t;
84 #define THREAD_PROC
85 #elif defined (WIN64)
86 typedef _u64 _word_size_t;
87 #define THREAD_PROC __stdcall
88 #elif defined (WIN32)
89 typedef _u32 _word_size_t;
90 #define THREAD_PROC __stdcall
91 #elif defined (__GNUC__)
92 typedef unsigned long _word_size_t;
93 #define THREAD_PROC
94 #elif defined (__ICCARM__)
95 typedef _u32 _word_size_t;
96 #define THREAD_PROC
97 #endif
98
99
100 typedef uint32_t u_result;
101
102 #define RESULT_OK 0
103 #define RESULT_FAIL_BIT 0x80000000
104 #define RESULT_ALREADY_DONE 0x20
105 #define RESULT_INVALID_DATA (0x8000 | RESULT_FAIL_BIT)
106 #define RESULT_OPERATION_FAIL (0x8001 | RESULT_FAIL_BIT)
107 #define RESULT_OPERATION_TIMEOUT (0x8002 | RESULT_FAIL_BIT)
108 #define RESULT_OPERATION_STOP (0x8003 | RESULT_FAIL_BIT)
109 #define RESULT_OPERATION_NOT_SUPPORT (0x8004 | RESULT_FAIL_BIT)
110 #define RESULT_FORMAT_NOT_SUPPORT (0x8005 | RESULT_FAIL_BIT)
111 #define RESULT_INSUFFICIENT_MEMORY (0x8006 | RESULT_FAIL_BIT)
112
113 #define IS_OK(x) ( ((x) & RESULT_FAIL_BIT) == 0 )
114 #define IS_FAIL(x) ( ((x) & RESULT_FAIL_BIT) )
115
116 typedef _word_size_t (THREAD_PROC * thread_proc_t ) ( void * );