1# HAL Layer Readme 2 3The HAL layer is designed to be used by the drivers. We don't guarantee the stability and back-compatibility among 4versions. The HAL layer may update very frequently with the driver. Please don't use them in the applications or treat 5them as stable APIs. 6 7The HAL layer consists of two layers: HAL (upper) and Lowlevel(bottom). The HAL layer defines the steps and data 8required by the peripheral. The lowlevel is a translation layer converting general conceptions to register configurations. 9 10## Lowlevel 11 12This layer should be all static inline. The first argument of LL functions is usually a pointer to the beginning address 13of the peripheral register. Each chip should have its own LL layer. The functions in this layer should be atomic and 14independent from each other so that the upper layer can change/perform one of the options/operation without touching the 15others. 16 17## HAL 18 19This layer should depend on the operating system as little as possible. It's a wrapping of LL functions, so that the upper 20layer can combine basic steps into different working ways (polling, non-polling, interrupt, etc.). Without using 21queues/locks/delay/loop/etc., this layer can be easily port to other os or simulation systems. 22 23To get better performance and better porting ability, ``context``s are used to hold sustainable data and pass the parameters. 24 25To develop your own driver, it is suggested to copy the HAL layer to your own code and keep them until manual update. 26