alt_flag.h 4.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #ifndef __ALT_FLAG_H__
  2. #define __ALT_FLAG_H__
  3. /******************************************************************************
  4. * *
  5. * License Agreement *
  6. * *
  7. * Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
  8. * All rights reserved. *
  9. * *
  10. * Permission is hereby granted, free of charge, to any person obtaining a *
  11. * copy of this software and associated documentation files (the "Software"), *
  12. * to deal in the Software without restriction, including without limitation *
  13. * the rights to use, copy, modify, merge, publish, distribute, sublicense, *
  14. * and/or sell copies of the Software, and to permit persons to whom the *
  15. * Software is furnished to do so, subject to the following conditions: *
  16. * *
  17. * The above copyright notice and this permission notice shall be included in *
  18. * all copies or substantial portions of the Software. *
  19. * *
  20. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
  21. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
  22. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
  23. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
  24. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
  25. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
  26. * DEALINGS IN THE SOFTWARE. *
  27. * *
  28. * This agreement shall be governed in all respects by the laws of the State *
  29. * of California and by the laws of the United States of America. *
  30. * *
  31. * Altera does not recommend, suggest or require that this reference design *
  32. * file be used in conjunction or combination with any other product. *
  33. ******************************************************************************/
  34. /******************************************************************************
  35. * *
  36. * THIS IS A LIBRARY READ-ONLY SOURCE FILE. DO NOT EDIT. *
  37. * *
  38. ******************************************************************************/
  39. /*
  40. * This header provides macro definitions that can be used to create and use
  41. * uc/OS-II style event flags. These macros can be used in both a uC/OS-II based
  42. * environment, and a single threaded HAL based environment.
  43. *
  44. * The motivation for these macros is to allow code to be developed which is
  45. * thread safe under uC/OS-II, but incurs no additional overhead when used in a
  46. * single threaded HAL environment.
  47. *
  48. * In the case of a single threaded HAL environment, they compile to
  49. * "do nothing" directives, which ensures they do not contribute to the final
  50. * executable.
  51. *
  52. * The following macros are available:
  53. *
  54. * ALT_FLAG_GRP - Create a flag group instance.
  55. * ALT_EXTERN_FLAG_GRP - Create a reference to an external flag group instance.
  56. * ALT_STATIC_FLAG_GRP - Create a static flag group instance.
  57. * ALT_FLAG_CREATE - Initialise a flag group.
  58. * ALT_FLAG_PEND - Pend on a flag group.
  59. * ALT_FLAG_POST - Set a flag condition.
  60. *
  61. * Input arguments and return codes are all consistant with the equivalent
  62. * uC/OS-II function.
  63. *
  64. * It's important to be careful in the use of the macros: ALT_FLAG_GRP,
  65. * ALT_EXTERN_FLAG_GRP, and ALT_STATIC_FLAG_GRP. In these three cases the
  66. * semi-colon is included in the macro definition; so, for example, you should
  67. * use:
  68. *
  69. * ALT_FLAG_GRP(mygroup)
  70. *
  71. * not:
  72. *
  73. * ALT_FLAG_GRP(mygroup);
  74. *
  75. * The inclusion of the semi-colon has been necessary to ensure the macros can
  76. * compile with no warnings when used in a single threaded HAL environment.
  77. *
  78. */
  79. #include "priv/alt_no_error.h"
  80. #define ALT_FLAG_GRP(group)
  81. #define ALT_EXTERN_FLAG_GRP(group)
  82. #define ALT_STATIC_FLAG_GRP(group)
  83. #define ALT_FLAG_CREATE(group, flags) alt_no_error ()
  84. #define ALT_FLAG_PEND(group, flags, wait_type, timeout) alt_no_error ()
  85. #define ALT_FLAG_POST(group, flags, opt) alt_no_error ()
  86. #ifndef ALT_SINGLE_THREADED
  87. #define ALT_SINGLE_THREADED
  88. #endif
  89. #endif /* __ALT_FLAG_H__ */