summaryrefslogtreecommitdiff
path: root/source/hal/include
diff options
context:
space:
mode:
authorKshitij Sisodia <kshitij.sisodia@arm.com>2022-04-08 09:54:53 +0100
committerKshitij Sisodia <kshitij.sisodia@arm.com>2022-04-08 12:30:28 +0100
commit4cc4021d356c174f780be2b7ef96910e36c8dd7b (patch)
treec2a790b914577873a368982a07a9491f6743443e /source/hal/include
parent11b75cc7dc140119dee490f425e25a004122703b (diff)
downloadml-embedded-evaluation-kit-4cc4021d356c174f780be2b7ef96910e36c8dd7b.tar.gz
MLECO-3070: Further HAL cleanup.
Cleaning up HAL sources by removing unnecessary redirections with function pointers. The "platform packages" under HAL are now streamlined enough to not need any major HAL wrapping (as was the case before). This allows us to have a very thin HAL layer that sits on top of the platform and compnent packs. Also helps in getting rid of "hal platform" pointer being passed around in the code to use any HAL functionality. Change-Id: I04b2057f972aad7a5cfb4a396bcdf147c9f9ef1c Signed-off-by: Kshitij Sisodia <kshitij.sisodia@arm.com>
Diffstat (limited to 'source/hal/include')
-rw-r--r--source/hal/include/hal.h30
-rw-r--r--source/hal/include/hal_pmu.h (renamed from source/hal/include/timer.h)28
2 files changed, 19 insertions, 39 deletions
diff --git a/source/hal/include/hal.h b/source/hal/include/hal.h
index 25ea1e2..5d1964d 100644
--- a/source/hal/include/hal.h
+++ b/source/hal/include/hal.h
@@ -29,47 +29,25 @@ extern "C" {
#endif
#include "platform_drivers.h" /* Platform drivers */
-#include "timer.h" /* Timer/profiler API */
+#include "hal_pmu.h" /* Timer/profiler API */
#include "hal_lcd.h" /* LCD functions */
#include <inttypes.h>
#include <stdbool.h>
-/* Structure to define a platform context to be used by the application */
-typedef struct hal_platform_context {
- int inited; /**< initialised */
- char plat_name[64]; /**< name of this platform */
- platform_timer* timer; /**< timer */
- int (* platform_init)(); /**< pointer to platform initialisation function */
- void (* platform_release)(); /**< pointer to platform release function */
-} hal_platform;
-
-/**
- * @brief Initialise the HAL structure based on compile time config. This
- * should be called before any other function in this API.
- * @param[in,out] platform Pointer to a pre-allocated platform struct.
- * @param[in,out] timer Pointer to a pre-allocated timer module.
- * @return 0 if successful, error code otherwise.
- **/
-int hal_init(hal_platform* platform, platform_timer* timer);
-
-
/**
* @brief Initialise the HAL platform. This will go and initialise all the
* modules on the platform the application requires to run.
- * @param[in] platform Pointer to a pre-allocated and initialised
- * platform structure.
- * @return 0 if successful, error code otherwise.
+ * @return True if successful, false otherwise.
**/
-int hal_platform_init(hal_platform* platform);
+bool hal_platform_init(void);
/**
* @brief Release the HAL platform. This should release resources acquired.
- * @param[in] platform pointer to a pre-allocated and initialised
* platform structure.
**/
-void hal_platform_release(hal_platform* platform);
+void hal_platform_release(void);
/**
* @brief Gets user input from the stdin interface.
diff --git a/source/hal/include/timer.h b/source/hal/include/hal_pmu.h
index 9910fcf..5bfe517 100644
--- a/source/hal/include/timer.h
+++ b/source/hal/include/hal_pmu.h
@@ -14,23 +14,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef HAL_TIMER_H
-#define HAL_TIMER_H
+#ifndef HAL_PMU_H
+#define HAL_PMU_H
-#include "platform_drivers.h" /* Platform package API */
-#include "user_input.h" /* PMU structs and API */
+#include "platform_pmu.h"
-/* Structure to hold a platform specific timer implementation */
-typedef struct _platform_timer {
- int inited; /**< Initialised or not. */
- void (* reset)(void); /**< Reset the timer. */
- pmu_counters (* get_counters)(void); /**< Gets the current time counter. */
+/**
+ * @brief Initialise the PMU available for the platform.
+ **/
+void hal_pmu_init(void);
-} platform_timer;
+/**
+ * @brief Resets the counters.
+ */
+void hal_pmu_reset(void);
/**
- * @brief Initialise the timer available for the platform.
+ * @brief Gets the current counter values.
+ * @param[out] Pointer to a pmu_counters object.
**/
-void init_timer(platform_timer* timer);
+void hal_pmu_get_counters(pmu_counters* counters);
-#endif /* HAL_TIMER_H */
+#endif /* HAL_PMU_H */