GPUart  1.01
Prototype of GPUart, an application-based limited preemptive GPU scheduler for embedded real-time systems
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
GPUart_Common.h
Go to the documentation of this file.
1 //Copyright (c) 2017-2018 Christoph A. Hartmann, Ulrich Margull and Technische Hochschule Ingolstadt (THI)
2 //
3 //Permission is hereby granted, free of charge, to any person obtaining a copy of this
4 //software and associated documentation files (the "Software"), to deal in the Software
5 //without restriction, including without limitation the rights to use, copy, modify,
6 //merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
7 //permit persons to whom the Software is furnished to do so, subject to the following
8 //conditions:
9 //
10 //The above copyright notice and this permission notice shall be included in all copies
11 //or substantial portions of the Software.
12 //
13 //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
14 //INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
15 //PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
16 //HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17 //OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
18 //SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 
20 /*
21 * File: GPUart_Common.h
22 * Created by: Christoph Hartmann
23 * Institute: Technische Hochschule Ingolstadt
24 * Date: 03.04.2017 */
25 /********************************************************
26 * ___ ___ ___ ___ 3 ___ *
27 * | | | | | |\ /| | | | | | *
28 * |___ | | |___| | \/ | | | |___ | | *
29 * | | | |\ | | | | | | | *
30 * | |___| | \ | | |___| ___| | |___ *
31 * *
32 *********************************************************/
33 
48 #ifndef GPUART_COMMON_H
49 #define GPUART_COMMON_H
50 
51 
52 
53 /************************************************************************************************/
54 /* Include */
55 /************************************************************************************************/
56 #include <stdio.h> //Standard I/O
57 #include <iostream> //Standard I/O
58 
59 
60 /************************************************************************************************/
61 /* Constants */
62 /************************************************************************************************/
63 
67 #define C_TRUE (1==1)
68 
72 #define C_FALSE (1==0)
73 
74 /************************************************************************************************/
75 /* Typedefs */
76 /************************************************************************************************/
77 
78 /* Native datatypes*/
79 typedef signed int sint32;
80 typedef unsigned int uint32;
81 
82 typedef signed char sint8;
83 typedef unsigned char uint8;
84 
85 typedef signed short sint16;
86 typedef unsigned short uint16;
87 
88 typedef signed long long sint64;
89 typedef unsigned long long uint64;
90 
91 typedef float float32;
92 typedef double float64;
93 
94 /* Specific datatypes */
95 
99 typedef signed int GPUart_Retval;
100 
101 
102 
103 /* GPGPU Language specific */
104 
105 
106 /************************************************************************************************/
107 /* Error Codes */
108 /************************************************************************************************/
109 
130 #define GPUART_SUCCESS (0x00)
131 #define GPUART_NO_SUCCESS (0x01)
132 #define GPUART_ERROR_NOT_READY (0x02)
133 #define GPUART_ERROR_NO_OPERTATION (0x03)
134 #define GPUART_ERROR_INVALID_ARGUMENT (0x04)
135 #define GPUART_ERROR_PESISTENT_KERNEL_IS_RUNNING (0x08)
136 
137 
138 
139 /************************************************************************************************/
140 /* Macro definition */
141 /************************************************************************************************/
142 
146 #define GPUART_CHECK_RETURN(value) gpuartCheckReturn(__FILE__,__LINE__, #value, value)
147 
148 
149 /************************************************************************************************/
150 /* Function definition */
151 /************************************************************************************************/
152 
153 
157 static void gpuartCheckReturn(const char *file, unsigned line, const char *statement, sint32 err)
158 {
159  if (err == 0)
160  return;
161  std::cerr << "GPUart RUNTIME ERROR! "<< statement << " returned " << "(" << err << ") at " << file << ":" << line << std::endl;
162  //exit(1);
163 }
164 
165 #endif
unsigned long long uint64
Definition: GPUart_Common.h:89
static void gpuartCheckReturn(const char *file, unsigned line, const char *statement, sint32 err)
Standard function for error checking within GPUart.
Definition: GPUart_Common.h:157
signed char sint8
Definition: GPUart_Common.h:82
unsigned int uint32
Definition: GPUart_Common.h:80
float float32
Definition: GPUart_Common.h:91
signed int sint32
Definition: GPUart_Common.h:79
signed long long sint64
Definition: GPUart_Common.h:88
signed short sint16
Definition: GPUart_Common.h:85
unsigned char uint8
Definition: GPUart_Common.h:83
double float64
Definition: GPUart_Common.h:92
unsigned short uint16
Definition: GPUart_Common.h:86
signed int GPUart_Retval
The standard return type of functions in GPUart, representing an error code.
Definition: GPUart_Common.h:99