Driver_Common.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Copyright (c) 2013-2017 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. * 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. Feb 2017
  19. * $Revision: V2.0
  20. *
  21. * Project: Common Driver definitions
  22. */
  23. /* History:
  24. * Version 2.0
  25. * Changed prefix ARM_DRV -> ARM_DRIVER
  26. * Added General return codes definitions
  27. * Version 1.10
  28. * Namespace prefix ARM_ added
  29. * Version 1.00
  30. * Initial release
  31. */
  32. #ifndef DRIVER_COMMON_H_
  33. #define DRIVER_COMMON_H_
  34. #include <stddef.h>
  35. #include <stdint.h>
  36. #include <stdbool.h>
  37. #define ARM_DRIVER_VERSION_MAJOR_MINOR(major,minor) (((major) << 8) | (minor))
  38. /**
  39. \brief Driver Version
  40. */
  41. typedef struct _ARM_DRIVER_VERSION {
  42. uint16_t api; ///< API version
  43. uint16_t drv; ///< Driver version
  44. } ARM_DRIVER_VERSION;
  45. /* General return codes */
  46. #define ARM_DRIVER_OK 0 ///< Operation succeeded
  47. #define ARM_DRIVER_ERROR -1 ///< Unspecified error
  48. #define ARM_DRIVER_ERROR_BUSY -2 ///< Driver is busy
  49. #define ARM_DRIVER_ERROR_TIMEOUT -3 ///< Timeout occurred
  50. #define ARM_DRIVER_ERROR_UNSUPPORTED -4 ///< Operation not supported
  51. #define ARM_DRIVER_ERROR_PARAMETER -5 ///< Parameter error
  52. #define ARM_DRIVER_ERROR_SPECIFIC -6 ///< Start of driver specific errors
  53. /**
  54. \brief General power states
  55. */
  56. typedef enum _ARM_POWER_STATE {
  57. ARM_POWER_OFF, ///< Power off: no operation possible
  58. ARM_POWER_LOW, ///< Low Power mode: retain state, detect and signal wake-up events
  59. ARM_POWER_FULL ///< Power on: full operation at maximum performance
  60. } ARM_POWER_STATE;
  61. #endif /* DRIVER_COMMON_H_ */