1 /* ----------------------------------------------------------------------------- 2 * SPDX-License-Identifier: Zlib 3 * Copyright (c) 2013-2014 ARM Ltd. 4 * 5 * This software is provided 'as-is', without any express or implied warranty. 6 * In no event will the authors be held liable for any damages arising from 7 * the use of this software. Permission is granted to anyone to use this 8 * software for any purpose, including commercial applications, and to alter 9 * it and redistribute it freely, subject to the following restrictions: 10 * 11 * 1. The origin of this software must not be misrepresented; you must not 12 * claim that you wrote the original software. If you use this software in 13 * a product, an acknowledgment in the product documentation would be 14 * appreciated but is not required. 15 * 16 * 2. Altered source versions must be plainly marked as such, and must not be 17 * misrepresented as being the original software. 18 * 19 * 3. This notice may not be removed or altered from any source distribution. 20 * 21 * 22 * $Date: 2. Jan 2014 23 * $Revision: V2.00 24 * 25 * Project: Common Driver definitions 26 * -------------------------------------------------------------------------- */ 27 28 /* History: 29 * Version 2.00 30 * Changed prefix ARM_DRV -> ARM_DRIVER 31 * Added General return codes definitions 32 * Version 1.10 33 * Namespace prefix ARM_ added 34 * Version 1.00 35 * Initial release 36 */ 37 38 #ifndef __DRIVER_COMMON_H 39 #define __DRIVER_COMMON_H 40 41 #include <stddef.h> 42 #include <stdint.h> 43 #include <stdbool.h> 44 45 #define ARM_DRIVER_VERSION_MAJOR_MINOR(major,minor) (((major) << 8) | (minor)) 46 47 /** 48 \brief Driver Version 49 */ 50 typedef struct _ARM_DRIVER_VERSION { 51 uint16_t api; ///< API version 52 uint16_t drv; ///< Driver version 53 } ARM_DRIVER_VERSION; 54 55 /* General return codes */ 56 #define ARM_DRIVER_OK 0 ///< Operation succeeded 57 #define ARM_DRIVER_ERROR -1 ///< Unspecified error 58 #define ARM_DRIVER_ERROR_BUSY -2 ///< Driver is busy 59 #define ARM_DRIVER_ERROR_TIMEOUT -3 ///< Timeout occurred 60 #define ARM_DRIVER_ERROR_UNSUPPORTED -4 ///< Operation not supported 61 #define ARM_DRIVER_ERROR_PARAMETER -5 ///< Parameter error 62 #define ARM_DRIVER_ERROR_SPECIFIC -6 ///< Start of driver specific errors 63 64 /** 65 \brief General power states 66 */ 67 typedef enum _ARM_POWER_STATE { 68 ARM_POWER_OFF, ///< Power off: no operation possible 69 ARM_POWER_LOW, ///< Low Power mode: retain state, detect and signal wake-up events 70 ARM_POWER_FULL ///< Power on: full operation at maximum performance 71 } ARM_POWER_STATE; 72 73 #endif /* __DRIVER_COMMON_H */ 74