mraa: rename from maa to mraa
[contrib/mraa.git] / api / mraa / types.h
1 /*
2  * Author: Brendan Le Foll <brendan.le.foll@intel.com>
3  * Copyright © 2014 Intel Corporation
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy
6  * of this software and associated documentation files (the "Software"), to
7  * deal in the Software without restriction, including without limitation the
8  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9  * sell copies of the Software, and to permit persons to whom the Software is
10  * furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in
13  * all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21  * IN THE SOFTWARE.
22  */
23
24 #pragma once
25
26 /** @file
27  *
28  * This file defines the basic shared types for libmraa
29  * this file is different to common.h in that swig takes this as an input
30  */
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 /**
37  * MRAA supported platform types
38  */
39 typedef enum {
40     MRAA_INTEL_GALILEO_GEN1 = 0, /**< The Generation 1 Galileo platform (RevD) */
41     MRAA_INTEL_GALILEO_GEN2 = 1, /**< The Generation 2 Galileo platform (RevG/H) */
42
43     MRAA_UNKNOWN_PLATFORM = 99 /**< An unknown platform type, typically will load INTEL_GALILEO_GEN1 */
44 } mraa_platform_t;
45
46 /**
47  * MRAA return codes
48  */
49 typedef enum {
50     MRAA_SUCCESS                              =  0, /**< Expected response */
51     MRAA_ERROR_FEATURE_NOT_IMPLEMENTED        =  1, /**< Feature TODO */
52     MRAA_ERROR_FEATURE_NOT_SUPPORTED          =  2, /**< Feature not supported by HW */
53     MRAA_ERROR_INVALID_VERBOSITY_LEVEL        =  3, /**< Verbosity level wrong */
54     MRAA_ERROR_INVALID_PARAMETER              =  4, /**< Parameter invalid */
55     MRAA_ERROR_INVALID_HANDLE                 =  5, /**< Handle invalid */
56     MRAA_ERROR_NO_RESOURCES                   =  6, /**< No resource of that type avail */
57     MRAA_ERROR_INVALID_RESOURCE               =  7, /**< Resource invalid */
58     MRAA_ERROR_INVALID_QUEUE_TYPE             =  8, /**< Queue type incorrect */
59     MRAA_ERROR_NO_DATA_AVAILABLE              =  9, /**< No data available */
60     MRAA_ERROR_INVALID_PLATFORM               = 10, /**< Platform not recognised */
61     MRAA_ERROR_PLATFORM_NOT_INITIALISED       = 11, /**< Board information not initialised */
62     MRAA_ERROR_PLATFORM_ALREADY_INITIALISED   = 12, /**< Board is already initialised */
63
64     MRAA_ERROR_UNSPECIFIED                    = 99 /**< Unknown Error */
65 } mraa_result_t;
66
67 /**
68  * This function attempts to set the mraa process to a given priority and the
69  * scheduler to SCHED_RR. Highest * priority is typically 99 and minimum is 0.
70  * This function * will set to MAX if * priority is > MAX. Function will return
71  * -1 on failure.
72
73  * @param priority Value from typically 0 to 99
74  * @return The priority value set
75  */
76 int mraa_set_priority(const unsigned int priority);
77
78 /** Get the version string of mraa autogenerated from git tag
79  *
80  * The version returned may not be what is expected however it is a reliable
81  * number associated with the git tag closest to that version at build time
82  *
83  * @return version string from version.h
84  */
85 const char* mraa_get_version();
86
87 /**
88  * Print a textual representation of the mraa_result_t
89  *
90  * @param result the result to print
91  */
92 void mraa_result_print(mraa_result_t result);
93
94 /**
95  * Get platform type, board must be initialised.
96  *
97  * @return mraa_platform_t Platform type enum
98  */
99 mraa_platform_t mraa_get_platform_type();
100
101 #ifdef __cplusplus
102 }
103 #endif