aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Brand <chris.brand@cypress.com>2020-07-13 12:56:42 -0700
committerDavid Hu <david.hu@arm.com>2020-10-29 02:09:12 +0000
commit6959e8dee1595c8d5000e19437854da9b6c9cd5b (patch)
treec0a92b9d771cab90993ed18968f28df2ccd7057c
parent5d67258c551948343bd7c8bdaf79583d1d1906e0 (diff)
downloadtrusted-firmware-m-6959e8dee1595c8d5000e19437854da9b6c9cd5b.tar.gz
PSoC64: Move BSP changes to TFM platform code
Commit b42fed53dd012149e63f0b44a3723940eb51a5e8 ("Platform: Add full support for PSoC64 platform") introduced some changes to the generated BSP code. Move those changes to target_cfg.{c|h}. Change-Id: If8ed40e9ee7b5b66642c7849c985456cd085c6c1 Signed-off-by: Chris Brand <chris.brand@cypress.com>
-rw-r--r--platform/ext/target/cypress/psoc64/Device/Include/device_definition.h4
-rw-r--r--platform/ext/target/cypress/psoc64/Device/Source/device_definition.c31
-rw-r--r--platform/ext/target/cypress/psoc64/Native_Driver/generated_source/cycfg_clocks.c6
-rw-r--r--platform/ext/target/cypress/psoc64/Native_Driver/generated_source/cycfg_peripherals.c32
-rw-r--r--platform/ext/target/cypress/psoc64/Native_Driver/generated_source/cycfg_peripherals.h4
-rw-r--r--platform/ext/target/cypress/psoc64/target_cfg.c26
6 files changed, 61 insertions, 42 deletions
diff --git a/platform/ext/target/cypress/psoc64/Device/Include/device_definition.h b/platform/ext/target/cypress/psoc64/Device/Include/device_definition.h
index efa3d3fceb..6660308515 100644
--- a/platform/ext/target/cypress/psoc64/Device/Include/device_definition.h
+++ b/platform/ext/target/cypress/psoc64/Device/Include/device_definition.h
@@ -27,11 +27,15 @@
#ifndef __DEVICE_DEFINITION_H__
#define __DEVICE_DEFINITION_H__
+#include "cy_scb_uart.h"
#include "device_cfg.h"
/* ======= Defines peripheral configuration structures ======= */
/* ======= and includes generic driver headers if necessary ======= */
+/* UART config */
+extern const cy_stc_scb_uart_config_t KITPROG_UART_config;
+
/* CMSDK Timer driver structures */
#ifdef CMSDK_TIMER0_S
#include "timer_cmsdk_drv.h"
diff --git a/platform/ext/target/cypress/psoc64/Device/Source/device_definition.c b/platform/ext/target/cypress/psoc64/Device/Source/device_definition.c
index af6ac12c2e..fbb3c38572 100644
--- a/platform/ext/target/cypress/psoc64/Device/Source/device_definition.c
+++ b/platform/ext/target/cypress/psoc64/Device/Source/device_definition.c
@@ -29,6 +29,37 @@
#include "tfm_peripherals_def.h"
#include "tfm_plat_defs.h"
+/* UART configuration */
+const cy_stc_scb_uart_config_t KITPROG_UART_config =
+{
+ .uartMode = CY_SCB_UART_STANDARD,
+ .enableMutliProcessorMode = false,
+ .smartCardRetryOnNack = false,
+ .irdaInvertRx = false,
+ .irdaEnableLowPowerReceiver = false,
+ .oversample = 8,
+ .enableMsbFirst = false,
+ .dataWidth = 8UL,
+ .parity = CY_SCB_UART_PARITY_NONE,
+ .stopBits = CY_SCB_UART_STOP_BITS_1,
+ .enableInputFilter = false,
+ .breakWidth = 11UL,
+ .dropOnFrameError = false,
+ .dropOnParityError = false,
+ .receiverAddress = 0x0UL,
+ .receiverAddressMask = 0x0UL,
+ .acceptAddrInFifo = false,
+ .enableCts = false,
+ .ctsPolarity = CY_SCB_UART_ACTIVE_LOW,
+ .rtsRxFifoLevel = 0UL,
+ .rtsPolarity = CY_SCB_UART_ACTIVE_LOW,
+ .rxFifoTriggerLevel = 63UL,
+ .rxFifoIntEnableMask = 0UL,
+ .txFifoTriggerLevel = 63UL,
+ .txFifoIntEnableMask = 0UL,
+};
+
+
/* TCPWM Timer driver structures */
#if defined(CY_TCPWM0_TIMER0_S) || defined(CY_TCPWM0_TIMER1_NS)
/* Sharing the tcpwm configuration data, as the IRQ test runs in sequence */
diff --git a/platform/ext/target/cypress/psoc64/Native_Driver/generated_source/cycfg_clocks.c b/platform/ext/target/cypress/psoc64/Native_Driver/generated_source/cycfg_clocks.c
index a15b23ea42..29af7a7a00 100644
--- a/platform/ext/target/cypress/psoc64/Native_Driver/generated_source/cycfg_clocks.c
+++ b/platform/ext/target/cypress/psoc64/Native_Driver/generated_source/cycfg_clocks.c
@@ -8,7 +8,7 @@
* Device Support Library (../../../../output/libs/COMPONENT_PSOC6/psoc6pdl): 1.5.0.1837
*
********************************************************************************
-* Copyright 2017-2019 Cypress Semiconductor Corporation
+* Copyright 2017-2020 Cypress Semiconductor Corporation
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -42,10 +42,6 @@ void init_cycfg_clocks(void)
Cy_SysClk_PeriphSetDivider(CY_SYSCLK_DIV_8_BIT, 0U, 0U);
Cy_SysClk_PeriphEnableDivider(CY_SYSCLK_DIV_8_BIT, 0U);
- Cy_SysClk_PeriphDisableDivider(CY_SYSCLK_DIV_8_BIT, 1U);
- Cy_SysClk_PeriphSetDivider(CY_SYSCLK_DIV_8_BIT, 1U, 54U);
- Cy_SysClk_PeriphEnableDivider(CY_SYSCLK_DIV_8_BIT, 1U);
-
#if defined (CY_USING_HAL)
cyhal_hwmgr_reserve(&CYBSP_CSD_CLK_DIV_obj);
#endif //defined (CY_USING_HAL)
diff --git a/platform/ext/target/cypress/psoc64/Native_Driver/generated_source/cycfg_peripherals.c b/platform/ext/target/cypress/psoc64/Native_Driver/generated_source/cycfg_peripherals.c
index 98e764f657..561e44cbe2 100644
--- a/platform/ext/target/cypress/psoc64/Native_Driver/generated_source/cycfg_peripherals.c
+++ b/platform/ext/target/cypress/psoc64/Native_Driver/generated_source/cycfg_peripherals.c
@@ -26,35 +26,6 @@
#include "cycfg_peripherals.h"
-const cy_stc_scb_uart_config_t KITPROG_UART_config =
-{
- .uartMode = CY_SCB_UART_STANDARD,
- .enableMutliProcessorMode = false,
- .smartCardRetryOnNack = false,
- .irdaInvertRx = false,
- .irdaEnableLowPowerReceiver = false,
- .oversample = 8,
- .enableMsbFirst = false,
- .dataWidth = 8UL,
- .parity = CY_SCB_UART_PARITY_NONE,
- .stopBits = CY_SCB_UART_STOP_BITS_1,
- .enableInputFilter = false,
- .breakWidth = 11UL,
- .dropOnFrameError = false,
- .dropOnParityError = false,
- .receiverAddress = 0x0UL,
- .receiverAddressMask = 0x0UL,
- .acceptAddrInFifo = false,
- .enableCts = false,
- .ctsPolarity = CY_SCB_UART_ACTIVE_LOW,
- .rtsRxFifoLevel = 0UL,
- .rtsPolarity = CY_SCB_UART_ACTIVE_LOW,
- .rxFifoTriggerLevel = 63UL,
- .rxFifoIntEnableMask = 0UL,
- .txFifoTriggerLevel = 63UL,
- .txFifoIntEnableMask = 0UL,
-};
-
cy_stc_csd_context_t cy_csd_0_context =
{
.lockKey = CY_CSD_NONE_KEY,
@@ -63,8 +34,7 @@ cy_stc_csd_context_t cy_csd_0_context =
void init_cycfg_peripherals(void)
{
- Cy_SysClk_PeriphAssignDivider(PCLK_CSD_CLOCK, CY_SYSCLK_DIV_8_BIT, 0U);
- Cy_SysClk_PeriphAssignDivider(PCLK_SCB5_CLOCK, CY_SYSCLK_DIV_8_BIT, 1U);
+ Cy_SysClk_PeriphAssignDivider(PCLK_CSD_CLOCK, CY_SYSCLK_DIV_8_BIT, 0U);
/* Secure: TIMER0 */
Cy_SysClk_PeriphAssignDivider(PCLK_TCPWM0_CLOCKS0, CY_SYSCLK_DIV_8_BIT, 1U);
/* Non-Secure: TIMER1 */
diff --git a/platform/ext/target/cypress/psoc64/Native_Driver/generated_source/cycfg_peripherals.h b/platform/ext/target/cypress/psoc64/Native_Driver/generated_source/cycfg_peripherals.h
index b7b4c98791..aa2b7a88e7 100644
--- a/platform/ext/target/cypress/psoc64/Native_Driver/generated_source/cycfg_peripherals.h
+++ b/platform/ext/target/cypress/psoc64/Native_Driver/generated_source/cycfg_peripherals.h
@@ -8,7 +8,7 @@
* Device Support Library (../../../../output/libs/COMPONENT_PSOC6/psoc6pdl): 1.5.0.1837
*
********************************************************************************
-* Copyright 2017-2019 Cypress Semiconductor Corporation
+* Copyright 2017-2020 Cypress Semiconductor Corporation
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -28,7 +28,6 @@
#define CYCFG_PERIPHERALS_H
#include "cycfg_notices.h"
-#include "cy_scb_uart.h"
#include "cy_sysclk.h"
#include "cy_csd.h"
@@ -73,7 +72,6 @@ extern "C" {
#define CYBSP_CSD_HW CSD0
#define CYBSP_CSD_IRQ csd_interrupt_IRQn
-extern const cy_stc_scb_uart_config_t KITPROG_UART_config;
extern cy_stc_csd_context_t cy_csd_0_context;
void init_cycfg_peripherals(void);
diff --git a/platform/ext/target/cypress/psoc64/target_cfg.c b/platform/ext/target/cypress/psoc64/target_cfg.c
index 3baf35a6c6..2a8e793807 100644
--- a/platform/ext/target/cypress/psoc64/target_cfg.c
+++ b/platform/ext/target/cypress/psoc64/target_cfg.c
@@ -97,18 +97,38 @@ void system_reset_cfg(void)
extern void Cy_Platform_Init(void);
void platform_init(void)
{
+ cy_en_sysclk_status_t clk_rc;
#ifdef TFM_ENABLE_IRQ_TEST
- cy_en_sysint_status_t rc;
+ cy_en_sysint_status_t int_rc;
#endif
Cy_PDL_Init(CY_DEVICE_CFG);
init_cycfg_all();
+
+ /* UART clock */
+ clk_rc = Cy_SysClk_PeriphDisableDivider(CY_SYSCLK_DIV_8_BIT, 1U);
+ if (clk_rc != CY_SYSCLK_SUCCESS) {
+ printf("WARNING: Failed to configure UART clock\n");
+ }
+ clk_rc = Cy_SysClk_PeriphSetDivider(CY_SYSCLK_DIV_8_BIT, 1U, 54U);
+ if (clk_rc != CY_SYSCLK_SUCCESS) {
+ printf("WARNING: Failed to configure UART clock\n");
+ }
+ clk_rc = Cy_SysClk_PeriphEnableDivider(CY_SYSCLK_DIV_8_BIT, 1U);
+ if (clk_rc != CY_SYSCLK_SUCCESS) {
+ printf("WARNING: Failed to configure UART clock\n");
+ }
+ clk_rc = Cy_SysClk_PeriphAssignDivider(PCLK_SCB5_CLOCK, CY_SYSCLK_DIV_8_BIT, 1U);
+ if (clk_rc != CY_SYSCLK_SUCCESS) {
+ printf("WARNING: Failed to configure UART clock\n");
+ }
+
Cy_Platform_Init();
#ifdef TFM_ENABLE_IRQ_TEST
- rc = Cy_SysInt_Init(&CY_TCPWM_NVIC_CFG_S, TFM_TIMER0_IRQ_Handler);
- if (rc != CY_SYSINT_SUCCESS) {
+ int_rc = Cy_SysInt_Init(&CY_TCPWM_NVIC_CFG_S, TFM_TIMER0_IRQ_Handler);
+ if (int_rc != CY_SYSINT_SUCCESS) {
printf("WARNING: Fail to initialize timer interrupt (IRQ TEST might fail)!\n");
}
#endif /* TFM_ENABLE_IRQ_TEST */