Mistake on this page?
Report an issue in GitHub or email us
pal_interfaces_ns.h
Go to the documentation of this file.
1 /** @file
2  * Copyright (c) 2018-2019, 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_NS_H_
18 #define _PAL_INTERFACES_NS_H_
19 
20 #include "val.h"
21 #include "val_client_defs.h"
22 #include <stdarg.h>
23 
24 /**
25  @brief - This function will read peripherals using SPI commands
26  @param - addr : address of the peripheral
27  - data : read buffer
28  - len : length of the read buffer in bytes
29  @return - error status
30 **/
31 int pal_spi_read(addr_t addr, uint8_t *data, uint32_t len);
32 
33 /**
34  * @brief - Retrieve the version of the PSA Framework API that is implemented.
35  * This is a wrapper API for psa_framework_version API.
36  * @param - void
37  * @return - The PSA Framework API version.
38  * Note - Return PAL_STATUS_ERROR if PSA IPC is not implemented.
39  */
40 uint32_t pal_ipc_framework_version(void);
41 
42 /**
43  * @brief - Retrieve the minor version of a Root of Trust Service by its SID.
44  * This is a wrapper API for the psa_version API.
45  * @param - sid The Root of Trust Service ID
46  * @return - Minor version of Root of Trust Service or PSA_VERSION_NONE if Root of Trust Service
47  * not present on the system.
48  * Note - Return PAL_STATUS_ERROR if PSA IPC is not implemented.
49  */
50 uint32_t pal_ipc_version(uint32_t sid);
51 
52 /**
53  * @brief - Connect to given sid.
54  * This is a wrapper API for the psa_connect API.
55  * @param - sid : RoT service id
56  * - minor_version : minor_version of RoT service
57  * @return - psa_handle_t : return connection handle
58  * Note - Return PSA_NULL_HANDLE if PSA IPC is not implemented.
59  */
60 psa_handle_t pal_ipc_connect(uint32_t sid, uint32_t minor_version);
61 
62 /**
63  * @brief - Call a connected Root of Trust Service.
64  * This is a wrapper API for the psa_call API. The caller must provide an array of
65  * psa_invec_t structures as the input payload.
66  * @param - handle: Handle for the connection.
67  * - in_vec: Array of psa_invec structures.
68  * - in_len: Number of psa_invec structures in in_vec.
69  * - out_vec: Array of psa_outvec structures for optional Root of Trust Service response.
70  * - out_len: Number of psa_outvec structures in out_vec.
71  * @return - psa_status_t
72  */
73 
74 psa_status_t pal_ipc_call(psa_handle_t handle,
75  const psa_invec *in_vec,
76  size_t in_len,
77  psa_outvec *out_vec,
78  size_t out_len);
79 
80 /**
81  * @brief - Close a connection to a Root of Trust Service.
82  * This is a wrapper API for the psa_close API.
83  * Sends the PSA_IPC_DISCONNECT message to the Root of Trust Service
84  * so it can clean up resources.
85  * @param - handle Handle for the connection.
86  * @return - void
87  */
88 void pal_ipc_close(psa_handle_t handle);
89 /**
90  @brief - This function initializes the UART
91  @param - uart base addr
92  @return - SUCCESS/FAILURE
93 **/
94 int pal_uart_init_ns(uint32_t uart_base_addr);
95 
96 /**
97  * @brief - This function parses the input string and writes bytes into UART TX FIFO
98  * @param - str : Input String
99  * - data : Value for format specifier
100  * @return - SUCCESS/FAILURE
101 **/
102 
103 int pal_print_ns(char *str, uint32_t data);
104 
105 /**
106  * @brief - Initializes an hardware watchdog timer
107  * @param - base_addr : Base address of the watchdog module
108  * - time_us : Time in micro seconds
109  * - timer_tick_us : Number of ticks per micro second
110  * @return - SUCCESS/FAILURE
111 **/
112 int pal_wd_timer_init_ns(addr_t base_addr, uint32_t time_us, uint32_t timer_tick_us);
113 
114 /**
115  * @brief - Enables a hardware watchdog timer
116  * @param - base_addr : Base address of the watchdog module
117  * @return - SUCCESS/FAILURE
118 **/
119 int pal_wd_timer_enable_ns(addr_t base_addr);
120 
121 /**
122  * @brief - Disables a hardware watchdog timer
123  * @param - base_addr : Base address of the watchdog module
124  * @return - SUCCESS/FAILURE
125 **/
126 int pal_wd_timer_disable_ns(addr_t base_addr);
127 
128 /**
129  * @brief - Reads from given non-volatile address.
130  * @param - base : Base address of nvmem
131  * offset : Offset
132  * buffer : Pointer to source address
133  * size : Number of bytes
134  * @return - SUCCESS/FAILURE
135 **/
136 int pal_nvmem_read_ns(addr_t base, uint32_t offset, void *buffer, int size);
137 
138 /**
139  * @brief - Writes into given non-volatile address.
140  * @param - base : Base address of nvmem
141  * offset : Offset
142  * buffer : Pointer to source address
143  * size : Number of bytes
144  * @return - SUCCESS/FAILURE
145 **/
146 int pal_nvmem_write_ns(addr_t base, uint32_t offset, void *buffer, int size);
147 
148 /**
149  * @brief - This API will call the requested crypto function
150  * @param - type : function code
151  * valist : variable argument list
152  * @return - error status
153 **/
154 int32_t pal_crypto_function(int type, va_list valist);
155 
156 /**
157  * @brief - This API will call the requested internal trusted storage function
158  * @param - type : function code
159  * valist : variable argument list
160  * @return - error status
161 **/
162 uint32_t pal_its_function(int type, va_list valist);
163 
164 /**
165  * @brief - This API will call the requested protected storage function
166  * @param - type : function code
167  * valist : variable argument list
168  * @return - error status
169 **/
170 uint32_t pal_ps_function(int type, va_list valist);
171 
172 /**
173  * @brief - This API will call the requested attestation function
174  * @param - type : function code
175  * valist : variable argument list
176  * @return - error status
177 **/
178 int32_t pal_attestation_function(int type, va_list valist);
179 
180 /**
181  * @brief - Terminates the simulation at the end of all tests completion.
182  * By default, it put cpus into power down mode.
183  * @param - void
184  * @return - void
185 **/
186 void pal_terminate_simulation(void);
187 #endif
uint32_t pal_ps_function(int type, va_list valist)
This API will call the requested protected storage function
void pal_terminate_simulation(void)
Terminates the simulation at the end of all tests completion.
int32_t pal_attestation_function(int type, va_list valist)
This API will call the requested attestation function
int32_t pal_crypto_function(int type, va_list valist)
This API will call the requested crypto function
int pal_wd_timer_enable_ns(addr_t base_addr)
Enables a hardware watchdog timer
uint32_t pal_ipc_version(uint32_t sid)
Retrieve the minor version of a Root of Trust Service by its SID.
Copyright (c) 2018-2019, Arm Limited or its affiliates.
uint32_t pal_its_function(int type, va_list valist)
This API will call the requested internal trusted storage function
int pal_wd_timer_init_ns(addr_t base_addr, uint32_t time_us, uint32_t timer_tick_us)
Initializes an hardware watchdog timer
int pal_wd_timer_disable_ns(addr_t base_addr)
Disables a hardware watchdog timer
psa_handle_t pal_ipc_connect(uint32_t sid, uint32_t minor_version)
Connect to given sid.
void pal_ipc_close(psa_handle_t handle)
Close a connection to a Root of Trust Service.
int pal_print_ns(char *str, uint32_t data)
This function parses the input string and writes bytes into UART TX FIFO
int pal_nvmem_write_ns(addr_t base, uint32_t offset, void *buffer, int size)
Writes into given non-volatile address.
int pal_uart_init_ns(uint32_t uart_base_addr)
This function initializes the UART
A writable output memory region provided to an RoT Service.
int pal_nvmem_read_ns(addr_t base, uint32_t offset, void *buffer, int size)
Reads from given non-volatile address.
A read-only input memory region provided to an RoT Service.
psa_status_t pal_ipc_call(psa_handle_t handle, const psa_invec *in_vec, size_t in_len, psa_outvec *out_vec, size_t out_len)
Call a connected Root of Trust Service.
Copyright (c) 2018-2019, Arm Limited or its affiliates.
int32_t psa_status_t
Function return status.
uint32_t pal_ipc_framework_version(void)
Retrieve the version of the PSA Framework API that is implemented.
int pal_spi_read(addr_t addr, uint8_t *data, uint32_t len)
This function will read peripherals using SPI commands
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.