Driver_Common.h 2.6 KB

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