summaryrefslogtreecommitdiff
path: root/gpr/source/lib/common/private
diff options
context:
space:
mode:
Diffstat (limited to 'gpr/source/lib/common/private')
-rw-r--r--gpr/source/lib/common/private/gpr_allocator.c44
-rwxr-xr-xgpr/source/lib/common/private/gpr_buffer.c99
-rwxr-xr-xgpr/source/lib/common/private/gpr_buffer_auto.cpp45
-rwxr-xr-xgpr/source/lib/common/private/gpr_buffer_auto.h148
-rwxr-xr-xgpr/source/lib/common/private/log.c60
-rwxr-xr-xgpr/source/lib/common/private/log.h60
-rwxr-xr-xgpr/source/lib/common/private/macros.h84
-rwxr-xr-xgpr/source/lib/common/private/stdc_includes.h33
-rwxr-xr-xgpr/source/lib/common/private/stdcpp_includes.h22
-rwxr-xr-xgpr/source/lib/common/private/timer.c54
-rwxr-xr-xgpr/source/lib/common/private/timer.h51
11 files changed, 700 insertions, 0 deletions
diff --git a/gpr/source/lib/common/private/gpr_allocator.c b/gpr/source/lib/common/private/gpr_allocator.c
new file mode 100644
index 0000000..366bdf8
--- /dev/null
+++ b/gpr/source/lib/common/private/gpr_allocator.c
@@ -0,0 +1,44 @@
+/*! @file gpr_allocator.c
+ *
+ * @brief Implementation of the global memory allocation functions.
+ * In order to customize memory allocation and deallocation, applications
+ * can implement these functions in additional files and include in
+ * build process
+ *
+ * @version 1.0.0
+ *
+ * (C) Copyright 2018 GoPro Inc (http://gopro.com/).
+ *
+ * Licensed under either:
+ * - Apache License, Version 2.0, http://www.apache.org/licenses/LICENSE-2.0
+ * - MIT license, http://opensource.org/licenses/MIT
+ * at your option.
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "gpr_allocator.h"
+
+/*!
+ @brief Allocate a block with the specified size
+ */
+void* gpr_global_malloc(size_t size)
+{
+ return malloc(size);
+}
+
+/*!
+ @brief Free a block that was allocated by the specified allocator
+
+ It is an error to free a block allocated by one allocator using a
+ different allocator.
+ */
+void gpr_global_free(void *block)
+{
+ free(block);
+}
+
diff --git a/gpr/source/lib/common/private/gpr_buffer.c b/gpr/source/lib/common/private/gpr_buffer.c
new file mode 100755
index 0000000..083bc0d
--- /dev/null
+++ b/gpr/source/lib/common/private/gpr_buffer.c
@@ -0,0 +1,99 @@
+/*! @file gpr_buffer.c
+ *
+ * @brief Implementation of gpr_buffer object and functions that work on buffer
+ *
+ * @version 1.0.0
+ *
+ * (C) Copyright 2018 GoPro Inc (http://gopro.com/).
+ *
+ * Licensed under either:
+ * - Apache License, Version 2.0, http://www.apache.org/licenses/LICENSE-2.0
+ * - MIT license, http://opensource.org/licenses/MIT
+ * at your option.
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "gpr_buffer.h"
+#include "macros.h"
+#include "stdc_includes.h"
+
+int read_from_file(gpr_buffer* buffer, const char* file_path, gpr_malloc malloc_function, gpr_free free_function)
+{
+ assert( buffer != NULL );
+
+ FILE *fIN = fopen(file_path, "rb");
+ if (fIN == NULL)
+ {
+ fprintf (stderr, "Error while reading file: %s", file_path);
+ return -1;
+ }
+
+ fseek (fIN, 0, SEEK_END);
+ buffer->size = (size_t) ftell(fIN);
+ rewind (fIN);
+
+ buffer->buffer = malloc_function(buffer->size);
+
+ if ( buffer->buffer == NULL)
+ {
+ fputs ("Memory error", stderr);
+ fclose(fIN);
+ return -1;
+ }
+
+ if (fread(buffer->buffer, 1, buffer->size, fIN) != buffer->size)
+ {
+ free_function(buffer->buffer);
+ fputs ("Reading error", stderr);
+ fclose(fIN);
+ return -1;
+ }
+
+ fclose(fIN);
+
+ return 0;
+}
+
+int write_to_file(const gpr_buffer* buffer, const char* file_path)
+{
+ unsigned int bytes_written;
+
+ FILE *fOUT = fopen(file_path, "wb");
+ if (fOUT == NULL)
+ {
+ fprintf (stderr, "Error while writing file: %s", file_path);
+ return -1;
+ }
+
+ bytes_written = fwrite(buffer->buffer, 1, buffer->size, fOUT);
+ if( bytes_written != buffer->size ) {
+ fputs("Could not write bytes \n", stderr);
+ perror("fwrite()");
+ fclose(fOUT);
+ return -2;
+ }
+
+ fclose(fOUT);
+
+ return 0;
+}
+
+#include "gpr_rgb_buffer.h"
+
+void gpr_rgb_gain_set_defaults(gpr_rgb_gain* x)
+{
+ x->r_gain_num = 30;
+ x->r_gain_pow2_den = 4;
+
+ x->g_gain_num = 1;
+ x->g_gain_pow2_den = 0;
+
+ x->b_gain_num = 7;
+ x->b_gain_pow2_den = 2;
+}
+
diff --git a/gpr/source/lib/common/private/gpr_buffer_auto.cpp b/gpr/source/lib/common/private/gpr_buffer_auto.cpp
new file mode 100755
index 0000000..736c139
--- /dev/null
+++ b/gpr/source/lib/common/private/gpr_buffer_auto.cpp
@@ -0,0 +1,45 @@
+/*! @file gpr_buffer_auto.cpp
+ *
+ * @brief Implementation of gpr_buffer_auto object.
+ *
+ * @version 1.0.0
+ *
+ * (C) Copyright 2018 GoPro Inc (http://gopro.com/).
+ *
+ * Licensed under either:
+ * - Apache License, Version 2.0, http://www.apache.org/licenses/LICENSE-2.0
+ * - MIT license, http://opensource.org/licenses/MIT
+ * at your option.
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "gpr_buffer.h"
+#include "gpr_buffer_auto.h"
+
+#include <stdlib.h>
+
+int gpr_buffer_auto::read_from_file(const char* file_path)
+{
+ assert( is_valid() == false );
+
+ int return_code = ::read_from_file(&buffer, file_path, mem_alloc, mem_free );
+
+ if( return_code == 0 )
+ {
+ free_in_destructor = true;
+ }
+
+ return return_code;
+}
+
+int gpr_buffer_auto::write_to_file(const char* file_path)
+{
+ assert( is_valid() );
+
+ return ::write_to_file(&buffer, file_path);
+}
diff --git a/gpr/source/lib/common/private/gpr_buffer_auto.h b/gpr/source/lib/common/private/gpr_buffer_auto.h
new file mode 100755
index 0000000..e4a2eee
--- /dev/null
+++ b/gpr/source/lib/common/private/gpr_buffer_auto.h
@@ -0,0 +1,148 @@
+/*! @file gpr_internal_buffer
+ *
+ * @brief Declaration of gpr_buffer_auto object. This object
+ * implements a buffer that carries size information. gpr_buffer_auto can
+ * deallocate itself in destructor (depending on free_in_destructor member)
+ *
+ * @version 1.0.0
+ *
+ * (C) Copyright 2018 GoPro Inc (http://gopro.com/).
+ *
+ * Licensed under either:
+ * - Apache License, Version 2.0, http://www.apache.org/licenses/LICENSE-2.0
+ * - MIT license, http://opensource.org/licenses/MIT
+ * at your option.
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef GPR_INTERNAL_BUFFER_H
+#define GPR_INTERNAL_BUFFER_H
+
+#include "gpr_allocator.h"
+#include "gpr_buffer.h"
+#include "gpr_platform.h"
+#include "stdc_includes.h"
+
+class gpr_buffer_auto
+{
+private:
+ gpr_buffer buffer;
+
+ bool free_in_destructor;
+
+ gpr_malloc mem_alloc;
+
+ gpr_free mem_free;
+
+public:
+ void reset()
+ {
+ buffer.buffer = NULL;
+ buffer.size = 0;
+ free_in_destructor = false;
+ }
+
+ gpr_buffer_auto(gpr_malloc malloc_function, gpr_free free_function)
+ {
+ reset();
+
+ mem_alloc = malloc_function;
+ mem_free = free_function;
+ }
+
+ ~gpr_buffer_auto()
+ {
+ deallocate();
+ }
+
+ void allocate(size_t size_of_memory)
+ {
+ assert(buffer.buffer == NULL);
+ assert(buffer.size == 0);
+
+ buffer.size = size_of_memory;
+
+ if(buffer.size > 0)
+ {
+ buffer.buffer = mem_alloc(buffer.size);
+ assert(buffer.buffer);
+
+ free_in_destructor = true;
+ }
+ }
+
+ void deallocate()
+ {
+ if(buffer.buffer && free_in_destructor)
+ mem_free( (char*)buffer.buffer );
+
+ reset();
+ }
+
+ void resize( size_t new_size )
+ {
+ buffer.size = new_size;
+
+ assert(buffer.buffer);
+ assert(buffer.size);
+ }
+
+ void set(void* _buffer, size_t _size, bool _free_in_destructor = false )
+ {
+ assert(buffer.buffer == NULL);
+ assert(buffer.size == 0);
+
+ buffer.buffer = _buffer;
+ buffer.size = _size;
+ free_in_destructor = _free_in_destructor;
+
+ assert(buffer.buffer);
+ assert(buffer.size);
+ }
+
+ void zero()
+ {
+ // Cant call zero for the case when buffer has been preallocated
+ // Call deallocate()
+ assert( free_in_destructor == false );
+
+ buffer.buffer = NULL;
+ buffer.size = 0;
+ }
+
+ bool is_valid() const
+ {
+ return ( buffer.buffer != NULL ) && buffer.size > 0;
+ }
+
+// Accessors
+ void* get_buffer() const { return buffer.buffer; }
+
+ char* to_char() const { return (char*)buffer.buffer; }
+
+ unsigned char* to_uchar() const { return (unsigned char*)buffer.buffer; }
+
+ unsigned short* to_ushort() const { return (unsigned short*)buffer.buffer; }
+
+ uint16_t* to_uint16_t() const { return (uint16_t*)buffer.buffer; }
+
+ size_t get_size() const { return buffer.size; }
+
+ gpr_malloc get_malloc() const { return mem_alloc; }
+
+ gpr_free get_free() const { return mem_free; }
+
+// Operations
+ int read_from_file(const char* file_path);
+
+ int write_to_file(const char* file_path);
+
+ const gpr_buffer& get_gpr_buffer() { return buffer; }
+};
+
+#endif // GPR_INTERNAL_BUFFER_H
diff --git a/gpr/source/lib/common/private/log.c b/gpr/source/lib/common/private/log.c
new file mode 100755
index 0000000..751ff6d
--- /dev/null
+++ b/gpr/source/lib/common/private/log.c
@@ -0,0 +1,60 @@
+/*! @file gpr_log.c
+ *
+ * @brief Implementation of functions used for logging
+ *
+ * @version 1.0.0
+ *
+ * (C) Copyright 2018 GoPro Inc (http://gopro.com/).
+ *
+ * Licensed under either:
+ * - Apache License, Version 2.0, http://www.apache.org/licenses/LICENSE-2.0
+ * - MIT license, http://opensource.org/licenses/MIT
+ * at your option.
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "timer.h"
+#include "stdc_includes.h"
+
+TIMER LogTimer;
+
+bool LogInit(void)
+{
+ InitTimer(&LogTimer);
+
+ return true;
+}
+
+#ifndef LogPrint
+int LogPrint(const char* format, ... )
+{
+ StopTimer(&LogTimer);
+
+ printf("[%5d-ms] ", (unsigned int)TimeMSecs(&LogTimer));
+
+ {
+ va_list argptr;
+ va_start(argptr, format);
+
+ vfprintf(stdout, format, argptr);
+
+ va_end(argptr);
+ }
+
+ printf( "%c", '\n' );
+
+ StartTimer(&LogTimer);
+
+ return 0;
+}
+#endif // LogPrint
+
+bool LogUninit(void)
+{
+ return true;
+}
diff --git a/gpr/source/lib/common/private/log.h b/gpr/source/lib/common/private/log.h
new file mode 100755
index 0000000..76e8879
--- /dev/null
+++ b/gpr/source/lib/common/private/log.h
@@ -0,0 +1,60 @@
+/*! @file gpr_log.h
+ *
+ * @brief Declatation of functions used for logging
+ *
+ * @version 1.0.0
+ *
+ * (C) Copyright 2018 GoPro Inc (http://gopro.com/).
+ *
+ * Licensed under either:
+ * - Apache License, Version 2.0, http://www.apache.org/licenses/LICENSE-2.0
+ * - MIT license, http://opensource.org/licenses/MIT
+ * at your option.
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef GPR_LOG_H
+#define GPR_LOG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ bool LogInit(void);
+
+ #ifndef LogPrint
+ int LogPrint(const char* format, ... );
+ #endif
+
+ bool LogUninit(void);
+
+ #define TIMESTAMP(x, y) TIMESTAMP_##y(x)
+
+ #if GPR_TIMING == 0
+ #define TIMESTAMP_3(x)
+ #define TIMESTAMP_2(x)
+ #define TIMESTAMP_1(x)
+ #elif GPR_TIMING == 1
+ #define TIMESTAMP_3(x)
+ #define TIMESTAMP_2(x)
+ #define TIMESTAMP_1(x) LogPrint("%s %s() %s (line %d)", x, __FUNCTION__, __FILE__, __LINE__);
+ #elif GPR_TIMING == 2
+ #define TIMESTAMP_3(x)
+ #define TIMESTAMP_2(x) LogPrint("%s %s() %s (line %d)", x, __FUNCTION__, __FILE__, __LINE__);
+ #define TIMESTAMP_1(x) LogPrint("%s %s() %s (line %d)", x, __FUNCTION__, __FILE__, __LINE__);
+ #elif GPR_TIMING == 3
+ #define TIMESTAMP_3(x) LogPrint("%s %s() %s (line %d)", x, __FUNCTION__, __FILE__, __LINE__);
+ #define TIMESTAMP_2(x) LogPrint("%s %s() %s (line %d)", x, __FUNCTION__, __FILE__, __LINE__);
+ #define TIMESTAMP_1(x) LogPrint("%s %s() %s (line %d)", x, __FUNCTION__, __FILE__, __LINE__);
+ #endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GPR_LOG_H
diff --git a/gpr/source/lib/common/private/macros.h b/gpr/source/lib/common/private/macros.h
new file mode 100755
index 0000000..5f3e9b5
--- /dev/null
+++ b/gpr/source/lib/common/private/macros.h
@@ -0,0 +1,84 @@
+/*! @file gpr_macros.h
+ *
+ * @brief Definitions of useful inline functions that are used everywhere in code.
+ *
+ * @version 1.0.0
+ *
+ * (C) Copyright 2018 GoPro Inc (http://gopro.com/).
+ *
+ * Licensed under either:
+ * - Apache License, Version 2.0, http://www.apache.org/licenses/LICENSE-2.0
+ * - MIT license, http://opensource.org/licenses/MIT
+ * at your option.
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef GPR_MACROS_H
+#define GPR_MACROS_H
+
+#ifndef neg
+ #define neg(x) (-(x))
+#endif
+
+#define DivideByShift(x, s) ((x) >> (s))
+
+STATIC_INLINE uint16_t clamp_uint(int32_t value, uint32_t precision)
+{
+ const int32_t limit = ((1 << precision) - 1);
+
+ if (value < 0)
+ value = 0;
+ else if (value > limit)
+ value = limit;
+
+ return (uint16_t)value;
+}
+
+STATIC_INLINE uint16_t clamp_uint16(int32_t value)
+{
+ return (uint16_t)clamp_uint( value, 16);
+}
+
+STATIC_INLINE uint16_t clamp_uint14(int32_t value)
+{
+ return (uint16_t)clamp_uint( value, 14);
+}
+
+STATIC_INLINE uint16_t clamp_uint12(int32_t value)
+{
+ return (uint16_t)clamp_uint( value, 12);
+}
+
+STATIC_INLINE uint8_t clamp_uint8(int32_t value)
+{
+ return (uint8_t)clamp_uint( value, 8);
+}
+
+STATIC_INLINE int minimum(int a, int b)
+{
+ return (a < b) ? a : b;
+}
+
+STATIC_INLINE int maximum(int a, int b)
+{
+ return (a < b) ? b : a;
+}
+
+STATIC_INLINE int absolute(int a)
+{
+ return (a < 0) ? -a : a;
+}
+
+STATIC_INLINE uint32_t Swap32(uint32_t value)
+{
+ value = (value & 0x0000FFFF) << 16 | (value & 0xFFFF0000) >> 16;
+ value = (value & 0x00FF00FF) << 8 | (value & 0xFF00FF00) >> 8;
+ return value;
+}
+
+#endif // GPR_MACROS_H
diff --git a/gpr/source/lib/common/private/stdc_includes.h b/gpr/source/lib/common/private/stdc_includes.h
new file mode 100755
index 0000000..dff18de
--- /dev/null
+++ b/gpr/source/lib/common/private/stdc_includes.h
@@ -0,0 +1,33 @@
+/*! @file stdc_includes.h
+ *
+ * @brief Standard C include files used by package
+ *
+ * @version 1.0.0
+ *
+ * (C) Copyright 2018 GoPro Inc (http://gopro.com/).
+ *
+ * Licensed under either:
+ * - Apache License, Version 2.0, http://www.apache.org/licenses/LICENSE-2.0
+ * - MIT license, http://opensource.org/licenses/MIT
+ * at your option.
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <ctype.h>
+#include <assert.h>
+#include <limits.h>
+#include <math.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <stdarg.h>
+
+#include <string.h>
+#include <time.h> \ No newline at end of file
diff --git a/gpr/source/lib/common/private/stdcpp_includes.h b/gpr/source/lib/common/private/stdcpp_includes.h
new file mode 100755
index 0000000..3da3a27
--- /dev/null
+++ b/gpr/source/lib/common/private/stdcpp_includes.h
@@ -0,0 +1,22 @@
+/*! @file stdcpp_includes.h
+ *
+ * @brief Standard C++ include files used by package
+ *
+ * @version 1.0.0
+ *
+ * (C) Copyright 2018 GoPro Inc (http://gopro.com/).
+ *
+ * Licensed under either:
+ * - Apache License, Version 2.0, http://www.apache.org/licenses/LICENSE-2.0
+ * - MIT license, http://opensource.org/licenses/MIT
+ * at your option.
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <fstream>
+
diff --git a/gpr/source/lib/common/private/timer.c b/gpr/source/lib/common/private/timer.c
new file mode 100755
index 0000000..4db60e7
--- /dev/null
+++ b/gpr/source/lib/common/private/timer.c
@@ -0,0 +1,54 @@
+/*! @file gpr_timer.c
+ *
+ * @brief Implementation of a high-resolution performance timer.
+ *
+ * @version 1.0.0
+ *
+ * (C) Copyright 2018 GoPro Inc (http://gopro.com/).
+ *
+ * Licensed under either:
+ * - Apache License, Version 2.0, http://www.apache.org/licenses/LICENSE-2.0
+ * - MIT license, http://opensource.org/licenses/MIT
+ * at your option.
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "timer.h"
+
+/*!
+ @brief Initialize a timer
+
+ The frequency of the performance timer is determined if it has not
+ already been obtained.
+ */
+void InitTimer(TIMER *timer)
+{
+ timer->begin = 0;
+ timer->elapsed = 0;
+}
+
+void StartTimer(TIMER *timer)
+{
+ timer->begin = clock();
+}
+
+void StopTimer(TIMER *timer)
+{
+ timer->elapsed += (clock() - timer->begin);
+}
+
+float TimeSecs(TIMER *timer)
+{
+ return (float)(timer->elapsed) / CLOCKS_PER_SEC;
+}
+
+float TimeMSecs(TIMER *timer)
+{
+ return (float)(TimeSecs(timer) * 1000);
+}
+
diff --git a/gpr/source/lib/common/private/timer.h b/gpr/source/lib/common/private/timer.h
new file mode 100755
index 0000000..9e05869
--- /dev/null
+++ b/gpr/source/lib/common/private/timer.h
@@ -0,0 +1,51 @@
+/*! @file gpr_timer.h
+ *
+ * @brief Declaration of a high-resolution performance timer.
+ *
+ * @version 1.0.0
+ *
+ * (C) Copyright 2018 GoPro Inc (http://gopro.com/).
+ *
+ * Licensed under either:
+ * - Apache License, Version 2.0, http://www.apache.org/licenses/LICENSE-2.0
+ * - MIT license, http://opensource.org/licenses/MIT
+ * at your option.
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef GPR_TIMER_H
+#define GPR_TIMER_H
+
+#include <time.h>
+
+typedef struct timer
+{
+ clock_t begin;
+ clock_t elapsed;
+
+} TIMER;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ void InitTimer(TIMER *timer);
+
+ void StartTimer(TIMER *timer);
+
+ void StopTimer(TIMER *timer);
+
+ float TimeSecs(TIMER *timer);
+
+ float TimeMSecs(TIMER *timer);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GPR_TIMER_H