blob: 4651bfd374f81a6259930cfd008424032bf3ab05 [file] [log] [blame]
alexander3c798932021-03-26 21:42:19 +00001/*
Isabella Gottardiee4920b2022-02-25 14:29:32 +00002 * Copyright (c) 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 */
Kshitij Sisodiaa1256e32022-02-23 14:40:45 +000017#include "hal.h" /* API */
alexander3c798932021-03-26 21:42:19 +000018
Kshitij Sisodiaa1256e32022-02-23 14:40:45 +000019#include "platform_drivers.h" /* Platform drivers */
20#include "log_macros.h" /* Logging macros */
alexander3c798932021-03-26 21:42:19 +000021
Kshitij Sisodia4cc40212022-04-08 09:54:53 +010022bool hal_platform_init(void)
alexander3c798932021-03-26 21:42:19 +000023{
alexander3c798932021-03-26 21:42:19 +000024 /* Initialise platform */
Kshitij Sisodia4cc40212022-04-08 09:54:53 +010025 if (0 != platform_init()) {
26 printf_err("Failed to initialise platform %s\n", platform_name());
27 return false;
alexander3c798932021-03-26 21:42:19 +000028 }
29
Kshitij Sisodia68fdd112022-04-06 13:03:20 +010030 /* Initialise LCD */
Kshitij Sisodia4cc40212022-04-08 09:54:53 +010031 if (0 != hal_lcd_init()) {
Kshitij Sisodia68fdd112022-04-06 13:03:20 +010032 printf_err("hal_lcd_init failed\n");
Kshitij Sisodia4cc40212022-04-08 09:54:53 +010033 return false;
alexander3c798932021-03-26 21:42:19 +000034 }
35
Kshitij Sisodia4cc40212022-04-08 09:54:53 +010036 /* Initialise PMU */
37 hal_pmu_init();
alexander3c798932021-03-26 21:42:19 +000038
Kshitij Sisodia4cc40212022-04-08 09:54:53 +010039 return true;
alexander3c798932021-03-26 21:42:19 +000040}
41
Kshitij Sisodia4cc40212022-04-08 09:54:53 +010042void hal_platform_release(void)
alexander3c798932021-03-26 21:42:19 +000043{
Kshitij Sisodia4cc40212022-04-08 09:54:53 +010044 platform_release();
alexander3c798932021-03-26 21:42:19 +000045}
Kshitij Sisodia68fdd112022-04-06 13:03:20 +010046
47bool hal_get_user_input(char* user_input, int size)
48{
49 if (1 != GetLine(user_input, size - 1)) {
50 return true;
51 }
52 return false;
53}