common_err.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. *********************************************************************************************************
  3. * uC/Common
  4. * Common Features for Micrium Stacks
  5. *
  6. * Copyright 2013-2020 Silicon Laboratories Inc. www.silabs.com
  7. *
  8. * SPDX-License-Identifier: APACHE-2.0
  9. *
  10. * This software is subject to an open source license and is distributed by
  11. * Silicon Laboratories Inc. pursuant to the terms of the Apache License,
  12. * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0.
  13. *
  14. *********************************************************************************************************
  15. */
  16. /*
  17. *********************************************************************************************************
  18. *
  19. * uC/Common - Generic error codes
  20. *
  21. * Filename : common_err.h
  22. * Version : V1.02.00
  23. *********************************************************************************************************
  24. */
  25. /*
  26. *********************************************************************************************************
  27. *********************************************************************************************************
  28. * MODULE
  29. *
  30. * Note(s) : (1) This library header file is protected from multiple pre-processor inclusion through
  31. * use of the library module present pre-processor macro definition.
  32. *********************************************************************************************************
  33. *********************************************************************************************************
  34. */
  35. #ifndef COMMON_ERR_MODULE_PRESENT /* See Note #1. */
  36. #define COMMON_ERR_MODULE_PRESENT
  37. /*
  38. *********************************************************************************************************
  39. *********************************************************************************************************
  40. * DATA TYPES
  41. *********************************************************************************************************
  42. *********************************************************************************************************
  43. */
  44. /*
  45. *********************************************************************************************************
  46. * COMMON ERR CODES
  47. *
  48. * Note(s) : (1) Caller should NEVER rely on the order/numerical value of ANY of these enum items. Their
  49. * order within the enum may change and other enum item may be added anywhere, impacting
  50. * the numerical values of other enum items.
  51. *
  52. * (2) A function MUST return the most accurate error it can. For example, if a NULL pointer is
  53. * passed to a function requiring a non-NULL pointer, it should return the RTOS_ERR_NULL_PTR
  54. * error and NOT RTOS_ERR_INVALID_ARG. A function should only return RTOS_ERR_INVALID_ARG
  55. * if no other error code can better describe the error that occurred.
  56. *********************************************************************************************************
  57. */
  58. typedef enum rtos_err {
  59. RTOS_ERR_NONE, /* No err. */
  60. /* ------------------ FEATURE SUPPORT ----------------- */
  61. RTOS_ERR_NOT_AVAIL, /* Feature not avail (due to cfg val(s). */
  62. RTOS_ERR_NOT_SUPPORTED, /* Feature not supported. */
  63. /* ------------------- INVALID ARGS ------------------- */
  64. RTOS_ERR_INVALID_ARG, /* Invalid arg or consequence of invalid arg. */
  65. RTOS_ERR_NULL_PTR, /* Null ptr. */
  66. RTOS_ERR_INVALID_STR_LEN, /* Len of str passed is invalid. */
  67. RTOS_ERR_INVALID_CREDENTIALS, /* Credentials used are invalid. */
  68. RTOS_ERR_NOT_FOUND, /* Requested item could not be found. */
  69. /* ---------------- CREATION/ALLOCATION --------------- */
  70. RTOS_ERR_ALLOC, /* Generic alloc err. */
  71. RTOS_ERR_CREATE_FAIL, /* Gen create obj err. */
  72. RTOS_ERR_NO_MORE_RSRC, /* Rsrc not avail to perform the operation. */
  73. RTOS_ERR_INIT, /* Init failed. */
  74. RTOS_ERR_ALREADY_INIT, /* Module has already been init'd. */
  75. RTOS_ERR_ALREADY_EXISTS, /* Item already exists. */
  76. /* ------------------- PEND/ACQUIRE ------------------- */
  77. RTOS_ERR_ABORT, /* Operation aborted. */
  78. RTOS_ERR_TIMEOUT, /* Operation timed out. */
  79. /* ------------------- POST/RELEASE ------------------- */
  80. RTOS_ERR_WOULD_BLOCK, /* Non-blocking operation would block. */
  81. RTOS_ERR_OWNERSHIP, /* Ownership err. */
  82. RTOS_ERR_WOULD_OVF, /* Item would overflow. */
  83. /* -------------------- OS-RELATED -------------------- */
  84. RTOS_ERR_ISR, /* Illegal call from ISR. */
  85. RTOS_ERR_OS, /* Generic OS err. */
  86. /* ----------------------- MISC ----------------------- */
  87. RTOS_ERR_PERMISSION /* Operation not allowed. */
  88. } RTOS_ERR;
  89. #endif /* COMMON_ERR_MODULE_PRESENT */