intel_minnow_max: Added platform definition
[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     MRAA_INTEL_EDISON_FAB_C = 2, /**< The Intel Edison (FAB C) */
43     MRAA_INTEL_DE3815 = 3, /**< The Intel DE3815 Baytrail NUC */
44     MRAA_INTEL_MINNOWBOARD_MAX = 4, /**< The Intel Minnow Board Max */
45
46     MRAA_UNKNOWN_PLATFORM = 99 /**< An unknown platform type, typically will load INTEL_GALILEO_GEN1 */
47 } mraa_platform_t;
48
49 /**
50  * MRAA return codes
51  */
52 typedef enum {
53     MRAA_SUCCESS                              =  0, /**< Expected response */
54     MRAA_ERROR_FEATURE_NOT_IMPLEMENTED        =  1, /**< Feature TODO */
55     MRAA_ERROR_FEATURE_NOT_SUPPORTED          =  2, /**< Feature not supported by HW */
56     MRAA_ERROR_INVALID_VERBOSITY_LEVEL        =  3, /**< Verbosity level wrong */
57     MRAA_ERROR_INVALID_PARAMETER              =  4, /**< Parameter invalid */
58     MRAA_ERROR_INVALID_HANDLE                 =  5, /**< Handle invalid */
59     MRAA_ERROR_NO_RESOURCES                   =  6, /**< No resource of that type avail */
60     MRAA_ERROR_INVALID_RESOURCE               =  7, /**< Resource invalid */
61     MRAA_ERROR_INVALID_QUEUE_TYPE             =  8, /**< Queue type incorrect */
62     MRAA_ERROR_NO_DATA_AVAILABLE              =  9, /**< No data available */
63     MRAA_ERROR_INVALID_PLATFORM               = 10, /**< Platform not recognised */
64     MRAA_ERROR_PLATFORM_NOT_INITIALISED       = 11, /**< Board information not initialised */
65     MRAA_ERROR_PLATFORM_ALREADY_INITIALISED   = 12, /**< Board is already initialised */
66
67     MRAA_ERROR_UNSPECIFIED                    = 99 /**< Unknown Error */
68 } mraa_result_t;
69
70 /**
71  * This function attempts to set the mraa process to a given priority and the
72  * scheduler to SCHED_RR. Highest * priority is typically 99 and minimum is 0.
73  * This function * will set to MAX if * priority is > MAX. Function will return
74  * -1 on failure.
75  *
76  * @param priority Value from typically 0 to 99
77  * @return The priority value set
78  */
79 int mraa_set_priority(const unsigned int priority);
80
81 /** Get the version string of mraa autogenerated from git tag
82  *
83  * The version returned may not be what is expected however it is a reliable
84  * number associated with the git tag closest to that version at build time
85  *
86  * @return version string from version.h
87  */
88 const char* mraa_get_version();
89
90 /**
91  * Print a textual representation of the mraa_result_t
92  *
93  * @param result the result to print
94  */
95 void mraa_result_print(mraa_result_t result);
96
97 /**
98  * Get platform type, board must be initialised.
99  *
100  * @return mraa_platform_t Platform type enum
101  */
102 mraa_platform_t mraa_get_platform_type();
103
104 #ifdef __cplusplus
105 }
106 #endif