|
| #define | CFN_HAL_USE_LOCK 0 |
| | Enable RTOS-aware thread safety for the HAL.
|
| |
| #define | CFN_HAL_INLINE static inline |
| | Macro for inlining HAL wrapper functions. Can be overridden with attribute((always_inline)) for performance-critical ports.
|
| |
| #define | CFN_HAL_MAX_DELAY (UINT32_MAX) |
| |
| #define | CFN_HAL_STATIC_ASSERT _Static_assert |
| | Cross-compiler static assertion macro. Uses C++11 static_assert or C11 _Static_assert to avoid dependency on <assert.h>.
|
| |
| #define | CFN_HAL_BIT(x) ((1UL) << (uint32_t) (x)) |
| |
| #define | CFN_HAL_BIT_SET(x, y) ((x) |= (CFN_HAL_BIT(y))) |
| |
| #define | CFN_HAL_BIT_CLEAR(x, y) ((x) &= ~(CFN_HAL_BIT(y))) |
| |
| #define | CFN_HAL_BIT_TOGGLE(x, y) ((x) ^= (CFN_HAL_BIT(y))) |
| |
| #define | CFN_HAL_BIT_CHECK(x, y) ((x) & (CFN_HAL_BIT(y))) |
| |
| #define | CFN_HAL_BIT_IS_SET(x, y) ((CFN_HAL_BIT_CHECK(x, y)) != 0) |
| |
| #define | CFN_HAL_STR_STRINGIFY(x) #x |
| |
| #define | CFN_HAL_INTERNAL_CONCAT(x, y) x##y |
| |
| #define | CFN_HAL_CONCAT(x, y) CFN_HAL_INTERNAL_CONCAT(x, y) |
| |
| #define | CFN_HAL_UNUSED(x) (void) (x) |
| |
| #define | CFN_HAL_CONTAINER_OF(ptr, type, member) ((type *) ((char *) (ptr) - offsetof(type, member))) |
| |
| #define | CFN_HAL_GET_DRIVER_FROM_BASE(ptr, type) CFN_HAL_CONTAINER_OF(ptr, type, base) |
| | Helper macro to get the peripheral driver pointer from a base driver pointer.
|
| |
| #define | CFN_HAL_CREATE_DRIVER_TYPE(prefix, config_type, api_type, phy_type, cb_type) |
| |
| #define | CFN_HAL_CHECK_AND_CALL_FUNC(expected_peripheral_type, func, driver, result) |
| |
| #define | CFN_HAL_CHECK_AND_CALL_FUNC_VARG(expected_peripheral_type, func, driver, result, ...) |
| |
| #define | CFN_HAL_GET_LOCK_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, _9, NAME, ...) NAME |
| |
| #define | CFN_HAL_LOCK(driver, timeout) (CFN_HAL_ERROR_OK) |
| |
| #define | CFN_HAL_UNLOCK(driver) (CFN_HAL_ERROR_OK) |
| |
| #define | CFN_HAL_WITH_LOCK_NO_LOCK_0(driver, timeout, result, function) |
| |
| #define | CFN_HAL_WITH_LOCK_NO_LOCK_N(driver, timeout, result, function, ...) |
| |
| #define | CFN_HAL_WITH_LOCK(...) |
| | Helper macro to execute a driver function (Locking disabled).
|
| |
Core Hardware Abstraction Layer definitions and macros.
Copyright (c) 2026 Hisham Moussa Daou https://www.whileone.me
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.