main.dox 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. /*
  2. ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. /**
  14. * @defgroup IO HAL
  15. * @brief Hardware Abstraction Layer.
  16. * @details Under ChibiOS the set of the various device driver interfaces
  17. * is called the HAL subsystem: Hardware Abstraction Layer. The HAL is the
  18. * abstract interface between ChibiOS applications and hardware.
  19. *
  20. * @section hal_device_driver_arch HAL Device Drivers Architecture
  21. * The HAL contains several kind of modules:
  22. * - Normal Device Drivers
  23. * - Complex Device Drivers
  24. * - Interfaces
  25. * - Inner Code
  26. * .
  27. * @section hal_normal_device_drivers HAL Normal Device Drivers
  28. * Normal device are meant to interface the application to the underlying
  29. * hardware through an high level API. Normal Device Drivers are split in two
  30. * layers:
  31. * - High Level Device Driver (<b>HLD</b>). This layer contains the definitions
  32. * of the driver's APIs and the platform independent part of the driver.<br>
  33. * An HLD is composed by two files:
  34. * - @p hal_@<driver@>.c, the HLD implementation file. This file must be
  35. * included in the Makefile in order to use the driver.
  36. * - @p hal_@<driver@>.h, the HLD header file. This file is implicitly
  37. * included by the HAL header file @p hal.h.
  38. * .
  39. * - Low Level Device Driver (<b>LLD</b>). This layer contains the platform
  40. * dependent part of the driver.<br>
  41. * A LLD is composed by two files:
  42. * - @p hal_@<driver@>_lld.c, the LLD implementation file. This file must be
  43. * included in the Makefile in order to use the driver.
  44. * - @p hal_@<driver@>_lld.h, the LLD header file. This file is implicitly
  45. * included by the HLD header file.
  46. * .
  47. * .
  48. * @subsection hal_device_driver_diagram Diagram
  49. * @dot
  50. digraph example {
  51. graph [size="5, 7", pad="1.5, 0"];
  52. node [shape=rectangle, fontname=Helvetica, fontsize=8,
  53. fixedsize="true", width="2.0", height="0.4"];
  54. edge [fontname=Helvetica, fontsize=8];
  55. app [label="Application"];
  56. hld [label="High Level Driver"];
  57. lld [label="Low Level Driver"];
  58. hw [label="Microcontroller Hardware"];
  59. hal_lld [label="HAL shared low level code"];
  60. app->hld;
  61. hld->lld;
  62. lld-> hw;
  63. lld->hal_lld;
  64. hal_lld->hw;
  65. }
  66. * @enddot
  67. *
  68. * @section hal_complex_device_drivers HAL Complex Device Drivers
  69. * It is a class of device drivers that offer an high level API but do not
  70. * use the hardware directly. Complex device drivers use other drivers for
  71. * accessing the machine resources.
  72. *
  73. * @section hal_interfaces HAL Interfaces
  74. * An interface is a binary structure allowing the access to a service
  75. * using virtual functions. This allows to create drivers that can be
  76. * accessed using a common interface.
  77. * The concept of interface is commonly found in object-oriented languages
  78. * like Java or C++, their meaning in ChibiOS/HAL is exactly the same.
  79. *
  80. * @section hal_inner_code HAL Inner Code
  81. * Some modules are shared among multiple device drivers and are not
  82. * necessarily meant to be used by the application layer.
  83. */
  84. /**
  85. * @defgroup HAL_CONF Configuration
  86. * @brief HAL Configuration.
  87. * @details The file @p halconf.h contains the high level settings for all
  88. * the drivers supported by the HAL. The low level, platform dependent,
  89. * settings are contained in the @p mcuconf.h file instead and are describe
  90. * in the various platforms reference manuals.
  91. *
  92. * @ingroup IO
  93. */
  94. /**
  95. * @defgroup HAL_NORMAL_DRIVERS Normal Drivers
  96. * @brief HAL Normal Drivers.
  97. *
  98. * @ingroup IO
  99. */
  100. /**
  101. * @defgroup HAL_COMPLEX_DRIVERS Complex Drivers
  102. * @brief HAL Complex Drivers.
  103. *
  104. * @ingroup IO
  105. */
  106. /**
  107. * @defgroup HAL_INTERFACES_CLASSES Interfaces and Classes
  108. * @brief HAL Interfaces and Classes.
  109. *
  110. * @ingroup IO
  111. */
  112. /**
  113. * @defgroup HAL_INNER_CODE Inner Code
  114. * @brief HAL Inner Code.
  115. *
  116. * @ingroup IO
  117. */
  118. /**
  119. * @defgroup HAL_SUPPORT Support Code
  120. * @brief HAL Support Code.
  121. *
  122. * @ingroup IO
  123. */
  124. /**
  125. * @defgroup OSAL OSAL
  126. * @brief Operating System Abstraction Layer.
  127. * @details <h2>The OSAL</h2>
  128. * The OSAL is the link between ChibiOS/HAL and services
  129. * provided by operating systems like:
  130. * - Critical Zones handling.
  131. * - Interrupts handling.
  132. * - Runtime Errors management.
  133. * - Inter-task synchronization.
  134. * - Task-ISR synchronization.
  135. * - Time management.
  136. * - Events.
  137. * .
  138. * ChibiOS/HAL is designed to tightly integrate with the underlying
  139. * RTOS in order to provide the best experience to developers and
  140. * minimize integration issues.<br>
  141. * This section describes the API that OSALs are expected to expose
  142. * to the HAL.
  143. *
  144. * <h2>RTOS Requirements</h2>
  145. * The OSAL API closely resembles the ChibiOS/RT API, for obvious
  146. * reasons, however an OSAL module can be implemented for any
  147. * reasonably complete RTOS or even a RTOS-less bare metal
  148. * machine, if required.<br>
  149. * In order to be able to support an HAL an RTOS should support the
  150. * following minimal set of features:
  151. * - Task-level critical zones API.
  152. * - ISR-level critical zones API, only required on those CPU
  153. * architectures supporting preemptable ISRs like Cortex-Mx
  154. * cores.
  155. * - Ability to invoke API functions from inside a task critical
  156. * zone. Functions that are required to support this feature are
  157. * marked with an "I" or "S" letter at the end of the name.
  158. * - Ability to invoke API functions from inside an ISR critical
  159. * zone. Functions that are required to support this feature are
  160. * marked with an "I" letter at the end of the name.
  161. * - Tasks Queues or Counting Semaphores with Timeout capability.
  162. * - Ability to suspend a task and wakeup it from ISR with Timeout
  163. * capability.
  164. * - Event flags, the mechanism can be simulated using callbacks in
  165. * case the RTOS does not support it.
  166. * - Mutual Exclusion mechanism like Semaphores or Mutexes.
  167. * .
  168. * All the above requirements can be satisfied even on naked HW with
  169. * a very think SW layer. In case that the HAL is required to work
  170. * without an RTOS.
  171. *
  172. * <h2>Supported RTOSes</h2>
  173. * The RTOSes supported out of the box are:
  174. * - ChibiOS/RT
  175. * - ChibiOS/NIL
  176. * .
  177. * Implementations have also been successfully created on RTOSes not
  178. * belonging to the ChibiOS products family but are not supported
  179. * as a core feature of ChibiOS/HAL.
  180. *
  181. * @ingroup IO
  182. */