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