blob: 9f7390f3e8174ee717435ee799601bdce1558034 [file] [log] [blame]
jk-arm957cfea2021-06-18 15:52:12 +05301/** @file
2 * Copyright (c) 2021 Arm Limited or its affiliates. All rights reserved.
3 * 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 _PAL_INTERFACES_H_
18#define _PAL_INTERFACES_H_
19
20#include <stdarg.h>
21#include <psa_adac.h>
22
23/**
24 * @brief - This function parses the input string and writes bytes into logger TX FIFO
25 * @param - str : Input String
26 * - data : Value for format specifier
27 * @return - SUCCESS/FAILURE
28**/
29
30int pal_print(const char *str, int32_t data);
31
32/**
33 * @brief - Terminates the simulation at the end of all tests completion.
34 * By default, it put cpus into power down mode.
35 * @param - void
36 * @return - void
37**/
38void pal_terminate_simulation(void);
39
40/**
41 * @brief - Resets the system.
42 * @param - void
43 * @return - SUCCESS/FAILURE
44**/
45int pal_system_reset(void);
46
47request_packet_t *request_packet_lock(size_t *max_data_size);
48
49/**
50 * @brief - Reserve the communication buffer memory for receive packet.
51 * @param - max_data_size Valid size of command frame
52 * @return - Pointer to the command frame to be read
53**/
54response_packet_t *response_packet_lock(size_t *max_data_size);
55
56/**
57 * @brief - Release the lock held by transmit packet.
58 * @param - packet Most recent command frame sent
59 * @return - SUCCESS/FAILURE
60**/
61int request_packet_release(request_packet_t *packet);
62
63/**
64 * @brief - Release the lock held by receive packet.
65 * @param - packet Most recent response packet received
66 * @return - SUCCESS/FAILURE
67**/
68int response_packet_release(response_packet_t *packet);
69
70/**
71 * @brief - Construct the Request packet for the specified ADAC command.
72 * @param - command ADAC command
73 * data Pointer to payload
74 * data_size Size of the command payload
75 * @return - Pointer to the command frame to be written
76**/
77request_packet_t *request_packet_build(uint16_t command, uint8_t *data, size_t data_size);
78
79/**
80 * @brief - Write the Request packet into the communication buffer for transmit.
81 * @param - packet Request packet built for dispatch
82 * @return - SUCCESS/FAILURE
83**/
84int request_packet_send(request_packet_t *packet);
85
86/**
87 * @brief - Read the Response packet from the communication buffer.
88 * @param - None
89 * @return - Response packet received from target.
90**/
91response_packet_t *response_packet_receive();
92
93#endif