Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #ifndef SP_HELPERS_H |
| 8 | #define SP_HELPERS_H |
| 9 | |
| 10 | #include <stdint.h> |
| 11 | #include <sys/types.h> |
| 12 | |
| 13 | typedef struct { |
| 14 | u_register_t arg0; |
| 15 | u_register_t arg1; |
| 16 | u_register_t arg2; |
| 17 | u_register_t arg3; |
| 18 | u_register_t arg4; |
| 19 | u_register_t arg5; |
| 20 | u_register_t arg6; |
| 21 | u_register_t arg7; |
| 22 | } svc_args; |
| 23 | |
| 24 | /* |
| 25 | * Trigger an SVC call. |
| 26 | * |
| 27 | * The arguments to pass through the SVC call must be stored in the svc_args |
| 28 | * structure. The return values of the SVC call will be stored in the same |
| 29 | * structure (overriding the input arguments). |
| 30 | * |
| 31 | * Return the first return value. It is equivalent to args.arg0 but is also |
| 32 | * provided as the return value for convenience. |
| 33 | */ |
| 34 | u_register_t sp_svc(svc_args *args); |
| 35 | |
| 36 | /* |
| 37 | * Choose a pseudo-random number within the [min,max] range (both limits are |
| 38 | * inclusive). |
| 39 | */ |
| 40 | uintptr_t bound_rand(uintptr_t min, uintptr_t max); |
| 41 | |
| 42 | /* |
| 43 | * Check that expr == expected. |
| 44 | * If not, loop forever. |
| 45 | */ |
| 46 | void expect(int expr, int expected); |
| 47 | |
| 48 | /* |
| 49 | * Test framework functions |
| 50 | */ |
| 51 | |
| 52 | void announce_test_section_start(const char *test_sect_desc); |
| 53 | void announce_test_section_end(const char *test_sect_desc); |
| 54 | |
| 55 | void announce_test_start(const char *test_desc); |
| 56 | void announce_test_end(const char *test_desc); |
| 57 | |
Antonio Nino Diaz | 2ac6f8f | 2018-07-02 09:04:07 +0100 | [diff] [blame] | 58 | /* Sleep for at least 'ms' milliseconds. */ |
| 59 | void sp_sleep(uint32_t ms); |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 60 | |
| 61 | #endif /* SP_HELPERS_H */ |