aboutsummaryrefslogtreecommitdiff
path: root/hal_internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'hal_internal.h')
-rw-r--r--hal_internal.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/hal_internal.h b/hal_internal.h
index cc2d749..5e6b939 100644
--- a/hal_internal.h
+++ b/hal_internal.h
@@ -390,6 +390,10 @@ typedef struct hal_ks hal_ks_t;
struct hal_ks_driver {
+ hal_error_t (*init)(const hal_ks_driver_t * const driver);
+
+ hal_error_t (*shutdown)(const hal_ks_driver_t * const driver);
+
hal_error_t (*open)(const hal_ks_driver_t * const driver,
hal_ks_t **ks);
@@ -430,6 +434,22 @@ extern const hal_ks_driver_t
hal_ks_volatile_driver[1],
hal_ks_token_driver[1];
+static inline hal_error_t hal_ks_init(const hal_ks_driver_t * const driver)
+{
+ if (driver == NULL || driver->init == NULL)
+ return HAL_ERROR_BAD_ARGUMENTS;
+
+ return driver->init(driver);
+}
+
+static inline hal_error_t hal_ks_shutdown(const hal_ks_driver_t * const driver)
+{
+ if (driver == NULL || driver->shutdown == NULL)
+ return HAL_ERROR_BAD_ARGUMENTS;
+
+ return driver->shutdown(driver);
+}
+
static inline hal_error_t hal_ks_open(const hal_ks_driver_t * const driver,
hal_ks_t **ks)
{