diff options
author | Alamy Liu <alamy.liu@cypress.com> | 2019-12-03 10:30:32 -0800 |
---|---|---|
committer | David Hu <david.hu@arm.com> | 2020-01-21 08:14:58 +0000 |
commit | e9894d9f11db98388abc19c1e7d734d0fdfcc68c (patch) | |
tree | 8052c14a4f3ad7c42c2c1a74fa6576ef2ed36240 | |
parent | 01ac46562dffca940340413bef4ffa07f99840de (diff) | |
download | trusted-firmware-m-e9894d9f11db98388abc19c1e7d734d0fdfcc68c.tar.gz |
Test: IRQ: use defined name from platform
Timer in different platform might have different IRQ number.
Instead of fixed IRQ number, it might be better to use
TFM_TIMERx_IRQ, which could be defined by each platform
to match their H.W. IRQ numbers
Change-Id: Iad3d93168edfb0835e965b59cf309f4d8dc725df
Signed-off-by: Alamy Liu <alamy.liu@cypress.com>
9 files changed, 75 insertions, 9 deletions
diff --git a/platform/ext/target/mps2/an519/tfm_peripherals_def.h b/platform/ext/target/mps2/an519/tfm_peripherals_def.h index de7f5e4851..0d0a0a50b1 100644 --- a/platform/ext/target/mps2/an519/tfm_peripherals_def.h +++ b/platform/ext/target/mps2/an519/tfm_peripherals_def.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2018-2019, Arm Limited. All rights reserved. + * Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -8,7 +9,14 @@ #ifndef __TFM_PERIPHERALS_DEF_H__ #define __TFM_PERIPHERALS_DEF_H__ -#define TFM_TIMER0_IRQ (3) +#include "platform_irq.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define TFM_TIMER0_IRQ (TIMER0_IRQn) +#define TFM_TIMER1_IRQ (TIMER1_IRQn) struct tfm_spm_partition_platform_data_t; @@ -22,4 +30,8 @@ extern struct tfm_spm_partition_platform_data_t tfm_peripheral_timer0; #define TFM_PERIPHERAL_FPGA_IO (&tfm_peripheral_fpga_io) #define TFM_PERIPHERAL_TIMER0 (&tfm_peripheral_timer0) +#ifdef __cplusplus +} +#endif + #endif /* __TFM_PERIPHERALS_DEF_H__ */ diff --git a/platform/ext/target/mps2/an521/tfm_peripherals_def.h b/platform/ext/target/mps2/an521/tfm_peripherals_def.h index de7f5e4851..0d0a0a50b1 100644 --- a/platform/ext/target/mps2/an521/tfm_peripherals_def.h +++ b/platform/ext/target/mps2/an521/tfm_peripherals_def.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2018-2019, Arm Limited. All rights reserved. + * Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -8,7 +9,14 @@ #ifndef __TFM_PERIPHERALS_DEF_H__ #define __TFM_PERIPHERALS_DEF_H__ -#define TFM_TIMER0_IRQ (3) +#include "platform_irq.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define TFM_TIMER0_IRQ (TIMER0_IRQn) +#define TFM_TIMER1_IRQ (TIMER1_IRQn) struct tfm_spm_partition_platform_data_t; @@ -22,4 +30,8 @@ extern struct tfm_spm_partition_platform_data_t tfm_peripheral_timer0; #define TFM_PERIPHERAL_FPGA_IO (&tfm_peripheral_fpga_io) #define TFM_PERIPHERAL_TIMER0 (&tfm_peripheral_timer0) +#ifdef __cplusplus +} +#endif + #endif /* __TFM_PERIPHERALS_DEF_H__ */ diff --git a/platform/ext/target/mps2/an539/tfm_peripherals_def.h b/platform/ext/target/mps2/an539/tfm_peripherals_def.h index 5376752eed..ed1e8507d1 100644 --- a/platform/ext/target/mps2/an539/tfm_peripherals_def.h +++ b/platform/ext/target/mps2/an539/tfm_peripherals_def.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2019, Arm Limited. All rights reserved. + * Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -8,11 +9,14 @@ #ifndef __TFM_PERIPHERALS_DEF_H__ #define __TFM_PERIPHERALS_DEF_H__ +#include "platform_irq.h" + #ifdef __cplusplus extern "C" { #endif -#define TFM_TIMER0_IRQ (3) +#define TFM_TIMER0_IRQ (TIMER0_IRQn) +#define TFM_TIMER1_IRQ (TIMER1_IRQn) struct tfm_spm_partition_platform_data_t; diff --git a/platform/ext/target/mps3/an524/tfm_peripherals_def.h b/platform/ext/target/mps3/an524/tfm_peripherals_def.h index 958313a84d..a6a8e558cb 100644 --- a/platform/ext/target/mps3/an524/tfm_peripherals_def.h +++ b/platform/ext/target/mps3/an524/tfm_peripherals_def.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2019, Arm Limited. All rights reserved. + * Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -8,11 +9,14 @@ #ifndef __TFM_PERIPHERALS_DEF_H__ #define __TFM_PERIPHERALS_DEF_H__ +#include "platform_irq.h" + #ifdef __cplusplus extern "C" { #endif -#define TFM_TIMER0_IRQ (3) +#define TFM_TIMER0_IRQ (TIMER0_IRQn) +#define TFM_TIMER1_IRQ (TIMER1_IRQn) struct tfm_spm_partition_platform_data_t; diff --git a/platform/ext/target/musca_a/tfm_peripherals_def.h b/platform/ext/target/musca_a/tfm_peripherals_def.h index f557701476..6f70235210 100644 --- a/platform/ext/target/musca_a/tfm_peripherals_def.h +++ b/platform/ext/target/musca_a/tfm_peripherals_def.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2018-2019, Arm Limited. All rights reserved. + * Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -8,7 +9,14 @@ #ifndef __TFM_PERIPHERALS_DEF_H__ #define __TFM_PERIPHERALS_DEF_H__ -#define TFM_TIMER0_IRQ (3) +#include "platform_irq.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define TFM_TIMER0_IRQ (TIMER0_IRQn) +#define TFM_TIMER1_IRQ (TIMER1_IRQn) struct tfm_spm_partition_platform_data_t; @@ -19,4 +27,8 @@ extern struct tfm_spm_partition_platform_data_t tfm_peripheral_timer0; #define TFM_PERIPHERAL_TIMER0 (&tfm_peripheral_timer0) #define TFM_PERIPHERAL_FPGA_IO (0) +#ifdef __cplusplus +} +#endif + #endif /* __TFM_PERIPHERALS_DEF_H__ */ diff --git a/platform/ext/target/musca_b1/tfm_peripherals_def.h b/platform/ext/target/musca_b1/tfm_peripherals_def.h index 4ece630287..6f70235210 100644 --- a/platform/ext/target/musca_b1/tfm_peripherals_def.h +++ b/platform/ext/target/musca_b1/tfm_peripherals_def.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2018-2019, Arm Limited. All rights reserved. + * Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -8,11 +9,14 @@ #ifndef __TFM_PERIPHERALS_DEF_H__ #define __TFM_PERIPHERALS_DEF_H__ +#include "platform_irq.h" + #ifdef __cplusplus extern "C" { #endif -#define TFM_TIMER0_IRQ (3) +#define TFM_TIMER0_IRQ (TIMER0_IRQn) +#define TFM_TIMER1_IRQ (TIMER1_IRQn) struct tfm_spm_partition_platform_data_t; diff --git a/platform/ext/target/musca_s1/tfm_peripherals_def.h b/platform/ext/target/musca_s1/tfm_peripherals_def.h index 4ece630287..6f70235210 100644 --- a/platform/ext/target/musca_s1/tfm_peripherals_def.h +++ b/platform/ext/target/musca_s1/tfm_peripherals_def.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2018-2019, Arm Limited. All rights reserved. + * Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -8,11 +9,14 @@ #ifndef __TFM_PERIPHERALS_DEF_H__ #define __TFM_PERIPHERALS_DEF_H__ +#include "platform_irq.h" + #ifdef __cplusplus extern "C" { #endif -#define TFM_TIMER0_IRQ (3) +#define TFM_TIMER0_IRQ (TIMER0_IRQn) +#define TFM_TIMER1_IRQ (TIMER1_IRQn) struct tfm_spm_partition_platform_data_t; diff --git a/platform/ext/target/sse-200_aws/tfm_peripherals_def.h b/platform/ext/target/sse-200_aws/tfm_peripherals_def.h index bc38eb4fdc..b9b4e7a51f 100644 --- a/platform/ext/target/sse-200_aws/tfm_peripherals_def.h +++ b/platform/ext/target/sse-200_aws/tfm_peripherals_def.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2018-2019, Arm Limited. All rights reserved. + * Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -8,7 +9,14 @@ #ifndef __TFM_PERIPHERALS_DEF_H__ #define __TFM_PERIPHERALS_DEF_H__ -#define TFM_TIMER0_IRQ (3) +#include "platform_irq.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define TFM_TIMER0_IRQ (TIMER0_IRQn) +#define TFM_TIMER1_IRQ (TIMER1_IRQn) struct tfm_spm_partition_platform_data_t; @@ -20,4 +28,8 @@ extern struct tfm_spm_partition_platform_data_t tfm_peripheral_timer0; #define TFM_PERIPHERAL_FPGA_IO (&tfm_peripheral_fpga_io) #define TFM_PERIPHERAL_TIMER0 (&tfm_peripheral_timer0) +#ifdef __cplusplus +} +#endif + #endif /* __TFM_PERIPHERALS_DEF_H__ */ diff --git a/test/suites/core/non_secure/core_ns_positive_testsuite.c b/test/suites/core/non_secure/core_ns_positive_testsuite.c index 4a0e70984c..4b275ab9ac 100644 --- a/test/suites/core/non_secure/core_ns_positive_testsuite.c +++ b/test/suites/core/non_secure/core_ns_positive_testsuite.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2017-2019, Arm Limited. All rights reserved. + * Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -20,6 +21,7 @@ #endif /* TFM_PSA_API */ #ifdef TFM_ENABLE_IRQ_TEST #include "platform_irq.h" +#include "tfm_peripherals_def.h" #endif /* Define test suite for core tests */ @@ -595,7 +597,7 @@ static void tfm_core_test_irq(struct test_result_t *ret) { int32_t err; - NVIC_EnableIRQ(4); + NVIC_EnableIRQ(TFM_TIMER1_IRQ); err = tfm_core_test_irq_scenario(IRQ_TEST_SCENARIO_1); if (err != CORE_TEST_ERRNO_SUCCESS) { |