blob: a535dc9eb57c5fb9fe18c9371063d34a45b95943 [file] [log] [blame]
alexander3c798932021-03-26 21:42:19 +00001/*
Kshitij Sisodiaa1256e32022-02-23 14:40:45 +00002 * Copyright (c) 2021-2022 Arm Limited. All rights reserved.
alexander3c798932021-03-26 21:42:19 +00003 * SPDX-License-Identifier: Apache-2.0
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17#ifndef PLATFORM_HAL_H
18#define PLATFORM_HAL_H
19
20/**
21 * This file should present a C API for the main application logic to use
22 * and be indifferent to the lower level platform. In addition to this it
23 * will also need to be aware of the API exposed by data acquisition and
24 * data presentation modules.
25 */
alexander3c798932021-03-26 21:42:19 +000026
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31#include "data_acq.h" /* Data acquisition abstraction */
32#include "data_psn.h" /* Data presentation abstraction */
33#include "timer.h" /* Timer/profiler API */
34
Kshitij Sisodiaf9c19ea2021-05-07 16:08:14 +010035#include <inttypes.h>
36
alexander3c798932021-03-26 21:42:19 +000037/* Structure to define a platform context to be used by the application */
38typedef struct hal_platform_context {
39 int inited; /**< initialised */
Kshitij Sisodiaf9c19ea2021-05-07 16:08:14 +010040 char plat_name[64]; /**< name of this platform */
alexander3c798932021-03-26 21:42:19 +000041 data_acq_module * data_acq; /**< data acquisition module pointer */
42 data_psn_module * data_psn; /**< data presentation module pointer */
43 platform_timer * timer; /**< timer */
44 int (* platform_init)(); /**< pointer to platform initialisation function */
45 void (* platform_release)(); /**< pointer to platform release function */
46} hal_platform;
47
48/**
49 * @brief Initialise the HAL structure based on compile time config. This
50 * should be called before any other function in this API.
51 * @param[in,out] platform Pointer to a pre-allocated platform struct.
52 * @param[in,out] data_acq Pointer to a pre-allocated data acquisition module.
53 * @param[in,out] data_psn Pointer to a pre-allocated data presentation module.
54 * @param[in,out] timer Pointer to a pre-allocated timer module.
55 * @return 0 if successful, error code otherwise.
56 **/
57int hal_init(hal_platform *platform, data_acq_module *data_acq,
58 data_psn_module *data_psn, platform_timer *timer);
59
60
61/**
62 * @brief Initialise the HAL platform. This will go and initialise all the
63 * modules on the platform the application requires to run.
64 * @param[in] platform Pointer to a pre-allocated and initialised
65 * platform structure.
66 * @return 0 if successful, error code otherwise.
67 **/
68int hal_platform_init(hal_platform *platform);
69
70
71/**
72 * @brief Release the HAL platform. This should release resources acquired.
73 * @param[in] platform pointer to a pre-allocated and initialised
74 * platform structure.
75 **/
76void hal_platform_release(hal_platform *platform);
77
78#ifdef __cplusplus
79}
80#endif
81
82#endif /* PLATFORM_HAL_H */