]> begriffs open source - cmsis/blob - CMSIS/Driver/Include/Driver_Common.h
Initial Commit starting from:
[cmsis] / CMSIS / Driver / Include / Driver_Common.h
1 /*\r
2  * Copyright (c) 2013-2016 ARM Limited. All rights reserved.\r
3  *\r
4  * SPDX-License-Identifier: Apache-2.0\r
5  *\r
6  * Licensed under the Apache License, Version 2.0 (the License); you may\r
7  * not use this file except in compliance with the License.\r
8  * You may obtain a copy of the License at\r
9  *\r
10  * http://www.apache.org/licenses/LICENSE-2.0\r
11  *\r
12  * Unless required by applicable law or agreed to in writing, software\r
13  * distributed under the License is distributed on an AS IS BASIS, WITHOUT\r
14  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
15  * See the License for the specific language governing permissions and\r
16  * limitations under the License.\r
17  *\r
18  * $Date:        2. Jan 2014\r
19  * $Revision:    V2.00\r
20  *\r
21  * Project:      Common Driver definitions\r
22  */\r
23 \r
24 /* History:\r
25  *  Version 2.00\r
26  *    Changed prefix ARM_DRV -> ARM_DRIVER\r
27  *    Added General return codes definitions\r
28  *  Version 1.10\r
29  *    Namespace prefix ARM_ added\r
30  *  Version 1.00\r
31  *    Initial release\r
32  */\r
33 \r
34 #ifndef __DRIVER_COMMON_H\r
35 #define __DRIVER_COMMON_H\r
36 \r
37 #include <stddef.h>\r
38 #include <stdint.h>\r
39 #include <stdbool.h>\r
40 \r
41 #define ARM_DRIVER_VERSION_MAJOR_MINOR(major,minor) (((major) << 8) | (minor))\r
42 \r
43 /**\r
44 \brief Driver Version\r
45 */\r
46 typedef struct _ARM_DRIVER_VERSION {\r
47   uint16_t api;                         ///< API version\r
48   uint16_t drv;                         ///< Driver version\r
49 } ARM_DRIVER_VERSION;\r
50 \r
51 /* General return codes */\r
52 #define ARM_DRIVER_OK                 0 ///< Operation succeeded \r
53 #define ARM_DRIVER_ERROR             -1 ///< Unspecified error\r
54 #define ARM_DRIVER_ERROR_BUSY        -2 ///< Driver is busy\r
55 #define ARM_DRIVER_ERROR_TIMEOUT     -3 ///< Timeout occurred\r
56 #define ARM_DRIVER_ERROR_UNSUPPORTED -4 ///< Operation not supported\r
57 #define ARM_DRIVER_ERROR_PARAMETER   -5 ///< Parameter error\r
58 #define ARM_DRIVER_ERROR_SPECIFIC    -6 ///< Start of driver specific errors \r
59 \r
60 /**\r
61 \brief General power states\r
62 */ \r
63 typedef enum _ARM_POWER_STATE {\r
64   ARM_POWER_OFF,                        ///< Power off: no operation possible\r
65   ARM_POWER_LOW,                        ///< Low Power mode: retain state, detect and signal wake-up events\r
66   ARM_POWER_FULL                        ///< Power on: full operation at maximum performance\r
67 } ARM_POWER_STATE;\r
68 \r
69 #endif /* __DRIVER_COMMON_H */\r