diff options
author | Chris Brand <chris.brand@cypress.com> | 2019-10-08 11:59:17 -0700 |
---|---|---|
committer | Chris Brand <chris.brand@cypress.com> | 2019-10-15 11:12:47 -0700 |
commit | 44b887157501a51ad7db56a234add2adc2067e0d (patch) | |
tree | 308be97dc06d93d52ebb209c57ba7afd66315ec7 | |
parent | 2de48e80778f83d07c8dc5aef68a3cdf5afbe13b (diff) | |
download | trusted-firmware-m-44b887157501a51ad7db56a234add2adc2067e0d.tar.gz |
plat: Update PSoC 64 PDL code to version 1.3.1
Note that this a verbatim copy of the PDL code.
As such, this patch effectively removes parts of the following
patches:
b901482dbf8b129a3adbe31c4e62432557fd1ba6
("plat: Tweak Cypress code for Arm Compiler version 6")
4b1cd72acf3a180664497beedcef91907e11f487
("Platform: Fix the condition check during preprocessing in
SMPU on PSoC 6")
5f7810c1f9b2e28e3ff5c16ae5b966f4479cab18
("plat: replace .cy_ramfunc with .ram_func")
142055ff18faa91fff25f18e54b2a3642880ae66
("plat: add shared memory region support (PSoC6)")
Later patches will re-apply those changes as needed.
Signed-off-by: Chris Brand <chris.brand@cypress.com>
Change-Id: Ic66de3161fce87f13f638a0f546fb35d77768aa9
90 files changed, 3799 insertions, 2128 deletions
diff --git a/platform/ext/target/psoc64/Device/Include/cy8c6247bzi_d54.h b/platform/ext/target/psoc64/Device/Include/cy8c6247bzi_d54.h index 71dccd2305..12b1ca9d1e 100644 --- a/platform/ext/target/psoc64/Device/Include/cy8c6247bzi_d54.h +++ b/platform/ext/target/psoc64/Device/Include/cy8c6247bzi_d54.h @@ -5,7 +5,7 @@ * CY8C6247BZI-D54 device header * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright @@ -45,7 +45,7 @@ typedef enum { #if ((defined(__GNUC__) && (__ARM_ARCH == 6) && (__ARM_ARCH_6M__ == 1)) || \ (defined(__ICCARM__) && (__CORE__ == __ARM6M__)) || \ - (defined(__ARMCC_VERSION) && ((__TARGET_ARCH_THUMB == 3) || (__ARM_ARCH_6M__ == 1))) || \ + (defined(__ARMCC_VERSION) && (__TARGET_ARCH_THUMB == 3)) || \ (defined(__ghs__) && defined(__CORE_CORTEXM0PLUS__))) /* ARM Cortex-M0+ Core Interrupt Numbers */ Reset_IRQn = -15, /*!< -15 Reset Vector, invoked on Power up and warm reset */ @@ -255,7 +255,7 @@ typedef enum { #if ((defined(__GNUC__) && (__ARM_ARCH == 6) && (__ARM_ARCH_6M__ == 1)) || \ (defined(__ICCARM__) && (__CORE__ == __ARM6M__)) || \ - (defined(__ARMCC_VERSION) && ((__TARGET_ARCH_THUMB == 3) || (__ARM_ARCH_6M__ == 1))) || \ + (defined(__ARMCC_VERSION) && (__TARGET_ARCH_THUMB == 3)) || \ (defined(__ghs__) && defined(__CORE_CORTEXM0PLUS__))) /* CY8C6247BZI-D54 interrupts that can be routed to the CM0+ NVIC */ @@ -418,7 +418,7 @@ typedef enum { #if ((defined(__GNUC__) && (__ARM_ARCH == 6) && (__ARM_ARCH_6M__ == 1)) || \ (defined(__ICCARM__) && (__CORE__ == __ARM6M__)) || \ - (defined(__ARMCC_VERSION) && ((__TARGET_ARCH_THUMB == 3) || (__ARM_ARCH_6M__ == 1))) || \ + (defined(__ARMCC_VERSION) && (__TARGET_ARCH_THUMB == 3)) || \ (defined(__ghs__) && defined(__CORE_CORTEXM0PLUS__))) /* Configuration of the ARM Cortex-M0+ Processor and Core Peripherals */ @@ -442,6 +442,9 @@ typedef enum { #define __MPU_PRESENT 1 /*!< MPU present or not */ #define __FPU_PRESENT 1 /*!< FPU present or not */ #define __CM0P_PRESENT 1 /*!< CM0P present or not */ +#define __DTCM_PRESENT 0 /*!< DTCM present or not */ +#define __ICACHE_PRESENT 0 /*!< ICACHE present or not */ +#define __DCACHE_PRESENT 0 /*!< DCACHE present or not */ /** \} Configuration_of_CMSIS */ @@ -514,7 +517,7 @@ typedef enum { #define CY_IP_MXS40PASS_INSTANCES 1u #define CY_IP_MXS40PASS_VERSION 1u #define CY_IP_MXS40PASS_SAR 1u -#define CY_IP_MXS40PASS_SAR_INSTANCES 16u +#define CY_IP_MXS40PASS_SAR_INSTANCES 1u #define CY_IP_MXS40PASS_SAR_VERSION 1u #define CY_IP_MXS40PASS_CTDAC 1u #define CY_IP_MXS40PASS_CTDAC_INSTANCES 1u diff --git a/platform/ext/target/psoc64/Device/Include/cy_device_headers.h b/platform/ext/target/psoc64/Device/Include/cy_device_headers.h index 2f73431430..4a0d2bdfb5 100644 --- a/platform/ext/target/psoc64/Device/Include/cy_device_headers.h +++ b/platform/ext/target/psoc64/Device/Include/cy_device_headers.h @@ -5,7 +5,7 @@ * Common header file to be included by the drivers. * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1292 * ******************************************************************************** * \copyright @@ -148,12 +148,94 @@ #include "cy8c6117wi_f34.h" #elif defined (CY8C6247WI_D54) #include "cy8c6247wi_d54.h" +#elif defined (CYB06447BZI_BLD54) + #include "cyb06447bzi_bld54.h" +#elif defined (CYB06447BZI_BLD53) + #include "cyb06447bzi_bld53.h" +#elif defined (CYB06447BZI_D54) + #include "cyb06447bzi_d54.h" +#elif defined (CY8C6336LQI_BLF02) + #include "cy8c6336lqi_blf02.h" +#elif defined (CY8C6336LQI_BLF42) + #include "cy8c6336lqi_blf42.h" +#elif defined (CY8C6347LQI_BLD52) + #include "cy8c6347lqi_bld52.h" #elif defined (CY8C624ABZI_D44) #include "cy8c624abzi_d44.h" #elif defined (CY8C624AAZI_D44) #include "cy8c624aazi_d44.h" #elif defined (CY8C624AFNI_D43) #include "cy8c624afni_d43.h" +#elif defined (CY8C624ABZI_D04) + #include "cy8c624abzi_d04.h" +#elif defined (CY8C624ABZI_D14) + #include "cy8c624abzi_d14.h" +#elif defined (CY8C624AAZI_D14) + #include "cy8c624aazi_d14.h" +#elif defined (CY8C6248AZI_D14) + #include "cy8c6248azi_d14.h" +#elif defined (CY8C6248BZI_D44) + #include "cy8c6248bzi_d44.h" +#elif defined (CY8C6248AZI_D44) + #include "cy8c6248azi_d44.h" +#elif defined (CY8C6248FNI_D43) + #include "cy8c6248fni_d43.h" +#elif defined (CY8C624ALQI_D42) + #include "cy8c624alqi_d42.h" +#elif defined (CYB0644ABZI_S2D44) + #include "cyb0644abzi_s2d44.h" +#elif defined (CY8C624ABZI_S2D44A0) + #include "cy8c624abzi_s2d44a0.h" +#elif defined (CY8C624ABZI_S2D44) + #include "cy8c624abzi_s2d44.h" +#elif defined (CY8C624AAZI_S2D44) + #include "cy8c624aazi_s2d44.h" +#elif defined (CY8C624AFNI_S2D43) + #include "cy8c624afni_s2d43.h" +#elif defined (CY8C624ABZI_S2D04) + #include "cy8c624abzi_s2d04.h" +#elif defined (CY8C624ABZI_S2D14) + #include "cy8c624abzi_s2d14.h" +#elif defined (CY8C624AAZI_S2D14) + #include "cy8c624aazi_s2d14.h" +#elif defined (CY8C6248AZI_S2D14) + #include "cy8c6248azi_s2d14.h" +#elif defined (CY8C6248BZI_S2D44) + #include "cy8c6248bzi_s2d44.h" +#elif defined (CY8C6248AZI_S2D44) + #include "cy8c6248azi_s2d44.h" +#elif defined (CY8C6248FNI_S2D43) + #include "cy8c6248fni_s2d43.h" +#elif defined (CY8C6245AZI_S3D72) + #include "cy8c6245azi_s3d72.h" +#elif defined (CY8C6245LQI_S3D72) + #include "cy8c6245lqi_s3d72.h" +#elif defined (CY8C6245FNI_S3D71) + #include "cy8c6245fni_s3d71.h" +#elif defined (CY8C6245AZI_S3D62) + #include "cy8c6245azi_s3d62.h" +#elif defined (CY8C6245LQI_S3D62) + #include "cy8c6245lqi_s3d62.h" +#elif defined (CY8C6245AZI_S3D42) + #include "cy8c6245azi_s3d42.h" +#elif defined (CY8C6245LQI_S3D42) + #include "cy8c6245lqi_s3d42.h" +#elif defined (CYB06445LQI_S3D42) + #include "cyb06445lqi_s3d42.h" +#elif defined (CY8C6245FNI_S3D41) + #include "cy8c6245fni_s3d41.h" +#elif defined (CY8C6245AZI_S3D12) + #include "cy8c6245azi_s3d12.h" +#elif defined (CY8C6245LQI_S3D12) + #include "cy8c6245lqi_s3d12.h" +#elif defined (CY8C6245FNI_S3D11) + #include "cy8c6245fni_s3d11.h" +#elif defined (CY8C6245AZI_S3D02) + #include "cy8c6245azi_s3d02.h" +#elif defined (CY8C6245LQI_S3D02) + #include "cy8c6245lqi_s3d02.h" +#elif defined (CY8C6245W_S3D72) + #include "cy8c6245w_s3d72.h" #else #include "cy_device_common.h" #endif diff --git a/platform/ext/target/psoc64/Device/Include/gpio_psoc6_01_124_bga.h b/platform/ext/target/psoc64/Device/Include/gpio_psoc6_01_124_bga.h index 779816a716..2816a3c9b2 100644 --- a/platform/ext/target/psoc64/Device/Include/gpio_psoc6_01_124_bga.h +++ b/platform/ext/target/psoc64/Device/Include/gpio_psoc6_01_124_bga.h @@ -5,7 +5,7 @@ * PSoC6_01 device GPIO header for 124-BGA package * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_backup.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_backup.h index c7d661f17c..9094b1446b 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_backup.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_backup.h @@ -5,7 +5,7 @@ * BACKUP IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_ble.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_ble.h index f43b6e0a1e..ea42cca185 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_ble.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_ble.h @@ -5,7 +5,7 @@ * BLE IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_cpuss.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_cpuss.h index 39104ec286..07e5d7c5ec 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_cpuss.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_cpuss.h @@ -5,7 +5,7 @@ * CPUSS IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright @@ -100,9 +100,11 @@ typedef struct { __IOM uint32_t PROTECTION; /*!< 0x00000500 Protection status */ __IM uint32_t RESERVED23[7]; __IOM uint32_t CM0_NMI_CTL; /*!< 0x00000520 CM0+ NMI control */ - __IM uint32_t RESERVED24[31]; + __IM uint32_t RESERVED24[7]; + __IOM uint32_t AP_CTL; /*!< 0x00000540 Access port control */ + __IM uint32_t RESERVED25[23]; __IM uint32_t MBIST_STAT; /*!< 0x000005A0 Memory BIST status */ - __IM uint32_t RESERVED25[14999]; + __IM uint32_t RESERVED26[14999]; __IOM uint32_t TRIM_ROM_CTL; /*!< 0x0000F000 ROM trim control */ __IOM uint32_t TRIM_RAM_CTL; /*!< 0x0000F004 RAM trim control */ } CPUSS_V1_Type; /*!< Size = 61448 (0xF008) */ @@ -312,6 +314,19 @@ typedef struct { /* CPUSS.CM0_NMI_CTL */ #define CPUSS_CM0_NMI_CTL_MUX0_SEL_Pos 0UL #define CPUSS_CM0_NMI_CTL_MUX0_SEL_Msk 0xFFUL +/* CPUSS.AP_CTL */ +#define CPUSS_AP_CTL_CM0_ENABLE_Pos 0UL +#define CPUSS_AP_CTL_CM0_ENABLE_Msk 0x1UL +#define CPUSS_AP_CTL_CM4_ENABLE_Pos 1UL +#define CPUSS_AP_CTL_CM4_ENABLE_Msk 0x2UL +#define CPUSS_AP_CTL_SYS_ENABLE_Pos 2UL +#define CPUSS_AP_CTL_SYS_ENABLE_Msk 0x4UL +#define CPUSS_AP_CTL_CM0_DISABLE_Pos 16UL +#define CPUSS_AP_CTL_CM0_DISABLE_Msk 0x10000UL +#define CPUSS_AP_CTL_CM4_DISABLE_Pos 17UL +#define CPUSS_AP_CTL_CM4_DISABLE_Msk 0x20000UL +#define CPUSS_AP_CTL_SYS_DISABLE_Pos 18UL +#define CPUSS_AP_CTL_SYS_DISABLE_Msk 0x40000UL /* CPUSS.MBIST_STAT */ #define CPUSS_MBIST_STAT_SFP_READY_Pos 0UL #define CPUSS_MBIST_STAT_SFP_READY_Msk 0x1UL diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_cpuss_v2.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_cpuss_v2.h index f2e0ff5ad0..de0b8e6275 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_cpuss_v2.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_cpuss_v2.h @@ -5,7 +5,7 @@ * CPUSS IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_crypto.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_crypto.h index 770a051ce4..f04a7ffa12 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_crypto.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_crypto.h @@ -5,7 +5,7 @@ * CRYPTO IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_crypto_v2.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_crypto_v2.h index 36ba2ff95a..1f4429b023 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_crypto_v2.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_crypto_v2.h @@ -5,7 +5,7 @@ * CRYPTO IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_csd.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_csd.h index 2d065364fc..caf4e0d69d 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_csd.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_csd.h @@ -5,7 +5,7 @@ * CSD IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_ctbm.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_ctbm.h index 44a089958f..0e9ae3497c 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_ctbm.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_ctbm.h @@ -5,7 +5,7 @@ * CTBM IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_ctdac.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_ctdac.h index 99a8c1461c..b40fd990a9 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_ctdac.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_ctdac.h @@ -5,7 +5,7 @@ * CTDAC IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_dmac_v2.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_dmac_v2.h index 23cfb7e710..1b9d340197 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_dmac_v2.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_dmac_v2.h @@ -5,7 +5,7 @@ * DMAC IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_dw.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_dw.h index d3764fd474..5f9a36e3fd 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_dw.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_dw.h @@ -5,7 +5,7 @@ * DW IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_dw_v2.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_dw_v2.h index ae73aaa838..4dd7bb35ba 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_dw_v2.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_dw_v2.h @@ -5,7 +5,7 @@ * DW IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_efuse.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_efuse.h index f2d599df17..5ca86eec26 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_efuse.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_efuse.h @@ -5,7 +5,7 @@ * EFUSE IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_efuse_data_psoc6_01.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_efuse_data_psoc6_01.h index 580f43b39e..4e126f48b8 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_efuse_data_psoc6_01.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_efuse_data_psoc6_01.h @@ -5,7 +5,7 @@ * EFUSE_DATA IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_efuse_data_psoc6_02.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_efuse_data_psoc6_02.h index e735b9fa80..7dcc98f844 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_efuse_data_psoc6_02.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_efuse_data_psoc6_02.h @@ -5,7 +5,7 @@ * EFUSE_DATA IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1287 * ******************************************************************************** * \copyright @@ -86,6 +86,125 @@ typedef struct { } cy_stc_lifecycle_stage_t; /** + * \brief Cypress asset hash byte 0 (CY_ASSET_HASH0) + */ +typedef struct { + uint8_t HASH_BYTE[8]; +} cy_stc_cy_asset_hash0_t; + +/** + * \brief Cypress asset hash byte 1 (CY_ASSET_HASH1) + */ +typedef struct { + uint8_t HASH_BYTE[8]; +} cy_stc_cy_asset_hash1_t; + +/** + * \brief Cypress asset hash byte 2 (CY_ASSET_HASH2) + */ +typedef struct { + uint8_t HASH_BYTE[8]; +} cy_stc_cy_asset_hash2_t; + +/** + * \brief Cypress asset hash byte 3 (CY_ASSET_HASH3) + */ +typedef struct { + uint8_t HASH_BYTE[8]; +} cy_stc_cy_asset_hash3_t; + +/** + * \brief Cypress asset hash byte 4 (CY_ASSET_HASH4) + */ +typedef struct { + uint8_t HASH_BYTE[8]; +} cy_stc_cy_asset_hash4_t; + +/** + * \brief Cypress asset hash byte 5 (CY_ASSET_HASH5) + */ +typedef struct { + uint8_t HASH_BYTE[8]; +} cy_stc_cy_asset_hash5_t; + +/** + * \brief Cypress asset hash byte 6 (CY_ASSET_HASH6) + */ +typedef struct { + uint8_t CY_ASSET_HASH[8]; +} cy_stc_cy_asset_hash6_t; + +/** + * \brief Cypress asset hash byte 7 (CY_ASSET_HASH7) + */ +typedef struct { + uint8_t HASH_BYTE[8]; +} cy_stc_cy_asset_hash7_t; + +/** + * \brief Cypress asset hash byte 8 (CY_ASSET_HASH8) + */ +typedef struct { + uint8_t HASH_BYTE[8]; +} cy_stc_cy_asset_hash8_t; + +/** + * \brief Cypress asset hash byte 9 (CY_ASSET_HASH9) + */ +typedef struct { + uint8_t HASH_BYTE[8]; +} cy_stc_cy_asset_hash9_t; + +/** + * \brief Cypress asset hash byte 10 (CY_ASSET_HASH10) + */ +typedef struct { + uint8_t HASH_BYTE[8]; +} cy_stc_cy_asset_hash10_t; + +/** + * \brief Cypress asset hash byte 11 (CY_ASSET_HASH11) + */ +typedef struct { + uint8_t CY_ASSET_HASH[8]; +} cy_stc_cy_asset_hash11_t; + +/** + * \brief Cypress asset hash byte 12 (CY_ASSET_HASH12) + */ +typedef struct { + uint8_t HASH_BYTE[8]; +} cy_stc_cy_asset_hash12_t; + +/** + * \brief Cypress asset hash byte 13 (CY_ASSET_HASH13) + */ +typedef struct { + uint8_t CY_ASSET_HASH[8]; +} cy_stc_cy_asset_hash13_t; + +/** + * \brief Cypress asset hash byte 14 (CY_ASSET_HASH14) + */ +typedef struct { + uint8_t HASH_BYTE[8]; +} cy_stc_cy_asset_hash14_t; + +/** + * \brief Cypress asset hash byte 15 (CY_ASSET_HASH15) + */ +typedef struct { + uint8_t HASH_BYTE[8]; +} cy_stc_cy_asset_hash15_t; + +/** + * \brief Number of zeros in Cypress asset hash (CY_ASSET_HASH_ZEROS) + */ +typedef struct { + uint8_t HASH_BYTE[8]; +} cy_stc_cy_asset_hash_zeros_t; + +/** * \brief Customer data (CUSTOMER_DATA) */ typedef struct { @@ -104,7 +223,24 @@ typedef struct { cy_stc_secure_access_restrict1_t SECURE_ACCESS_RESTRICT1; cy_stc_lifecycle_stage_t LIFECYCLE_STAGE; uint8_t RESERVED1[160]; - cy_stc_customer_data_t CUSTOMER_DATA[64]; + cy_stc_cy_asset_hash0_t CY_ASSET_HASH0; + cy_stc_cy_asset_hash1_t CY_ASSET_HASH1; + cy_stc_cy_asset_hash2_t CY_ASSET_HASH2; + cy_stc_cy_asset_hash3_t CY_ASSET_HASH3; + cy_stc_cy_asset_hash4_t CY_ASSET_HASH4; + cy_stc_cy_asset_hash5_t CY_ASSET_HASH5; + cy_stc_cy_asset_hash6_t CY_ASSET_HASH6; + cy_stc_cy_asset_hash7_t CY_ASSET_HASH7; + cy_stc_cy_asset_hash8_t CY_ASSET_HASH8; + cy_stc_cy_asset_hash9_t CY_ASSET_HASH9; + cy_stc_cy_asset_hash10_t CY_ASSET_HASH10; + cy_stc_cy_asset_hash11_t CY_ASSET_HASH11; + cy_stc_cy_asset_hash12_t CY_ASSET_HASH12; + cy_stc_cy_asset_hash13_t CY_ASSET_HASH13; + cy_stc_cy_asset_hash14_t CY_ASSET_HASH14; + cy_stc_cy_asset_hash15_t CY_ASSET_HASH15; + cy_stc_cy_asset_hash_zeros_t CY_ASSET_HASH_ZEROS; + cy_stc_customer_data_t CUSTOMER_DATA[47]; } cy_stc_efuse_data_t; diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_fault.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_fault.h index 1bc284d4fb..f957f54944 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_fault.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_fault.h @@ -5,7 +5,7 @@ * FAULT IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_fault_v2.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_fault_v2.h index df3434a237..24d9bb9eb1 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_fault_v2.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_fault_v2.h @@ -5,7 +5,7 @@ * FAULT IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_flashc.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_flashc.h index a1716ff413..cd949a2e04 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_flashc.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_flashc.h @@ -5,7 +5,7 @@ * FLASHC IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_flashc_v2.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_flashc_v2.h index 8639987988..4eceb50692 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_flashc_v2.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_flashc_v2.h @@ -5,7 +5,7 @@ * FLASHC IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_gpio.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_gpio.h index 1f701ad662..cca8ff92a6 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_gpio.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_gpio.h @@ -5,7 +5,7 @@ * GPIO IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_gpio_v2.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_gpio_v2.h index 79b52438f6..5eca17e057 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_gpio_v2.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_gpio_v2.h @@ -5,7 +5,7 @@ * GPIO IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_hsiom.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_hsiom.h index 8f6cbcc99a..62509103f6 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_hsiom.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_hsiom.h @@ -5,7 +5,7 @@ * HSIOM IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_hsiom_v2.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_hsiom_v2.h index 69f373e29a..350edad2a1 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_hsiom_v2.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_hsiom_v2.h @@ -5,7 +5,7 @@ * HSIOM IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_i2s.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_i2s.h index 220de6a426..e3c0b247e1 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_i2s.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_i2s.h @@ -5,7 +5,7 @@ * I2S IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_ipc.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_ipc.h index 3c9de860ed..c2e5d58e8c 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_ipc.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_ipc.h @@ -5,7 +5,7 @@ * IPC IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_ipc_v2.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_ipc_v2.h index 6d97a7dd2e..5869a9c92b 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_ipc_v2.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_ipc_v2.h @@ -5,7 +5,7 @@ * IPC IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_lcd.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_lcd.h index 57ffce75a4..241e5b0b58 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_lcd.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_lcd.h @@ -5,7 +5,7 @@ * LCD IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_lpcomp.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_lpcomp.h index 48710051c8..68b92eab75 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_lpcomp.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_lpcomp.h @@ -5,7 +5,7 @@ * LPCOMP IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_pass.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_pass.h index 000206db2b..b853d6e640 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_pass.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_pass.h @@ -5,7 +5,7 @@ * PASS IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_pdm.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_pdm.h index 45bff05e83..8fdcd7f841 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_pdm.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_pdm.h @@ -5,7 +5,7 @@ * PDM IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_peri.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_peri.h index 41678c4b25..cd589cca35 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_peri.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_peri.h @@ -5,7 +5,7 @@ * PERI IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_peri_ms_v2.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_peri_ms_v2.h index 3390ba4e4e..a2c6c0125f 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_peri_ms_v2.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_peri_ms_v2.h @@ -5,7 +5,7 @@ * PERI_MS IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_peri_v2.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_peri_v2.h index c0786e8047..1eb63a6c0d 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_peri_v2.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_peri_v2.h @@ -5,7 +5,7 @@ * PERI IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_profile.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_profile.h index 00125d9043..8c21eb24b5 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_profile.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_profile.h @@ -5,7 +5,7 @@ * PROFILE IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_prot.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_prot.h index dd4e1d578a..c9832c9410 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_prot.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_prot.h @@ -5,7 +5,7 @@ * PROT IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1287 * ******************************************************************************** * \copyright @@ -91,7 +91,7 @@ typedef struct { */ typedef struct { __IOM uint32_t MS_CTL; /*!< 0x00000000 Master control */ - __IM uint32_t RESERVED[127]; + __IM uint32_t MS_CTL_READ_MIR[127]; /*!< 0x00000004 Master control read mirror */ PROT_MPU_MPU_STRUCT_V1_Type MPU_STRUCT[16]; /*!< 0x00000200 MPU structure */ } PROT_MPU_V1_Type; /*!< Size = 1024 (0x400) */ @@ -375,6 +375,11 @@ typedef struct { #define PROT_MPU_MS_CTL_PC_Msk 0xFUL #define PROT_MPU_MS_CTL_PC_SAVED_Pos 16UL #define PROT_MPU_MS_CTL_PC_SAVED_Msk 0xF0000UL +/* PROT_MPU.MS_CTL_READ_MIR */ +#define PROT_MPU_MS_CTL_READ_MIR_PC_Pos 0UL +#define PROT_MPU_MS_CTL_READ_MIR_PC_Msk 0xFUL +#define PROT_MPU_MS_CTL_READ_MIR_PC_SAVED_Pos 16UL +#define PROT_MPU_MS_CTL_READ_MIR_PC_SAVED_Msk 0xF0000UL #endif /* _CYIP_PROT_H_ */ diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_prot_v2.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_prot_v2.h index 068081bb9e..194f0ba3b4 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_prot_v2.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_prot_v2.h @@ -5,7 +5,7 @@ * PROT IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1287 * ******************************************************************************** * \copyright @@ -91,7 +91,7 @@ typedef struct { */ typedef struct { __IOM uint32_t MS_CTL; /*!< 0x00000000 Master control */ - __IM uint32_t RESERVED[127]; + __IM uint32_t MS_CTL_READ_MIR[127]; /*!< 0x00000004 Master control read mirror */ PROT_MPU_MPU_STRUCT_V2_Type MPU_STRUCT[16]; /*!< 0x00000200 MPU structure */ } PROT_MPU_V2_Type; /*!< Size = 1024 (0x400) */ @@ -375,6 +375,11 @@ typedef struct { #define PROT_MPU_V2_MS_CTL_PC_Msk 0xFUL #define PROT_MPU_V2_MS_CTL_PC_SAVED_Pos 16UL #define PROT_MPU_V2_MS_CTL_PC_SAVED_Msk 0xF0000UL +/* PROT_MPU.MS_CTL_READ_MIR */ +#define PROT_MPU_V2_MS_CTL_READ_MIR_PC_Pos 0UL +#define PROT_MPU_V2_MS_CTL_READ_MIR_PC_Msk 0xFUL +#define PROT_MPU_V2_MS_CTL_READ_MIR_PC_SAVED_Pos 16UL +#define PROT_MPU_V2_MS_CTL_READ_MIR_PC_SAVED_Msk 0xF0000UL #endif /* _CYIP_PROT_V2_H_ */ diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_sar.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_sar.h index 82f85ee007..12294a6942 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_sar.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_sar.h @@ -5,7 +5,7 @@ * SAR IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_scb.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_scb.h index cf796869d0..3dc6186dc0 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_scb.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_scb.h @@ -5,7 +5,7 @@ * SCB IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright @@ -59,53 +59,51 @@ typedef struct { __IOM uint32_t I2C_M_CMD; /*!< 0x00000068 I2C master command */ __IOM uint32_t I2C_S_CMD; /*!< 0x0000006C I2C slave command */ __IOM uint32_t I2C_CFG; /*!< 0x00000070 I2C configuration */ - __IM uint32_t RESERVED3[35]; - __IOM uint32_t DDFT_CTRL; /*!< 0x00000100 Digital DfT control */ - __IM uint32_t RESERVED4[63]; + __IM uint32_t RESERVED3[99]; __IOM uint32_t TX_CTRL; /*!< 0x00000200 Transmitter control */ __IOM uint32_t TX_FIFO_CTRL; /*!< 0x00000204 Transmitter FIFO control */ __IM uint32_t TX_FIFO_STATUS; /*!< 0x00000208 Transmitter FIFO status */ - __IM uint32_t RESERVED5[13]; + __IM uint32_t RESERVED4[13]; __OM uint32_t TX_FIFO_WR; /*!< 0x00000240 Transmitter FIFO write */ - __IM uint32_t RESERVED6[47]; + __IM uint32_t RESERVED5[47]; __IOM uint32_t RX_CTRL; /*!< 0x00000300 Receiver control */ __IOM uint32_t RX_FIFO_CTRL; /*!< 0x00000304 Receiver FIFO control */ __IM uint32_t RX_FIFO_STATUS; /*!< 0x00000308 Receiver FIFO status */ - __IM uint32_t RESERVED7; + __IM uint32_t RESERVED6; __IOM uint32_t RX_MATCH; /*!< 0x00000310 Slave address and mask */ - __IM uint32_t RESERVED8[11]; + __IM uint32_t RESERVED7[11]; __IM uint32_t RX_FIFO_RD; /*!< 0x00000340 Receiver FIFO read */ __IM uint32_t RX_FIFO_RD_SILENT; /*!< 0x00000344 Receiver FIFO read silent */ - __IM uint32_t RESERVED9[46]; + __IM uint32_t RESERVED8[46]; __IOM uint32_t EZ_DATA[512]; /*!< 0x00000400 Memory buffer */ - __IM uint32_t RESERVED10[128]; + __IM uint32_t RESERVED9[128]; __IM uint32_t INTR_CAUSE; /*!< 0x00000E00 Active clocked interrupt signal */ - __IM uint32_t RESERVED11[31]; + __IM uint32_t RESERVED10[31]; __IOM uint32_t INTR_I2C_EC; /*!< 0x00000E80 Externally clocked I2C interrupt request */ - __IM uint32_t RESERVED12; + __IM uint32_t RESERVED11; __IOM uint32_t INTR_I2C_EC_MASK; /*!< 0x00000E88 Externally clocked I2C interrupt mask */ __IM uint32_t INTR_I2C_EC_MASKED; /*!< 0x00000E8C Externally clocked I2C interrupt masked */ - __IM uint32_t RESERVED13[12]; + __IM uint32_t RESERVED12[12]; __IOM uint32_t INTR_SPI_EC; /*!< 0x00000EC0 Externally clocked SPI interrupt request */ - __IM uint32_t RESERVED14; + __IM uint32_t RESERVED13; __IOM uint32_t INTR_SPI_EC_MASK; /*!< 0x00000EC8 Externally clocked SPI interrupt mask */ __IM uint32_t INTR_SPI_EC_MASKED; /*!< 0x00000ECC Externally clocked SPI interrupt masked */ - __IM uint32_t RESERVED15[12]; + __IM uint32_t RESERVED14[12]; __IOM uint32_t INTR_M; /*!< 0x00000F00 Master interrupt request */ __IOM uint32_t INTR_M_SET; /*!< 0x00000F04 Master interrupt set request */ __IOM uint32_t INTR_M_MASK; /*!< 0x00000F08 Master interrupt mask */ __IM uint32_t INTR_M_MASKED; /*!< 0x00000F0C Master interrupt masked request */ - __IM uint32_t RESERVED16[12]; + __IM uint32_t RESERVED15[12]; __IOM uint32_t INTR_S; /*!< 0x00000F40 Slave interrupt request */ __IOM uint32_t INTR_S_SET; /*!< 0x00000F44 Slave interrupt set request */ __IOM uint32_t INTR_S_MASK; /*!< 0x00000F48 Slave interrupt mask */ __IM uint32_t INTR_S_MASKED; /*!< 0x00000F4C Slave interrupt masked request */ - __IM uint32_t RESERVED17[12]; + __IM uint32_t RESERVED16[12]; __IOM uint32_t INTR_TX; /*!< 0x00000F80 Transmitter interrupt request */ __IOM uint32_t INTR_TX_SET; /*!< 0x00000F84 Transmitter interrupt set request */ __IOM uint32_t INTR_TX_MASK; /*!< 0x00000F88 Transmitter interrupt mask */ __IM uint32_t INTR_TX_MASKED; /*!< 0x00000F8C Transmitter interrupt masked request */ - __IM uint32_t RESERVED18[12]; + __IM uint32_t RESERVED17[12]; __IOM uint32_t INTR_RX; /*!< 0x00000FC0 Receiver interrupt request */ __IOM uint32_t INTR_RX_SET; /*!< 0x00000FC4 Receiver interrupt set request */ __IOM uint32_t INTR_RX_MASK; /*!< 0x00000FC8 Receiver interrupt mask */ @@ -307,15 +305,6 @@ typedef struct { #define SCB_I2C_CFG_SDA_OUT_FILT2_TRIM_Msk 0x300000UL #define SCB_I2C_CFG_SDA_OUT_FILT_SEL_Pos 28UL #define SCB_I2C_CFG_SDA_OUT_FILT_SEL_Msk 0x30000000UL -/* SCB.DDFT_CTRL */ -#define SCB_DDFT_CTRL_DDFT_IN0_SEL_Pos 0UL -#define SCB_DDFT_CTRL_DDFT_IN0_SEL_Msk 0x1UL -#define SCB_DDFT_CTRL_DDFT_IN1_SEL_Pos 4UL -#define SCB_DDFT_CTRL_DDFT_IN1_SEL_Msk 0x10UL -#define SCB_DDFT_CTRL_DDFT_OUT0_SEL_Pos 16UL -#define SCB_DDFT_CTRL_DDFT_OUT0_SEL_Msk 0x70000UL -#define SCB_DDFT_CTRL_DDFT_OUT1_SEL_Pos 20UL -#define SCB_DDFT_CTRL_DDFT_OUT1_SEL_Msk 0x700000UL /* SCB.TX_CTRL */ #define SCB_TX_CTRL_DATA_WIDTH_Pos 0UL #define SCB_TX_CTRL_DATA_WIDTH_Msk 0xFUL diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_sdhc.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_sdhc.h index d16d4839c2..5a84a7d3e5 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_sdhc.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_sdhc.h @@ -5,7 +5,7 @@ * SDHC IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_sflash.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_sflash.h index f44269e524..f824008671 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_sflash.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_sflash.h @@ -5,7 +5,7 @@ * SFLASH IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1287 * ******************************************************************************** * \copyright @@ -45,10 +45,7 @@ typedef struct { __IOM uint16_t SILICON_ID; /*!< 0x00000002 Indicates Silicon ID of the device */ __IM uint32_t RESERVED1[2]; __IOM uint16_t FAMILY_ID; /*!< 0x0000000C Indicates Family ID of the device */ - __IOM uint8_t FB_HARDFAULT; /*!< 0x0000000E Flash boot Hard fault */ - __IM uint8_t RESERVED2; - __IOM uint32_t FLASHC_GEOMETRY; /*!< 0x00000010 Contains Flash Memory Geomerty structure, Format and data shall - be equal to FLASHC_GEOMETRY MMIO register */ + __IM uint16_t RESERVED2[3]; __IOM uint32_t CPUSS_WOUNDING; /*!< 0x00000014 CPUSS Wounding */ __IM uint32_t RESERVED3[378]; __IOM uint8_t DIE_LOT[3]; /*!< 0x00000600 Lot Number (3 bytes) */ @@ -116,11 +113,11 @@ typedef struct { __IOM uint32_t TOC1_MAGIC_NUMBER; /*!< 0x00007804 Magic number(0x01211219) */ __IOM uint32_t TOC1_FHASH_OBJECTS; /*!< 0x00007808 Number of objects starting from offset 0xC to be verified for FACTORY_HASH */ - __IOM uint32_t TOC1_SFLASH_GENERAL_TRIM_ADDR; /*!< 0x0000780C Address of trims stored in SFLASH */ + __IOM uint32_t TOC1_GENERAL_TRIM_ADDR_UNUSED; /*!< 0x0000780C Unused (Address is Hardcoded in ROM) */ __IOM uint32_t TOC1_UNIQUE_ID_ADDR; /*!< 0x00007810 Address of Unique ID stored in SFLASH */ __IOM uint32_t TOC1_FB_OBJECT_ADDR; /*!< 0x00007814 Addresss of FLASH Boot(FB) object that include FLASH patch also */ - __IOM uint32_t TOC1_SYSCALL_TABLE_ADDR; /*!< 0x00007818 Address of SYSCALL_TABLE entry in SFLASH */ - __IOM uint32_t TOC1_BOOT_PROTECTION_ADDR; /*!< 0x0000781C Address of boot protection object */ + __IOM uint32_t TOC1_SYSCALL_TABLE_ADDR_UNUSED; /*!< 0x00007818 Unused (Address is Hardcoded in ROM) */ + __IOM uint32_t TOC1_OBJECT_ADDR_UNUSED; /*!< 0x0000781C Unused (Address is Hardcoded in ROM) */ __IM uint32_t RESERVED16[119]; __IOM uint32_t TOC1_CRC_ADDR; /*!< 0x000079FC Upper 2 bytes contain CRC16-CCITT and lower 2 bytes are 0 */ __IOM uint32_t RTOC1_OBJECT_SIZE; /*!< 0x00007A00 Redundant Object size in bytes for CRC calculation starting @@ -128,12 +125,13 @@ typedef struct { __IOM uint32_t RTOC1_MAGIC_NUMBER; /*!< 0x00007A04 Redundant Magic number(0x01211219) */ __IOM uint32_t RTOC1_FHASH_OBJECTS; /*!< 0x00007A08 Redundant Number of objects starting from offset 0xC to be verified for FACTORY_HASH */ - __IOM uint32_t RTOC1_SFLASH_GENERAL_TRIM_ADDR; /*!< 0x00007A0C Redundant Address of trims stored in SFLASH */ + __IOM uint32_t RTOC1_GENERAL_TRIM_ADDR_UNUSED; /*!< 0x00007A0C Redundant Unused (Address is Hardcoded in ROM) */ __IOM uint32_t RTOC1_UNIQUE_ID_ADDR; /*!< 0x00007A10 Redundant Address of Unique ID stored in SFLASH */ __IOM uint32_t RTOC1_FB_OBJECT_ADDR; /*!< 0x00007A14 Redundant Addresss of FLASH Boot(FB) object that include FLASH patch also */ - __IOM uint32_t RTOC1_SYSCALL_TABLE_ADDR; /*!< 0x00007A18 Redundant Address of SYSCALL_TABLE entry in SFLASH */ - __IM uint32_t RESERVED17[120]; + __IOM uint32_t RTOC1_SYSCALL_TABLE_ADDR_UNUSED; /*!< 0x00007A18 Redundant Unused (Address is Hardcoded in ROM) */ + __IOM uint32_t RTOC1_OBJECT_ADDR_UNUSED; /*!< 0x00007A1C Redundant Unused (Address is Hardcoded in ROM) */ + __IM uint32_t RESERVED17[119]; __IOM uint32_t RTOC1_CRC_ADDR; /*!< 0x00007BFC Redundant CRC,Upper 2 bytes contain CRC16-CCITT and lower 2 bytes are 0 */ __IOM uint32_t TOC2_OBJECT_SIZE; /*!< 0x00007C00 Object size in bytes for CRC calculation starting from offset @@ -154,7 +152,7 @@ typedef struct { __IOM uint32_t TOC2_SIGNATURE_VERIF_KEY; /*!< 0x00007C24 Address of signature verification key (0 if none).The object is signature specific key. It is the public key in case of RSA */ __IM uint32_t RESERVED18[115]; - __IOM uint32_t TOC2_FB_HARDFAULT; /*!< 0x00007DF4 TOC2 Flash Boot Hard fault */ + __IOM uint32_t TOC2_REVISION; /*!< 0x00007DF4 Indicates TOC2 Revision. It is not used now. */ __IOM uint32_t TOC2_FLAGS; /*!< 0x00007DF8 TOC2_FLAGS */ __IOM uint32_t TOC2_CRC_ADDR; /*!< 0x00007DFC CRC,Upper 2 bytes contain CRC16-CCITT and lower 2 bytes are 0 */ __IOM uint32_t RTOC2_OBJECT_SIZE; /*!< 0x00007E00 Redundant Object size in bytes for CRC calculation starting @@ -175,7 +173,8 @@ typedef struct { __IOM uint32_t RTOC2_SIGNATURE_VERIF_KEY; /*!< 0x00007E24 Redundant Address of signature verification key (0 if none).The object is signature specific key. It is the public key in case of RSA */ - __IM uint32_t RESERVED19[116]; + __IM uint32_t RESERVED19[115]; + __IOM uint32_t RTOC2_REVISION; /*!< 0x00007FF4 Indicates RTOC2 Revision. It is not used now. */ __IOM uint32_t RTOC2_FLAGS; /*!< 0x00007FF8 RTOC2_FLAGS */ __IOM uint32_t RTOC2_CRC_ADDR; /*!< 0x00007FFC Redundant CRC,Upper 2 bytes contain CRC16-CCITT and lower 2 bytes are 0 */ @@ -191,12 +190,6 @@ typedef struct { /* SFLASH.FAMILY_ID */ #define SFLASH_FAMILY_ID_FAMILY_ID_Pos 0UL #define SFLASH_FAMILY_ID_FAMILY_ID_Msk 0xFFFFUL -/* SFLASH.FB_HARDFAULT */ -#define SFLASH_FB_HARDFAULT_FB_HARDFAULT_Pos 0UL -#define SFLASH_FB_HARDFAULT_FB_HARDFAULT_Msk 0xFFUL -/* SFLASH.FLASHC_GEOMETRY */ -#define SFLASH_FLASHC_GEOMETRY_FLASHC_GEOMETRY_Pos 0UL -#define SFLASH_FLASHC_GEOMETRY_FLASHC_GEOMETRY_Msk 0xFFFFFFFFUL /* SFLASH.CPUSS_WOUNDING */ #define SFLASH_CPUSS_WOUNDING_CPUSS_WOUNDING_Pos 0UL #define SFLASH_CPUSS_WOUNDING_CPUSS_WOUNDING_Msk 0xFFFFFFFFUL @@ -377,21 +370,21 @@ typedef struct { /* SFLASH.TOC1_FHASH_OBJECTS */ #define SFLASH_TOC1_FHASH_OBJECTS_DATA32_Pos 0UL #define SFLASH_TOC1_FHASH_OBJECTS_DATA32_Msk 0xFFFFFFFFUL -/* SFLASH.TOC1_SFLASH_GENERAL_TRIM_ADDR */ -#define SFLASH_TOC1_SFLASH_GENERAL_TRIM_ADDR_DATA32_Pos 0UL -#define SFLASH_TOC1_SFLASH_GENERAL_TRIM_ADDR_DATA32_Msk 0xFFFFFFFFUL +/* SFLASH.TOC1_GENERAL_TRIM_ADDR_UNUSED */ +#define SFLASH_TOC1_GENERAL_TRIM_ADDR_UNUSED_DATA32_Pos 0UL +#define SFLASH_TOC1_GENERAL_TRIM_ADDR_UNUSED_DATA32_Msk 0xFFFFFFFFUL /* SFLASH.TOC1_UNIQUE_ID_ADDR */ #define SFLASH_TOC1_UNIQUE_ID_ADDR_DATA32_Pos 0UL #define SFLASH_TOC1_UNIQUE_ID_ADDR_DATA32_Msk 0xFFFFFFFFUL /* SFLASH.TOC1_FB_OBJECT_ADDR */ #define SFLASH_TOC1_FB_OBJECT_ADDR_DATA32_Pos 0UL #define SFLASH_TOC1_FB_OBJECT_ADDR_DATA32_Msk 0xFFFFFFFFUL -/* SFLASH.TOC1_SYSCALL_TABLE_ADDR */ -#define SFLASH_TOC1_SYSCALL_TABLE_ADDR_DATA32_Pos 0UL -#define SFLASH_TOC1_SYSCALL_TABLE_ADDR_DATA32_Msk 0xFFFFFFFFUL -/* SFLASH.TOC1_BOOT_PROTECTION_ADDR */ -#define SFLASH_TOC1_BOOT_PROTECTION_ADDR_DATA32_Pos 0UL -#define SFLASH_TOC1_BOOT_PROTECTION_ADDR_DATA32_Msk 0xFFFFFFFFUL +/* SFLASH.TOC1_SYSCALL_TABLE_ADDR_UNUSED */ +#define SFLASH_TOC1_SYSCALL_TABLE_ADDR_UNUSED_DATA32_Pos 0UL +#define SFLASH_TOC1_SYSCALL_TABLE_ADDR_UNUSED_DATA32_Msk 0xFFFFFFFFUL +/* SFLASH.TOC1_OBJECT_ADDR_UNUSED */ +#define SFLASH_TOC1_OBJECT_ADDR_UNUSED_DATA32_Pos 0UL +#define SFLASH_TOC1_OBJECT_ADDR_UNUSED_DATA32_Msk 0xFFFFFFFFUL /* SFLASH.TOC1_CRC_ADDR */ #define SFLASH_TOC1_CRC_ADDR_DATA32_Pos 0UL #define SFLASH_TOC1_CRC_ADDR_DATA32_Msk 0xFFFFFFFFUL @@ -404,18 +397,21 @@ typedef struct { /* SFLASH.RTOC1_FHASH_OBJECTS */ #define SFLASH_RTOC1_FHASH_OBJECTS_DATA32_Pos 0UL #define SFLASH_RTOC1_FHASH_OBJECTS_DATA32_Msk 0xFFFFFFFFUL -/* SFLASH.RTOC1_SFLASH_GENERAL_TRIM_ADDR */ -#define SFLASH_RTOC1_SFLASH_GENERAL_TRIM_ADDR_DATA32_Pos 0UL -#define SFLASH_RTOC1_SFLASH_GENERAL_TRIM_ADDR_DATA32_Msk 0xFFFFFFFFUL +/* SFLASH.RTOC1_GENERAL_TRIM_ADDR_UNUSED */ +#define SFLASH_RTOC1_GENERAL_TRIM_ADDR_UNUSED_DATA32_Pos 0UL +#define SFLASH_RTOC1_GENERAL_TRIM_ADDR_UNUSED_DATA32_Msk 0xFFFFFFFFUL /* SFLASH.RTOC1_UNIQUE_ID_ADDR */ #define SFLASH_RTOC1_UNIQUE_ID_ADDR_DATA32_Pos 0UL #define SFLASH_RTOC1_UNIQUE_ID_ADDR_DATA32_Msk 0xFFFFFFFFUL /* SFLASH.RTOC1_FB_OBJECT_ADDR */ #define SFLASH_RTOC1_FB_OBJECT_ADDR_DATA32_Pos 0UL #define SFLASH_RTOC1_FB_OBJECT_ADDR_DATA32_Msk 0xFFFFFFFFUL -/* SFLASH.RTOC1_SYSCALL_TABLE_ADDR */ -#define SFLASH_RTOC1_SYSCALL_TABLE_ADDR_DATA32_Pos 0UL -#define SFLASH_RTOC1_SYSCALL_TABLE_ADDR_DATA32_Msk 0xFFFFFFFFUL +/* SFLASH.RTOC1_SYSCALL_TABLE_ADDR_UNUSED */ +#define SFLASH_RTOC1_SYSCALL_TABLE_ADDR_UNUSED_DATA32_Pos 0UL +#define SFLASH_RTOC1_SYSCALL_TABLE_ADDR_UNUSED_DATA32_Msk 0xFFFFFFFFUL +/* SFLASH.RTOC1_OBJECT_ADDR_UNUSED */ +#define SFLASH_RTOC1_OBJECT_ADDR_UNUSED_DATA32_Pos 0UL +#define SFLASH_RTOC1_OBJECT_ADDR_UNUSED_DATA32_Msk 0xFFFFFFFFUL /* SFLASH.RTOC1_CRC_ADDR */ #define SFLASH_RTOC1_CRC_ADDR_DATA32_Pos 0UL #define SFLASH_RTOC1_CRC_ADDR_DATA32_Msk 0xFFFFFFFFUL @@ -449,9 +445,9 @@ typedef struct { /* SFLASH.TOC2_SIGNATURE_VERIF_KEY */ #define SFLASH_TOC2_SIGNATURE_VERIF_KEY_DATA32_Pos 0UL #define SFLASH_TOC2_SIGNATURE_VERIF_KEY_DATA32_Msk 0xFFFFFFFFUL -/* SFLASH.TOC2_FB_HARDFAULT */ -#define SFLASH_TOC2_FB_HARDFAULT_DATA32_Pos 0UL -#define SFLASH_TOC2_FB_HARDFAULT_DATA32_Msk 0xFFFFFFFFUL +/* SFLASH.TOC2_REVISION */ +#define SFLASH_TOC2_REVISION_DATA32_Pos 0UL +#define SFLASH_TOC2_REVISION_DATA32_Msk 0xFFFFFFFFUL /* SFLASH.TOC2_FLAGS */ #define SFLASH_TOC2_FLAGS_CLOCK_CONFIG_Pos 0UL #define SFLASH_TOC2_FLAGS_CLOCK_CONFIG_Msk 0x3UL @@ -459,10 +455,10 @@ typedef struct { #define SFLASH_TOC2_FLAGS_LISTEN_WINDOW_Msk 0x1CUL #define SFLASH_TOC2_FLAGS_SWJ_PINS_CTL_Pos 5UL #define SFLASH_TOC2_FLAGS_SWJ_PINS_CTL_Msk 0x60UL -#define SFLASH_TOC2_FLAGS_APP_AUTH_DISABLE_Pos 7UL -#define SFLASH_TOC2_FLAGS_APP_AUTH_DISABLE_Msk 0x180UL -#define SFLASH_TOC2_FLAGS_FB_BOOTLOADER_DISABLE_Pos 9UL -#define SFLASH_TOC2_FLAGS_FB_BOOTLOADER_DISABLE_Msk 0x600UL +#define SFLASH_TOC2_FLAGS_APP_AUTH_CTL_Pos 7UL +#define SFLASH_TOC2_FLAGS_APP_AUTH_CTL_Msk 0x180UL +#define SFLASH_TOC2_FLAGS_FB_BOOTLOADER_CTL_Pos 9UL +#define SFLASH_TOC2_FLAGS_FB_BOOTLOADER_CTL_Msk 0x600UL /* SFLASH.TOC2_CRC_ADDR */ #define SFLASH_TOC2_CRC_ADDR_DATA32_Pos 0UL #define SFLASH_TOC2_CRC_ADDR_DATA32_Msk 0xFFFFFFFFUL @@ -496,6 +492,9 @@ typedef struct { /* SFLASH.RTOC2_SIGNATURE_VERIF_KEY */ #define SFLASH_RTOC2_SIGNATURE_VERIF_KEY_DATA32_Pos 0UL #define SFLASH_RTOC2_SIGNATURE_VERIF_KEY_DATA32_Msk 0xFFFFFFFFUL +/* SFLASH.RTOC2_REVISION */ +#define SFLASH_RTOC2_REVISION_DATA32_Pos 0UL +#define SFLASH_RTOC2_REVISION_DATA32_Msk 0xFFFFFFFFUL /* SFLASH.RTOC2_FLAGS */ #define SFLASH_RTOC2_FLAGS_DATA32_Pos 0UL #define SFLASH_RTOC2_FLAGS_DATA32_Msk 0xFFFFFFFFUL diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_smartio.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_smartio.h index 7e01fc990c..a3fb95ab98 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_smartio.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_smartio.h @@ -5,7 +5,7 @@ * SMARTIO IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_smartio_v2.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_smartio_v2.h index 2d6b9708fe..a4d5f4be3d 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_smartio_v2.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_smartio_v2.h @@ -5,7 +5,7 @@ * SMARTIO IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_smif.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_smif.h index c29dac5fa2..ebe1700ce1 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_smif.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_smif.h @@ -5,7 +5,7 @@ * SMIF IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_srss.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_srss.h index 103d24f955..d8730d5b68 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_srss.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_srss.h @@ -5,7 +5,7 @@ * SRSS IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright @@ -92,35 +92,38 @@ typedef struct { __IM uint32_t CLK_ECO_STATUS; /*!< 0x00000530 ECO Status Register */ __IM uint32_t RESERVED7[2]; __IOM uint32_t CLK_PILO_CONFIG; /*!< 0x0000053C Precision ILO Configuration Register */ - __IM uint32_t RESERVED8[16]; + __IM uint32_t RESERVED8; + __IOM uint32_t CLK_MF_SELECT; /*!< 0x00000544 Medium Frequency Clock Select Register */ + __IOM uint32_t CLK_MFO_CONFIG; /*!< 0x00000548 MFO Configuration Register */ + __IM uint32_t RESERVED9[13]; __IOM uint32_t CLK_FLL_CONFIG; /*!< 0x00000580 FLL Configuration Register */ __IOM uint32_t CLK_FLL_CONFIG2; /*!< 0x00000584 FLL Configuration Register 2 */ __IOM uint32_t CLK_FLL_CONFIG3; /*!< 0x00000588 FLL Configuration Register 3 */ __IOM uint32_t CLK_FLL_CONFIG4; /*!< 0x0000058C FLL Configuration Register 4 */ __IOM uint32_t CLK_FLL_STATUS; /*!< 0x00000590 FLL Status Register */ - __IM uint32_t RESERVED9[27]; + __IM uint32_t RESERVED10[27]; __IOM uint32_t CLK_PLL_CONFIG[15]; /*!< 0x00000600 PLL Configuration Register */ - __IM uint32_t RESERVED10; + __IM uint32_t RESERVED11; __IOM uint32_t CLK_PLL_STATUS[15]; /*!< 0x00000640 PLL Status Register */ - __IM uint32_t RESERVED11[33]; + __IM uint32_t RESERVED12[33]; __IOM uint32_t SRSS_INTR; /*!< 0x00000700 SRSS Interrupt Register */ __IOM uint32_t SRSS_INTR_SET; /*!< 0x00000704 SRSS Interrupt Set Register */ __IOM uint32_t SRSS_INTR_MASK; /*!< 0x00000708 SRSS Interrupt Mask Register */ __IM uint32_t SRSS_INTR_MASKED; /*!< 0x0000070C SRSS Interrupt Masked Register */ __IOM uint32_t SRSS_INTR_CFG; /*!< 0x00000710 SRSS Interrupt Configuration Register */ - __IM uint32_t RESERVED12[59]; + __IM uint32_t RESERVED13[59]; __IOM uint32_t RES_CAUSE; /*!< 0x00000800 Reset Cause Observation Register */ __IOM uint32_t RES_CAUSE2; /*!< 0x00000804 Reset Cause Observation Register 2 */ - __IM uint32_t RESERVED13[7614]; + __IM uint32_t RESERVED14[7614]; __IOM uint32_t PWR_TRIM_REF_CTL; /*!< 0x00007F00 Reference Trim Register */ __IOM uint32_t PWR_TRIM_BODOVP_CTL; /*!< 0x00007F04 BOD/OVP Trim Register */ __IOM uint32_t CLK_TRIM_CCO_CTL; /*!< 0x00007F08 CCO Trim Register */ __IOM uint32_t CLK_TRIM_CCO_CTL2; /*!< 0x00007F0C CCO Trim Register 2 */ - __IM uint32_t RESERVED14[8]; + __IM uint32_t RESERVED15[8]; __IOM uint32_t PWR_TRIM_WAKE_CTL; /*!< 0x00007F30 Wakeup Trim Register */ - __IM uint32_t RESERVED15[8183]; + __IM uint32_t RESERVED16[8183]; __IOM uint32_t PWR_TRIM_LVD_CTL; /*!< 0x0000FF10 LVD Trim Register */ - __IM uint32_t RESERVED16; + __IM uint32_t RESERVED17; __IOM uint32_t CLK_TRIM_ILO_CTL; /*!< 0x0000FF18 ILO Trim Register */ __IOM uint32_t PWR_TRIM_PWRSYS_CTL; /*!< 0x0000FF1C Power System Trim Register */ __IOM uint32_t CLK_TRIM_ECO_CTL; /*!< 0x0000FF20 ECO Trim Register */ @@ -390,6 +393,18 @@ typedef struct { #define SRSS_CLK_PILO_CONFIG_PILO_RESET_N_Msk 0x40000000UL #define SRSS_CLK_PILO_CONFIG_PILO_EN_Pos 31UL #define SRSS_CLK_PILO_CONFIG_PILO_EN_Msk 0x80000000UL +/* SRSS.CLK_MF_SELECT */ +#define SRSS_CLK_MF_SELECT_MFCLK_SEL_Pos 0UL +#define SRSS_CLK_MF_SELECT_MFCLK_SEL_Msk 0x7UL +#define SRSS_CLK_MF_SELECT_MFCLK_DIV_Pos 8UL +#define SRSS_CLK_MF_SELECT_MFCLK_DIV_Msk 0xFF00UL +#define SRSS_CLK_MF_SELECT_ENABLE_Pos 31UL +#define SRSS_CLK_MF_SELECT_ENABLE_Msk 0x80000000UL +/* SRSS.CLK_MFO_CONFIG */ +#define SRSS_CLK_MFO_CONFIG_DPSLP_ENABLE_Pos 30UL +#define SRSS_CLK_MFO_CONFIG_DPSLP_ENABLE_Msk 0x40000000UL +#define SRSS_CLK_MFO_CONFIG_ENABLE_Pos 31UL +#define SRSS_CLK_MFO_CONFIG_ENABLE_Msk 0x80000000UL /* SRSS.CLK_FLL_CONFIG */ #define SRSS_CLK_FLL_CONFIG_FLL_MULT_Pos 0UL #define SRSS_CLK_FLL_CONFIG_FLL_MULT_Msk 0x3FFFFUL diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_tcpwm.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_tcpwm.h index 59dad62a9b..a728d0c5ff 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_tcpwm.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_tcpwm.h @@ -5,7 +5,7 @@ * TCPWM IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_udb.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_udb.h index 4f8dff4a34..6748dd1120 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_udb.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_udb.h @@ -5,7 +5,7 @@ * UDB IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/ip/cyip_usbfs.h b/platform/ext/target/psoc64/Device/Include/ip/cyip_usbfs.h index d80a95c4b2..2c2d5df640 100644 --- a/platform/ext/target/psoc64/Device/Include/ip/cyip_usbfs.h +++ b/platform/ext/target/psoc64/Device/Include/ip/cyip_usbfs.h @@ -5,7 +5,7 @@ * USBFS IP definitions * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/psoc6_01_config.h b/platform/ext/target/psoc64/Device/Include/psoc6_01_config.h index 0ef4286aaf..321f0398b4 100644 --- a/platform/ext/target/psoc64/Device/Include/psoc6_01_config.h +++ b/platform/ext/target/psoc64/Device/Include/psoc6_01_config.h @@ -5,7 +5,7 @@ * PSoC6_01 device configuration header * * \note -* Generator version: 1.4.0.1232 +* Generator version: 1.5.0.1286 * ******************************************************************************** * \copyright diff --git a/platform/ext/target/psoc64/Device/Include/system_psoc6_cm0plus_flash_init.h b/platform/ext/target/psoc64/Device/Include/system_psoc6_cm0plus_flash_init.h deleted file mode 100644 index 1a5aef3e52..0000000000 --- a/platform/ext/target/psoc64/Device/Include/system_psoc6_cm0plus_flash_init.h +++ /dev/null @@ -1,30 +0,0 @@ -/***************************************************************************//** -* \file system_psoc6_cm0plus_flash_init.c -* \version 2.30 -* -* The header for Flash initialization function. -* -******************************************************************************** -* \copyright -* Copyright 2016-2019 Cypress Semiconductor Corporation -* SPDX-License-Identifier: Apache-2.0 -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*******************************************************************************/ - -#ifndef _SYSTEM_PSOC6_CM0PLUS_FLASH_INIT_H_ -#define _SYSTEM_PSOC6_CM0PLUS_FLASH_INIT_H_ - -void Cy_SemaIpcFlashInit(void); - -#endif /* _SYSTEM_PSOC6_CM0PLUS_FLASH_INIT_H_ */ diff --git a/platform/ext/target/psoc64/Device/Source/system_psoc6_cm0plus.c b/platform/ext/target/psoc64/Device/Source/system_psoc6_cm0plus.c index 4fdcb6d1ca..9164b15dd6 100644 --- a/platform/ext/target/psoc64/Device/Source/system_psoc6_cm0plus.c +++ b/platform/ext/target/psoc64/Device/Source/system_psoc6_cm0plus.c @@ -1,6 +1,6 @@ /***************************************************************************//** * \file system_psoc6_cm0plus.c -* \version 2.30 +* \version 2.60 * * The device system-source file. * @@ -28,8 +28,6 @@ #include "cy_device_headers.h" #include "cy_syslib.h" #include "cy_wdt.h" -#include "Driver_Flash.h" -#include "flash_layout.h" #if !defined(CY_IPC_DEFAULT_CFG_DISABLE) #include "cy_ipc_sema.h" @@ -158,7 +156,6 @@ uint32_t cy_delay32kMs = CY_DELAY_MS_OVERFLOW_THRESHOLD * #define CY_SYS_CM4_PWR_CTL_KEY_CLOSE (0xFA05UL) #define CY_SYS_CM4_VECTOR_TABLE_VALID_ADDR (0x000003FFUL) -void Cy_Platform_Init(void); /******************************************************************************* * Function Name: SystemInit @@ -167,16 +164,14 @@ void Cy_Platform_Init(void); * Initializes the system: * - Restores FLL registers to the default state. * - Unlocks and disables WDT. +* - Calls Cy_PDL_Init() function to define the driver library. * - Calls the Cy_SystemInit() function, if compiled from PSoC Creator. * - Calls \ref SystemCoreClockUpdate(). * *******************************************************************************/ void SystemInit(void) { -#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) - extern const cy_israddress __Vectors[]; /* Vector Table in flash */; - SCB->VTOR = (uint32_t) &__Vectors; -#endif + Cy_PDL_Init(CY_DEVICE_CFG); /* Restore FLL registers to the default state as they are not restored by the ROM code */ uint32_t copy = SRSS->CLK_FLL_CONFIG; @@ -208,6 +203,69 @@ void SystemInit(void) IPC_STRUCT7->RELEASE = 0UL; } #endif /* defined(CY_DEVICE_PSOC6ABLE2) && !defined(CY_PSOC6ABLE2_REV_0A_SUPPORT_DISABLE) */ + +#if !defined(CY_IPC_DEFAULT_CFG_DISABLE) + /* Allocate and initialize semaphores for the system operations. */ + CY_SECTION(".cy_sharedmem") + static uint32_t ipcSemaArray[CY_IPC_SEMA_COUNT / CY_IPC_SEMA_PER_WORD]; + + (void) Cy_IPC_Sema_Init(CY_IPC_CHAN_SEMA, CY_IPC_SEMA_COUNT, ipcSemaArray); + + + /******************************************************************************** + * + * Initializes the system pipes. The system pipes are used by BLE and Flash. + * + * If the default startup file is not used, or SystemInit() is not called in your + * project, call the following three functions prior to executing any flash or + * EmEEPROM write or erase operation: + * -# Cy_IPC_Sema_Init() + * -# Cy_IPC_Pipe_Config() + * -# Cy_IPC_Pipe_Init() + * -# Cy_Flash_Init() + * + *******************************************************************************/ + + /* Create an array of endpoint structures */ + static cy_stc_ipc_pipe_ep_t systemIpcPipeEpArray[CY_IPC_MAX_ENDPOINTS]; + + Cy_IPC_Pipe_Config(systemIpcPipeEpArray); + + static cy_ipc_pipe_callback_ptr_t systemIpcPipeSysCbArray[CY_SYS_CYPIPE_CLIENT_CNT]; + + static const cy_stc_ipc_pipe_config_t systemIpcPipeConfigCm0 = + { + /* .ep0ConfigData */ + { + /* .ipcNotifierNumber */ CY_IPC_INTR_CYPIPE_EP0, + /* .ipcNotifierPriority */ CY_SYS_INTR_CYPIPE_PRIOR_EP0, + /* .ipcNotifierMuxNumber */ CY_SYS_INTR_CYPIPE_MUX_EP0, + /* .epAddress */ CY_IPC_EP_CYPIPE_CM0_ADDR, + /* .epConfig */ CY_SYS_CYPIPE_CONFIG_EP0 + }, + /* .ep1ConfigData */ + { + /* .ipcNotifierNumber */ CY_IPC_INTR_CYPIPE_EP1, + /* .ipcNotifierPriority */ CY_SYS_INTR_CYPIPE_PRIOR_EP1, + /* .ipcNotifierMuxNumber */ 0u, + /* .epAddress */ CY_IPC_EP_CYPIPE_CM4_ADDR, + /* .epConfig */ CY_SYS_CYPIPE_CONFIG_EP1 + }, + /* .endpointClientsCount */ CY_SYS_CYPIPE_CLIENT_CNT, + /* .endpointsCallbacksArray */ systemIpcPipeSysCbArray, + /* .userPipeIsrHandler */ &Cy_SysIpcPipeIsrCm0 + }; + + if (cy_device->flashPipeRequired != 0u) + { + Cy_IPC_Pipe_Init(&systemIpcPipeConfigCm0); + } + +#if defined(CY_DEVICE_PSOC6ABLE2) + Cy_Flash_Init(); +#endif /* defined(CY_DEVICE_PSOC6ABLE2) */ + +#endif /* !defined(CY_IPC_DEFAULT_CFG_DISABLE) */ } @@ -569,8 +627,7 @@ void Cy_SysResetCM4(void) } #endif /* #if (CY_SYSTEM_CPU_CM0P == 1UL) || defined(CY_DOXYGEN) */ - -#if !defined(CY_IPC_DEFAULT_CFG_DISABLE) && !defined(CY_FLASH_RWW_DRV_SUPPORT_DISABLED) +#if !defined(CY_IPC_DEFAULT_CFG_DISABLE) /******************************************************************************* * Function Name: Cy_SysIpcPipeIsrCm0 ****************************************************************************//** @@ -594,7 +651,7 @@ void Cy_SysIpcPipeIsrCm0(void) * linker configuration files. The following symbols used by the cymcuelftool. * *******************************************************************************/ -#if defined (__ARMCC_VERSION) && (__ARMCC_VERSION < 6010050) +#if defined (__ARMCC_VERSION) && (__ARMCC_VERSION < 6010050) __asm void Cy_MemorySymbols(void) { /* Flash */ @@ -622,7 +679,6 @@ __asm void Cy_MemorySymbols(void) EXPORT __cy_memory_4_length EXPORT __cy_memory_4_row_size - /* Flash */ __cy_memory_0_start EQU __cpp(CY_FLASH_BASE) __cy_memory_0_length EQU __cpp(CY_FLASH_SIZE) @@ -651,97 +707,4 @@ __cy_memory_4_row_size EQU __cpp(1) #endif /* defined (__ARMCC_VERSION) && (__ARMCC_VERSION < 6010050) */ -/******************************************************************************* -* Function Name: Cy_Platform_Init -****************************************************************************//** -* -* CM0 custom HW initialization -* -*******************************************************************************/ -void Cy_Platform_Init(void) -{ - Cy_PDL_Init(CY_DEVICE_CFG); - -#if !defined(CY_IPC_DEFAULT_CFG_DISABLE) - /* Initialize semaphores for the system operations.*/ - (void) Cy_IPC_Sema_Init(CY_IPC_CHAN_SEMA, 0ul, NULL); - -#if !defined(CY_FLASH_RWW_DRV_SUPPORT_DISABLED) - /******************************************************************************** - * - * Initializes the system pipes. The system pipes are used by BLE and Flash. - * - * If the default startup file is not used, or SystemInit() is not called in your - * project, call the following three functions prior to executing any flash or - * EmEEPROM write or erase operation: - * -# Cy_IPC_Sema_Init() - * -# Cy_IPC_Pipe_Config() - * -# Cy_IPC_Pipe_Init() - * -# Cy_Flash_Init() - * - *******************************************************************************/ - - /* Create an array of endpoint structures */ - static cy_stc_ipc_pipe_ep_t systemIpcPipeEpArray[CY_IPC_MAX_ENDPOINTS]; - - Cy_IPC_Pipe_Config(systemIpcPipeEpArray); - - static cy_ipc_pipe_callback_ptr_t systemIpcPipeSysCbArray[CY_SYS_CYPIPE_CLIENT_CNT]; - - static const cy_stc_ipc_pipe_config_t systemIpcPipeConfigCm0 = - { - /* .ep0ConfigData */ - { - /* .ipcNotifierNumber */ CY_IPC_INTR_CYPIPE_EP0, - /* .ipcNotifierPriority */ CY_SYS_INTR_CYPIPE_PRIOR_EP0, - /* .ipcNotifierMuxNumber */ CY_SYS_INTR_CYPIPE_MUX_EP0, - /* .epAddress */ CY_IPC_EP_CYPIPE_CM0_ADDR, - /* .epConfig */ CY_SYS_CYPIPE_CONFIG_EP0 - }, - /* .ep1ConfigData */ - { - /* .ipcNotifierNumber */ CY_IPC_INTR_CYPIPE_EP1, - /* .ipcNotifierPriority */ CY_SYS_INTR_CYPIPE_PRIOR_EP1, - /* .ipcNotifierMuxNumber */ 0u, - /* .epAddress */ CY_IPC_EP_CYPIPE_CM4_ADDR, - /* .epConfig */ CY_SYS_CYPIPE_CONFIG_EP1 - }, - /* .endpointClientsCount */ CY_SYS_CYPIPE_CLIENT_CNT, - /* .endpointsCallbacksArray */ systemIpcPipeSysCbArray, - /* .userPipeIsrHandler */ &Cy_SysIpcPipeIsrCm0 - }; - - if (cy_device->flashPipeRequired != 0u) - { - Cy_IPC_Pipe_Init(&systemIpcPipeConfigCm0); - } - -#if defined(CY_DEVICE_PSOC6ABLE2) - Cy_Flash_Init(); -#endif /* defined(CY_DEVICE_PSOC6ABLE2) */ - -#endif /* !defined(CY_FLASH_RWW_DRV_SUPPORT_DISABLED) */ - -#endif /* !defined(CY_IPC_DEFAULT_CFG_DISABLE) */ - - - return; -} - -#ifdef BL2 -/* Flash device name must be specified by target */ -extern ARM_DRIVER_FLASH FLASH_DEV_NAME; - -uint32_t bl2_platform_init(void) -{ - /* make sure CM4 is disabled */ - if (CY_SYS_CM4_STATUS_ENABLED == Cy_SysGetCM4Status()) { - Cy_SysDisableCM4(); - } - Cy_Platform_Init(); - - return FLASH_DEV_NAME.Initialize(NULL); -} -#endif - /* [] END OF FILE */ diff --git a/platform/ext/target/psoc64/Device/Source/system_psoc6_cm4.c b/platform/ext/target/psoc64/Device/Source/system_psoc6_cm4.c index cc7069063f..0a18f50a4d 100644 --- a/platform/ext/target/psoc64/Device/Source/system_psoc6_cm4.c +++ b/platform/ext/target/psoc64/Device/Source/system_psoc6_cm4.c @@ -1,6 +1,6 @@ /***************************************************************************//** * \file system_psoc6_cm4.c -* \version 2.30 +* \version 2.60 * * The device system-source file. * @@ -28,7 +28,7 @@ #include "cy_device_headers.h" #include "cy_syslib.h" #include "cy_wdt.h" -#include "cycfg.h" + #if !defined(CY_IPC_DEFAULT_CFG_DISABLE) #include "cy_ipc_sema.h" #include "cy_ipc_pipe.h" @@ -39,8 +39,6 @@ #endif /* defined(CY_DEVICE_PSOC6ABLE2) */ #endif /* !defined(CY_IPC_DEFAULT_CFG_DISABLE) */ -#include "target_cfg.h" -#include "Driver_USART.h" /******************************************************************************* * SystemCoreClockUpdate() @@ -160,24 +158,14 @@ uint32_t cy_delay32kMs = CY_DELAY_MS_OVERFLOW_THRESHOLD * * Initializes the system: * - Restores FLL registers to the default state for single core devices. * - Unlocks and disables WDT. +* - Calls Cy_PDL_Init() function to define the driver library. * - Calls the Cy_SystemInit() function, if compiled from PSoC Creator. * - Calls \ref SystemCoreClockUpdate(). * \endcond *******************************************************************************/ void SystemInit(void) { -#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) - extern const cy_israddress __Vectors[]; /* Vector Table in flash */ - SCB->VTOR = (uint32_t) &__Vectors; -#endif - - /* - * FIXME: - * Even if __FPU_USED is undefined or cleared, FP registers are still - * accessed inside armclang library. Not sure about why armclang doesn't - * care about the __FPU_USED. - */ - SCB->CPACR |= SCB_CPACR_CP10_CP11_ENABLE; + Cy_PDL_Init(CY_DEVICE_CFG); #ifdef __CM0P_PRESENT #if (__CM0P_PRESENT == 0) @@ -203,6 +191,75 @@ void SystemInit(void) Cy_SystemInit(); SystemCoreClockUpdate(); + +#if !defined(CY_IPC_DEFAULT_CFG_DISABLE) + +#ifdef __CM0P_PRESENT + #if (__CM0P_PRESENT == 0) + /* Allocate and initialize semaphores for the system operations. */ + static uint32_t ipcSemaArray[CY_IPC_SEMA_COUNT / CY_IPC_SEMA_PER_WORD]; + (void) Cy_IPC_Sema_Init(CY_IPC_CHAN_SEMA, CY_IPC_SEMA_COUNT, ipcSemaArray); + #else + (void) Cy_IPC_Sema_Init(CY_IPC_CHAN_SEMA, 0ul, NULL); + #endif /* (__CM0P_PRESENT) */ +#else + (void) Cy_IPC_Sema_Init(CY_IPC_CHAN_SEMA, 0ul, NULL); +#endif /* __CM0P_PRESENT */ + + + /******************************************************************************** + * + * Initializes the system pipes. The system pipes are used by BLE and Flash. + * + * If the default startup file is not used, or SystemInit() is not called in your + * project, call the following three functions prior to executing any flash or + * EmEEPROM write or erase operation: + * -# Cy_IPC_Sema_Init() + * -# Cy_IPC_Pipe_Config() + * -# Cy_IPC_Pipe_Init() + * -# Cy_Flash_Init() + * + *******************************************************************************/ + /* Create an array of endpoint structures */ + static cy_stc_ipc_pipe_ep_t systemIpcPipeEpArray[CY_IPC_MAX_ENDPOINTS]; + + Cy_IPC_Pipe_Config(systemIpcPipeEpArray); + + static cy_ipc_pipe_callback_ptr_t systemIpcPipeSysCbArray[CY_SYS_CYPIPE_CLIENT_CNT]; + + static const cy_stc_ipc_pipe_config_t systemIpcPipeConfigCm4 = + { + /* .ep0ConfigData */ + { + /* .ipcNotifierNumber */ CY_IPC_INTR_CYPIPE_EP0, + /* .ipcNotifierPriority */ CY_SYS_INTR_CYPIPE_PRIOR_EP0, + /* .ipcNotifierMuxNumber */ CY_SYS_INTR_CYPIPE_MUX_EP0, + /* .epAddress */ CY_IPC_EP_CYPIPE_CM0_ADDR, + /* .epConfig */ CY_SYS_CYPIPE_CONFIG_EP0 + }, + /* .ep1ConfigData */ + { + /* .ipcNotifierNumber */ CY_IPC_INTR_CYPIPE_EP1, + /* .ipcNotifierPriority */ CY_SYS_INTR_CYPIPE_PRIOR_EP1, + /* .ipcNotifierMuxNumber */ 0u, + /* .epAddress */ CY_IPC_EP_CYPIPE_CM4_ADDR, + /* .epConfig */ CY_SYS_CYPIPE_CONFIG_EP1 + }, + /* .endpointClientsCount */ CY_SYS_CYPIPE_CLIENT_CNT, + /* .endpointsCallbacksArray */ systemIpcPipeSysCbArray, + /* .userPipeIsrHandler */ &Cy_SysIpcPipeIsrCm4 + }; + + if (cy_device->flashPipeRequired != 0u) + { + Cy_IPC_Pipe_Init(&systemIpcPipeConfigCm4); + } + +#if defined(CY_DEVICE_PSOC6ABLE2) + Cy_Flash_Init(); +#endif /* defined(CY_DEVICE_PSOC6ABLE2) */ + +#endif /* !defined(CY_IPC_DEFAULT_CFG_DISABLE) */ } @@ -412,6 +469,21 @@ void Cy_SystemInitFpuEnable(void) } +#if !defined(CY_IPC_DEFAULT_CFG_DISABLE) +/******************************************************************************* +* Function Name: Cy_SysIpcPipeIsrCm4 +****************************************************************************//** +* +* This is the interrupt service routine for the system pipe. +* +*******************************************************************************/ +void Cy_SysIpcPipeIsrCm4(void) +{ + Cy_IPC_Pipe_ExecuteCallback(CY_IPC_EP_CYPIPE_CM4_ADDR); +} +#endif + + /******************************************************************************* * Function Name: Cy_MemorySymbols ****************************************************************************//** @@ -474,115 +546,7 @@ __cy_memory_4_start EQU __cpp(0x90700000) __cy_memory_4_length EQU __cpp(0x100000) __cy_memory_4_row_size EQU __cpp(1) } - #endif /* defined (__ARMCC_VERSION) && (__ARMCC_VERSION < 6010050) */ -#if !defined(CY_IPC_DEFAULT_CFG_DISABLE) && !defined(CY_FLASH_RWW_DRV_SUPPORT_DISABLED) -/******************************************************************************* -* Function Name: Cy_SysIpcPipeIsrCm4 -****************************************************************************//** -* -* This is the interrupt service routine for the system pipe. -* -*******************************************************************************/ -void Cy_SysIpcPipeIsrCm4(void) -{ - Cy_IPC_Pipe_ExecuteCallback(CY_IPC_EP_CYPIPE_CM4_ADDR); -} -#endif - - -/* For UART the CMSIS driver is used */ -extern ARM_DRIVER_USART NS_DRIVER_STDIO; - -/******************************************************************************* -* Function Name: Cy_Platform_Init -****************************************************************************//** -* -* CM4 custom HW initialization -* -*******************************************************************************/ -void Cy_Platform_Init(void) -{ - Cy_PDL_Init(CY_DEVICE_CFG); - - (void)NS_DRIVER_STDIO.Initialize(NULL); - NS_DRIVER_STDIO.Control(ARM_USART_MODE_ASYNCHRONOUS, 115200); - -#if !defined(CY_IPC_DEFAULT_CFG_DISABLE) -#ifdef __CM0P_PRESENT - /* Allocate and initialize semaphores for the system operations. */ - static uint32_t ipcSemaArray[CY_IPC_SEMA_COUNT / CY_IPC_SEMA_PER_WORD]; - (void) Cy_IPC_Sema_Init(CY_IPC_CHAN_SEMA, CY_IPC_SEMA_COUNT, ipcSemaArray); -#else - (void) Cy_IPC_Sema_Init(CY_IPC_CHAN_SEMA, 0ul, NULL); -#endif /* __CM0P_PRESENT */ - -#if !defined(CY_FLASH_RWW_DRV_SUPPORT_DISABLED) - /******************************************************************************** - * - * Initializes the system pipes. The system pipes are used by BLE and Flash. - * - * If the default startup file is not used, or SystemInit() is not called in your - * project, call the following three functions prior to executing any flash or - * EmEEPROM write or erase operation: - * -# Cy_IPC_Sema_Init() - * -# Cy_IPC_Pipe_Config() - * -# Cy_IPC_Pipe_Init() - * -# Cy_Flash_Init() - * - *******************************************************************************/ - /* Create an array of endpoint structures */ - static cy_stc_ipc_pipe_ep_t systemIpcPipeEpArray[CY_IPC_MAX_ENDPOINTS]; - - Cy_IPC_Pipe_Config(systemIpcPipeEpArray); - - static cy_ipc_pipe_callback_ptr_t systemIpcPipeSysCbArray[CY_SYS_CYPIPE_CLIENT_CNT]; - - static const cy_stc_ipc_pipe_config_t systemIpcPipeConfigCm4 = - { - /* .ep0ConfigData */ - { - /* .ipcNotifierNumber */ CY_IPC_INTR_CYPIPE_EP0, - /* .ipcNotifierPriority */ CY_SYS_INTR_CYPIPE_PRIOR_EP0, - /* .ipcNotifierMuxNumber */ CY_SYS_INTR_CYPIPE_MUX_EP0, - /* .epAddress */ CY_IPC_EP_CYPIPE_CM0_ADDR, - /* .epConfig */ CY_SYS_CYPIPE_CONFIG_EP0 - - }, - /* .ep1ConfigData */ - { - /* .ipcNotifierNumber */ CY_IPC_INTR_CYPIPE_EP1, - /* .ipcNotifierPriority */ CY_SYS_INTR_CYPIPE_PRIOR_EP1, - /* .ipcNotifierMuxNumber */ 0u, - /* .epAddress */ CY_IPC_EP_CYPIPE_CM4_ADDR, - /* .epConfig */ CY_SYS_CYPIPE_CONFIG_EP1 - }, - /* .endpointClientsCount */ CY_SYS_CYPIPE_CLIENT_CNT, - /* .endpointsCallbacksArray */ systemIpcPipeSysCbArray, - /* .userPipeIsrHandler */ &Cy_SysIpcPipeIsrCm4 - }; - - if (cy_device->flashPipeRequired != 0u) - { - Cy_IPC_Pipe_Init(&systemIpcPipeConfigCm4); - } - -#if defined(CY_DEVICE_PSOC6ABLE2) - Cy_Flash_Init(); -#endif /* defined(CY_DEVICE_PSOC6ABLE2) */ -#endif /* !defined(CY_FLASH_RWW_DRV_SUPPORT_DISABLED) */ -#endif /* !defined(CY_IPC_DEFAULT_CFG_DISABLE) */ - - return; -} - - -int32_t tfm_ns_platform_init (void) -{ - Cy_Platform_Init(); - return ARM_DRIVER_OK; -} - /* [] END OF FILE */ diff --git a/platform/ext/target/psoc64/Native_Driver/include/cy_csd.h b/platform/ext/target/psoc64/Native_Driver/include/cy_csd.h index e6a1abe160..f88605b284 100644 --- a/platform/ext/target/psoc64/Native_Driver/include/cy_csd.h +++ b/platform/ext/target/psoc64/Native_Driver/include/cy_csd.h @@ -1,6 +1,6 @@ /***************************************************************************//** * \file cy_csd.h -* \version 1.0.1 +* \version 1.10 * * The header file of the CSD driver. * @@ -105,7 +105,7 @@ * The following code snippet demonstrates how to capture the CSD HW block for * custom implementation: * -* \snippet csd/1.0/snippet/main.c snippet_Cy_CSD_Conversion +* \snippet csd/snippet/main.c snippet_Cy_CSD_Conversion * * The entire solution, either CapSense or CSDADC, in addition to * the CSD HW block, incorporates the following instances: @@ -199,12 +199,12 @@ * The following code snippet demonstrates how to implement a routine to handle * the interrupt. The routine is called when a CSD interrupt is triggered. * -* \snippet csd/1.0/snippet/main.c snippet_Cy_CSD_IntHandler +* \snippet csd/snippet/main.c snippet_Cy_CSD_IntHandler * * The following code snippet demonstrates how to configure and enable * the CSD interrupt: * -* \snippet csd/1.0/snippet/main.c snippet_Cy_CSD_IntEnabling +* \snippet csd/snippet/main.c snippet_Cy_CSD_IntEnabling * * For more information, refer to the \ref group_sysint driver. * @@ -253,11 +253,23 @@ * * * <a href="http://www.cypress.com/trm218176"><b>Technical Reference Manual (TRM)</b></a> * -* * <a href="..\..\capsense_api_reference_manual.html"><b>Cypress CapSense Middleware Library</b></a> +* * <a href="https://github.com/cypresssemiconductorco/capsense"> +* <b>Cypress CapSense Middleware Library</b></a> * -* * <a href="..\..\csdadc_api_reference_manual.html"><b>Cypress CSDADC Middleware Library</b></a> +* * <a href="https://cypresssemiconductorco.github.io/capsense/capsense_api_reference_manual/html/index.html"> +* <b>Cypress CapSense Middleware API Reference Guide</b></a> * -* * <a href="..\..\csdidac_api_reference_manual.html"><b>Cypress CSDIDAC Middleware Library</b></a> +* * <a href="https://github.com/cypresssemiconductorco/csdadc"> +* <b>Cypress CSDADC Middleware Library</b></a> +* +* * <a href="https://cypresssemiconductorco.github.io/csdadc/csdadc_api_reference_manual/html/index.html"> +* <b>Cypress CSDADC Middleware API Reference Guide</b></a> +* +* * <a href="https://github.com/cypresssemiconductorco/csdidac"> +* <b>Cypress CSDIDAC Middleware Library</b></a> +* +* * <a href="https://cypresssemiconductorco.github.io/csdidac/csdidac_api_reference_manual/html/index.html"> +* <b>Cypress CSDIDAC Middleware API Reference Guide</b></a> * * * \ref page_getting_started "Getting Started with the PDL" * @@ -300,15 +312,26 @@ * <table class="doxtable"> * <tr><th>Version</th><th>Changes</th><th>Reason for Change</th></tr> * <tr> -* <td>1.0</td> -* <td>The initial version.</td> -* <td></td> +* <td rowspan="2">1.10</td> +* <td>The CSD driver sources are enclosed with the conditional compilation +* to ensure a successful compilation for non-CapSense-capable devices +* </td> +* <td>Compilation for non-CapSense-capable devices</td> +* <tr> +* <td>Changed the Cy_CSD_GetConversionStatus() function implementation</td> +* <td>Fixed defect</td> +* </tr> * </tr> * <tr> * <td>1.0.1</td> -* <td>Documentation updates.</td> +* <td>Documentation updates</td> * <td>Improve user's experience</td> * </tr> +* <tr> +* <td>1.0</td> +* <td>The initial version</td> +* <td></td> +* </tr> * </table> */ @@ -334,9 +357,7 @@ #include "cy_device_headers.h" #include "cy_syslib.h" -#ifndef CY_IP_MXCSDV2 - #error "The CSD driver is not supported on this device" -#endif +#if defined(CY_IP_MXCSDV2) #if defined(__cplusplus) extern "C" { @@ -351,7 +372,7 @@ extern "C" { #define CY_CSD_DRV_VERSION_MAJOR (1) /** Driver minor version */ -#define CY_CSD_DRV_VERSION_MINOR (0) +#define CY_CSD_DRV_VERSION_MINOR (10) /****************************************************************************** @@ -782,7 +803,7 @@ __STATIC_INLINE void Cy_CSD_WriteBits(CSD_Type * base, uint32_t offset, uint32_t * * \funcusage * -* \snippet csd/1.0/snippet/main.c snippet_Cy_CSD_CheckKey +* \snippet csd/snippet/main.c snippet_Cy_CSD_CheckKey * *******************************************************************************/ __STATIC_INLINE cy_en_csd_key_t Cy_CSD_GetLockStatus(const CSD_Type * base, const cy_stc_csd_context_t * context) @@ -810,7 +831,7 @@ __STATIC_INLINE cy_en_csd_key_t Cy_CSD_GetLockStatus(const CSD_Type * base, cons * * \funcusage * -* \snippet csd/1.0/snippet/main.c snippet_Cy_CSD_CheckStatus +* \snippet csd/snippet/main.c snippet_Cy_CSD_CheckStatus * *******************************************************************************/ __STATIC_INLINE cy_en_csd_status_t Cy_CSD_GetConversionStatus(const CSD_Type * base, const cy_stc_csd_context_t * context) @@ -818,7 +839,8 @@ __STATIC_INLINE cy_en_csd_status_t Cy_CSD_GetConversionStatus(const CSD_Type * b cy_en_csd_status_t csdStatus = CY_CSD_BUSY; (void)context; - if ((base->SEQ_START & CSD_SEQ_START_START_Msk) == 0u) + if (((base->SEQ_START & CSD_SEQ_START_START_Msk) == 0u) && + ((base->STAT_SEQ & (CSD_STAT_SEQ_SEQ_STATE_Msk | CSD_STAT_SEQ_ADC_STATE_Msk)) == 0u)) { csdStatus = CY_CSD_SUCCESS; } @@ -833,6 +855,8 @@ __STATIC_INLINE cy_en_csd_status_t Cy_CSD_GetConversionStatus(const CSD_Type * b } #endif +#endif /* CY_IP_MXCSDV2 */ + #endif /* CY_CSD_H */ diff --git a/platform/ext/target/psoc64/Native_Driver/include/cy_device.h b/platform/ext/target/psoc64/Native_Driver/include/cy_device.h index f60560f49c..1f2060bf82 100644 --- a/platform/ext/target/psoc64/Native_Driver/include/cy_device.h +++ b/platform/ext/target/psoc64/Native_Driver/include/cy_device.h @@ -1,6 +1,6 @@ /***************************************************************************//** * \file cy_device.h -* \version 1.10 +* \version 2.10 * * This file specifies the structure for core and peripheral block HW base * addresses, versions, and parameters. @@ -22,6 +22,31 @@ * See the License for the specific language governing permissions and * limitations under the License. *******************************************************************************/ +/** +* \section group_device_MISRA MISRA-C Compliance +* <table class="doxtable"> +* <tr> +* <th>MISRA Rule</th> +* <th>Rule Class (Required/Advisory)</th> +* <th>Rule Description</th> +* <th>Description of Deviation(s)</th> +* </tr> +* <tr> +* <td>10.1</td> +* <td>R</td> +* <td>The value of an expression of integer type shall not be implicitly converted to a different underlying type +* under some circumstances.</td> +* <td>An operand of essentially enum type is being converted to unsigned type as a result of an arithmetic or +* conditional operation. The conversion does not have any unintended effect.</td> +* </tr> +* <tr> +* <td>20.6</td> +* <td>R</td> +* <td>The macro offsetof, in library <stddef.h>, shall not be used.</td> +* <td>The only HW block register offsets are defined using this macro.</td> +* </tr> +* </table> +*/ #ifndef CY_DEVICE_H_ #define CY_DEVICE_H_ @@ -55,7 +80,9 @@ #include "ip/cyip_i2s.h" #include "ip/cyip_pdm.h" #include "ip/cyip_lcd.h" +#include "ip/cyip_lcd_v2.h" #include "ip/cyip_sdhc.h" +#include "ip/cyip_canfd.h" #include "ip/cyip_smartio.h" /* Device descriptor type */ @@ -73,21 +100,19 @@ typedef struct uint32_t ipcBase; uint32_t cryptoBase; - /* IP block versions */ + /* IP block versions: [7:4] major, [3:0] minor */ uint8_t cpussVersion; uint8_t cryptoVersion; uint8_t dwVersion; - uint8_t flashcVersion; - uint8_t gpioVersion; - uint8_t hsiomVersion; uint8_t ipcVersion; uint8_t periVersion; - uint8_t protVersion; + uint8_t srssVersion; /* Parameters */ uint8_t cpussIpcNr; uint8_t cpussIpcIrqNr; - uint8_t cpussDwChNr; + uint8_t cpussDw0ChNr; + uint8_t cpussDw1ChNr; uint8_t cpussFlashPaSize; int16_t cpussIpc0Irq; int16_t cpussFmIrq; @@ -189,7 +214,10 @@ void Cy_PDL_Init(const cy_stc_device_t * device); * Register Access Helper Macros *******************************************************************************/ -#define CY_CRYPTO_HW_V1 (1U == cy_device->cryptoVersion) /* true if the mxcrypto version is 1 */ +#define CY_CRYPTO_V1 (0x20U > cy_device->cryptoVersion) /* true if the mxcrypto version is 1.x */ + +#define CY_SRSS_V1_3 (0x13U == cy_device->srssVersion) +#define CY_SRSS_MFO_PRESENT (CY_SRSS_V1_3) #define CY_SRSS_NUM_CLKPATH ((uint32_t)(cy_device->srssNumClkpath)) #define CY_SRSS_NUM_PLL ((uint32_t)(cy_device->srssNumPll)) @@ -222,6 +250,8 @@ void Cy_PDL_Init(const cy_stc_device_t * device); #define SRSS_CLK_ECO_CONFIG (((SRSS_V1_Type *) SRSS)->CLK_ECO_CONFIG) #define SRSS_CLK_ECO_STATUS (((SRSS_V1_Type *) SRSS)->CLK_ECO_STATUS) #define SRSS_CLK_PILO_CONFIG (((SRSS_V1_Type *) SRSS)->CLK_PILO_CONFIG) +#define SRSS_CLK_MF_SELECT (((SRSS_V1_Type *) SRSS)->CLK_MF_SELECT) /* for CY_SRSS_V1_3 only */ +#define SRSS_CLK_MFO_CONFIG (((SRSS_V1_Type *) SRSS)->CLK_MFO_CONFIG) /* for CY_SRSS_V1_3 only */ #define SRSS_CLK_FLL_CONFIG (((SRSS_V1_Type *) SRSS)->CLK_FLL_CONFIG) #define SRSS_CLK_FLL_CONFIG2 (((SRSS_V1_Type *) SRSS)->CLK_FLL_CONFIG2) #define SRSS_CLK_FLL_CONFIG3 (((SRSS_V1_Type *) SRSS)->CLK_FLL_CONFIG3) @@ -267,6 +297,54 @@ void Cy_PDL_Init(const cy_stc_device_t * device); #define BACKUP_RESET (((BACKUP_V1_Type *) BACKUP)->RESET) /******************************************************************************* +* CANFD +*******************************************************************************/ + +#define CANFD_CTL(base) (((CANFD_V1_Type *)(base))->CTL) +#define CANFD_STATUS(base) (((CANFD_V1_Type *)(base))->STATUS) +#define CANFD_NBTP(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.NBTP) +#define CANFD_IR(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.IR) +#define CANFD_IE(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.IE) +#define CANFD_ILS(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.ILS) +#define CANFD_ILE(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.ILE) +#define CANFD_CCCR(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.CCCR) +#define CANFD_SIDFC(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.SIDFC) +#define CANFD_XIDFC(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.XIDFC) +#define CANFD_XIDAM(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.XIDAM) +#define CANFD_RXESC(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.RXESC) +#define CANFD_RXF0C(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.RXF0C) +#define CANFD_RXF1C(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.RXF1C) +#define CANFD_RXFTOP_CTL(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].RXFTOP_CTL) +#define CANFD_RXBC(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.RXBC) +#define CANFD_TXESC(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.TXESC) +#define CANFD_TXEFC(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.TXEFC) +#define CANFD_TXBC(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.TXBC) +#define CANFD_DBTP(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.DBTP) +#define CANFD_TDCR(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.TDCR) +#define CANFD_GFC(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.GFC) +#define CANFD_TXBRP(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.TXBRP) +#define CANFD_TXBAR(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.TXBAR) +#define CANFD_TXBCR(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.TXBCR) +#define CANFD_TXBTO(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.TXBTO) +#define CANFD_TXBCF(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.TXBCF) +#define CANFD_TXBTIE(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.TXBTIE) +#define CANFD_TXBCIE(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.TXBCIE) +#define CANFD_NDAT1(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.NDAT1) +#define CANFD_NDAT2(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.NDAT2) +#define CANFD_RXF0S(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.RXF0S) +#define CANFD_RXFTOP0_DATA(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].RXFTOP0_DATA) +#define CANFD_RXFTOP1_DATA(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].RXFTOP1_DATA) +#define CANFD_RXF0A(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.RXF0A) +#define CANFD_RXF1S(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.RXF1S) +#define CANFD_RXF1A(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.RXF1A) +#define CANFD_PSR(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.PSR) +#define CANFD_TEST(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.TEST) +#define CANFD_CREL(base, chan) (((CANFD_V1_Type *)(base))->CH[chan].M_TTCAN.CREL) + +#define CY_CANFD_CHANNELS_NUM (0x1UL) + + +/******************************************************************************* * FLASHC *******************************************************************************/ @@ -303,9 +381,9 @@ void Cy_PDL_Init(const cy_stc_device_t * device); #define SFLASH_CPUSS_TRIM_ROM_CTL_ULP (((SFLASH_V1_Type *) SFLASH)->CPUSS_TRIM_ROM_CTL_ULP) #define SFLASH_CPUSS_TRIM_RAM_CTL_ULP (((SFLASH_V1_Type *) SFLASH)->CPUSS_TRIM_RAM_CTL_ULP) #define SFLASH_CPUSS_TRIM_ROM_CTL_HALF_LP (((SFLASH_V1_Type *) SFLASH)->CPUSS_TRIM_ROM_CTL_HALF_LP) -#define SFLASH_CPUSS_TRIM_ROM_CTL_HALF_LP (((SFLASH_V1_Type *) SFLASH)->CPUSS_TRIM_ROM_CTL_HALF_LP) -#define SFLASH_CPUSS_TRIM_RAM_CTL_HALF_ULP (((SFLASH_V1_Type *) SFLASH)->CPUSS_TRIM_RAM_CTL_HALF_ULP) +#define SFLASH_CPUSS_TRIM_RAM_CTL_HALF_LP (((SFLASH_V1_Type *) SFLASH)->CPUSS_TRIM_RAM_CTL_HALF_LP) #define SFLASH_CPUSS_TRIM_ROM_CTL_HALF_ULP (((SFLASH_V1_Type *) SFLASH)->CPUSS_TRIM_ROM_CTL_HALF_ULP) +#define SFLASH_CPUSS_TRIM_RAM_CTL_HALF_ULP (((SFLASH_V1_Type *) SFLASH)->CPUSS_TRIM_RAM_CTL_HALF_ULP) #define SFLASH_CSD0_ADC_VREF0_TRIM (((SFLASH_V1_Type *) SFLASH)->CSDV2_CSD0_ADC_VREF0) @@ -317,7 +395,7 @@ void Cy_PDL_Init(const cy_stc_device_t * device); * CPUSS *******************************************************************************/ -#define CY_CPUSS_V1 (1U == cy_device->cpussVersion) +#define CY_CPUSS_V1 (0x20U > cy_device->cpussVersion) #define CY_CPUSS_NOT_CONNECTED_IRQN ((uint32_t)(cy_device->cpussNotConnectedIrq)) #define CY_CPUSS_DISCONNECTED_IRQN ((cy_en_intr_t)CY_CPUSS_NOT_CONNECTED_IRQN) @@ -593,9 +671,11 @@ void Cy_PDL_Init(const cy_stc_device_t * device); * DW *******************************************************************************/ -#define CY_DW_V1 (1U == cy_device->dwVersion) -#define CY_DW_CRC (1U < cy_device->dwVersion) -#define CY_DW_CH_NR (cy_device->cpussDwChNr) +#define CY_DW_V1 (0x20U > cy_device->dwVersion) +#define CY_DW_CRC (0x20U <= cy_device->dwVersion) +#define CY_DW0_BASE ((DW_Type*) 0x40280000UL) +#define CY_DW0_CH_NR (cy_device->cpussDw0ChNr) +#define CY_DW1_CH_NR (cy_device->cpussDw1ChNr) #define CY_DW_CH_CTL_PRIO_Pos ((uint32_t)(cy_device->dwChCtlPrioPos)) #define CY_DW_CH_CTL_PRIO_Msk ((uint32_t)(0x3UL << CY_DW_CH_CTL_PRIO_Pos)) @@ -651,7 +731,7 @@ void Cy_PDL_Init(const cy_stc_device_t * device); *******************************************************************************/ #define CY_PERI_BASE ((PERI_V1_Type *) cy_device->periBase) -#define CY_PERI_V1 (1U == cy_device->periVersion) /* true if the mxperi version is 1 */ +#define CY_PERI_V1 (0x20U > cy_device->periVersion) /* true if the mxperi version is 1.x */ #define CY_PERI_V2_TR_GR_SIZE (sizeof(PERI_TR_GR_V2_Type)) #define CY_PERI_TR_CTL_NUM (cy_device->periTrGrSize / sizeof(uint32_t)) #define CY_PERI_TR_CTL_SEL_Pos (0UL) @@ -827,8 +907,10 @@ void Cy_PDL_Init(const cy_stc_device_t * device); * LCD *******************************************************************************/ -#define LCD_OCTET_NUM (8U) /* number of octets */ -#define LCD_COM_NUM (8U) /* maximum number of commons */ +#define LCD_OCTET_NUM (8U) /* LCD_NUMPORTS - number of octets supporting up to 4 COMs */ +#define LCD_OCTET_NUM_8 (8U) /* LCD_NUMPORTS8 - number of octets supporting up to 8 COMs */ +#define LCD_OCTET_NUM_16 (0U) /* LCD_NUMPORTS16 - number of octets supporting up to 16 COMs */ +#define LCD_COM_NUM (8U) /* LCD_CHIP_TOP_COM_NR - maximum number of commons */ #define LCD_ID(base) (((LCD_V1_Type*)(base))->ID) #define LCD_CONTROL(base) (((LCD_V1_Type*)(base))->CONTROL) @@ -843,6 +925,8 @@ void Cy_PDL_Init(const cy_stc_device_t * device); * IPC *******************************************************************************/ +#define CY_IPC_V1 (0x20u > cy_device->ipcVersion) /* true if the IPC version is 1.x */ + #define REG_IPC_STRUCT_ACQUIRE(base) (((IPC_STRUCT_V1_Type*)(base))->ACQUIRE) #define REG_IPC_STRUCT_RELEASE(base) (((IPC_STRUCT_V1_Type*)(base))->RELEASE) #define REG_IPC_STRUCT_NOTIFY(base) (((IPC_STRUCT_V1_Type*)(base))->NOTIFY) @@ -864,7 +948,7 @@ void Cy_PDL_Init(const cy_stc_device_t * device); #define CY_IPC_CHAN_SYSCALL_CM0 (0U) /* System calls for the CM0 processor */ #define CY_IPC_CHAN_SYSCALL_CM4 (1U) /* System calls for the 1st non-CM0 processor */ #define CY_IPC_CHAN_SYSCALL_DAP (2UL) /* System calls for the DAP */ -#define CY_IPC_CHAN_SEMA (4UL) /* IPC data channel for the Semaphores */ +#define CY_IPC_CHAN_SEMA (3UL) /* IPC data channel for the Semaphores */ #define CY_IPC_CHAN_CYPIPE_EP0 (5UL) /* IPC data channel for CYPIPE EP0 */ #define CY_IPC_CHAN_CYPIPE_EP1 (6UL) /* IPC data channel for CYPIPE EP1 */ #define CY_IPC_CHAN_DDFT (7UL) /* IPC data channel for DDFT */ diff --git a/platform/ext/target/psoc64/Native_Driver/include/cy_dma.h b/platform/ext/target/psoc64/Native_Driver/include/cy_dma.h index 6263528e8e..514ba7b8ee 100644 --- a/platform/ext/target/psoc64/Native_Driver/include/cy_dma.h +++ b/platform/ext/target/psoc64/Native_Driver/include/cy_dma.h @@ -1,6 +1,6 @@ /***************************************************************************//** * \file cy_dma.h -* \version 2.10 +* \version 2.20 * * \brief * The header file of the DMA driver. @@ -81,7 +81,7 @@ * function for each DMA channel. * * For example: -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Enable +* \snippet dma/snippet/main.c snippet_Cy_DMA_Enable * * \section group_dma_more_information More Information. * See: the DMA chapter of the device technical reference manual (TRM); @@ -121,6 +121,11 @@ * <table class="doxtable"> * <tr><th>Version</th><th>Changes</th><th>Reason for Change</th></tr> * <tr> +* <td>2.20</td> +* <td>The channel number validation method is updated.</td> +* <td>New devices support.</td> +* </tr> +* <tr> * <td rowspan="3">2.10</td> * <td>Flattened the organization of the driver source code into the single source directory and the single include directory.</td> * <td>Driver library directory-structure simplification.</td> @@ -203,7 +208,7 @@ extern "C" { #define CY_DMA_DRV_VERSION_MAJOR 2 /** The driver minor version */ -#define CY_DMA_DRV_VERSION_MINOR 10 +#define CY_DMA_DRV_VERSION_MINOR 20 /** The DMA driver identifier */ #define CY_DMA_ID (CY_PDL_DRV_ID(0x13U)) @@ -341,8 +346,8 @@ typedef enum (CY_DMA_2D_TRANSFER == (descrType)) || \ (CY_DMA_CRC_TRANSFER == (descrType))) -#define CY_DMA_IS_CH_NR_VALID(chNr) ((chNr) < CY_DW_CH_NR) - +#define CY_DMA_IS_CH_NR_VALID(base, chNr) ((CY_DW0_BASE == (base)) ? ((chNr) < CY_DW0_CH_NR) : \ + ((chNr) < CY_DW1_CH_NR)) /* The descriptor structure bit field definitions */ #define CY_DMA_CTL_RETRIG_Pos (0UL) @@ -592,7 +597,7 @@ __STATIC_INLINE cy_en_dma_channel_state_t Cy_DMA_Descriptor_GetChannelState * The pointer to the hardware DMA block. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Enable +* \snippet dma/snippet/main.c snippet_Cy_DMA_Enable * *******************************************************************************/ __STATIC_INLINE void Cy_DMA_Enable(DW_Type * base) @@ -611,7 +616,7 @@ __STATIC_INLINE void Cy_DMA_Enable(DW_Type * base) * The pointer to the hardware DMA block. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Disable +* \snippet dma/snippet/main.c snippet_Cy_DMA_Disable * *******************************************************************************/ __STATIC_INLINE void Cy_DMA_Disable(DW_Type * base) @@ -635,7 +640,7 @@ __STATIC_INLINE void Cy_DMA_Disable(DW_Type * base) * DMA block. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Disable +* \snippet dma/snippet/main.c snippet_Cy_DMA_Disable * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_DMA_GetActiveChannel(DW_Type const * base) @@ -657,7 +662,7 @@ __STATIC_INLINE uint32_t Cy_DMA_GetActiveChannel(DW_Type const * base) * Returns the pointer to the source of transfer. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_GetActiveSrcAddress +* \snippet dma/snippet/main.c snippet_Cy_DMA_GetActiveSrcAddress * *******************************************************************************/ __STATIC_INLINE void * Cy_DMA_GetActiveSrcAddress(DW_Type * base) @@ -679,7 +684,7 @@ __STATIC_INLINE void * Cy_DMA_GetActiveSrcAddress(DW_Type * base) * Returns the pointer to the destination of transfer. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_GetActiveSrcAddress +* \snippet dma/snippet/main.c snippet_Cy_DMA_GetActiveSrcAddress * *******************************************************************************/ __STATIC_INLINE void * Cy_DMA_GetActiveDstAddress(DW_Type * base) @@ -708,7 +713,7 @@ __STATIC_INLINE void * Cy_DMA_GetActiveDstAddress(DW_Type * base) * The source address value for the descriptor. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_SetterFunctions +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_SetterFunctions * *******************************************************************************/ __STATIC_INLINE void Cy_DMA_Descriptor_SetSrcAddress(cy_stc_dma_descriptor_t * descriptor, void const * srcAddress) @@ -730,7 +735,7 @@ __STATIC_INLINE void Cy_DMA_Descriptor_SetSrcAddress(cy_stc_dma_descriptor_t * d * The source address value of the descriptor. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_GetterFunctions +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_GetterFunctions * *******************************************************************************/ __STATIC_INLINE void * Cy_DMA_Descriptor_GetSrcAddress(cy_stc_dma_descriptor_t const * descriptor) @@ -752,7 +757,7 @@ __STATIC_INLINE void * Cy_DMA_Descriptor_GetSrcAddress(cy_stc_dma_descriptor_t c * The destination address value for the descriptor. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_SetterFunctions +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_SetterFunctions * *******************************************************************************/ __STATIC_INLINE void Cy_DMA_Descriptor_SetDstAddress(cy_stc_dma_descriptor_t * descriptor, void const * dstAddress) @@ -774,7 +779,7 @@ __STATIC_INLINE void Cy_DMA_Descriptor_SetDstAddress(cy_stc_dma_descriptor_t * d * The destination address value of the descriptor. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_GetterFunctions +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_GetterFunctions * *******************************************************************************/ __STATIC_INLINE void * Cy_DMA_Descriptor_GetDstAddress(cy_stc_dma_descriptor_t const * descriptor) @@ -796,7 +801,7 @@ __STATIC_INLINE void * Cy_DMA_Descriptor_GetDstAddress(cy_stc_dma_descriptor_t c * The interrupt type set for the descriptor. \ref cy_en_dma_trigger_type_t * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_SetterFunctions +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_SetterFunctions * *******************************************************************************/ __STATIC_INLINE void Cy_DMA_Descriptor_SetInterruptType(cy_stc_dma_descriptor_t * descriptor, cy_en_dma_trigger_type_t interruptType) @@ -820,7 +825,7 @@ __STATIC_INLINE void Cy_DMA_Descriptor_SetInterruptType(cy_stc_dma_descriptor_t * The Interrupt-Type \ref cy_en_dma_trigger_type_t. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_GetterFunctions +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_GetterFunctions * *******************************************************************************/ __STATIC_INLINE cy_en_dma_trigger_type_t Cy_DMA_Descriptor_GetInterruptType(cy_stc_dma_descriptor_t const * descriptor) @@ -842,7 +847,7 @@ __STATIC_INLINE cy_en_dma_trigger_type_t Cy_DMA_Descriptor_GetInterruptType(cy_s * The Trigger In Type parameter \ref cy_en_dma_trigger_type_t * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_SetterFunctions +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_SetterFunctions * *******************************************************************************/ __STATIC_INLINE void Cy_DMA_Descriptor_SetTriggerInType(cy_stc_dma_descriptor_t * descriptor, cy_en_dma_trigger_type_t triggerInType) @@ -866,7 +871,7 @@ __STATIC_INLINE void Cy_DMA_Descriptor_SetTriggerInType(cy_stc_dma_descriptor_t * The Trigger-In-Type \ref cy_en_dma_trigger_type_t * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_GetterFunctions +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_GetterFunctions * *******************************************************************************/ __STATIC_INLINE cy_en_dma_trigger_type_t Cy_DMA_Descriptor_GetTriggerInType(cy_stc_dma_descriptor_t const * descriptor) @@ -888,7 +893,7 @@ __STATIC_INLINE cy_en_dma_trigger_type_t Cy_DMA_Descriptor_GetTriggerInType(cy_s * The Trigger-Out-Type set for the descriptor. \ref cy_en_dma_trigger_type_t * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_SetterFunctions +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_SetterFunctions * *******************************************************************************/ __STATIC_INLINE void Cy_DMA_Descriptor_SetTriggerOutType(cy_stc_dma_descriptor_t * descriptor, cy_en_dma_trigger_type_t triggerOutType) @@ -912,7 +917,7 @@ __STATIC_INLINE void Cy_DMA_Descriptor_SetTriggerOutType(cy_stc_dma_descriptor_t * The Trigger-Out-Type parameter \ref cy_en_dma_trigger_type_t. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_GetterFunctions +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_GetterFunctions * *******************************************************************************/ __STATIC_INLINE cy_en_dma_trigger_type_t Cy_DMA_Descriptor_GetTriggerOutType(cy_stc_dma_descriptor_t const * descriptor) @@ -934,7 +939,7 @@ __STATIC_INLINE cy_en_dma_trigger_type_t Cy_DMA_Descriptor_GetTriggerOutType(cy_ * The Data Element Size \ref cy_en_dma_data_size_t * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_SetterFunctions +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_SetterFunctions * *******************************************************************************/ __STATIC_INLINE void Cy_DMA_Descriptor_SetDataSize(cy_stc_dma_descriptor_t * descriptor, cy_en_dma_data_size_t dataSize) @@ -958,7 +963,7 @@ __STATIC_INLINE void Cy_DMA_Descriptor_SetDataSize(cy_stc_dma_descriptor_t * des * The Data Element Size \ref cy_en_dma_data_size_t. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_GetterFunctions +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_GetterFunctions * *******************************************************************************/ __STATIC_INLINE cy_en_dma_data_size_t Cy_DMA_Descriptor_GetDataSize(cy_stc_dma_descriptor_t const * descriptor) @@ -980,7 +985,7 @@ __STATIC_INLINE cy_en_dma_data_size_t Cy_DMA_Descriptor_GetDataSize(cy_stc_dma_d * The Source Transfer Size \ref cy_en_dma_transfer_size_t. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_SetterFunctions +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_SetterFunctions * *******************************************************************************/ __STATIC_INLINE void Cy_DMA_Descriptor_SetSrcTransferSize(cy_stc_dma_descriptor_t * descriptor, cy_en_dma_transfer_size_t srcTransferSize) @@ -1004,7 +1009,7 @@ __STATIC_INLINE void Cy_DMA_Descriptor_SetSrcTransferSize(cy_stc_dma_descriptor_ * The Source Transfer Size \ref cy_en_dma_transfer_size_t. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_GetterFunctions +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_GetterFunctions * *******************************************************************************/ __STATIC_INLINE cy_en_dma_transfer_size_t Cy_DMA_Descriptor_GetSrcTransferSize(cy_stc_dma_descriptor_t const * descriptor) @@ -1026,7 +1031,7 @@ __STATIC_INLINE cy_en_dma_transfer_size_t Cy_DMA_Descriptor_GetSrcTransferSize(c * The Destination Transfer Size \ref cy_en_dma_transfer_size_t. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_SetterFunctions +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_SetterFunctions * *******************************************************************************/ __STATIC_INLINE void Cy_DMA_Descriptor_SetDstTransferSize(cy_stc_dma_descriptor_t * descriptor, cy_en_dma_transfer_size_t dstTransferSize) @@ -1050,7 +1055,7 @@ __STATIC_INLINE void Cy_DMA_Descriptor_SetDstTransferSize(cy_stc_dma_descriptor_ * The Destination Transfer Size \ref cy_en_dma_transfer_size_t. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_GetterFunctions +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_GetterFunctions * *******************************************************************************/ __STATIC_INLINE cy_en_dma_transfer_size_t Cy_DMA_Descriptor_GetDstTransferSize(cy_stc_dma_descriptor_t const * descriptor) @@ -1074,7 +1079,7 @@ __STATIC_INLINE cy_en_dma_transfer_size_t Cy_DMA_Descriptor_GetDstTransferSize(c * should wait for the input trigger to be deactivated. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_SetterFunctions +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_SetterFunctions * *******************************************************************************/ __STATIC_INLINE void Cy_DMA_Descriptor_SetRetrigger(cy_stc_dma_descriptor_t * descriptor, cy_en_dma_retrigger_t retrigger) @@ -1099,7 +1104,7 @@ __STATIC_INLINE void Cy_DMA_Descriptor_SetRetrigger(cy_stc_dma_descriptor_t * de * The Retrigger setting \ref cy_en_dma_retrigger_t. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_GetterFunctions +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_GetterFunctions * *******************************************************************************/ __STATIC_INLINE cy_en_dma_retrigger_t Cy_DMA_Descriptor_GetRetrigger(cy_stc_dma_descriptor_t const * descriptor) @@ -1121,7 +1126,7 @@ __STATIC_INLINE cy_en_dma_retrigger_t Cy_DMA_Descriptor_GetRetrigger(cy_stc_dma_ * The descriptor type \ref cy_en_dma_descriptor_type_t. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_GetterFunctions +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_GetterFunctions * *******************************************************************************/ __STATIC_INLINE cy_en_dma_descriptor_type_t Cy_DMA_Descriptor_GetDescriptorType(cy_stc_dma_descriptor_t const * descriptor) @@ -1143,7 +1148,7 @@ __STATIC_INLINE cy_en_dma_descriptor_type_t Cy_DMA_Descriptor_GetDescriptorType( * The channel state \ref cy_en_dma_channel_state_t. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_SetterFunctions +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_SetterFunctions * *******************************************************************************/ __STATIC_INLINE void Cy_DMA_Descriptor_SetChannelState(cy_stc_dma_descriptor_t * descriptor, cy_en_dma_channel_state_t channelState) @@ -1167,7 +1172,7 @@ __STATIC_INLINE void Cy_DMA_Descriptor_SetChannelState(cy_stc_dma_descriptor_t * * The Channel State setting \ref cy_en_dma_channel_state_t. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_GetterFunctions +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_GetterFunctions * *******************************************************************************/ __STATIC_INLINE cy_en_dma_channel_state_t Cy_DMA_Descriptor_GetChannelState(cy_stc_dma_descriptor_t const * descriptor) @@ -1190,7 +1195,7 @@ __STATIC_INLINE cy_en_dma_channel_state_t Cy_DMA_Descriptor_GetChannelState(cy_s * The number of data elements to transfer in the X loop. Valid range is 1 ... 256. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_SetterFunctions +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_SetterFunctions * *******************************************************************************/ __STATIC_INLINE void Cy_DMA_Descriptor_SetXloopDataCount(cy_stc_dma_descriptor_t * descriptor, uint32_t xCount) @@ -1216,7 +1221,7 @@ __STATIC_INLINE void Cy_DMA_Descriptor_SetXloopDataCount(cy_stc_dma_descriptor_t * The number of data elements to transfer in the X loop. The range is 1 ... 256. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_GetterFunctions +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_GetterFunctions * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_DMA_Descriptor_GetXloopDataCount(cy_stc_dma_descriptor_t const * descriptor) @@ -1241,7 +1246,7 @@ __STATIC_INLINE uint32_t Cy_DMA_Descriptor_GetXloopDataCount(cy_stc_dma_descript * The value of the source increment. The valid range is -2048 ... 2047. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_SetterFunctions +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_SetterFunctions * *******************************************************************************/ __STATIC_INLINE void Cy_DMA_Descriptor_SetXloopSrcIncrement(cy_stc_dma_descriptor_t * descriptor, int32_t srcXincrement) @@ -1267,7 +1272,7 @@ __STATIC_INLINE void Cy_DMA_Descriptor_SetXloopSrcIncrement(cy_stc_dma_descripto * The value of the source increment. The range is -2048 ... 2047. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_GetterFunctions +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_GetterFunctions * *******************************************************************************/ __STATIC_INLINE int32_t Cy_DMA_Descriptor_GetXloopSrcIncrement(cy_stc_dma_descriptor_t const * descriptor) @@ -1292,7 +1297,7 @@ __STATIC_INLINE int32_t Cy_DMA_Descriptor_GetXloopSrcIncrement(cy_stc_dma_descri * The value of the destination increment. The valid range is -2048 ... 2047. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_SetterFunctions +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_SetterFunctions * *******************************************************************************/ __STATIC_INLINE void Cy_DMA_Descriptor_SetXloopDstIncrement(cy_stc_dma_descriptor_t * descriptor, int32_t dstXincrement) @@ -1318,7 +1323,7 @@ __STATIC_INLINE void Cy_DMA_Descriptor_SetXloopDstIncrement(cy_stc_dma_descripto * The value of the destination increment. The range is -2048 ... 2047. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_GetterFunctions +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_GetterFunctions * *******************************************************************************/ __STATIC_INLINE int32_t Cy_DMA_Descriptor_GetXloopDstIncrement(cy_stc_dma_descriptor_t const * descriptor) @@ -1343,7 +1348,7 @@ __STATIC_INLINE int32_t Cy_DMA_Descriptor_GetXloopDstIncrement(cy_stc_dma_descri * The number of X loops to execute in the Y loop. The valid range is 1 ... 256. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_SetterFunctions +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_SetterFunctions * *******************************************************************************/ __STATIC_INLINE void Cy_DMA_Descriptor_SetYloopDataCount(cy_stc_dma_descriptor_t * descriptor, uint32_t yCount) @@ -1369,7 +1374,7 @@ __STATIC_INLINE void Cy_DMA_Descriptor_SetYloopDataCount(cy_stc_dma_descriptor_t * The number of X loops to execute in the Y loop. The range is 1 ... 256. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_GetterFunctions +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_GetterFunctions * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_DMA_Descriptor_GetYloopDataCount(cy_stc_dma_descriptor_t const * descriptor) @@ -1394,7 +1399,7 @@ __STATIC_INLINE uint32_t Cy_DMA_Descriptor_GetYloopDataCount(cy_stc_dma_descript * The value of the source increment. The valid range is -2048 ... 2047. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_SetterFunctions +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_SetterFunctions * *******************************************************************************/ __STATIC_INLINE void Cy_DMA_Descriptor_SetYloopSrcIncrement(cy_stc_dma_descriptor_t * descriptor, int32_t srcYincrement) @@ -1420,7 +1425,7 @@ __STATIC_INLINE void Cy_DMA_Descriptor_SetYloopSrcIncrement(cy_stc_dma_descripto * The value of the source increment. The range is -2048 ... 2047. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_GetterFunctions +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_GetterFunctions * *******************************************************************************/ __STATIC_INLINE int32_t Cy_DMA_Descriptor_GetYloopSrcIncrement(cy_stc_dma_descriptor_t const * descriptor) @@ -1445,7 +1450,7 @@ __STATIC_INLINE int32_t Cy_DMA_Descriptor_GetYloopSrcIncrement(cy_stc_dma_descri * The value of the destination increment. The valid range is -2048 ... 2047. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_SetterFunctions +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_SetterFunctions * *******************************************************************************/ __STATIC_INLINE void Cy_DMA_Descriptor_SetYloopDstIncrement(cy_stc_dma_descriptor_t * descriptor, int32_t dstYincrement) @@ -1471,7 +1476,7 @@ __STATIC_INLINE void Cy_DMA_Descriptor_SetYloopDstIncrement(cy_stc_dma_descripto * The value of the destination increment. The range is -2048 ... 2047. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_GetterFunctions +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_GetterFunctions * *******************************************************************************/ __STATIC_INLINE int32_t Cy_DMA_Descriptor_GetYloopDstIncrement(cy_stc_dma_descriptor_t const * descriptor) @@ -1507,12 +1512,12 @@ __STATIC_INLINE int32_t Cy_DMA_Descriptor_GetYloopDstIncrement(cy_stc_dma_descri * This is the descriptor to be associated with the channel. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Enable +* \snippet dma/snippet/main.c snippet_Cy_DMA_Enable * *******************************************************************************/ __STATIC_INLINE void Cy_DMA_Channel_SetDescriptor(DW_Type * base, uint32_t channel, cy_stc_dma_descriptor_t const * descriptor) { - CY_ASSERT_L1(CY_DMA_IS_CH_NR_VALID(channel)); + CY_ASSERT_L1(CY_DMA_IS_CH_NR_VALID(base, channel)); DW_CH_CURR_PTR(base, channel) = (uint32_t)descriptor; DW_CH_IDX(base, channel) &= (uint32_t) ~(DW_CH_STRUCT_CH_IDX_X_IDX_Msk | DW_CH_STRUCT_CH_IDX_Y_IDX_Msk); @@ -1532,12 +1537,12 @@ __STATIC_INLINE void Cy_DMA_Channel_SetDescriptor(DW_Type * base, uint32_t chann * The channel number. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Enable +* \snippet dma/snippet/main.c snippet_Cy_DMA_Enable * *******************************************************************************/ __STATIC_INLINE void Cy_DMA_Channel_Enable(DW_Type * base, uint32_t channel) { - CY_ASSERT_L1(CY_DMA_IS_CH_NR_VALID(channel)); + CY_ASSERT_L1(CY_DMA_IS_CH_NR_VALID(base, channel)); DW_CH_CTL(base, channel) |= DW_CH_STRUCT_CH_CTL_ENABLED_Msk; } @@ -1556,12 +1561,12 @@ __STATIC_INLINE void Cy_DMA_Channel_Enable(DW_Type * base, uint32_t channel) * The channel number. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Disable +* \snippet dma/snippet/main.c snippet_Cy_DMA_Disable * *******************************************************************************/ __STATIC_INLINE void Cy_DMA_Channel_Disable(DW_Type * base, uint32_t channel) { - CY_ASSERT_L1(CY_DMA_IS_CH_NR_VALID(channel)); + CY_ASSERT_L1(CY_DMA_IS_CH_NR_VALID(base, channel)); DW_CH_CTL(base, channel) &= (uint32_t) ~DW_CH_STRUCT_CH_CTL_ENABLED_Msk; } @@ -1583,12 +1588,12 @@ __STATIC_INLINE void Cy_DMA_Channel_Disable(DW_Type * base, uint32_t channel) * The priority to be set for the DMA channel. The allowed values are 0,1,2,3. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Enable +* \snippet dma/snippet/main.c snippet_Cy_DMA_Enable * *******************************************************************************/ __STATIC_INLINE void Cy_DMA_Channel_SetPriority(DW_Type * base, uint32_t channel, uint32_t priority) { - CY_ASSERT_L1(CY_DMA_IS_CH_NR_VALID(channel)); + CY_ASSERT_L1(CY_DMA_IS_CH_NR_VALID(base, channel)); CY_ASSERT_L2(CY_DMA_IS_PRIORITY_VALID(priority)); CY_REG32_CLR_SET(DW_CH_CTL(base, channel), CY_DW_CH_CTL_PRIO, priority); @@ -1611,12 +1616,12 @@ __STATIC_INLINE void Cy_DMA_Channel_SetPriority(DW_Type * base, uint32_t channel * The priority of the channel. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Disable +* \snippet dma/snippet/main.c snippet_Cy_DMA_Disable * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_DMA_Channel_GetPriority(DW_Type const * base, uint32_t channel) { - CY_ASSERT_L1(CY_DMA_IS_CH_NR_VALID(channel)); + CY_ASSERT_L1(CY_DMA_IS_CH_NR_VALID(base, channel)); return ((uint32_t) _FLD2VAL(CY_DW_CH_CTL_PRIO, DW_CH_CTL(base, channel))); } @@ -1638,12 +1643,12 @@ __STATIC_INLINE uint32_t Cy_DMA_Channel_GetPriority(DW_Type const * base, uint32 * The pointer to the descriptor associated with the channel. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_Descriptor_Deinit +* \snippet dma/snippet/main.c snippet_Cy_DMA_Descriptor_Deinit * *******************************************************************************/ __STATIC_INLINE cy_stc_dma_descriptor_t * Cy_DMA_Channel_GetCurrentDescriptor(DW_Type const * base, uint32_t channel) { - CY_ASSERT_L1(CY_DMA_IS_CH_NR_VALID(channel)); + CY_ASSERT_L1(CY_DMA_IS_CH_NR_VALID(base, channel)); return ((cy_stc_dma_descriptor_t*)(DW_CH_CURR_PTR(base, channel))); } @@ -1666,12 +1671,12 @@ __STATIC_INLINE cy_stc_dma_descriptor_t * Cy_DMA_Channel_GetCurrentDescriptor(DW * The status of an interrupt for the specified channel. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_GetInterruptStatus +* \snippet dma/snippet/main.c snippet_Cy_DMA_GetInterruptStatus * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_DMA_Channel_GetInterruptStatus(DW_Type const * base, uint32_t channel) { - CY_ASSERT_L1(CY_DMA_IS_CH_NR_VALID(channel)); + CY_ASSERT_L1(CY_DMA_IS_CH_NR_VALID(base, channel)); return (DW_CH_INTR(base, channel)); } @@ -1693,12 +1698,12 @@ __STATIC_INLINE uint32_t Cy_DMA_Channel_GetInterruptStatus(DW_Type const * base, * The cause \ref cy_en_dma_intr_cause_t of the interrupt. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_ClearInterrupt +* \snippet dma/snippet/main.c snippet_Cy_DMA_ClearInterrupt * *******************************************************************************/ __STATIC_INLINE cy_en_dma_intr_cause_t Cy_DMA_Channel_GetStatus(DW_Type const * base, uint32_t channel) { - CY_ASSERT_L1(CY_DMA_IS_CH_NR_VALID(channel)); + CY_ASSERT_L1(CY_DMA_IS_CH_NR_VALID(base, channel)); return ((cy_en_dma_intr_cause_t) _FLD2VAL(DW_CH_STRUCT_CH_STATUS_INTR_CAUSE, DW_CH_STATUS(base, channel))); } @@ -1717,12 +1722,12 @@ __STATIC_INLINE cy_en_dma_intr_cause_t Cy_DMA_Channel_GetStatus(DW_Type const * * The channel number. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_ClearInterrupt +* \snippet dma/snippet/main.c snippet_Cy_DMA_ClearInterrupt * *******************************************************************************/ __STATIC_INLINE void Cy_DMA_Channel_ClearInterrupt(DW_Type * base, uint32_t channel) { - CY_ASSERT_L1(CY_DMA_IS_CH_NR_VALID(channel)); + CY_ASSERT_L1(CY_DMA_IS_CH_NR_VALID(base, channel)); DW_CH_INTR(base, channel) = CY_DMA_INTR_MASK; (void) DW_CH_INTR(base, channel); @@ -1742,12 +1747,12 @@ __STATIC_INLINE void Cy_DMA_Channel_ClearInterrupt(DW_Type * base, uint32_t chan * The channel number. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_SetInterruptMask +* \snippet dma/snippet/main.c snippet_Cy_DMA_SetInterruptMask * *******************************************************************************/ __STATIC_INLINE void Cy_DMA_Channel_SetInterrupt(DW_Type * base, uint32_t channel) { - CY_ASSERT_L1(CY_DMA_IS_CH_NR_VALID(channel)); + CY_ASSERT_L1(CY_DMA_IS_CH_NR_VALID(base, channel)); DW_CH_INTR_SET(base, channel) = CY_DMA_INTR_MASK; } @@ -1769,12 +1774,12 @@ __STATIC_INLINE void Cy_DMA_Channel_SetInterrupt(DW_Type * base, uint32_t channe * The interrupt mask value. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_SetInterruptMask +* \snippet dma/snippet/main.c snippet_Cy_DMA_SetInterruptMask * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_DMA_Channel_GetInterruptMask(DW_Type const * base, uint32_t channel) { - CY_ASSERT_L1(CY_DMA_IS_CH_NR_VALID(channel)); + CY_ASSERT_L1(CY_DMA_IS_CH_NR_VALID(base, channel)); return (DW_CH_INTR_MASK(base, channel)); } @@ -1797,12 +1802,12 @@ __STATIC_INLINE uint32_t Cy_DMA_Channel_GetInterruptMask(DW_Type const * base, u * CY_DMA_INTR_MASK to enable the interrupt or 0UL to disable the interrupt. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_SetInterruptMask +* \snippet dma/snippet/main.c snippet_Cy_DMA_SetInterruptMask * *******************************************************************************/ __STATIC_INLINE void Cy_DMA_Channel_SetInterruptMask(DW_Type * base, uint32_t channel, uint32_t interrupt) { - CY_ASSERT_L1(CY_DMA_IS_CH_NR_VALID(channel)); + CY_ASSERT_L1(CY_DMA_IS_CH_NR_VALID(base, channel)); CY_ASSERT_L2(CY_DMA_IS_INTR_MASK_VALID(interrupt)); DW_CH_INTR_MASK(base, channel) = interrupt; } @@ -1822,12 +1827,12 @@ __STATIC_INLINE void Cy_DMA_Channel_SetInterruptMask(DW_Type * base, uint32_t ch * The channel number. * * \funcusage -* \snippet dma\2.10\snippet\main.c snippet_Cy_DMA_ClearInterrupt +* \snippet dma/snippet/main.c snippet_Cy_DMA_ClearInterrupt * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_DMA_Channel_GetInterruptStatusMasked(DW_Type const * base, uint32_t channel) { - CY_ASSERT_L1(CY_DMA_IS_CH_NR_VALID(channel)); + CY_ASSERT_L1(CY_DMA_IS_CH_NR_VALID(base, channel)); return (DW_CH_INTR_MASKED(base, channel)); } diff --git a/platform/ext/target/psoc64/Native_Driver/include/cy_flash.h b/platform/ext/target/psoc64/Native_Driver/include/cy_flash.h index 45a01744f0..ad3c50820e 100644 --- a/platform/ext/target/psoc64/Native_Driver/include/cy_flash.h +++ b/platform/ext/target/psoc64/Native_Driver/include/cy_flash.h @@ -1,6 +1,6 @@ /***************************************************************************//** * \file cy_flash.h -* \version 3.20 +* \version 3.30.2 * * Provides the API declarations of the Flash driver. * @@ -52,12 +52,13 @@ * interrupt instead of a reset. * * A Read while Write violation occurs when a flash Read operation is initiated -* in the same or neighboring flash sector where the flash Write, Erase, or +* in the same or neighboring (neighboring restriction is applicable just for the +* CY8C6xx6, CY8C6xx7 devices) flash sector where the flash Write, Erase, or * Program operation is working. This violation may cause a HardFault exception. * To avoid the Read while Write violation, the user must carefully split the * Read and Write operation on flash sectors which are not neighboring, -* considering both cores in the multi-processor device. The flash is divided -* into four equal sectors. You may edit the linker script to place the code +* considering both cores in the multi-processor device. If the flash is divided +* into four equal sectors, you may edit the linker script to place the code * into neighboring sectors. For example, use sectors number 0 and 1 for code * and sectors 2 and 3 for data storage. * @@ -104,7 +105,7 @@ * Crypto). * -# If you do not use the default startup, perform the following steps * before any flash write/erase operations: -* \snippet flash\3.20\snippet\main.c Flash Initialization +* \snippet flash/snippet/main.c Flash Initialization * * \subsection group_flash_config_rww Partially Blocking: * This method has a much shorter time window during which Flash accesses are not @@ -112,7 +113,7 @@ * Flash Write duration, for both cores. Blocking duration depends upon the API * sequence used. * -* For API sequence Cy_Flash_StartErase() + Cy_Flash_StartProgram() there are +* For API sequence Cy_Flash_StartEraseRow() + Cy_Flash_StartProgram() there are * four block-out regions during which the read is blocked using the software * driver (PDL). See <b>Figure 1</b>. * @@ -216,7 +217,7 @@ * (DMA and Crypto). * -# If you do not use the default startup, perform the following steps * before any flash write/erase operations: -* \snippet flash\3.20\snippet\main.c Flash Initialization +* \snippet flash/snippet/main.c Flash Initialization * * \subsection group_flash_config_emeeprom EEPROM section use: * If you plan to use "cy_em_eeprom" section for different purposes for both of @@ -255,6 +256,31 @@ * <table class="doxtable"> * <tr><th>Version</th><th style="width: 52%;">Changes</th><th>Reason for Change</th></tr> * <tr> +* <td rowspan="1">3.30.2</td> +* <td>Updated documentation to limit devices with the neighboring restriction.</td> +* <td>User experience enhancement.</td> +* </tr> +* <tr> +* <td rowspan="1">3.30.1</td> +* <td>Used the CY_RAMFUNC_BEGIN and CY_RAMFUNC_END macros that allocate the function in RAM instead of using the CY_SECTION(".cy_ramfunc") macros.</td> +* <td>Removed the code duplication.</td> +* </tr> +* <tr> +* <td rowspan="3">3.30</td> +* <td>Moved ipcWaitMessageStc structure to the RAM section called ".cy_sharedmem".</td> +* <td>Support Secure Boot devices.</td> +* </tr> +* <tr> +* <td>Renamed Function Cy_Flash_StartErase() to Cy_Flash_StartEraseRow().</td> +* <td>The driver improvements based on the usability feedback.</td> +* </tr> +* <tr> +* <td>Added new API functions \ref Cy_Flash_EraseSector, +* \ref Cy_Flash_StartEraseSector, \ref Cy_Flash_EraseSubsector, +* \ref Cy_Flash_StartEraseSubsector </td> +* <td>The driver improvements based on the usability feedback.</td> +* </tr> +* <tr> * <td rowspan="3">3.20</td> * <td>Flattened the organization of the driver source code into the single source directory and the single include directory.</td> * <td>Driver library directory-structure simplification.</td> @@ -359,7 +385,7 @@ extern "C" { #define CY_FLASH_DRV_VERSION_MAJOR 3 /** Driver minor version */ -#define CY_FLASH_DRV_VERSION_MINOR 20 +#define CY_FLASH_DRV_VERSION_MINOR 30 #define CY_FLASH_ID (CY_PDL_DRV_ID(0x14UL)) /**< FLASH PDL ID */ @@ -377,8 +403,6 @@ extern "C" { /** Flash row size */ #define CY_FLASH_SIZEOF_ROW (CPUSS_FLASHC_PA_SIZE * 4u) -/** Flash effective page size */ -#define CY_FLASH_EFFECTIVE_PAGE_SIZE 32 /** Long words flash row size */ #define CY_FLASH_SIZEOF_ROW_LONG_UNITS (CY_FLASH_SIZEOF_ROW / sizeof(uint32_t)) @@ -430,11 +454,15 @@ typedef enum cy_en_flashdrv_status */ void Cy_Flash_Init(void); cy_en_flashdrv_status_t Cy_Flash_EraseRow(uint32_t rowAddr); +cy_en_flashdrv_status_t Cy_Flash_StartEraseRow(uint32_t rowAddr); +cy_en_flashdrv_status_t Cy_Flash_EraseSector(uint32_t sectorAddr); +cy_en_flashdrv_status_t Cy_Flash_StartEraseSector(uint32_t sectorAddr); +cy_en_flashdrv_status_t Cy_Flash_EraseSubsector(uint32_t subSectorAddr); +cy_en_flashdrv_status_t Cy_Flash_StartEraseSubsector(uint32_t subSectorAddr); cy_en_flashdrv_status_t Cy_Flash_ProgramRow(uint32_t rowAddr, const uint32_t* data); cy_en_flashdrv_status_t Cy_Flash_WriteRow(uint32_t rowAddr, const uint32_t* data); cy_en_flashdrv_status_t Cy_Flash_StartWrite(uint32_t rowAddr, const uint32_t* data); cy_en_flashdrv_status_t Cy_Flash_StartProgram(uint32_t rowAddr, const uint32_t* data); -cy_en_flashdrv_status_t Cy_Flash_StartErase(uint32_t rowAddr); cy_en_flashdrv_status_t Cy_Flash_IsOperationComplete(void); cy_en_flashdrv_status_t Cy_Flash_RowChecksum(uint32_t rowAddr, uint32_t* checksumPtr); cy_en_flashdrv_status_t Cy_Flash_CalculateHash(const uint32_t* data, uint32_t numberOfBytes, uint32_t* hashPtr); @@ -451,11 +479,15 @@ uint32_t Cy_Flash_GetExternalStatus(void); void Cy_Flash_ResumeIrqHandler(void); #endif -/* Macros to backward compatibility */ +/******************************************************************************* +Backward compatibility macro. The following code is DEPRECATED and must +not be used in new projects +*******************************************************************************/ #define Cy_Flash_IsWriteComplete(...) Cy_Flash_IsOperationComplete() #define Cy_Flash_IsProgramComplete(...) Cy_Flash_IsOperationComplete() #define Cy_Flash_IsEraseComplete(...) Cy_Flash_IsOperationComplete() -#define CY_FLASH_NUMBER_ROWS (CY_FLASH_SIZE / CY_FLASH_SIZEOF_ROW) +#define CY_FLASH_NUMBER_ROWS (CY_FLASH_SIZE / CY_FLASH_SIZEOF_ROW) +#define Cy_Flash_StartErase Cy_Flash_StartEraseRow /** \endcond */ diff --git a/platform/ext/target/psoc64/Native_Driver/include/cy_gpio.h b/platform/ext/target/psoc64/Native_Driver/include/cy_gpio.h index ef1896a682..c74bdc9102 100644 --- a/platform/ext/target/psoc64/Native_Driver/include/cy_gpio.h +++ b/platform/ext/target/psoc64/Native_Driver/include/cy_gpio.h @@ -79,7 +79,7 @@ * - Port output data set register * - Port output data clear register * -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c Cy_GPIO_Snippet +* \snippet gpio/snippet/main.c Cy_GPIO_Snippet * * \section group_gpio_more_information More Information * @@ -646,7 +646,7 @@ __STATIC_INLINE uint32_t Cy_GPIO_GetInterruptCause3(void); * not thread safe as the resource is shared among multiple pins on a port. * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_SetHSIOM +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_SetHSIOM * *******************************************************************************/ __STATIC_INLINE void Cy_GPIO_SetHSIOM(GPIO_PRT_Type* base, uint32_t pinNum, en_hsiom_sel_t value) @@ -691,7 +691,7 @@ __STATIC_INLINE void Cy_GPIO_SetHSIOM(GPIO_PRT_Type* base, uint32_t pinNum, en_h * HSIOM input selection * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_SetHSIOM +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_SetHSIOM * *******************************************************************************/ __STATIC_INLINE en_hsiom_sel_t Cy_GPIO_GetHSIOM(GPIO_PRT_Type* base, uint32_t pinNum) @@ -735,7 +735,7 @@ __STATIC_INLINE en_hsiom_sel_t Cy_GPIO_GetHSIOM(GPIO_PRT_Type* base, uint32_t pi * Base address of the port register structure * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_PortToAddr +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_PortToAddr * *******************************************************************************/ __STATIC_INLINE GPIO_PRT_Type* Cy_GPIO_PortToAddr(uint32_t portNum) @@ -779,7 +779,7 @@ __STATIC_INLINE GPIO_PRT_Type* Cy_GPIO_PortToAddr(uint32_t portNum) * Logic level present on the pin * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_Read +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_Read * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_GPIO_Read(GPIO_PRT_Type* base, uint32_t pinNum) @@ -809,7 +809,7 @@ __STATIC_INLINE uint32_t Cy_GPIO_Read(GPIO_PRT_Type* base, uint32_t pinNum) * Logic level to drive out on the pin * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_Write +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_Write * *******************************************************************************/ __STATIC_INLINE void Cy_GPIO_Write(GPIO_PRT_Type* base, uint32_t pinNum, uint32_t value) @@ -845,7 +845,7 @@ __STATIC_INLINE void Cy_GPIO_Write(GPIO_PRT_Type* base, uint32_t pinNum, uint32_ * Logic level on the pin output driver * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_ReadOut +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_ReadOut * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_GPIO_ReadOut(GPIO_PRT_Type* base, uint32_t pinNum) @@ -872,7 +872,7 @@ __STATIC_INLINE uint32_t Cy_GPIO_ReadOut(GPIO_PRT_Type* base, uint32_t pinNum) * Position of the pin bit-field within the port register * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_Set +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_Set * *******************************************************************************/ __STATIC_INLINE void Cy_GPIO_Set(GPIO_PRT_Type* base, uint32_t pinNum) @@ -899,7 +899,7 @@ __STATIC_INLINE void Cy_GPIO_Set(GPIO_PRT_Type* base, uint32_t pinNum) * Position of the pin bit-field within the port register * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_Clr +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_Clr * *******************************************************************************/ __STATIC_INLINE void Cy_GPIO_Clr(GPIO_PRT_Type* base, uint32_t pinNum) @@ -927,7 +927,7 @@ __STATIC_INLINE void Cy_GPIO_Clr(GPIO_PRT_Type* base, uint32_t pinNum) * Position of the pin bit-field within the port register * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_Inv +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_Inv * *******************************************************************************/ __STATIC_INLINE void Cy_GPIO_Inv(GPIO_PRT_Type* base, uint32_t pinNum) @@ -963,7 +963,7 @@ __STATIC_INLINE void Cy_GPIO_Inv(GPIO_PRT_Type* base, uint32_t pinNum) * not thread safe as the resource is shared among multiple pins on a port. * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_SetDrivemode +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_SetDrivemode * *******************************************************************************/ __STATIC_INLINE void Cy_GPIO_SetDrivemode(GPIO_PRT_Type* base, uint32_t pinNum, uint32_t value) @@ -996,7 +996,7 @@ __STATIC_INLINE void Cy_GPIO_SetDrivemode(GPIO_PRT_Type* base, uint32_t pinNum, * Pin drive mode. Options are detailed in \ref group_gpio_driveModes macros * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_SetDrivemode +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_SetDrivemode * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_GPIO_GetDrivemode(GPIO_PRT_Type* base, uint32_t pinNum) @@ -1027,7 +1027,7 @@ __STATIC_INLINE uint32_t Cy_GPIO_GetDrivemode(GPIO_PRT_Type* base, uint32_t pinN * not thread safe as the resource is shared among multiple pins on a port. * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_SetVtrip +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_SetVtrip * *******************************************************************************/ __STATIC_INLINE void Cy_GPIO_SetVtrip(GPIO_PRT_Type* base, uint32_t pinNum, uint32_t value) @@ -1058,7 +1058,7 @@ __STATIC_INLINE void Cy_GPIO_SetVtrip(GPIO_PRT_Type* base, uint32_t pinNum, uint * Pin voltage threshold mode. Options are detailed in \ref group_gpio_vtrip macros * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_SetVtrip +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_SetVtrip * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_GPIO_GetVtrip(GPIO_PRT_Type* base, uint32_t pinNum) @@ -1093,7 +1093,7 @@ __STATIC_INLINE uint32_t Cy_GPIO_GetVtrip(GPIO_PRT_Type* base, uint32_t pinNum) * not thread safe as the resource is shared among multiple pins on a port. * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_SetSlewRate +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_SetSlewRate * *******************************************************************************/ __STATIC_INLINE void Cy_GPIO_SetSlewRate(GPIO_PRT_Type* base, uint32_t pinNum, uint32_t value) @@ -1124,7 +1124,7 @@ __STATIC_INLINE void Cy_GPIO_SetSlewRate(GPIO_PRT_Type* base, uint32_t pinNum, u * Pin slew rate. Options are detailed in \ref group_gpio_slewRate macros * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_SetSlewRate +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_SetSlewRate * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_GPIO_GetSlewRate(GPIO_PRT_Type* base, uint32_t pinNum) @@ -1155,7 +1155,7 @@ __STATIC_INLINE uint32_t Cy_GPIO_GetSlewRate(GPIO_PRT_Type* base, uint32_t pinNu * not thread safe as the resource is shared among multiple pins on a port. * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_SetDriveSel +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_SetDriveSel * *******************************************************************************/ __STATIC_INLINE void Cy_GPIO_SetDriveSel(GPIO_PRT_Type* base, uint32_t pinNum, uint32_t value) @@ -1188,7 +1188,7 @@ __STATIC_INLINE void Cy_GPIO_SetDriveSel(GPIO_PRT_Type* base, uint32_t pinNum, u * Pin drive strength. Options are detailed in \ref group_gpio_driveStrength macros * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_SetDriveSel +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_SetDriveSel * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_GPIO_GetDriveSel(GPIO_PRT_Type* base, uint32_t pinNum) @@ -1228,7 +1228,7 @@ __STATIC_INLINE uint32_t Cy_GPIO_GetDriveSel(GPIO_PRT_Type* base, uint32_t pinNu * not thread safe as the resource is shared among multiple pins on a port. * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_SetVregEn +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_SetVregEn * *******************************************************************************/ __STATIC_INLINE void Cy_GPIO_SetVregEn(GPIO_PRT_Type* base, uint32_t pinNum, uint32_t value) @@ -1263,7 +1263,7 @@ __STATIC_INLINE void Cy_GPIO_SetVregEn(GPIO_PRT_Type* base, uint32_t pinNum, uin * SIO pair output buffer regulator mode. Options are detailed in \ref group_gpio_sioVreg macros * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_SetVregEn +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_SetVregEn * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_GPIO_GetVregEn(GPIO_PRT_Type* base, uint32_t pinNum) @@ -1296,7 +1296,7 @@ __STATIC_INLINE uint32_t Cy_GPIO_GetVregEn(GPIO_PRT_Type* base, uint32_t pinNum) * not thread safe as the resource is shared among multiple pins on a port. * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_SetIbufMode +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_SetIbufMode * *******************************************************************************/ __STATIC_INLINE void Cy_GPIO_SetIbufMode(GPIO_PRT_Type* base, uint32_t pinNum, uint32_t value) @@ -1331,7 +1331,7 @@ __STATIC_INLINE void Cy_GPIO_SetIbufMode(GPIO_PRT_Type* base, uint32_t pinNum, u * SIO pair input buffer mode. Options are detailed in \ref group_gpio_sioIbuf macros * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_SetIbufMode +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_SetIbufMode * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_GPIO_GetIbufMode(GPIO_PRT_Type* base, uint32_t pinNum) @@ -1364,7 +1364,7 @@ __STATIC_INLINE uint32_t Cy_GPIO_GetIbufMode(GPIO_PRT_Type* base, uint32_t pinNu * not thread safe as the resource is shared among multiple pins on a port. * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_SetVtripSel +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_SetVtripSel * *******************************************************************************/ __STATIC_INLINE void Cy_GPIO_SetVtripSel(GPIO_PRT_Type* base, uint32_t pinNum, uint32_t value) @@ -1399,7 +1399,7 @@ __STATIC_INLINE void Cy_GPIO_SetVtripSel(GPIO_PRT_Type* base, uint32_t pinNum, u * SIO pair input buffer trip point. Options are detailed in \ref group_gpio_sioVtrip macros * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_SetVtripSel +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_SetVtripSel * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_GPIO_GetVtripSel(GPIO_PRT_Type* base, uint32_t pinNum) @@ -1432,7 +1432,7 @@ __STATIC_INLINE uint32_t Cy_GPIO_GetVtripSel(GPIO_PRT_Type* base, uint32_t pinNu * not thread safe as the resource is shared among multiple pins on a port. * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_SetVrefSel +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_SetVrefSel * *******************************************************************************/ __STATIC_INLINE void Cy_GPIO_SetVrefSel(GPIO_PRT_Type* base, uint32_t pinNum, uint32_t value) @@ -1467,7 +1467,7 @@ __STATIC_INLINE void Cy_GPIO_SetVrefSel(GPIO_PRT_Type* base, uint32_t pinNum, ui * SIO pair reference voltage. Options are detailed in \ref group_gpio_sioVref macros * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_SetVrefSel +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_SetVrefSel * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_GPIO_GetVrefSel(GPIO_PRT_Type* base, uint32_t pinNum) @@ -1503,7 +1503,7 @@ __STATIC_INLINE uint32_t Cy_GPIO_GetVrefSel(GPIO_PRT_Type* base, uint32_t pinNum * not thread safe as the resource is shared among multiple pins on a port. * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_SetVohSel +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_SetVohSel * *******************************************************************************/ __STATIC_INLINE void Cy_GPIO_SetVohSel(GPIO_PRT_Type* base, uint32_t pinNum, uint32_t value) @@ -1538,7 +1538,7 @@ __STATIC_INLINE void Cy_GPIO_SetVohSel(GPIO_PRT_Type* base, uint32_t pinNum, uin * SIO pair reference voltage. Options are detailed in \ref group_gpio_sioVoh macros * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_SetVohSel +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_SetVohSel * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_GPIO_GetVohSel(GPIO_PRT_Type* base, uint32_t pinNum) @@ -1577,7 +1577,7 @@ __STATIC_INLINE uint32_t Cy_GPIO_GetVohSel(GPIO_PRT_Type* base, uint32_t pinNum) * 1 = Pin interrupt condition detected * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_GetInterruptStatus +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_GetInterruptStatus * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_GPIO_GetInterruptStatus(GPIO_PRT_Type* base, uint32_t pinNum) @@ -1602,7 +1602,7 @@ __STATIC_INLINE uint32_t Cy_GPIO_GetInterruptStatus(GPIO_PRT_Type* base, uint32_ * Bit position 8 is the routed pin through the port glitch filter. * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_ClearInterrupt +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_ClearInterrupt * *******************************************************************************/ __STATIC_INLINE void Cy_GPIO_ClearInterrupt(GPIO_PRT_Type* base, uint32_t pinNum) @@ -1641,7 +1641,7 @@ __STATIC_INLINE void Cy_GPIO_ClearInterrupt(GPIO_PRT_Type* base, uint32_t pinNum * not thread safe as the resource is shared among multiple pins on a port. * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_SetInterruptMask +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_SetInterruptMask * *******************************************************************************/ __STATIC_INLINE void Cy_GPIO_SetInterruptMask(GPIO_PRT_Type* base, uint32_t pinNum, uint32_t value) @@ -1677,7 +1677,7 @@ __STATIC_INLINE void Cy_GPIO_SetInterruptMask(GPIO_PRT_Type* base, uint32_t pinN * 1 = Pin interrupt masked and forwarded to CPU interrupt controller * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_SetInterruptMask +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_SetInterruptMask * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_GPIO_GetInterruptMask(GPIO_PRT_Type* base, uint32_t pinNum) @@ -1710,7 +1710,7 @@ __STATIC_INLINE uint32_t Cy_GPIO_GetInterruptMask(GPIO_PRT_Type* base, uint32_t * 1 = Pin interrupt detected and forwarded to CPU interrupt controller * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_GetInterruptStatusMasked +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_GetInterruptStatusMasked * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_GPIO_GetInterruptStatusMasked(GPIO_PRT_Type* base, uint32_t pinNum) @@ -1735,7 +1735,7 @@ __STATIC_INLINE uint32_t Cy_GPIO_GetInterruptStatusMasked(GPIO_PRT_Type* base, u * Bit position 8 is the routed pin through the port glitch filter. * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_SetSwInterrupt +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_SetSwInterrupt * *******************************************************************************/ __STATIC_INLINE void Cy_GPIO_SetSwInterrupt(GPIO_PRT_Type* base, uint32_t pinNum) @@ -1767,7 +1767,7 @@ __STATIC_INLINE void Cy_GPIO_SetSwInterrupt(GPIO_PRT_Type* base, uint32_t pinNum * not thread safe as the resource is shared among multiple pins on a port. * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_SetInterruptEdge +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_SetInterruptEdge * *******************************************************************************/ __STATIC_INLINE void Cy_GPIO_SetInterruptEdge(GPIO_PRT_Type* base, uint32_t pinNum, uint32_t value) @@ -1801,7 +1801,7 @@ __STATIC_INLINE void Cy_GPIO_SetInterruptEdge(GPIO_PRT_Type* base, uint32_t pinN * Pin interrupt mode. Options are detailed in \ref group_gpio_interruptTrigger macros * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_SetInterruptEdge +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_SetInterruptEdge * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_GPIO_GetInterruptEdge(GPIO_PRT_Type* base, uint32_t pinNum) @@ -1838,7 +1838,7 @@ __STATIC_INLINE uint32_t Cy_GPIO_GetInterruptEdge(GPIO_PRT_Type* base, uint32_t * it cannot be routed directly to other peripherals in hardware. * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_SetFilter +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_SetFilter * *******************************************************************************/ __STATIC_INLINE void Cy_GPIO_SetFilter(GPIO_PRT_Type* base, uint32_t value) @@ -1871,7 +1871,7 @@ __STATIC_INLINE void Cy_GPIO_SetFilter(GPIO_PRT_Type* base, uint32_t value) * The number of the port pin routed to the port filter (0...7) * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_SetFilter +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_SetFilter * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_GPIO_GetFilter(GPIO_PRT_Type* base) @@ -1891,7 +1891,7 @@ __STATIC_INLINE uint32_t Cy_GPIO_GetFilter(GPIO_PRT_Type* base) * 1 = Interrupt detected on port * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_GetInterruptCause0 +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_GetInterruptCause0 * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_GPIO_GetInterruptCause0(void) diff --git a/platform/ext/target/psoc64/Native_Driver/include/cy_ipc_drv.h b/platform/ext/target/psoc64/Native_Driver/include/cy_ipc_drv.h index d9a214ce75..95d3dc8087 100644 --- a/platform/ext/target/psoc64/Native_Driver/include/cy_ipc_drv.h +++ b/platform/ext/target/psoc64/Native_Driver/include/cy_ipc_drv.h @@ -1,6 +1,6 @@ /***************************************************************************//** * \file cy_ipc_drv.h -* \version 1.30 +* \version 1.40 * * Provides an API declaration of the IPC driver. * @@ -81,8 +81,8 @@ * conduit to transfer messages or data to and from multiple processes or CPUs. * * A pipe has two endpoints, one on each core. Each endpoint contains a dedicated -* IPC channel and an interrupt. IPC channels 0-7 and IPC interrupts 0-7 are -* reserved for system use. +* IPC channel and an interrupt. IPC channels 0-7(8 for the CYB064XX devices) +* and IPC interrupts 0-7 are reserved for system use. * * The pipe also contains the number of clients it supports, and for each client * a callback function. So the pipe can service a number of clients, each with a @@ -251,6 +251,11 @@ * <table class="doxtable"> * <tr><th>Version</th><th>Changes</th><th>Reason for Change</th></tr> * <tr> +* <td rowspan="1">1.40</td> +* <td>Moved cy_semaData structure to the RAM section called ".cy_sharedmem".</td> +* <td>Support Secure Boot devices.</td> +* </tr> +* <tr> * <td rowspan="3">1.30</td> * <td>Flattened the organization of the driver source code into the single source directory and the single include directory.</td> * <td>Driver library directory-structure simplification.</td> @@ -338,7 +343,7 @@ #define CY_IPC_DRV_VERSION_MAJOR 1 /** Driver minor version */ -#define CY_IPC_DRV_VERSION_MINOR 30 +#define CY_IPC_DRV_VERSION_MINOR 40 /** Defines a value to indicate that no notification events are needed */ #define CY_IPC_NO_NOTIFICATION (uint32_t)(0x00000000ul) @@ -453,7 +458,7 @@ __STATIC_INLINE void Cy_IPC_Drv_ClearInterrupt (IPC_INTR_STRUCT_Type * base, * Returns a pointer to the base of the IPC registers. * * \funcusage -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_Cy_IPC_Drv_SendMsgWord +* \snippet ipc/snippet/main.c snippet_Cy_IPC_Drv_SendMsgWord * *******************************************************************************/ __STATIC_INLINE IPC_STRUCT_Type* Cy_IPC_Drv_GetIpcBaseAddress (uint32_t ipcIndex) @@ -481,7 +486,7 @@ __STATIC_INLINE IPC_STRUCT_Type* Cy_IPC_Drv_GetIpcBaseAddress (uint32_t ipcIndex * Returns a pointer to the base of the IPC interrupt registers. * * \funcusage -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_Cy_IPC_Drv_GetInterruptStatus +* \snippet ipc/snippet/main.c snippet_Cy_IPC_Drv_GetInterruptStatus * *******************************************************************************/ __STATIC_INLINE IPC_INTR_STRUCT_Type* Cy_IPC_Drv_GetIntrBaseAddr (uint32_t ipcIntrIndex) @@ -511,7 +516,7 @@ __STATIC_INLINE IPC_INTR_STRUCT_Type* Cy_IPC_Drv_GetIntrBaseAddr (uint32_t ipcIn * notify event. * * \funcusage -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_Cy_IPC_Drv_GetInterruptStatusMasked +* \snippet ipc/snippet/main.c snippet_Cy_IPC_Drv_GetInterruptStatusMasked * *******************************************************************************/ __STATIC_INLINE void Cy_IPC_Drv_SetInterruptMask (IPC_INTR_STRUCT_Type* base, @@ -543,7 +548,7 @@ __STATIC_INLINE void Cy_IPC_Drv_SetInterruptMask (IPC_INTR_STRUCT_Type* base, * </table> * * \funcusage -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_Cy_IPC_Drv_GetInterruptStatusMasked +* \snippet ipc/snippet/main.c snippet_Cy_IPC_Drv_GetInterruptStatusMasked * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_IPC_Drv_GetInterruptMask(IPC_INTR_STRUCT_Type const * base) @@ -573,7 +578,7 @@ __STATIC_INLINE uint32_t Cy_IPC_Drv_GetInterruptMask(IPC_INTR_STRUCT_Type const * </table> * * \funcusage -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_Cy_IPC_Drv_GetInterruptStatusMasked +* \snippet ipc/snippet/main.c snippet_Cy_IPC_Drv_GetInterruptStatusMasked * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_IPC_Drv_GetInterruptStatusMasked (IPC_INTR_STRUCT_Type const * base) @@ -603,7 +608,7 @@ __STATIC_INLINE uint32_t Cy_IPC_Drv_GetInterruptStatusMasked (IPC_INTR_STRUCT_Ty * </table> * * \funcusage -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_Cy_IPC_Drv_GetInterruptStatus +* \snippet ipc/snippet/main.c snippet_Cy_IPC_Drv_GetInterruptStatus * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_IPC_Drv_GetInterruptStatus(IPC_INTR_STRUCT_Type const * base) @@ -634,7 +639,7 @@ __STATIC_INLINE uint32_t Cy_IPC_Drv_GetInterruptStatus(IPC_INTR_STRUCT_Type cons * notify event. * * \funcusage -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_Cy_IPC_Drv_SetInterrupt +* \snippet ipc/snippet/main.c snippet_Cy_IPC_Drv_SetInterrupt * *******************************************************************************/ __STATIC_INLINE void Cy_IPC_Drv_SetInterrupt(IPC_INTR_STRUCT_Type* base, uint32_t ipcReleaseMask, uint32_t ipcAcquireMask) @@ -666,7 +671,7 @@ __STATIC_INLINE void Cy_IPC_Drv_SetInterrupt(IPC_INTR_STRUCT_Type* base, uint32 * notify event. * * \funcusage -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_Cy_IPC_Drv_GetInterruptStatusMasked +* \snippet ipc/snippet/main.c snippet_Cy_IPC_Drv_GetInterruptStatusMasked * *******************************************************************************/ __STATIC_INLINE void Cy_IPC_Drv_ClearInterrupt(IPC_INTR_STRUCT_Type* base, uint32_t ipcReleaseMask, uint32_t ipcAcquireMask) @@ -701,7 +706,7 @@ __STATIC_INLINE void Cy_IPC_Drv_ClearInterrupt(IPC_INTR_STRUCT_Type* base, uint * structure. * * \funcusage -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_Cy_IPC_Drv_LockAcquire +* \snippet ipc/snippet/main.c snippet_Cy_IPC_Drv_LockAcquire * *******************************************************************************/ __STATIC_INLINE void Cy_IPC_Drv_AcquireNotify (IPC_STRUCT_Type* base, uint32_t notifyEventIntr) @@ -727,7 +732,7 @@ __STATIC_INLINE void Cy_IPC_Drv_AcquireNotify (IPC_STRUCT_Type* base, uint32_t * Bit encoded list of IPC interrupt lines that are triggered by a notification. * * \funcusage -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_Cy_IPC_Drv_ReadMsgWord +* \snippet ipc/snippet/main.c snippet_Cy_IPC_Drv_ReadMsgWord * *******************************************************************************/ __STATIC_INLINE void Cy_IPC_Drv_ReleaseNotify (IPC_STRUCT_Type* base, uint32_t notifyEventIntr) @@ -806,7 +811,7 @@ __STATIC_INLINE uint32_t Cy_IPC_Drv_ReadDataValue (IPC_STRUCT_Type const * base) * false: The IPC channel is in the Released state. * * \funcusage -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_Cy_IPC_Drv_LockAcquire +* \snippet ipc/snippet/main.c snippet_Cy_IPC_Drv_LockAcquire * *******************************************************************************/ __STATIC_INLINE bool Cy_IPC_Drv_IsLockAcquired (IPC_STRUCT_Type const * base) @@ -831,7 +836,7 @@ __STATIC_INLINE bool Cy_IPC_Drv_IsLockAcquired (IPC_STRUCT_Type const * base) * Value from LOCK_STATUS register. * * \funcusage -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_Cy_IPC_Drv_GetLockStatus +* \snippet ipc/snippet/main.c snippet_Cy_IPC_Drv_GetLockStatus * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_IPC_Drv_GetLockStatus (IPC_STRUCT_Type const * base) @@ -917,7 +922,7 @@ __STATIC_INLINE uint32_t Cy_IPC_Drv_ExtractReleaseMask (uint32_t intMask) * it is already locked. * * \funcusage -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_Cy_IPC_Drv_SendMsgPtr +* \snippet ipc/snippet/main.c snippet_Cy_IPC_Drv_SendMsgPtr * *******************************************************************************/ __STATIC_INLINE cy_en_ipcdrv_status_t Cy_IPC_Drv_SendMsgPtr(IPC_STRUCT_Type* base, uint32_t notifyEventIntr, void const * msgPtr) @@ -952,7 +957,7 @@ __STATIC_INLINE cy_en_ipcdrv_status_t Cy_IPC_Drv_SendMsgPtr(IPC_STRUCT_Type* ba * in it is invalid. * * \funcusage -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_Cy_IPC_Drv_ReadMsgPtr +* \snippet ipc/snippet/main.c snippet_Cy_IPC_Drv_ReadMsgPtr * *******************************************************************************/ __STATIC_INLINE cy_en_ipcdrv_status_t Cy_IPC_Drv_ReadMsgPtr (IPC_STRUCT_Type const * base, void ** msgPtr) @@ -980,7 +985,7 @@ __STATIC_INLINE cy_en_ipcdrv_status_t Cy_IPC_Drv_ReadMsgPtr (IPC_STRUCT_Type c * by another master * * \funcusage -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_Cy_IPC_Drv_LockAcquire +* \snippet ipc/snippet/main.c snippet_Cy_IPC_Drv_LockAcquire * *******************************************************************************/ __STATIC_INLINE cy_en_ipcdrv_status_t Cy_IPC_Drv_LockAcquire (IPC_STRUCT_Type const * base) diff --git a/platform/ext/target/psoc64/Native_Driver/include/cy_ipc_pipe.h b/platform/ext/target/psoc64/Native_Driver/include/cy_ipc_pipe.h index c19f261ac3..a8c9e78680 100644 --- a/platform/ext/target/psoc64/Native_Driver/include/cy_ipc_pipe.h +++ b/platform/ext/target/psoc64/Native_Driver/include/cy_ipc_pipe.h @@ -1,6 +1,6 @@ /***************************************************************************//** * \file cy_ipc_pipe.h -* \version 1.30 +* \version 1.40 * * Description: * IPC Pipe Driver - This header file contains all the function prototypes, diff --git a/platform/ext/target/psoc64/Native_Driver/include/cy_ipc_sema.h b/platform/ext/target/psoc64/Native_Driver/include/cy_ipc_sema.h index cf61025659..a221e49977 100644 --- a/platform/ext/target/psoc64/Native_Driver/include/cy_ipc_sema.h +++ b/platform/ext/target/psoc64/Native_Driver/include/cy_ipc_sema.h @@ -1,6 +1,6 @@ /***************************************************************************//** * \file cy_ipc_sema.h -* \version 1.30 +* \version 1.40 * * \brief * Header file for IPC SEM functions diff --git a/platform/ext/target/psoc64/Native_Driver/include/cy_prot.h b/platform/ext/target/psoc64/Native_Driver/include/cy_prot.h index e217aad51e..c51985c421 100644 --- a/platform/ext/target/psoc64/Native_Driver/include/cy_prot.h +++ b/platform/ext/target/psoc64/Native_Driver/include/cy_prot.h @@ -1,6 +1,6 @@ /***************************************************************************//** * \file cy_prot.h -* \version 1.30 +* \version 1.30.1 * * \brief * Provides an API declaration of the Protection Unit driver @@ -152,7 +152,7 @@ * and bit 3 - the valid field for CM0_PC3_HANDLER. * * The example of using of the single entry point mechanism is shown below. -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_ProtectionContext +* \snippet prot/snippet/main.c snippet_Cy_Prot_ProtectionContext * * \section group_prot_access_evaluation Access Evaluation * @@ -390,6 +390,11 @@ * <table class="doxtable"> * <tr><th>Version</th><th>Changes</th><th>Reason for Change</th></tr> * <tr> +* <td>1.30.1</td> +* <td>Snippet updated.</td> +* <td>Old snippet outdated.</td> +* </tr> +* <tr> * <td>1.30</td> * <td>Defect in \ref Cy_Prot_GetPpuProgStruct() function due to faulty defines is fixed.</td> * <td>Defect fixing.</td> @@ -514,80 +519,42 @@ typedef enum }cy_en_prot_perm_t; /** -* Bit shift of memory region size setting -*/ -#define PROT_SIZE_4B_BIT_SHIFT 1U /**< 4 bytes */ -#define PROT_SIZE_8B_BIT_SHIFT 2U /**< 8 bytes */ -#define PROT_SIZE_16B_BIT_SHIFT 3U /**< 16 bytes */ -#define PROT_SIZE_32B_BIT_SHIFT 4U /**< 32 bytes */ -#define PROT_SIZE_64B_BIT_SHIFT 5U /**< 64 bytes */ -#define PROT_SIZE_128B_BIT_SHIFT 6U /**< 128 bytes */ -#define PROT_SIZE_256B_BIT_SHIFT 7U /**< 256 bytes */ -#define PROT_SIZE_512B_BIT_SHIFT 8U /**< 512 bytes */ - -#define PROT_SIZE_1KB_BIT_SHIFT 9U /**< 1 Kilobyte */ -#define PROT_SIZE_2KB_BIT_SHIFT 10U /**< 2 Kilobytes */ -#define PROT_SIZE_4KB_BIT_SHIFT 11U /**< 4 Kilobytes */ -#define PROT_SIZE_8KB_BIT_SHIFT 12U /**< 8 Kilobytes */ -#define PROT_SIZE_16KB_BIT_SHIFT 13U /**< 16 Kilobytes */ -#define PROT_SIZE_32KB_BIT_SHIFT 14U /**< 32 Kilobytes */ -#define PROT_SIZE_64KB_BIT_SHIFT 15U /**< 64 Kilobytes */ -#define PROT_SIZE_128KB_BIT_SHIFT 16U /**< 128 Kilobytes */ -#define PROT_SIZE_256KB_BIT_SHIFT 17U /**< 256 Kilobytes */ -#define PROT_SIZE_512KB_BIT_SHIFT 18U /**< 512 Kilobytes */ - -#define PROT_SIZE_1MB_BIT_SHIFT 19U /**< 1 Megabyte */ -#define PROT_SIZE_2MB_BIT_SHIFT 20U /**< 2 Megabytes */ -#define PROT_SIZE_4MB_BIT_SHIFT 21U /**< 4 Megabytes */ -#define PROT_SIZE_8MB_BIT_SHIFT 22U /**< 8 Megabytes */ -#define PROT_SIZE_16MB_BIT_SHIFT 23U /**< 16 Megabytes */ -#define PROT_SIZE_32MB_BIT_SHIFT 24U /**< 32 Megabytes */ -#define PROT_SIZE_64MB_BIT_SHIFT 25U /**< 64 Megabytes */ -#define PROT_SIZE_128MB_BIT_SHIFT 26U /**< 128 Megabytes */ -#define PROT_SIZE_256MB_BIT_SHIFT 27U /**< 256 Megabytes */ -#define PROT_SIZE_512MB_BIT_SHIFT 28U /**< 512 Megabytes */ - -#define PROT_SIZE_1GB_BIT_SHIFT 29U /**< 1 Gigabyte */ -#define PROT_SIZE_2GB_BIT_SHIFT 30U /**< 2 Gigabytes */ -#define PROT_SIZE_4GB_BIT_SHIFT 31U /**< 4 Gigabytes */ - -/** * Memory region size */ typedef enum { - CY_PROT_SIZE_4B = PROT_SIZE_4B_BIT_SHIFT, /**< 4 bytes */ - CY_PROT_SIZE_8B = PROT_SIZE_8B_BIT_SHIFT, /**< 8 bytes */ - CY_PROT_SIZE_16B = PROT_SIZE_16B_BIT_SHIFT, /**< 16 bytes */ - CY_PROT_SIZE_32B = PROT_SIZE_32B_BIT_SHIFT, /**< 32 bytes */ - CY_PROT_SIZE_64B = PROT_SIZE_64B_BIT_SHIFT, /**< 64 bytes */ - CY_PROT_SIZE_128B = PROT_SIZE_128B_BIT_SHIFT, /**< 128 bytes */ - - CY_PROT_SIZE_256B = PROT_SIZE_256B_BIT_SHIFT, /**< 256 bytes */ - CY_PROT_SIZE_512B = PROT_SIZE_512B_BIT_SHIFT, /**< 512 bytes */ - CY_PROT_SIZE_1KB = PROT_SIZE_1KB_BIT_SHIFT, /**< 1 Kilobyte */ - CY_PROT_SIZE_2KB = PROT_SIZE_2KB_BIT_SHIFT, /**< 2 Kilobytes */ - CY_PROT_SIZE_4KB = PROT_SIZE_4KB_BIT_SHIFT, /**< 4 Kilobytes */ - CY_PROT_SIZE_8KB = PROT_SIZE_8KB_BIT_SHIFT, /**< 8 Kilobytes */ - CY_PROT_SIZE_16KB = PROT_SIZE_16KB_BIT_SHIFT, /**< 16 Kilobytes */ - CY_PROT_SIZE_32KB = PROT_SIZE_32KB_BIT_SHIFT, /**< 32 Kilobytes */ - CY_PROT_SIZE_64KB = PROT_SIZE_64KB_BIT_SHIFT, /**< 64 Kilobytes */ - CY_PROT_SIZE_128KB = PROT_SIZE_128KB_BIT_SHIFT, /**< 128 Kilobytes */ - CY_PROT_SIZE_256KB = PROT_SIZE_256KB_BIT_SHIFT, /**< 256 Kilobytes */ - CY_PROT_SIZE_512KB = PROT_SIZE_512KB_BIT_SHIFT, /**< 512 Kilobytes */ - CY_PROT_SIZE_1MB = PROT_SIZE_1MB_BIT_SHIFT, /**< 1 Megabyte */ - CY_PROT_SIZE_2MB = PROT_SIZE_2MB_BIT_SHIFT, /**< 2 Megabytes */ - CY_PROT_SIZE_4MB = PROT_SIZE_4MB_BIT_SHIFT, /**< 4 Megabytes */ - CY_PROT_SIZE_8MB = PROT_SIZE_8MB_BIT_SHIFT, /**< 8 Megabytes */ - CY_PROT_SIZE_16MB = PROT_SIZE_16MB_BIT_SHIFT, /**< 16 Megabytes */ - CY_PROT_SIZE_32MB = PROT_SIZE_32MB_BIT_SHIFT, /**< 32 Megabytes */ - CY_PROT_SIZE_64MB = PROT_SIZE_64MB_BIT_SHIFT, /**< 64 Megabytes */ - CY_PROT_SIZE_128MB = PROT_SIZE_128MB_BIT_SHIFT, /**< 128 Megabytes */ - CY_PROT_SIZE_256MB = PROT_SIZE_256MB_BIT_SHIFT, /**< 256 Megabytes */ - CY_PROT_SIZE_512MB = PROT_SIZE_512MB_BIT_SHIFT, /**< 512 Megabytes */ - CY_PROT_SIZE_1GB = PROT_SIZE_1GB_BIT_SHIFT, /**< 1 Gigabyte */ - CY_PROT_SIZE_2GB = PROT_SIZE_2GB_BIT_SHIFT, /**< 2 Gigabytes */ - CY_PROT_SIZE_4GB = PROT_SIZE_4GB_BIT_SHIFT /**< 4 Gigabytes */ + CY_PROT_SIZE_4B = 1U, /**< 4 bytes */ + CY_PROT_SIZE_8B = 2U, /**< 8 bytes */ + CY_PROT_SIZE_16B = 3U, /**< 16 bytes */ + CY_PROT_SIZE_32B = 4U, /**< 32 bytes */ + CY_PROT_SIZE_64B = 5U, /**< 64 bytes */ + CY_PROT_SIZE_128B = 6U, /**< 128 bytes */ + + CY_PROT_SIZE_256B = 7U, /**< 256 bytes */ + CY_PROT_SIZE_512B = 8U, /**< 512 bytes */ + CY_PROT_SIZE_1KB = 9U, /**< 1 Kilobyte */ + CY_PROT_SIZE_2KB = 10U, /**< 2 Kilobytes */ + CY_PROT_SIZE_4KB = 11U, /**< 4 Kilobytes */ + CY_PROT_SIZE_8KB = 12U, /**< 8 Kilobytes */ + CY_PROT_SIZE_16KB = 13U, /**< 16 Kilobytes */ + CY_PROT_SIZE_32KB = 14U, /**< 32 Kilobytes */ + CY_PROT_SIZE_64KB = 15U, /**< 64 Kilobytes */ + CY_PROT_SIZE_128KB = 16U, /**< 128 Kilobytes */ + CY_PROT_SIZE_256KB = 17U, /**< 256 Kilobytes */ + CY_PROT_SIZE_512KB = 18U, /**< 512 Kilobytes */ + CY_PROT_SIZE_1MB = 19U, /**< 1 Megabyte */ + CY_PROT_SIZE_2MB = 20U, /**< 2 Megabytes */ + CY_PROT_SIZE_4MB = 21U, /**< 4 Megabytes */ + CY_PROT_SIZE_8MB = 22U, /**< 8 Megabytes */ + CY_PROT_SIZE_16MB = 23U, /**< 16 Megabytes */ + CY_PROT_SIZE_32MB = 24U, /**< 32 Megabytes */ + CY_PROT_SIZE_64MB = 25U, /**< 64 Megabytes */ + CY_PROT_SIZE_128MB = 26U, /**< 128 Megabytes */ + CY_PROT_SIZE_256MB = 27U, /**< 256 Megabytes */ + CY_PROT_SIZE_512MB = 28U, /**< 512 Megabytes */ + CY_PROT_SIZE_1GB = 29U, /**< 1 Gigabyte */ + CY_PROT_SIZE_2GB = 30U, /**< 2 Gigabytes */ + CY_PROT_SIZE_4GB = 31U /**< 4 Gigabytes */ }cy_en_prot_size_t; /** @@ -1121,7 +1088,7 @@ cy_en_prot_status_t Cy_Prot_DisablePpuFixedRgSlaveStruct(PERI_GR_PPU_RG_Type* ba * CY_PROT_INVALID_STATE | Function was called on the unsupported PERI IP version * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_DisableSmpuStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_DisableSmpuStruct * *******************************************************************************/ __STATIC_INLINE cy_en_prot_status_t Cy_Prot_DisableSmpuStruct(PROT_SMPU_SMPU_STRUCT_Type* base) @@ -1165,7 +1132,7 @@ __STATIC_INLINE cy_en_prot_status_t Cy_Prot_DisableSmpuStruct(PROT_SMPU_SMPU_STR * CY_PROT_INVALID_STATE | Function was called on the unsupported PERI IP version * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_DisablePpuProgStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_DisablePpuProgStruct * *******************************************************************************/ __STATIC_INLINE cy_en_prot_status_t Cy_Prot_DisablePpuProgStruct(PERI_PPU_PR_Type* base) diff --git a/platform/ext/target/psoc64/Native_Driver/include/cy_rtc.h b/platform/ext/target/psoc64/Native_Driver/include/cy_rtc.h index b99e18f242..36cac15f57 100644 --- a/platform/ext/target/psoc64/Native_Driver/include/cy_rtc.h +++ b/platform/ext/target/psoc64/Native_Driver/include/cy_rtc.h @@ -1,6 +1,6 @@ /***************************************************************************//** * \file cy_rtc.h -* \version 2.20 +* \version 2.20.1 * * This file provides constants and parameter values for the APIs for the * Real-Time Clock (RTC). @@ -228,6 +228,11 @@ * <table class="doxtable"> * <tr><th>Version</th><th>Changes</th><th>Reason for Change</th></tr> * <tr> +* <td>2.20.1</td> +* <td>Modified header guard CY_IP_MXS40SRSS_RTC.</td> +* <td>To enable the PDL compilation with wounded out IP blocks.</td> +* </tr> +* <tr> * <td rowspan="3">2.20</td> * <td>Flattened the organization of the driver source code into the single * source directory and the single include directory. @@ -303,9 +308,7 @@ #include "cy_syslib.h" #include "cy_syspm.h" -#ifndef CY_IP_MXS40SRSS_RTC - #error "The RTC driver is not supported on this device" -#endif +#ifdef CY_IP_MXS40SRSS_RTC #if defined(__cplusplus) extern "C" { @@ -1315,6 +1318,8 @@ __STATIC_INLINE void Cy_RTC_SyncToRtcAhbAlarm(uint32_t alarmTimeBcd, uint32_t al } #endif +#endif /* CY_IP_MXS40SRSS_RTC */ + #endif /* CY_RTC_H */ /** \} group_rtc_low_level_functions */ diff --git a/platform/ext/target/psoc64/Native_Driver/include/cy_scb_common.h b/platform/ext/target/psoc64/Native_Driver/include/cy_scb_common.h index 0d4d1fc1bc..d8f30c116b 100644 --- a/platform/ext/target/psoc64/Native_Driver/include/cy_scb_common.h +++ b/platform/ext/target/psoc64/Native_Driver/include/cy_scb_common.h @@ -1,6 +1,6 @@ /***************************************************************************//** * \file cy_scb_common.h -* \version 2.20 +* \version 2.30.1 * * Provides common API declarations of the SCB driver. * @@ -42,33 +42,15 @@ * \} */ /** -* \addtogroup group_scb_common +* \addtogroup group_scb * \{ * -* Common API for the Serial Communication Block. -* -* This is the common API that provides an interface to the SCB hardware. -* The I2C, SPI, and UART drivers use this common API. -* Most users will use individual drivers and do not need to use the common -* API for the SCB. However, you can use the common SCB API to implement -* a custom driver based on the SCB hardware. -* -* The functions and other declarations used in this part of the driver are in -* cy_scb_common.h. You can include either of cy_scb_spi.h, cy_scb_uart.h, -* cy_scb_ezi2c.h, cy_scb_i2c.h depending on the desired functionality. -* You can also include cy_pdl.h to get access to all functions and declarations -* in the PDL. -* -******************************************************************************* -* \section group_scb_common_configuration Configuration Considerations ******************************************************************************** -* This is not a driver and it does not require configuration. -* -******************************************************************************* -* \section group_scb_common_more_information More Information -******************************************************************************* -* Refer to the SCB chapter of the technical reference manual (TRM). -* +* \section group_scb_more_information More Information +******************************************************************************** +* For more information on the SCB peripheral, refer to the technical reference +* manual (TRM). +* ******************************************************************************* * \section group_scb_common_MISRA MISRA-C Compliance ******************************************************************************* @@ -84,11 +66,68 @@ * <td>A</td> * <td>A cast should not be performed between a pointer to object type and * a different pointer to object type.</td> -* <td>The pointer to the buffer memory is void to allow handling of +* <td> +* * The pointer to the buffer memory is void to allow handling of * different data types: uint8_t (4-8 bits) or uint16_t (9-16 bits). * The cast operation is safe because the configuration is verified * before operation is performed. -* </td> +* * The functions \ref Cy_SCB_I2C_DeepSleepCallback and +* \ref Cy_SCB_I2C_HibernateCallback are callback of +* \ref cy_en_syspm_status_t type. The cast operation safety in these +* functions becomes the user's responsibility because pointers are +* initialized when callback is registered in SysPm driver. +* * The functions \ref Cy_SCB_EZI2C_DeepSleepCallback and +* \ref Cy_SCB_EZI2C_HibernateCallback are callback of +* \ref cy_en_syspm_status_t type. The cast operation safety in these +* functions becomes the user's responsibility because pointers are +* initialized when callback is registered in SysPm driver. +* * The functions \ref Cy_SCB_UART_DeepSleepCallback and +* \ref Cy_SCB_UART_HibernateCallback are callback of +* \ref cy_en_syspm_status_t type. The cast operation safety in these +* functions becomes the user's responsibility because pointers are +* initialized when callback is registered in SysPm driver. +* * The functions \ref Cy_SCB_SPI_DeepSleepCallback and +* \ref Cy_SCB_SPI_HibernateCallback are callback of +* \ref cy_en_syspm_status_t type. The cast operation safety in these +* functions becomes the user's responsibility because pointers are +* initialized when callback is registered in SysPm driver. +* </td> +* </tr> +* <tr> +* <td>14.1</td> +* <td>R</td> +* <td>There shall be no unreachable code.</td> +* <td>The SCB block parameters can be a constant false or true depends on +* the selected device and cause code to be unreachable.</td> +* </tr> +* <tr> +* <td>14.2</td> +* <td>R</td> +* <td>All non-null statements shall either: a) have at least one side-effect +* however executed, or b) cause control flow to change.</td> +* <td>The unused function parameters are cast to void. This statement +* has no side-effect and is used to suppress a compiler warning.</td> +* </tr> +* <tr> +* <td>14.7</td> +* <td>R</td> +* <td>A function shall have a single point of exit at the end of the +* function.</td> +* <td>The functions can return from several points. This is done to improve +* code clarity when returning error status code if input parameters +* validation fails.</td> +* </tr> +* <tr> +* <td>13.7</td> +* <td>R</td> +* <td>Boolean operations whose results are invariant shall not be +* permitted.</td> +* <td> +* * The SCB block parameters can be a constant false or true depends on +* the selected device and cause this violation. +* * The same condition check is executed before and after callback is +* called because after the callback returns, the condition might be not +* true any more.</td> * </tr> * </table> * @@ -98,7 +137,40 @@ * <table class="doxtable"> * <tr><th>Version</th><th>Changes</th><th>Reason for Change</th></tr> * <tr> -* <td rowspan="2">2.20</td> +* <td>2.30.1</td> +* <td>Added header guards CY_IP_MXSCB.</td> +* <td>To enable the PDL compilation with wounded out IP blocks.</td> +* </tr> +* <tr> +* <td rowspan="5">2.30</td> +* <td>Fixed MISRA violation.</td> +* <td>MISRA compliance.</td> +* </tr> +* <tr> +* <td>Changed values CY_SCB_SPI_CPHA0_CPOL1 and CY_SCB_SPI_CPHA1_CPOL0 in enum \ref cy_en_scb_spi_sclk_mode_t.</td> +* <td>The incorrect values in \ref cy_en_scb_spi_sclk_mode_t caused incorrect initialization of the combination of +* phases and polarity: "CHPA = 0, CPOL = 1" and "CHPA = 1, CPOL = 0". +* </td> +* </tr> +* <tr> +* <td>Added new CY_SCB_UART_RECEIVE_NOT_EMTPY and CY_SCB_UART_TRANSMIT_EMTPY callback events \ref group_scb_uart_macros_callback_events.</td> +* <td>Extended the driver callback events to support the MBED-OS.</td> +* </tr> +* <tr> +* <td>Merged SCB changelogs for each mode into one changelog.</td> +* <td>Changelog optimization.</td> +* </tr> +* <tr> +* <td>Merged SCB MISRA-C Compliance sections for each mode into one section.</td> +* <td>To optimize the SCB MISRA-C Compliance sections.</td> +* </tr> +* <tr> +* <td> 2.20.1</td> +* <td>Documentation of the MISRA rule violation.</td> +* <td>MISRA compliance.</td> +* </tr> +* <tr> +* <td rowspan="4">2.20</td> * <td>Flattened the organization of the driver source code into the single * source directory and the single include directory. * </td> @@ -111,12 +183,49 @@ * not need to be recompiled for each supported part number.</td> * </tr> * <tr> -* <td>2.10</td> -* <td>None.</td> -* <td>SCB I2C driver updated.</td> +* <td>Added the enableDigitalFilter, highPhaseDutyCycle and lowPhaseDutyCycle +* fields to the \ref cy_stc_scb_i2c_config_t configuration structure. +* </td> +* <td>Added the I2C master data rate configuration using the configuration structure. +* </td> +* </tr> +* <tr> +* <td>Fixed the \ref Cy_SCB_I2C_SetDataRate function to properly configure data rates +* greater than 400 kbps in Master and Master-Slave modes. \n +* Added verification that clk_scb is within the valid range for the desired data rate. +* </td> +* <td>The analog filter was enabled for all data rates in Master and Master-Slave modes. +* This prevents reaching the maximum supported data rate of 1000 kbps which requires a digital filter. +* </td> * </tr> * <tr> -* <td rowspan="2"> 2.0</td> +* <td rowspan="4"> 2.10</td> +* <td>Fixed the ReStart condition generation sequence for a write +* transaction in the \ref Cy_SCB_I2C_MasterWrite function.</td> +* <td>The driver can notify about a zero length write transaction completion +* before the address byte is sent if the \ref Cy_SCB_I2C_MasterWrite +* function execution was interrupted between setting the restart +* generation command and writing the address byte into the TX FIFO.</td> +* </tr> +* <tr> +* <td>Added the slave- and master-specific interrupt functions: +* \ref Cy_SCB_I2C_SlaveInterrupt and \ref Cy_SCB_I2C_MasterInterrupt. +* </td> +* <td>Improved the interrupt configuration options for the I2C slave and +* master mode configurations.</td> +* </tr> +* <tr> +* <td>Updated the Start condition generation sequence in the \ref +* Cy_SCB_I2C_MasterWrite and \ref Cy_SCB_I2C_MasterRead.</td> +* <td></td> +* </tr> +* <tr> +* <td>Updated the ReStart condition generation sequence for a write +* transaction in the \ref Cy_SCB_I2C_MasterSendReStart function.</td> +* <td></td> +* </tr> +* <tr> +* <td rowspan="9"> 2.0</td> * <td>Added parameters validation for public API. * <td></td> * </tr> @@ -126,11 +235,84 @@ * <td></td> * </tr> * <tr> +* <td>Added missing "cy_cb_" to the callback function type names.</td> +* <td></td> +* </tr> +* <tr> +* <td>Replaced variables that have limited range of values with enumerated +* types.</td> +* <td></td> +* </tr> +* <tr> +* <td>Added function \ref Cy_SCB_UART_SendBreakBlocking for break condition +* generation.</td> +* <td></td> +* </tr> +* <tr> +* <td>Fixed low power callbacks \ref Cy_SCB_UART_DeepSleepCallback and +* \ref Cy_SCB_UART_HibernateCallback to prevent the device from entering +* low power mode when RX FIFO is not empty.</td> +* <td>The callbacks allowed entering device into low power mode when RX FIFO +* had data.</td> +* </tr> +* <tr> +* <td>Fixed SPI callback notification when error event occurred.</td> +* <td>The SPI callback passed incorrect event value if error event occurred.</td> +* </tr> +* <tr> +* <td>Fixed the \ref Cy_SCB_I2C_MasterSendReStart function to properly +* generate the ReStart condition when the previous transaction was +* a write.</td> +* <td>The master interpreted the address byte written into the TX FIFO as a +* data byte and continued a write transaction. The ReStart condition was +* generated after the master completed transferring the data byte. +* The SCL line was stretched by the master waiting for the address byte +* to be written into the TX FIFO after the ReStart condition generation. +* The following timeout detection released the bus from the master +* control.</td> +* </tr> +* <tr> +* <td>Fixed the slave operation after the address byte was NACKed by the +* firmware.</td> +* <td>The observed slave operation failure depends on whether Level 2 assert +* is enabled or not. Enabled: the device stuck in the fault handler due +* to the assert assignment in the \ref Cy_SCB_I2C_Interrupt. Disabled: +* the slave sets the transaction completion status and notifies on the +* transaction completion event after the address was NACKed. The failure +* is observed only when the slave is configured to accept an address in +* the RX FIFO.</td> +* </tr> +* <tr> * <td>1.0</td> * <td>Initial version.</td> * <td></td> * </tr> * </table> +*/ + +/** \} group_scb */ +/** +* \addtogroup group_scb_common +* \{ +* +* Common API for the Serial Communication Block. +* +* This is the common API that provides an interface to the SCB hardware. +* The I2C, SPI, and UART drivers use this common API. +* Most users will use individual drivers and do not need to use the common +* API for the SCB. However, you can use the common SCB API to implement +* a custom driver based on the SCB hardware. +* +* The functions and other declarations used in this part of the driver are in +* cy_scb_common.h. You can include either of cy_scb_spi.h, cy_scb_uart.h, +* cy_scb_ezi2c.h, cy_scb_i2c.h depending on the desired functionality. +* You can also include cy_pdl.h to get access to all functions and declarations +* in the PDL. +* +******************************************************************************* +* \section group_scb_common_configuration Configuration Considerations +******************************************************************************** +* This is not a driver and it does not require configuration. * * \defgroup group_scb_common_macros Macros * \defgroup group_scb_common_functions Functions @@ -261,7 +443,7 @@ __STATIC_INLINE uint32_t Cy_SCB_GetRxFifoLevel (CySCB_Type const *base); #define CY_SCB_DRV_VERSION_MAJOR (2) /** Driver minor version */ -#define CY_SCB_DRV_VERSION_MINOR (20) +#define CY_SCB_DRV_VERSION_MINOR (30) /** SCB driver identifier */ #define CY_SCB_ID CY_PDL_DRV_ID(0x2AU) diff --git a/platform/ext/target/psoc64/Native_Driver/include/cy_scb_ezi2c.h b/platform/ext/target/psoc64/Native_Driver/include/cy_scb_ezi2c.h index 0283cfc639..324750b03e 100644 --- a/platform/ext/target/psoc64/Native_Driver/include/cy_scb_ezi2c.h +++ b/platform/ext/target/psoc64/Native_Driver/include/cy_scb_ezi2c.h @@ -1,6 +1,6 @@ /***************************************************************************//** * \file cy_scb_ezi2c.h -* \version 2.20 +* \version 2.30.1 * * Provides EZI2C API declarations of the SCB driver. * @@ -78,13 +78,13 @@ * function providing a pointer to the populated \ref cy_stc_scb_ezi2c_config_t * structure and the allocated \ref cy_stc_scb_ezi2c_context_t structure. * -* \snippet SCB_CompDatasheet_sut_01_revA.cydsn\ezi2c_snippets.c EZI2C_CFG +* \snippet scb/ezi2c_snippet/main.c EZI2C_CFG * * Set up the EZI2C slave buffer before enabling its * operation by using \ref Cy_SCB_EZI2C_SetBuffer1 for the primary slave address * and \ref Cy_SCB_EZI2C_SetBuffer2 for the secondary (if the secondary is enabled). * -* \snippet SCB_CompDatasheet_sut_01_revA.cydsn\ezi2c_snippets.c EZI2C_CFG_BUFFER +* \snippet scb/ezi2c_snippet/main.c EZI2C_CFG_BUFFER * ******************************************************************************** * \subsection group_scb_ezi2c_pins Assign and Configure Pins @@ -94,7 +94,7 @@ * SCB block. Also the I2C pins must be configured in Open-Drain, Drives Low mode * (this pin configuration implies usage of external pull-up resistors): * -* \snippet SCB_CompDatasheet_sut_01_revA.cydsn\ezi2c_snippets.c EZI2C_CFG_PINS +* \snippet scb/ezi2c_snippet/main.c EZI2C_CFG_PINS * * \note * The alternative pins configuration is Resistive Pull-ups which implies usage @@ -110,7 +110,7 @@ * You must use one of the 8-bit or 16-bit dividers. Use the \ref group_sysclk * driver API to do this. * -* \snippet SCB_CompDatasheet_sut_01_revA.cydsn\ezi2c_snippets.c EZI2C_CFG_ASSIGN_CLOCK +* \snippet scb/ezi2c_snippet/main.c EZI2C_CFG_ASSIGN_CLOCK * ******************************************************************************** * \subsection group_scb_ezi2c_data_rate Configure Data Rate @@ -123,7 +123,7 @@ * Oversampling and Bit Rate to get information about how to configure the * I2C to run at the desired data rate</b>. * -* \snippet SCB_CompDatasheet_sut_01_revA.cydsn\ezi2c_snippets.c EZI2C_CFG_DATA_RATE +* \snippet scb/ezi2c_snippet/main.c EZI2C_CFG_DATA_RATE * ******************************************************************************** * \subsection group_scb_ezi2c_intr Configure Interrupt @@ -133,15 +133,15 @@ * handler for the selected SCB instance. Also, this interrupt must be enabled * in the NVIC or it will not work. * -* \snippet SCB_CompDatasheet_sut_01_revA.cydsn\ezi2c_snippets.c EZI2C_INTR_A -* \snippet SCB_CompDatasheet_sut_01_revA.cydsn\ezi2c_snippets.c EZI2C_INTR_B +* \snippet scb/ezi2c_snippet/main.c EZI2C_INTR_A +* \snippet scb/ezi2c_snippet/main.c EZI2C_INTR_B * ******************************************************************************** * \subsection group_scb_ezi2c_enable Enable EZI2C slave ******************************************************************************** * Finally, enable the EZI2C slave operation by calling \ref Cy_SCB_EZI2C_Enable. * Now the I2C device responds to the assigned address. -* \snippet SCB_CompDatasheet_sut_01_revA.cydsn\ezi2c_snippets.c EZI2C_ENABLE +* \snippet scb/ezi2c_snippet/main.c EZI2C_ENABLE * ******************************************************************************** * \section group_scb_ezi2c_use_cases Common Use Cases @@ -226,97 +226,6 @@ * source from Deep Sleep mode, the \ref Cy_SCB_EZI2C_DeepSleepCallback must * be copied and modified. Refer to the function description to get the details. * -******************************************************************************** -* \section group_scb_ezi2c_more_information More Information -******************************************************************************** -* For more information on the SCB peripheral, refer to the technical reference -* manual (TRM). -* -******************************************************************************** -* \section group_scb_ezi2c_MISRA MISRA-C Compliance -******************************************************************************** -* <table class="doxtable"> -* <tr> -* <th>MISRA Rule</th> -* <th>Rule Class (Required/Advisory)</th> -* <th>Rule Description</th> -* <th>Description of Deviation(s)</th> -* </tr> -* <tr> -* <td>11.4</td> -* <td>A</td> -* <td>A cast should not be performed between a pointer to object type and -* a different pointer to object type.</td> -* <td>The functions \ref Cy_SCB_EZI2C_DeepSleepCallback and -* \ref Cy_SCB_EZI2C_HibernateCallback are callback of -* \ref cy_en_syspm_status_t type. The cast operation safety in these -* functions becomes the user's responsibility because pointers are -* initialized when callback is registered in SysPm driver.</td> -* </tr> -* <tr> -* <td>14.1</td> -* <td>R</td> -* <td>There shall be no unreachable code.</td> -* <td>The SCB block parameters can be a constant false or true depending on -* the selected device and cause code to be unreachable.</td> -* </tr> -* <tr> -* <td>14.2</td> -* <td>R</td> -* <td>All non-null statements shall either: a) have at least one side-effect -* however executed, or b) cause control flow to change.</td> -* <td>The unused function parameters are cast to void. This statement -* has no side-effect and is used to suppress a compiler warning.</td> -* </tr> -* <tr> -* <td>14.7</td> -* <td>R</td> -* <td>A function shall have a single point of exit at the end of the -* function.</td> -* <td>The functions can return from several points. This is done to improve -* code clarity when returning error status code if input parameter -* validation fails.</td> -* </tr> -* </table> -* -* \section group_scb_ezi2c_changelog Changelog -* <table class="doxtable"> -* <tr><th>Version</th><th>Changes</th><th>Reason for Change</th></tr> -* <tr> -* <td rowspan="2">2.20</td> -* <td>Flattened the organization of the driver source code into the single -* source directory and the single include directory. -* </td> -* <td>Driver library directory-structure simplification.</td> -* </tr> -* <tr> -* <td>Added register access layer. Use register access macros instead -* of direct register access using dereferenced pointers.</td> -* <td>Makes register access device-independent, so that the PDL does -* not need to be recompiled for each supported part number.</td> -* </tr> -* <tr> -* <td>2.10</td> -* <td>None.</td> -* <td>SCB I2C driver updated.</td> -* </tr> -* <tr> -* <td rowspan="2"> 2.0</td> -* <td>Added parameters validation for public API.</td> -* <td></td> -* </tr> -* <tr> -* <td>Replaced variables that have limited range of values with enumerated -* types.</td> -* <td></td> -* </tr> -* <tr> -* <td>1.0</td> -* <td>Initial version.</td> -* <td></td> -* </tr> -* </table> -* * \defgroup group_scb_ezi2c_macros Macros * \defgroup group_scb_ezi2c_functions Functions * \{ @@ -333,6 +242,8 @@ #include "cy_scb_common.h" +#ifdef CY_IP_MXSCB + #if defined(__cplusplus) extern "C" { #endif @@ -638,7 +549,7 @@ __STATIC_INLINE void Cy_SCB_EZI2C_Enable(CySCB_Type *base) /** \} group_scb_ezi2c */ -#endif /* (CY_SCB_EZI2C_H) */ - +#endif /* (CY_IP_MXSCB) */ +#endif /* (CY_SCB_EZI2C_H) */ /* [] END OF FILE */ diff --git a/platform/ext/target/psoc64/Native_Driver/include/cy_scb_uart.h b/platform/ext/target/psoc64/Native_Driver/include/cy_scb_uart.h index 4d78eb7cdc..37a22434f9 100644 --- a/platform/ext/target/psoc64/Native_Driver/include/cy_scb_uart.h +++ b/platform/ext/target/psoc64/Native_Driver/include/cy_scb_uart.h @@ -1,6 +1,6 @@ /***************************************************************************//** * \file cy_scb_uart.h -* \version 2.20 +* \version 2.30.1 * * Provides UART API declarations of the SCB driver. * @@ -86,7 +86,7 @@ * function providing a pointer to the populated \ref cy_stc_scb_uart_config_t * structure and the allocated \ref cy_stc_scb_uart_context_t structure. * -* \snippet SCB_CompDatasheet_sut_01_revA.cydsn\uart_snippets.c UART_CFG +* \snippet scb/uart_snippet/main.c UART_CFG * ******************************************************************************** * \subsection group_scb_uart_pins Assign and Configure Pins @@ -96,7 +96,7 @@ * SCB block. Also, the UART output pins must be configured in Strong Drive * Input Off mode and UART input pins in Digital High-Z: * -* \snippet SCB_CompDatasheet_sut_01_revA.cydsn\uart_snippets.c UART_CFG_PINS +* \snippet scb/uart_snippet/main.c UART_CFG_PINS * ******************************************************************************** * \subsection group_scb_uart_clock Assign Clock Divider @@ -106,7 +106,7 @@ * You must use one of available integer or fractional dividers. Use the * \ref group_sysclk driver API to do this. * -* \snippet SCB_CompDatasheet_sut_01_revA.cydsn\uart_snippets.c UART_CFG_ASSIGN_CLOCK +* \snippet scb/uart_snippet/main.c UART_CFG_ASSIGN_CLOCK * ******************************************************************************** * \subsection group_scb_uart_data_rate Configure Baud Rate @@ -117,7 +117,7 @@ * in configuration structure</b></em> to define the number of the SCB clocks * within one UART bit-time. * -* \snippet SCB_CompDatasheet_sut_01_revA.cydsn\uart_snippets.c UART_CFG_DATA_RATE +* \snippet scb/uart_snippet/main.c UART_CFG_DATA_RATE * * <b>Refer to the technical reference manual (TRM) section UART sub-section * Clocking and Oversampling to get information about how to configure the UART to run with @@ -132,15 +132,15 @@ * in the NVIC. * The interrupt must be configured when \ref group_scb_uart_hl will be used. * -* \snippet SCB_CompDatasheet_sut_01_revA.cydsn\uart_snippets.c UART_INTR_A -* \snippet SCB_CompDatasheet_sut_01_revA.cydsn\uart_snippets.c UART_INTR_B +* \snippet scb/uart_snippet/main.c UART_INTR_A +* \snippet scb/uart_snippet/main.c UART_INTR_B * ******************************************************************************** * \subsection group_scb_uart_enable Enable UART ******************************************************************************** * Finally, enable the UART operation by calling \ref Cy_SCB_UART_Enable. * -* \snippet SCB_CompDatasheet_sut_01_revA.cydsn\uart_snippets.c UART_ENABLE +* \snippet scb/uart_snippet/main.c UART_ENABLE * ******************************************************************************** * \section group_scb_uart_use_cases Common Use Cases @@ -179,7 +179,7 @@ * \ref Cy_SCB_UART_IsTxComplete, \ref Cy_SCB_UART_GetNumInRxFifo and * \ref Cy_SCB_UART_GetNumInTxFifo. * -* \snippet SCB_CompDatasheet_sut_01_revA.cydsn\uart_snippets.c UART_TRANSMIT_DATA_LL +* \snippet scb/uart_snippet/main.c UART_TRANSMIT_DATA_LL * ******************************************************************************** * \subsection group_scb_uart_hl High-Level API @@ -197,10 +197,10 @@ * function to be notified about \ref group_scb_uart_macros_callback_events. * * <b>Receive Operation</b> -* \snippet SCB_CompDatasheet_sut_01_revA.cydsn\uart_snippets.c UART_RECEIVE_DATA_HL +* \snippet scb/uart_snippet/main.c UART_RECEIVE_DATA_HL * * <b>Transmit Operation</b> -* \snippet SCB_CompDatasheet_sut_01_revA.cydsn\uart_snippets.c UART_TRANSMIT_DATA_HL +* \snippet scb/uart_snippet/main.c UART_TRANSMIT_DATA_HL * * There is also capability to insert a receive ring buffer that operates between * the RX FIFO and the user buffer. The received data is copied into the ring @@ -273,111 +273,6 @@ * to the appropriate UART lines to keep them inactive during Deep-Sleep or * Hibernate. * -******************************************************************************** -* \section group_scb_uart_more_information More Information -******************************************************************************** -* For more information on the SCB peripheral, refer to the technical reference -* manual (TRM). -* -******************************************************************************** -* \section group_scb_uart_MISRA MISRA-C Compliance -******************************************************************************** -* <table class="doxtable"> -* <tr> -* <th>MISRA Rule</th> -* <th>Rule Class (Required/Advisory)</th> -* <th>Rule Description</th> -* <th>Description of Deviation(s)</th> -* </tr> -* <tr> -* <td>11.4</td> -* <td>A</td> -* <td>A cast should not be performed between a pointer to object type and -* a different pointer to object type.</td> -* <td> -* * The pointer to the buffer memory is void to allow handling different -* different data types: uint8_t (4-8 bits) or uint16_t (9-16 bits). -* The cast operation is safe because the configuration is verified -* before operation is performed. -* * The functions \ref Cy_SCB_UART_DeepSleepCallback and -* \ref Cy_SCB_UART_HibernateCallback are callback of -* \ref cy_en_syspm_status_t type. The cast operation safety in these -* functions becomes the user's responsibility because pointers are -* initialized when callback is registered in SysPm driver.</td> -* </tr> -* <tr> -* <td>14.2</td> -* <td>R</td> -* <td>All non-null statements shall either: a) have at least one side-effect -* however executed, or b) cause control flow to change.</td> -* <td>The unused function parameters are cast to void. This statement -* has no side-effect and is used to suppress a compiler warning.</td> -* </tr> -* <tr> -* <td>14.7</td> -* <td>R</td> -* <td>A function shall have a single point of exit at the end of the -* function.</td> -* <td>The functions can return from several points. This is done to improve -* code clarity when returning error status code if input parameters -* validation fails.</td> -* </tr> -* </table> -* -* \section group_scb_uart_changelog Changelog -* <table class="doxtable"> -* <tr><th>Version</th><th>Changes</th><th>Reason for Change</th></tr> -* <tr> -* <td rowspan="2">2.20</td> -* <td>Flattened the organization of the driver source code into the single -* source directory and the single include directory. -* </td> -* <td>Driver library directory-structure simplification.</td> -* </tr> -* <tr> -* <td>Added register access layer. Use register access macros instead -* of direct register access using dereferenced pointers.</td> -* <td>Makes register access device-independent, so that the PDL does -* not need to be recompiled for each supported part number.</td> -* </tr> -* <tr> -* <td>2.10</td> -* <td>None.</td> -* <td>SCB I2C driver updated.</td> -* </tr> -* <tr> -* <td rowspan="5">2.0</td> -* <td>Added parameters validation for public API.</td> -* <td></td> -* </tr> -* <tr> -* <td>Replaced variables that have limited range of values with enumerated -* types.</td> -* <td></td> -* </tr> -* <tr> -* <td>Added missing "cy_cb_" to the callback function type names.</td> -* <td></td> -* </tr> -* <tr> -* <td>Added function \ref Cy_SCB_UART_SendBreakBlocking for break condition -* generation.</td> -* <td></td> -* </tr> -* <tr> -* <td>Fixed low power callbacks \ref Cy_SCB_UART_DeepSleepCallback and -* \ref Cy_SCB_UART_HibernateCallback to prevent the device from entering -* low power mode when RX FIFO is not empty.</td> -* <td>The callbacks allowed entering device into low power mode when RX FIFO -* had data.</td> -* </tr> -* <tr> -* <td>1.0</td> -* <td>Initial version.</td> -* <td></td> -* </tr> -* </table> -* * \defgroup group_scb_uart_macros Macros * \defgroup group_scb_uart_functions Functions * \{ @@ -396,6 +291,8 @@ #include "cy_scb_common.h" +#ifdef CY_IP_MXSCB + #if defined(__cplusplus) extern "C" { #endif @@ -955,8 +852,15 @@ cy_en_syspm_status_t Cy_SCB_UART_HibernateCallback(cy_stc_syspm_callback_params_ * the source of the error */ #define CY_SCB_UART_TRANSMIT_ERR_EVENT (0x20UL) + +/** The receive fifo is not empty. To use this event the \ref CY_SCB_RX_INTR_NOT_EMPTY interrupt must be enabled by the user. */ +#define CY_SCB_UART_RECEIVE_NOT_EMTPY (0x40UL) + +/** The transmit fifo is empty. To use this event the \ref CY_SCB_UART_TX_EMPTY interrupt must be enabled by the user. */ +#define CY_SCB_UART_TRANSMIT_EMTPY (0x80UL) /** \} group_scb_uart_macros_callback_events */ + /** Data returned by the hardware when an empty RX FIFO is read */ #define CY_SCB_UART_RX_NO_DATA (0xFFFFFFFFUL) @@ -1615,8 +1519,8 @@ __STATIC_INLINE void Cy_SCB_UART_RegisterCallback(CySCB_Type const *base, /** \} group_scb_uart */ -#endif /* (CY_SCB_UART_H) */ - +#endif /* (CY_IP_MXSCB) */ +#endif /* (CY_SCB_UART_H) */ /* [] END OF FILE */ diff --git a/platform/ext/target/psoc64/Native_Driver/include/cy_smif.h b/platform/ext/target/psoc64/Native_Driver/include/cy_smif.h index 70f9cb0765..0bbdacd992 100644 --- a/platform/ext/target/psoc64/Native_Driver/include/cy_smif.h +++ b/platform/ext/target/psoc64/Native_Driver/include/cy_smif.h @@ -1,6 +1,6 @@ /***************************************************************************//** * \file cy_smif.h -* \version 1.20.1 +* \version 1.40 * * Provides an API declaration of the Cypress SMIF driver. * @@ -33,7 +33,7 @@ * * SMIF: Serial Memory Interface: This IP block implements an SPI-based * communication interface for interfacing external memory devices to PSoC. The SMIF -* supports Octal-SPI, Dual Quad-SPI, Quad-SPI, DSPI, and SPI. +* supports Octal-SPI, Dual Quad-SPI, Quad-SPI, Dual-SPI, and SPI. * * Features * - Standard SPI Master interface @@ -43,16 +43,15 @@ * memory devices * - eXecute-In-Place (XIP) operation mode for both read and write accesses * with 4KB XIP read cache and on-the-fly encryption and decryption -* - Supports external serial memory initialization via Serial Flash -* Discoverable Parameters (SFDP) standard -* - Support for SPI clock frequencies up to 80 MHz -* +* - Supports external serial memory initialization via +* <a href="https://www.jedec.org/standards-documents/docs/jesd216b" target="_blank"> +* Serial Flash Discoverable Parameters (SFDP)</a> standard * * The primary usage model for the SMIF is that of an external memory interface. * The SMIF is capable of interfacing with different types of memory, up to four * types. * -* \b SMIF driver is divided in next layers +* \b SMIF driver is divided into three layers * - cy_smif.h API * - cy_smif_memslot.h API * - SMIF configuration structures @@ -63,9 +62,9 @@ * * The memory slot API has functions to implement the basic memory operations such as * program, read, erase etc. These functions are implemented using the memory -* parameters in the memory device configuration data structure. The memory-slot -* initialization API initializes all the memory slots based on the settings in the -* array. +* parameters in the memory device configuration data structure. The +* Cy_SMIF_MemInit() API initializes all the memory slots based on the settings +* in the array. * * \image html smif_1_0_p01_layers.png * @@ -74,7 +73,7 @@ * (e.g. for PDL 3.0.0 and Windows OS PDL/3.0.0/tools/win/SMIFConfigurationTool). * * In ModusToolbox this tool is called QSPI Configurator. QSPI Configurator is a part of -* PSoC 6 Software Library and can be found in \<ModusToolbox\>/tools/qspi-configurator-1.0 +* PSoC 6 Software Library and can be found in \<ModusToolbox\>/tools/qspi-configurator-1.1 * * Tool generates *.c and *.h file with configuration structures. These configuration * structures are input parameters for cy_smif_memslot API level @@ -87,30 +86,30 @@ * * For the Write operation, check that the SMIF driver has completed * transferring by calling Cy_SMIF_BusyCheck(). Also, check that the memory is -* available with Cy_SMIF_Memslot_IsBusy() before proceeding. +* available with Cy_SMIF_MemIsBusy() before proceeding. * * Simple example of external flash memory programming using low level SMIF API. * All steps mentioned in example below are incorporated in -* \ref Cy_SMIF_Memslot_CmdWriteEnable(), \ref Cy_SMIF_Memslot_CmdProgram(), and -* \ref Cy_SMIF_Memslot_IsBusy() of the +* \ref Cy_SMIF_MemCmdWriteEnable(), \ref Cy_SMIF_MemCmdProgram(), and +* \ref Cy_SMIF_MemIsBusy() of the * \ref group_smif_mem_slot_functions "memory slot level API". * \warning Example is simplified, without checks of error conditions. * \note Flash memories need erase operation before programming. Refer to * external memory datasheet for specific memory commands. * -* \snippet smif/smif_sut_01.cydsn/main_cm4.c SMIF_API: Write example +* \snippet smif/snippet/main.c SMIF_API: Write example * * For the Read operation, before accessing the read buffer, check that it is ready * by calling Cy_SMIF_GetTxFifoStatus(). * * Simple example of external flash memory read using low level SMIF API. All * steps mentioned in example below are incorporated in -* \ref Cy_SMIF_Memslot_CmdRead() of the +* \ref Cy_SMIF_MemCmdRead() of the * \ref group_smif_mem_slot_functions "memory slot level API". * \warning Example is simplified, without checks of error conditions. * \note Refer to external memory datasheet for specific memory commands. * -* \snippet smif/smif_sut_01.cydsn/main_cm4.c SMIF_API: Read example +* \snippet smif/snippet/main.c SMIF_API: Read example * * The user should invalidate the cache by calling Cy_SMIF_CacheInvalidate() when * switching from the MMIO mode to XIP mode. @@ -120,7 +119,7 @@ * PDL API has common parameters: base, context, config described in * \ref page_getting_started_pdl_design "PDL Design" section. * -* See the documentation for Cy_SMIF_Init() and Cy_SMIF_Memslot_Init() for details +* See the documentation for Cy_SMIF_Init() and Cy_SMIF_MemInit() for details * on the required configuration structures and other initialization topics. * * The normal (MMIO) mode is used for implementing a generic SPI/DSPI/QSPI/Dual @@ -143,12 +142,12 @@ * \subsection group_smif_init SMIF Initialization * Create interrupt function and allocate memory for SMIF context * structure -* \snippet smif/smif_sut_01.cydsn/main_cm4.c SMIF_INIT: context and interrupt +* \snippet smif/snippet/main.c SMIF_INIT: context and interrupt * SMIF driver initialization for low level API usage (cysmif.h) -* \snippet smif/smif_sut_01.cydsn/main_cm4.c SMIF_INIT: low level +* \snippet smif/snippet/main.c SMIF_INIT: low level * Additional steps to initialize SMIF driver for memory slot level API usage * (cy_smif_memslot.h). -* \snippet smif/smif_sut_01.cydsn/main_cm4.c SMIF_INIT: memslot level +* \snippet smif/snippet/main.c SMIF_INIT: memslot level * \note Example does not include initialization of all needed configuration * structures (\ref cy_stc_smif_mem_device_cfg_t, \ref cy_stc_smif_mem_cmd_t). * SMIF/QSPI Configuration tool generates all configuration structures needed for @@ -160,8 +159,10 @@ * function calls. In this mode the SMIF block maps the AHB bus-accesses to * external memory device addresses to make it behave similar to internal memory. * This allows the CPU to execute code directly from external memory. This mode -* is not limited to code and is suitable also for data read and write accesses. -* \snippet smif/smif_sut_01.cydsn/main_cm4.c SMIF_INIT: XIP +* is not limited to code and is suitable also for data read and write accesses. +* The memory regions available for XIP addresses allocation are defined +* in a linker script file (.ld). +* \snippet smif/snippet/main.c SMIF_INIT: XIP * \note Example of input parameters initialization is in \ref group_smif_init * section. * \warning Functions that called from external memory should be declared with @@ -212,6 +213,109 @@ * <table class="doxtable"> * <tr><th>Version</th><th>Changes</th><th>Reason for Change</th></tr> * <tr> +* <td rowspan="5">1.40</td> +* <td>The following functions are renamed:\n +* Cy_SMIF_GetTxfrStatus into Cy_SMIF_GetTransferStatus;\n +* Cy_SMIF_Memslot_Init into Cy_SMIF_MemInit;\n +* Cy_SMIF_Memslot_DeInit into Cy_SMIF_MemDeInit;\n +* Cy_SMIF_Memslot_CmdWriteEnable into Cy_SMIF_MemCmdWriteEnable;\n +* Cy_SMIF_Memslot_CmdWriteDisable into Cy_SMIF_MemCmdWriteDisable;\n +* Cy_SMIF_Memslot_IsBusy into Cy_SMIF_MemIsBusy;\n +* Cy_SMIF_Memslot_QuadEnable into Cy_SMIF_MemQuadEnable;\n +* Cy_SMIF_Memslot_CmdReadSts into Cy_SMIF_MemCmdReadStatus;\n +* Cy_SMIF_Memslot_CmdWriteSts into Cy_SMIF_MemCmdWriteStatus;\n +* Cy_SMIF_Memslot_CmdChipErase into Cy_SMIF_MemCmdChipErase;\n +* Cy_SMIF_Memslot_CmdSectorErase into Cy_SMIF_MemCmdSectorErase;\n +* Cy_SMIF_Memslot_SfdpDetect into Cy_SMIF_MemSfdpDetect;\n +* Cy_SMIF_Memslot_CmdProgram into Cy_SMIF_MemCmdProgram;\n +* Cy_SMIF_Memslot_CmdRead into Cy_SMIF_MemCmdRead.\n +* The following ENUMa are renamed:\n +* CY_SMIF_SEND_CMPLT into CY_SMIF_SEND_COMPLETE;\n +* CY_SMIF_REC_CMPLT into CY_SMIF_RX_COMPLETE;\n +* CY_SMIF_REC_BUSY into CY_SMIF_RX_BUSY;\n +* CY_SMIF_SEL_INV_INTERNAL_CLK into CY_SMIF_SEL_INVERTED_INTERNAL_CLK;\n +* CY_SMIF_SEL_INV_FEEDBACK_CLK into CY_SMIF_SEL_INVERTED_FEEDBACK_CLK;\n +* cy_en_smif_cache_en_t into cy_en_smif_cache_t.\n +* The following MACROs are renamed:\n +* CY_SMIF_FLAG_WR_EN into CY_SMIF_FLAG_WRITE_ENABLE;\n +* CY_SMIF_FLAG_CRYPTO_EN into CY_SMIF_FLAG_CRYPTO_ENABLE;\n +* CY_SMIF_SFDP_SING_BYTE_00 into CY_SMIF_SFDP_SIGNATURE_BYTE_00;\n +* CY_SMIF_SFDP_SING_BYTE_01 into CY_SMIF_SFDP_SIGNATURE_BYTE_01;\n +* CY_SMIF_SFDP_SING_BYTE_02 into CY_SMIF_SFDP_SIGNATURE_BYTE_02;\n +* CY_SMIF_SFDP_SING_BYTE_03 into CY_SMIF_SFDP_SIGNATURE_BYTE_03;\n +* CY_SMIF_WR_STS_REG1_CMD into CY_SMIF_WRITE_STATUS_REG1_CMD;\n +* CY_SMIF_WR_DISABLE_CMD into CY_SMIF_WRITE_DISABLE_CMD;\n +* CY_SMIF_RD_STS_REG1_CMD into CY_SMIF_READ_STATUS_REG1_CMD;\n +* CY_SMIF_WR_ENABLE_CMD into CY_SMIF_WRITE_ENABLE_CMD;\n +* CY_SMIF_RD_STS_REG2_T1_CMD into CY_SMIF_READ_STATUS_REG2_T1_CMD;\n +* CY_SMIF_WR_STS_REG2_CMD into CY_SMIF_WRITE_STATUS_REG2_CMD;\n +* CY_SMIF_RD_STS_REG2_T2_CMD into CY_SMIF_READ_STATUS_REG2_T2_CMD;\n +* CY_SMIF_QE_BIT_STS_REG2_T1 into CY_SMIF_QE_BIT_STATUS_REG2_T1;\n +* CY_SMIF_STS_REG_BUSY_MASK into CY_SMIF_STATUS_REG_BUSY_MASK.\n +* </td> +* <td rowspan="2">Documentation improvement.</td> +* </tr> +* <tr> +* <td>Updated the description of the Cy_SMIF_MemInit() function. +* Updated the Cy_SMIF_Encrypt() function usage example. +* </td> +* </tr> +* <tr> +* <td>The type of arguments that are not modified by the functions are set to const. +* </td> +* <td>Usability improvement. +* </td> +* </tr> +* <tr> +* <td>The Cy_SMIF_MemSfdpDetect() function is updated to support new +* commands for 4 bytes addressing. +* </td> +* <td>Memory devices with new 4 byte addressing commands support. +* </td> +* </tr> +* <tr> +* <td>Added the blocking functions which take care of the +* busy-status check of the memory: +* - \ref Cy_SMIF_MemIsReady +* - \ref Cy_SMIF_MemIsQuadEnabled +* - \ref Cy_SMIF_MemEnableQuadMode +* - \ref Cy_SMIF_MemRead +* - \ref Cy_SMIF_MemWrite +* - \ref Cy_SMIF_MemEraseSector +* - \ref Cy_SMIF_MemEraseChip +* </td> +* <td>Added new high-level blocking functions. +* </td> +* </tr> +* <tr> +* <td rowspan="5">1.30</td> +* <td>The CY_SMIF_CMD_FIFO_WR_RX_COUNT_Msk value is changed to 0x0000FFFFUL.</td> +* <td rowspan="4">Driver maintenance.</td> +* </tr> +* <tr> +* <td>Added the check of the size parameter in the Cy_SMIF_TransmitData() function.</td> +* </tr> +* <tr> +* <td>Added conditional check for presence of the SMIF hardware IP.</td> +* </tr> +* <tr> +* <td>Fixed the wrong erase command in the SFDP protocol for devices with Erase Type 3.</td> +* </tr> +* <tr> +* <td>Updated the General Description section with minor changes. +* Updated the ordering of the parameters descriptions for some functions. +* Added the text saying that the Cy_SMIF_MemInit() function is applicable +* to use the external memory as memory-mapped to PSoC (XIP mode). +* Added the snippet for the Cy_SMIF_Encrypt() function to show how to use this function. +* Added below the picture in the Low-Level Functions section the sequence of PDL +* functions required in a Read or Write transaction. +* Added the text below the picture about the address. +* Updated DUMMY COUNT in this picture. +* Added checking of the size parameter in the Cy_SMIF_TransmitData() function. +* </td> +* <td>Documentation improvement.</td> +* </tr> +* <tr> * <td>1.20.1</td> * <td>Added upper limit to size parameter in several functions.</td> * <td>Documentation improvement.</td> @@ -275,12 +379,20 @@ * \{ * \defgroup group_smif_low_level_functions Low Level Functions * \{ -* Basic flow for read/write commands using \ref Cy_SMIF_TransmitCommand -* \ref Cy_SMIF_TransmitData \ref Cy_SMIF_ReceiveData +* Basic flow for read/write commands using \ref Cy_SMIF_TransmitCommand, +* \ref Cy_SMIF_TransmitData, \ref Cy_SMIF_ReceiveData and * \ref Cy_SMIF_SendDummyCycles * * \image html smif_1_0_p03_rw_cmd.png * +* The sequence of the PDL functions required in a read or write transaction is: +* \ref Cy_SMIF_TransmitCommand() -> +* \ref Cy_SMIF_SendDummyCycles() -> +* \ref Cy_SMIF_ReceiveData() / \ref Cy_SMIF_TransmitData() -> +* \ref Cy_SMIF_BusyCheck(). +* The address is sent as part of the Cy_SMIF_TransmitCommand() function. +* No separate function call is required. +* * \} * \defgroup group_smif_mem_slot_functions Memory Slot Functions * \defgroup group_smif_functions_syspm_callback Low Power Callback @@ -328,14 +440,14 @@ extern "C" { #define CY_SMIF_DRV_VERSION_MAJOR 1 /** The driver minor version */ -#define CY_SMIF_DRV_VERSION_MINOR 20 +#define CY_SMIF_DRV_VERSION_MINOR 40 /** One microsecond timeout for Cy_SMIF_TimeoutRun() */ -#define CY_SMIF_WAIT_1_UNIT (1U) +#define CY_SMIF_WAIT_1_UNIT (1U) /** The SMIF driver ID, reported as part of an unsuccessful API return status * \ref cy_en_smif_status_t */ -#define CY_SMIF_ID CY_PDL_DRV_ID(0x2CU) +#define CY_SMIF_ID CY_PDL_DRV_ID(0x2CU) /** @@ -350,7 +462,7 @@ extern "C" { /** Enable TX_DATA_FIFO_OVERFLOW interrupt see TRM for details */ #define CY_SMIF_TX_DATA_FIFO_OVERFLOW (SMIF_INTR_TX_DATA_FIFO_OVERFLOW_Msk) /** Enable TX_CMD_FIFO_OVERFLOW interrupt see TRM for details */ -#define CY_SMIF_TX_COMMAND_FIFO_OVERFLOW (SMIF_INTR_TX_CMD_FIFO_OVERFLOW_Msk) +#define CY_SMIF_TX_COMMAND_FIFO_OVERFLOW (SMIF_INTR_TX_CMD_FIFO_OVERFLOW_Msk) /** Enable TR_TX_REQ interrupt see TRM for details */ #define CY_SMIF_TX_DATA_FIFO_LEVEL_TRIGGER (SMIF_INTR_TR_TX_REQ_Msk) /** Enable TR_RX_REQ interrupt see TRM for details */ @@ -360,73 +472,76 @@ extern "C" { /** \cond INTERNAL */ -#define CY_SMIF_CMD_FIFO_TX_MODE (0UL) -#define CY_SMIF_CMD_FIFO_TX_COUNT_MODE (1UL) -#define CY_SMIF_CMD_FIFO_RX_COUNT_MODE (2UL) -#define CY_SMIF_CMD_FIFO_DUMMY_COUNT_MODE (3UL) - -#define CY_SMIF_TX_CMD_FIFO_STATUS_RANGE (4U) -#define CY_SMIF_TX_DATA_FIFO_STATUS_RANGE (8U) -#define CY_SMIF_RX_DATA_FIFO_STATUS_RANGE (8U) - -#define CY_SMIF_ONE_BYTE (1U) -#define CY_SMIF_TWO_BYTES (2U) -#define CY_SMIF_THREE_BYTES (3U) -#define CY_SMIF_FOUR_BYTES (4U) -#define CY_SMIF_FIVE_BYTES (5U) -#define CY_SMIF_SIX_BYTES (6U) -#define CY_SMIF_SEVEN_BYTES (7U) -#define CY_SMIF_EIGHT_BYTES (8U) - -#define CY_SMIF_CRYPTO_FIRST_WORD (0U) -#define CY_SMIF_CRYPTO_SECOND_WORD (4U) -#define CY_SMIF_CRYPTO_THIRD_WORD (8U) -#define CY_SMIF_CRYPTO_FOURTH_WORD (12U) - -#define CY_SMIF_CRYPTO_START (1UL) -#define CY_SMIF_CRYPTO_COMPLETED (0UL) -#define CY_SMIF_CRYPTO_ADDR_MASK (0xFFFFFFF0UL) -#define CY_SMIF_AES128_BYTES (16U) - -#define CY_SMIF_CTL_REG_DEFAULT (0x00000300U) /* 3 - [13:12] CLOCK_IF_RX_SEL */ - -#define CY_SMIF_SFDP_FAIL (0x08U) -#define CY_SMIF_SFDP_FAIL_SS0_POS (0x00U) -#define CY_SMIF_SFDP_FAIL_SS1_POS (0x01U) -#define CY_SMIF_SFDP_FAIL_SS2_POS (0x02U) -#define CY_SMIF_SFDP_FAIL_SS3_POS (0x03U) - -#define CY_SMIF_MAX_DESELECT_DELAY (7U) -#define CY_SMIF_MAX_TX_TR_LEVEL (8U) -#define CY_SMIF_MAX_RX_TR_LEVEL (8U) - -#define CY_SMIF_MODE_VALID(mode) ((CY_SMIF_NORMAL == (cy_en_smif_mode_t)(mode)) || \ - (CY_SMIF_MEMORY == (cy_en_smif_mode_t)(mode))) +#define CY_SMIF_CMD_FIFO_TX_MODE (0UL) +#define CY_SMIF_CMD_FIFO_TX_COUNT_MODE (1UL) +#define CY_SMIF_CMD_FIFO_RX_COUNT_MODE (2UL) +#define CY_SMIF_CMD_FIFO_DUMMY_COUNT_MODE (3UL) + +#define CY_SMIF_TX_CMD_FIFO_STATUS_RANGE (4U) +#define CY_SMIF_TX_DATA_FIFO_STATUS_RANGE (8U) +#define CY_SMIF_RX_DATA_FIFO_STATUS_RANGE (8U) + +#define CY_SMIF_ONE_BYTE (1U) +#define CY_SMIF_TWO_BYTES (2U) +#define CY_SMIF_THREE_BYTES (3U) +#define CY_SMIF_FOUR_BYTES (4U) +#define CY_SMIF_FIVE_BYTES (5U) +#define CY_SMIF_SIX_BYTES (6U) +#define CY_SMIF_SEVEN_BYTES (7U) +#define CY_SMIF_EIGHT_BYTES (8U) + +#define CY_SMIF_CRYPTO_FIRST_WORD (0U) +#define CY_SMIF_CRYPTO_SECOND_WORD (4U) +#define CY_SMIF_CRYPTO_THIRD_WORD (8U) +#define CY_SMIF_CRYPTO_FOURTH_WORD (12U) + +#define CY_SMIF_CRYPTO_START (1UL) +#define CY_SMIF_CRYPTO_COMPLETED (0UL) +#define CY_SMIF_CRYPTO_ADDR_MASK (0xFFFFFFF0UL) +#define CY_SMIF_AES128_BYTES (16U) + +#define CY_SMIF_CTL_REG_DEFAULT (0x00000300U) /* 3 - [13:12] CLOCK_IF_RX_SEL */ + +#define CY_SMIF_SFDP_FAIL (0x08U) +#define CY_SMIF_SFDP_FAIL_SS0_POS (0x00U) +#define CY_SMIF_SFDP_FAIL_SS1_POS (0x01U) +#define CY_SMIF_SFDP_FAIL_SS2_POS (0x02U) +#define CY_SMIF_SFDP_FAIL_SS3_POS (0x03U) + +#define CY_SMIF_MAX_DESELECT_DELAY (7U) +#define CY_SMIF_MAX_TX_TR_LEVEL (8U) +#define CY_SMIF_MAX_RX_TR_LEVEL (8U) + +#define CY_SMIF_MODE_VALID(mode) ((CY_SMIF_NORMAL == (cy_en_smif_mode_t)(mode)) || \ + (CY_SMIF_MEMORY == (cy_en_smif_mode_t)(mode))) #define CY_SMIF_BLOCK_EVENT_VALID(event) ((CY_SMIF_BUS_ERROR == (cy_en_smif_error_event_t)(event)) || \ (CY_SMIF_WAIT_STATES == (cy_en_smif_error_event_t)(event))) #define CY_SMIF_CLOCK_SEL_VALID(clkSel) ((CY_SMIF_SEL_INTERNAL_CLK == (cy_en_smif_clk_select_t)(clkSel)) || \ - (CY_SMIF_SEL_INV_INTERNAL_CLK == (cy_en_smif_clk_select_t)(clkSel)) || \ + (CY_SMIF_SEL_INVERTED_INTERNAL_CLK == (cy_en_smif_clk_select_t)(clkSel)) || \ (CY_SMIF_SEL_FEEDBACK_CLK == (cy_en_smif_clk_select_t)(clkSel)) || \ - (CY_SMIF_SEL_INV_FEEDBACK_CLK == (cy_en_smif_clk_select_t)(clkSel))) + (CY_SMIF_SEL_INVERTED_FEEDBACK_CLK == (cy_en_smif_clk_select_t)(clkSel))) -#define CY_SMIF_DESELECT_DELAY_VALID(delay) ((delay) <= CY_SMIF_MAX_DESELECT_DELAY) -#define CY_SMIF_SLAVE_SEL_VALID(ss) ((CY_SMIF_SLAVE_SELECT_0 == (ss)) || \ - (CY_SMIF_SLAVE_SELECT_1 == (ss)) || \ - (CY_SMIF_SLAVE_SELECT_2 == (ss)) || \ - (CY_SMIF_SLAVE_SELECT_3 == (ss))) -#define CY_SMIF_DATA_SEL_VALID(ss) ((CY_SMIF_DATA_SEL0 == (ss)) || \ - (CY_SMIF_DATA_SEL1 == (ss)) || \ - (CY_SMIF_DATA_SEL2 == (ss)) || \ - (CY_SMIF_DATA_SEL3 == (ss))) -#define CY_SMIF_TXFR_WIDTH_VALID(width) ((CY_SMIF_WIDTH_SINGLE == (width)) || \ - (CY_SMIF_WIDTH_DUAL == (width)) || \ - (CY_SMIF_WIDTH_QUAD == (width)) || \ - (CY_SMIF_WIDTH_OCTAL == (width)) || \ - (CY_SMIF_WIDTH_NA == (width))) -#define CY_SMIF_CMD_PARAM_VALID(param, paramSize) (((paramSize) > 0U)? (NULL != (param)) : (true)) - -#define CY_SMIF_WIDTH_NA_VALID(paramWidth, paramSize) (((paramSize) > 0U)? \ - (CY_SMIF_WIDTH_NA != (paramWidth)) : (true)) +#define CY_SMIF_DESELECT_DELAY_VALID(delay) ((delay) <= CY_SMIF_MAX_DESELECT_DELAY) +#define CY_SMIF_SLAVE_SEL_VALID(ss) ((CY_SMIF_SLAVE_SELECT_0 == (ss)) || \ + (CY_SMIF_SLAVE_SELECT_1 == (ss)) || \ + (CY_SMIF_SLAVE_SELECT_2 == (ss)) || \ + (CY_SMIF_SLAVE_SELECT_3 == (ss))) +#define CY_SMIF_DATA_SEL_VALID(ss) ((CY_SMIF_DATA_SEL0 == (ss)) || \ + (CY_SMIF_DATA_SEL1 == (ss)) || \ + (CY_SMIF_DATA_SEL2 == (ss)) || \ + (CY_SMIF_DATA_SEL3 == (ss))) +#define CY_SMIF_TXFR_WIDTH_VALID(width) ((CY_SMIF_WIDTH_SINGLE == (width)) || \ + (CY_SMIF_WIDTH_DUAL == (width)) || \ + (CY_SMIF_WIDTH_QUAD == (width)) || \ + (CY_SMIF_WIDTH_OCTAL == (width)) || \ + (CY_SMIF_WIDTH_NA == (width))) +#define CY_SMIF_CMD_PARAM_VALID(param, paramSize) (((paramSize) > 0U)? (NULL != (param)) : (true)) + +#define CY_SMIF_WIDTH_NA_VALID(paramWidth, paramSize) (((paramSize) > 0U)? \ + (CY_SMIF_WIDTH_NA != (paramWidth)) : (true)) + +#define CY_SMIF_BUFFER_SIZE_MAX (65536UL) +#define CY_SMIF_BUF_SIZE_VALID(size) (((CY_SMIF_BUFFER_SIZE_MAX) >= (size)) && ((0UL) < (size))) /*************************************** * Command FIFO Register @@ -461,7 +576,7 @@ extern "C" { #define CY_SMIF_CMD_FIFO_WR_DUMMY_Msk (0x0000FFFFUL) /* DATA[15:0] Dummy count */ #define CY_SMIF_CMD_FIFO_WR_TX_COUNT_Msk (0x0000FFFFUL) /* DATA[15:0] TX count */ #define CY_SMIF_CMD_FIFO_WR_TX_COUNT_Pos (0UL) /* [0] TX count */ -#define CY_SMIF_CMD_FIFO_WR_RX_COUNT_Msk (0x0003FFFFUL) /* DATA[17:0] RX count */ +#define CY_SMIF_CMD_FIFO_WR_RX_COUNT_Msk (0x0000FFFFUL) /* DATA[15:0] RX count */ #define CY_SMIF_CMD_FIFO_WR_RX_COUNT_Pos (0UL) /* [0] RX count */ /** \endcond*/ @@ -530,10 +645,10 @@ typedef enum typedef enum { CY_SMIF_STARTED, /**< The SMIF started. */ - CY_SMIF_SEND_CMPLT, /**< The data transmission is complete. */ + CY_SMIF_SEND_COMPLETE, /**< The data transmission is complete. */ CY_SMIF_SEND_BUSY, /**< The data transmission is in progress. */ - CY_SMIF_REC_CMPLT, /**< The data reception is completed. */ - CY_SMIF_REC_BUSY, /**< The data reception is in progress. */ + CY_SMIF_RX_COMPLETE, /**< The data reception is completed. */ + CY_SMIF_RX_BUSY, /**< The data reception is in progress. */ CY_SMIF_XIP_ERROR, /**< An XIP alignment error. */ CY_SMIF_CMD_ERROR, /**< A TX CMD FIFO overflow. */ CY_SMIF_TX_ERROR, /**< A TX DATA FIFO overflow. */ @@ -585,9 +700,9 @@ typedef enum typedef enum { CY_SMIF_SEL_INTERNAL_CLK = 0U, /**< The SMIF internal clock */ - CY_SMIF_SEL_INV_INTERNAL_CLK = 1U, /**< The SMIF internal inverted clock */ + CY_SMIF_SEL_INVERTED_INTERNAL_CLK = 1U, /**< The SMIF internal inverted clock */ CY_SMIF_SEL_FEEDBACK_CLK = 2U, /**< The SMIF feedback clock */ - CY_SMIF_SEL_INV_FEEDBACK_CLK = 3U /**< The SMIF feedback inverted clock */ + CY_SMIF_SEL_INVERTED_FEEDBACK_CLK = 3U /**< The SMIF feedback inverted clock */ } cy_en_smif_clk_select_t; /** Specifies enabled type of SMIF cache. */ @@ -596,7 +711,23 @@ typedef enum CY_SMIF_CACHE_SLOW = 1U, /**< The SMIF slow cache (in the clk_slow domain) see TRM for details */ CY_SMIF_CACHE_FAST = 2U, /**< The SMIF fast cache (in the clk_fast domain) see TRM for details */ CY_SMIF_CACHE_BOTH = 3U /**< The SMIF both caches */ -} cy_en_smif_cache_en_t; +} cy_en_smif_cache_t; + +/** \cond INTERNAL */ +/******************************************************************************* +* These are legacy macros. They are left here just for backward compatibility. +* Do not use them in new designs. +*******************************************************************************/ + +#define CY_SMIF_SEND_CMPLT CY_SMIF_SEND_COMPLETE +#define CY_SMIF_REC_CMPLT CY_SMIF_RX_COMPLETE +#define CY_SMIF_REC_BUSY CY_SMIF_RX_BUSY +#define CY_SMIF_SEL_INV_INTERNAL_CLK CY_SMIF_SEL_INVERTED_INTERNAL_CLK +#define CY_SMIF_SEL_INV_FEEDBACK_CLK CY_SMIF_SEL_INVERTED_FEEDBACK_CLK +#define cy_en_smif_cache_en_t cy_en_smif_cache_t +#define Cy_SMIF_GetTxfrStatus Cy_SMIF_GetTransferStatus + +/** \endcond*/ /** \} group_smif_enums */ @@ -640,7 +771,7 @@ typedef struct /** The SMIF internal context data. The user must not modify it. */ typedef struct { - uint8_t volatile * volatile txBufferAddress; /**< The pointer to the data to transfer */ + uint8_t const volatile * volatile txBufferAddress; /**< The pointer to the data to transfer */ uint32_t txBufferSize; /**< The size of the data to transmit in bytes */ /** * The transfer counter. The number of the transmitted bytes = txBufferSize - txBufferCounter @@ -656,8 +787,8 @@ typedef struct * The status of the transfer. The transmitting / receiving is completed / in progress */ uint32_t volatile transferStatus; - cy_smif_event_cb_t volatile txCmpltCb; /**< The user-defined callback executed at the completion of a transmission */ - cy_smif_event_cb_t volatile rxCmpltCb; /**< The user-defined callback executed at the completion of a reception */ + cy_smif_event_cb_t volatile txCompleteCb; /**< The user-defined callback executed at the completion of a transmission */ + cy_smif_event_cb_t volatile rxCompleteCb; /**< The user-defined callback executed at the completion of a reception */ /** * The timeout in microseconds for the blocking functions. This timeout value applies to all blocking APIs. */ @@ -685,22 +816,22 @@ cy_en_smif_status_t Cy_SMIF_TransmitCommand(SMIF_Type *base, cy_en_smif_txfr_width_t cmdTxfrWidth, uint8_t const cmdParam[], uint32_t paramSize, cy_en_smif_txfr_width_t paramTxfrWidth, - cy_en_smif_slave_select_t slaveSelect, uint32_t cmpltTxfr, + cy_en_smif_slave_select_t slaveSelect, uint32_t completeTxfr, cy_stc_smif_context_t const *context); cy_en_smif_status_t Cy_SMIF_TransmitData(SMIF_Type *base, - uint8_t *txBuffer, uint32_t size, + uint8_t const *txBuffer, uint32_t size, cy_en_smif_txfr_width_t transferWidth, - cy_smif_event_cb_t TxCmpltCb, + cy_smif_event_cb_t TxCompleteCb, cy_stc_smif_context_t *context); cy_en_smif_status_t Cy_SMIF_TransmitDataBlocking(SMIF_Type *base, - uint8_t *txBuffer, + uint8_t const *txBuffer, uint32_t size, cy_en_smif_txfr_width_t transferWidth, cy_stc_smif_context_t const *context); cy_en_smif_status_t Cy_SMIF_ReceiveData(SMIF_Type *base, uint8_t *rxBuffer, uint32_t size, cy_en_smif_txfr_width_t transferWidth, - cy_smif_event_cb_t RxCmpltCb, + cy_smif_event_cb_t RxCompleteCb, cy_stc_smif_context_t *context); cy_en_smif_status_t Cy_SMIF_ReceiveDataBlocking(SMIF_Type *base, uint8_t *rxBuffer, @@ -708,7 +839,7 @@ cy_en_smif_status_t Cy_SMIF_ReceiveDataBlocking(SMIF_Type *base, cy_en_smif_txfr_width_t transferWidth, cy_stc_smif_context_t const *context); cy_en_smif_status_t Cy_SMIF_SendDummyCycles(SMIF_Type *base, uint32_t cycles); -uint32_t Cy_SMIF_GetTxfrStatus(SMIF_Type *base, cy_stc_smif_context_t const *context); +uint32_t Cy_SMIF_GetTransferStatus(SMIF_Type const *base, cy_stc_smif_context_t const *context); void Cy_SMIF_Enable(SMIF_Type *base, cy_stc_smif_context_t *context); __STATIC_INLINE void Cy_SMIF_Disable(SMIF_Type *base); __STATIC_INLINE void Cy_SMIF_SetInterruptMask(SMIF_Type *base, uint32_t interrupt); @@ -729,11 +860,11 @@ cy_en_smif_status_t Cy_SMIF_Encrypt(SMIF_Type *base, cy_stc_smif_context_t const *context); __STATIC_INLINE bool Cy_SMIF_BusyCheck(SMIF_Type const *base); __STATIC_INLINE void Cy_SMIF_Interrupt(SMIF_Type *base, cy_stc_smif_context_t *context); -cy_en_smif_status_t Cy_SMIF_CacheEnable(SMIF_Type *base, cy_en_smif_cache_en_t cacheType); -cy_en_smif_status_t Cy_SMIF_CacheDisable(SMIF_Type *base, cy_en_smif_cache_en_t cacheType); -cy_en_smif_status_t Cy_SMIF_CachePrefetchingEnable(SMIF_Type *base, cy_en_smif_cache_en_t cacheType); -cy_en_smif_status_t Cy_SMIF_CachePrefetchingDisable(SMIF_Type *base, cy_en_smif_cache_en_t cacheType); -cy_en_smif_status_t Cy_SMIF_CacheInvalidate(SMIF_Type *base, cy_en_smif_cache_en_t cacheType); +cy_en_smif_status_t Cy_SMIF_CacheEnable(SMIF_Type *base, cy_en_smif_cache_t cacheType); +cy_en_smif_status_t Cy_SMIF_CacheDisable(SMIF_Type *base, cy_en_smif_cache_t cacheType); +cy_en_smif_status_t Cy_SMIF_CachePrefetchingEnable(SMIF_Type *base, cy_en_smif_cache_t cacheType); +cy_en_smif_status_t Cy_SMIF_CachePrefetchingDisable(SMIF_Type *base, cy_en_smif_cache_t cacheType); +cy_en_smif_status_t Cy_SMIF_CacheInvalidate(SMIF_Type *base, cy_en_smif_cache_t cacheType); /** \addtogroup group_smif_functions_syspm_callback * The driver supports SysPm callback for Deep Sleep and Hibernate transition. @@ -1216,10 +1347,10 @@ __STATIC_INLINE void Cy_SMIF_PushTxFifo(SMIF_Type *baseaddr, cy_stc_smif_context /* Disable the TR_TX_REQ interrupt */ Cy_SMIF_SetInterruptMask(baseaddr, Cy_SMIF_GetInterruptMask(baseaddr) & ~SMIF_INTR_TR_TX_REQ_Msk); - context->transferStatus = (uint32_t) CY_SMIF_SEND_CMPLT; - if (NULL != context->txCmpltCb) + context->transferStatus = (uint32_t) CY_SMIF_SEND_COMPLETE; + if (NULL != context->txCompleteCb) { - context->txCmpltCb((uint32_t) CY_SMIF_SEND_CMPLT); + context->txCompleteCb((uint32_t) CY_SMIF_SEND_COMPLETE); } } } @@ -1318,10 +1449,10 @@ __STATIC_INLINE void Cy_SMIF_PopRxFifo(SMIF_Type *baseaddr, cy_stc_smif_context_ { /* Disable the TR_RX_REQ interrupt */ Cy_SMIF_SetInterruptMask(baseaddr, Cy_SMIF_GetInterruptMask(baseaddr) & ~SMIF_INTR_TR_RX_REQ_Msk); - context->transferStatus = (uint32_t) CY_SMIF_REC_CMPLT; - if (NULL != context->rxCmpltCb) + context->transferStatus = (uint32_t) CY_SMIF_RX_COMPLETE; + if (NULL != context->rxCompleteCb) { - context->rxCmpltCb((uint32_t) CY_SMIF_REC_CMPLT); + context->rxCompleteCb((uint32_t) CY_SMIF_RX_COMPLETE); } } @@ -1341,8 +1472,8 @@ __STATIC_INLINE void Cy_SMIF_PopRxFifo(SMIF_Type *baseaddr, cy_stc_smif_context_ * The byte array to pack. * * \param fourBytes -* - The True pack is for a 32-bit value. -* - The False pack is for a 16-bit value. +* - True: The pack is for a 32-bit value. +* - False: The pack is for a 16-bit value. * * \return * The 4-byte value packed from the byte array. diff --git a/platform/ext/target/psoc64/Native_Driver/include/cy_sysclk.h b/platform/ext/target/psoc64/Native_Driver/include/cy_sysclk.h index 3c71b78aab..7b80ad6739 100644 --- a/platform/ext/target/psoc64/Native_Driver/include/cy_sysclk.h +++ b/platform/ext/target/psoc64/Native_Driver/include/cy_sysclk.h @@ -1,6 +1,6 @@ /***************************************************************************//** * \file cy_sysclk.h -* \version 1.30 +* \version 1.40.2 * * Provides an API declaration of the sysclk driver. * @@ -104,6 +104,41 @@ * <table class="doxtable"> * <tr><th>Version</th><th>Changes</th><th>Reason for Change</th></tr> * <tr> +* <td>1.40.2</td> +* <td>Update documentation based on collateral review feedback.</td> +* <td>User experience enhancement.</td> +* </tr> +* <tr> +* <td>1.40.1</td> +* <td>Fix compiler warning.</td> +* <td></td> +* </tr> +* <tr> +* <td rowspan="4">1.40</td> +* <td>Updated the following functions implementation: \ref Cy_SysClk_PllConfigure and \ref Cy_SysClk_PllEnable.</td> +* <td> +* Fixed the \ref Cy_SysClk_PllConfigure API function behaviour when it is called with a bypass mode, \n +* Fixed the \ref Cy_SysClk_PllEnable API function behaviour when it is called with a zero timeout. +* </td> +* </tr> +* <tr> +* <td>Added the following functions: \ref Cy_SysClk_MfoEnable, \ref Cy_SysClk_MfoIsEnabled,\n +* \ref Cy_SysClk_MfoDisable, \ref Cy_SysClk_ClkMfEnable, \ref Cy_SysClk_ClkMfIsEnabled,\n +* \ref Cy_SysClk_ClkMfDisable, \ref Cy_SysClk_ClkMfGetDivider, \ref Cy_SysClk_ClkMfSetDivider,\n. +* \ref Cy_SysClk_ClkMfGetFrequency</td> +* <td>New device support.</td> +* </tr> +* <tr> +* <td>Added the following new API functions \ref Cy_SysClk_FllIsEnabled, \ref Cy_SysClk_PllIsEnabled,\n +* \ref Cy_SysClk_ExtClkSetFrequency, \ref Cy_SysClk_ClkHfGetFrequency, \ref Cy_SysClk_ClkFastGetFrequency,\n +* \ref Cy_SysClk_ClkPeriGetFrequency and \ref Cy_SysClk_ClkSlowGetFrequency</td> +* <td>Enhancement based on usability feedback</td> +* </tr> +* <tr> +* <td>Deprecated the following macros: CY_SYSCLK_DIV_ROUND and CY_SYSCLK_DIV_ROUNDUP</td> +* <td>Macros were moved into \ref group_syslib</td> +* </tr> +* <tr> * <td rowspan="2">1.30</td> * <td>Updated the following functions implementation: \ref Cy_SysClk_EcoConfigure and \ref Cy_SysClk_FllConfigure.</td> * <td>Math library dependency is removed, the floating-point math is replaced with integer math.</td> @@ -194,6 +229,21 @@ * \{ * \defgroup group_sysclk_returns Function return values * \} +* \defgroup group_sysclk_ext External Clock Source (EXTCLK) +* \{ +* The External Clock Source (EXTCLK) is a clock source routed into PSoC +* through a GPIO pin. The EXTCLK is a source clock that can be used to +* source one or more clock paths (Refer to \ref group_sysclk_path_src). +* These clock paths can then source the processors and peripherals in +* the device. +* +* The EXTCLK relies on the presence of an external clock signal applied +* to the GPIO pin. The pin must be configured to operate in Digital +* High-Z drive mode with input buffer on and HSIOM connection +* set to HSIOM_SEL_ACT_4 (P0_0_SRSS_EXT_CLK, P0_5_SRSS_EXT_CLK). +* +* \defgroup group_sysclk_ext_funcs Functions +* \} * \defgroup group_sysclk_eco External Crystal Oscillator (ECO) * \{ * The External Crystal Oscillator (ECO) is a clock source that consists @@ -401,15 +451,7 @@ * an external 32.768 kHz square wave is brought in directly through the * SRSS_WCO_OUT_PIN pin. * -* Some devices support a built-in clock supervisor (CSV) in the WCO. The clock -* supervisor detects if the WCO has been lost; that is, the WCO is no longer -* producing clock pulses. The CSV does this by checking to ensure there is at -* least one WCO clock pulse within a certain time window. The ILO or PILO can be -* the supervising clock. Firmware can configure the CSV to trigger a fault, -* a reset, or both after specified cycles of the supervising clock. -* * \defgroup group_sysclk_wco_funcs Functions -* \defgroup group_sysclk_wco_structs Data Structures * \defgroup group_sysclk_wco_enums Enumerated Types * \} * \defgroup group_sysclk_clk_hf High-Frequency Clocks @@ -439,14 +481,7 @@ * * ![](sysclk_hf_dist.png) * -* Some devices support a clock supervisor (CSV) for each root clock. These -* can detect frequency loss, or monitor that the clock frequency stays within -* a specified range. The possible supervising clocks are IMO, ECO, or ALTHF. -* Loss detection and frequency monitoring can be enabled or disabled independently. -* Each has its own programmable action that occurs on detection of an error. -* * \defgroup group_sysclk_clk_hf_funcs Functions -* \defgroup group_sysclk_clk_hf_structs Data Structures * \defgroup group_sysclk_clk_hf_enums Enumerated Types * \} * \defgroup group_sysclk_clk_fast Fast Clock @@ -571,6 +606,14 @@ * \defgroup group_sysclk_clk_bak_funcs Functions * \defgroup group_sysclk_clk_bak_enums Enumerated Types * \} +* \defgroup group_sysclk_mf_funcs Medium Frequency Domain Clock +* \{ +* The Medium Frequency Domain Clock is present only in SRSS_ver1_3. +* Consists of MFO - the Medium Frequency Oscillator, +* and CLK_MF - the Medium Frequency Clock divider. +* This clock chain is designed to source the LCD block +* in Deep Sleep mode, see \ref cy_en_seglcd_lsclk_t. +* \} */ #if !defined(CY_SYSCLK_H) @@ -594,17 +637,25 @@ extern "C" { /** Driver major version */ #define CY_SYSCLK_DRV_VERSION_MAJOR 1 /** Driver minor version */ -#define CY_SYSCLK_DRV_VERSION_MINOR 30 +#define CY_SYSCLK_DRV_VERSION_MINOR 40 /** Sysclk driver identifier */ #define CY_SYSCLK_ID CY_PDL_DRV_ID(0x12U) /** ILO clock frequency */ #define CY_SYSCLK_ILO_FREQ (32768UL) /* Hz */ +/** WCO clock frequency */ +#define CY_SYSCLK_WCO_FREQ (32768UL) /* Hz */ +/** PILO clock frequency */ +#define CY_SYSCLK_PILO_FREQ (32768UL) /* Hz */ + /** IMO clock frequency */ #define CY_SYSCLK_IMO_FREQ (8000000UL) /* Hz */ +/** MFO clock frequency */ +#define CY_SYSCLK_MFO_FREQ (2000000UL) /* Hz */ /** \} group_sysclk_macros */ + /** * \addtogroup group_sysclk_returns * \{ @@ -619,13 +670,17 @@ typedef enum } cy_en_sysclk_status_t; /** \} group_sysclk_returns */ -/** \cond INTERNAL */ -/* Calculate a / b with rounding to the nearest integer. a and b must have the same sign */ -#define CY_SYSCLK_DIV_ROUND(a, b) (((a) + ((b) / 2u)) / (b)) -/* Calculate a / b with rounding up if remainder != 0. a and b must both be positive */ -#define CY_SYSCLK_DIV_ROUNDUP(a, b) ((((a) - 1U) / (b)) + 1U) -/** \endcond */ +/* ========================================================================== */ +/* =========================== EXT SECTION ============================ */ +/* ========================================================================== */ + +/** +* \addtogroup group_sysclk_ext_funcs +* \{ +*/ +void Cy_SysClk_ExtClkSetFrequency(uint32_t freq); +/** \} group_sysclk_ext_funcs */ /* ========================================================================== */ /* =========================== ECO SECTION ============================ */ @@ -670,7 +725,7 @@ __STATIC_INLINE uint32_t Cy_SysClk_EcoGetStatus(void); * called if the ECO is sourcing clkHf[0]. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_EcoDisable +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_EcoDisable * *******************************************************************************/ __STATIC_INLINE void Cy_SysClk_EcoDisable(void) @@ -678,6 +733,7 @@ __STATIC_INLINE void Cy_SysClk_EcoDisable(void) SRSS_CLK_ECO_CONFIG &= ~SRSS_CLK_ECO_CONFIG_ECO_EN_Msk; } + /******************************************************************************* * Function Name: Cy_SysClk_EcoGetStatus ****************************************************************************//** @@ -690,7 +746,7 @@ __STATIC_INLINE void Cy_SysClk_EcoDisable(void) * CY_SYSCLK_ECOSTAT_STABLE = ECO has fully stabilized * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_EcoGetStatus +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_EcoGetStatus * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_SysClk_EcoGetStatus(void) @@ -762,6 +818,7 @@ typedef enum CY_SYSCLK_FLLPLL_OUTPUT_OUTPUT = 3U /**< Output FLL/PLL output regardless of lock status. This can be dangerous if used to clock clkHf, because FLL/PLL output may be unstable */ } cy_en_fll_pll_output_mode_t; + /** FLL current-controlled oscillator (CCO) frequency ranges. * See register CLK_FLL_CONFIG4, bits CCO_RANGE. */ @@ -775,6 +832,7 @@ typedef enum } cy_en_fll_cco_ranges_t; /** \} group_sysclk_fll_enums */ + /** * \addtogroup group_sysclk_fll_structs * \{ @@ -805,8 +863,30 @@ cy_en_sysclk_status_t Cy_SysClk_FllManualConfigure(const cy_stc_fll_manual_confi void Cy_SysClk_FllGetConfiguration(cy_stc_fll_manual_config_t *config); cy_en_sysclk_status_t Cy_SysClk_FllEnable(uint32_t timeoutus); __STATIC_INLINE bool Cy_SysClk_FllLocked(void); +__STATIC_INLINE bool Cy_SysClk_FllIsEnabled(void); __STATIC_INLINE cy_en_sysclk_status_t Cy_SysClk_FllDisable(void); + +/******************************************************************************* +* Function Name: Cy_SysClk_FllIsEnabled +****************************************************************************//** +* +* Reports whether or not the FLL is enabled. +* +* \return +* false = disabled \n +* true = enabled +* +* \funcusage +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_FllDisable +* +*******************************************************************************/ +__STATIC_INLINE bool Cy_SysClk_FllIsEnabled(void) +{ + return (_FLD2BOOL(SRSS_CLK_FLL_CONFIG_FLL_ENABLE, SRSS_CLK_FLL_CONFIG)); +} + + /******************************************************************************* * Function Name: Cy_SysClk_FllLocked ****************************************************************************//** @@ -823,7 +903,7 @@ __STATIC_INLINE cy_en_sysclk_status_t Cy_SysClk_FllDisable(void); * is not recommended to check the FLL normal operation stability. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_FllLocked +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_FllLocked * *******************************************************************************/ __STATIC_INLINE bool Cy_SysClk_FllLocked(void) @@ -849,7 +929,7 @@ __STATIC_INLINE bool Cy_SysClk_FllLocked(void) * the FLL is the source of CLK_HF0 and the CLK_HF0 frequency is decreasing. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_FllDisable +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_FllDisable * *******************************************************************************/ __STATIC_INLINE cy_en_sysclk_status_t Cy_SysClk_FllDisable(void) @@ -900,9 +980,35 @@ cy_en_sysclk_status_t Cy_SysClk_PllManualConfigure(uint32_t clkPath, const cy_st cy_en_sysclk_status_t Cy_SysClk_PllGetConfiguration(uint32_t clkPath, cy_stc_pll_manual_config_t *config); cy_en_sysclk_status_t Cy_SysClk_PllEnable(uint32_t clkPath, uint32_t timeoutus); __STATIC_INLINE bool Cy_SysClk_PllLocked(uint32_t clkPath); +__STATIC_INLINE bool Cy_SysClk_PllIsEnabled(uint32_t clkPath); __STATIC_INLINE bool Cy_SysClk_PllLostLock(uint32_t clkPath); __STATIC_INLINE cy_en_sysclk_status_t Cy_SysClk_PllDisable(uint32_t clkPath); + +/******************************************************************************* +* Function Name: Cy_SysClk_PllIsEnabled +****************************************************************************//** +* +* Reports whether or not the selected PLL is enabled. +* +* \param clkPath Selects which PLL to check. 1 is the first PLL; 0 is invalid. +* +* \return +* false = disabled \n +* true = enabled +* +* \funcusage +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_PllDisable +* +*******************************************************************************/ +__STATIC_INLINE bool Cy_SysClk_PllIsEnabled(uint32_t clkPath) +{ + clkPath--; /* to correctly access PLL config and status registers structures */ + CY_ASSERT_L1(clkPath < CY_SRSS_NUM_PLL); + return (_FLD2BOOL(SRSS_CLK_PLL_CONFIG_ENABLE, SRSS_CLK_PLL_CONFIG[clkPath])); +} + + /******************************************************************************* * Function Name: Cy_SysClk_PllLocked ****************************************************************************//** @@ -916,7 +1022,7 @@ __STATIC_INLINE cy_en_sysclk_status_t Cy_SysClk_PllDisable(uint32_t clkPath); * true = locked * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_PllLocked +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_PllLocked * *******************************************************************************/ __STATIC_INLINE bool Cy_SysClk_PllLocked(uint32_t clkPath) @@ -926,6 +1032,7 @@ __STATIC_INLINE bool Cy_SysClk_PllLocked(uint32_t clkPath) return (_FLD2BOOL(SRSS_CLK_PLL_STATUS_LOCKED, SRSS_CLK_PLL_STATUS[clkPath])); } + /******************************************************************************* * Function Name: Cy_SysClk_PllLostLock ****************************************************************************//** @@ -940,7 +1047,7 @@ __STATIC_INLINE bool Cy_SysClk_PllLocked(uint32_t clkPath) * true = lost lock * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_PllLostLock +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_PllLostLock * *******************************************************************************/ __STATIC_INLINE bool Cy_SysClk_PllLostLock(uint32_t clkPath) @@ -953,6 +1060,7 @@ __STATIC_INLINE bool Cy_SysClk_PllLostLock(uint32_t clkPath) return (retVal); } + /******************************************************************************* * Function Name: Cy_SysClk_PllDisable ****************************************************************************//** @@ -978,7 +1086,7 @@ __STATIC_INLINE bool Cy_SysClk_PllLostLock(uint32_t clkPath) * the PLL is the source of CLK_HF0 and the CLK_HF0 frequency is decreasing. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_PllDisable +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_PllDisable * *******************************************************************************/ __STATIC_INLINE cy_en_sysclk_status_t Cy_SysClk_PllDisable(uint32_t clkPath) @@ -1020,7 +1128,7 @@ __STATIC_INLINE void Cy_SysClk_IloHibernateOn(bool on); * \note The watchdog timer (WDT) must be unlocked before calling this function. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_IloEnable +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_IloEnable * *******************************************************************************/ __STATIC_INLINE void Cy_SysClk_IloEnable(void) @@ -1028,6 +1136,7 @@ __STATIC_INLINE void Cy_SysClk_IloEnable(void) SRSS_CLK_ILO_CONFIG |= SRSS_CLK_ILO_CONFIG_ENABLE_Msk; } + /******************************************************************************* * Function Name: Cy_SysClk_IloDisable ****************************************************************************//** @@ -1043,7 +1152,7 @@ __STATIC_INLINE void Cy_SysClk_IloEnable(void) * the ILO. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_IloDisable +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_IloDisable * *******************************************************************************/ __STATIC_INLINE cy_en_sysclk_status_t Cy_SysClk_IloDisable(void) @@ -1057,6 +1166,7 @@ __STATIC_INLINE cy_en_sysclk_status_t Cy_SysClk_IloDisable(void) return (retVal); } + /******************************************************************************* * Function Name: Cy_SysClk_IloHibernateOn ****************************************************************************//** @@ -1071,7 +1181,7 @@ __STATIC_INLINE cy_en_sysclk_status_t Cy_SysClk_IloDisable(void) * \note Writes to the register/bit are ignored if the watchdog (WDT) is locked. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_IloHibernateOn +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_IloHibernateOn * *******************************************************************************/ __STATIC_INLINE void Cy_SysClk_IloHibernateOn(bool on) @@ -1103,7 +1213,7 @@ __STATIC_INLINE uint32_t Cy_SysClk_PiloGetTrim(void); * releasing the PILO reset. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_PiloEnable +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_PiloEnable * *******************************************************************************/ __STATIC_INLINE void Cy_SysClk_PiloEnable(void) @@ -1115,6 +1225,7 @@ __STATIC_INLINE void Cy_SysClk_PiloEnable(void) SRSS_CLK_PILO_CONFIG_PILO_CLK_EN_Msk; } + /******************************************************************************* * Function Name: Cy_SysClk_PiloDisable ****************************************************************************//** @@ -1122,7 +1233,7 @@ __STATIC_INLINE void Cy_SysClk_PiloEnable(void) * Disables the PILO. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_PiloDisable +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_PiloDisable * *******************************************************************************/ __STATIC_INLINE void Cy_SysClk_PiloDisable(void) @@ -1134,6 +1245,7 @@ __STATIC_INLINE void Cy_SysClk_PiloDisable(void) SRSS_CLK_PILO_CONFIG_PILO_CLK_EN_Msk); } + /******************************************************************************* * Function Name: Cy_SysClk_PiloSetTrim ****************************************************************************//** @@ -1142,7 +1254,7 @@ __STATIC_INLINE void Cy_SysClk_PiloDisable(void) * done after measuring the PILO frequency; see \ref Cy_SysClk_StartClkMeasurementCounters(). * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_PiloSetTrim +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_PiloSetTrim * *******************************************************************************/ __STATIC_INLINE void Cy_SysClk_PiloSetTrim(uint32_t trimVal) @@ -1150,6 +1262,7 @@ __STATIC_INLINE void Cy_SysClk_PiloSetTrim(uint32_t trimVal) CY_REG32_CLR_SET(SRSS_CLK_PILO_CONFIG, SRSS_CLK_PILO_CONFIG_PILO_FFREQ, trimVal); } + /******************************************************************************* * Function Name: Cy_SysClk_PiloGetTrim ****************************************************************************//** @@ -1294,59 +1407,44 @@ typedef enum CY_SYSCLK_WCO_NOT_BYPASSED = 0U, /**< WCO is not bypassed crystal is used */ CY_SYSCLK_WCO_BYPASSED = 1U /**< WCO is bypassed external clock must be supplied on XTAL pin */ } cy_en_wco_bypass_modes_t; +/** \} group_sysclk_wco_enums */ -/** WCO CSV supervisor clock selections */ +/** \cond BWC */ typedef enum { - CY_SYSCLK_WCO_CSV_SUPERVISOR_ILO, /**< WCO CSV supervisor clock source is the ILO */ - CY_SYSCLK_WCO_CSV_SUPERVISOR_ALTLF, /**< WCO CSV supervisor clock source is the alternate low-frequency clock (ALTLF) */ - CY_SYSCLK_WCO_CSV_SUPERVISOR_PILO /**< WCO CSV supervisor clock source is the PILO */ + CY_SYSCLK_WCO_CSV_SUPERVISOR_ILO, + CY_SYSCLK_WCO_CSV_SUPERVISOR_ALTLF, + CY_SYSCLK_WCO_CSV_SUPERVISOR_PILO } cy_en_wco_csv_supervisor_clock_t; -/** -* Clock supervisor clock loss window. There must be one clock of the supervised -* clock within this many clocks of the supervising clock. -* See registers CLK_CSV_HF_CTL and CLK_CSV_WCO_CTL, bitfield CSV_LOSS_WINDOW. -*/ typedef enum { - CY_SYSCLK_CSV_LOSS_4_CYCLES = 0U, /**< 1 clock must be seen within 4 cycles of the supervising clock */ - CY_SYSCLK_CSV_LOSS_8_CYCLES = 1U, /**< 1 clock must be seen within 8 cycles of the supervising clock */ - CY_SYSCLK_CSV_LOSS_16_CYCLES = 2U, /**< 1 clock must be seen within 16 cycles of the supervising clock */ - CY_SYSCLK_CSV_LOSS_32_CYCLES = 3U, /**< 1 clock must be seen within 32 cycles of the supervising clock */ - CY_SYSCLK_CSV_LOSS_64_CYCLES = 4U, /**< 1 clock must be seen within 64 cycles of the supervising clock */ - CY_SYSCLK_CSV_LOSS_128_CYCLES = 5U, /**< 1 clock must be seen within 128 cycles of the supervising clock */ - CY_SYSCLK_CSV_LOSS_256_CYCLES = 6U, /**< 1 clock must be seen within 256 cycles of the supervising clock */ - CY_SYSCLK_CSV_LOSS_512_CYCLES = 7U /**< 1 clock must be seen within 512 cycles of the supervising clock */ + CY_SYSCLK_CSV_LOSS_4_CYCLES = 0U, + CY_SYSCLK_CSV_LOSS_8_CYCLES = 1U, + CY_SYSCLK_CSV_LOSS_16_CYCLES = 2U, + CY_SYSCLK_CSV_LOSS_32_CYCLES = 3U, + CY_SYSCLK_CSV_LOSS_64_CYCLES = 4U, + CY_SYSCLK_CSV_LOSS_128_CYCLES = 5U, + CY_SYSCLK_CSV_LOSS_256_CYCLES = 6U, + CY_SYSCLK_CSV_LOSS_512_CYCLES = 7U } cy_en_csv_loss_window_t; -/** -* Clock supervisor error actions. See register CLK_CSV_HF_CTL[CSV_FREQ_ACTION and CSV_LOSS_ACTION]. -*/ typedef enum { - CY_SYSCLK_CSV_ERROR_IGNORE = 0U, /**< Ignore the error reported by the clock supervisor */ - CY_SYSCLK_CSV_ERROR_FAULT = 1U, /**< Trigger a fault when an error is reported by the clock supervisor */ - CY_SYSCLK_CSV_ERROR_RESET = 2U, /**< Trigger a reset when an error is reported by the clock supervisor */ - CY_SYSCLK_CSV_ERROR_FAULT_RESET = 3U /**< Trigger a fault then reset when an error is reported by the supervisor */ + CY_SYSCLK_CSV_ERROR_IGNORE = 0U, + CY_SYSCLK_CSV_ERROR_FAULT = 1U, + CY_SYSCLK_CSV_ERROR_RESET = 2U, + CY_SYSCLK_CSV_ERROR_FAULT_RESET = 3U } cy_en_csv_error_actions_t; -/** \} group_sysclk_wco_enums */ -/** -* \addtogroup group_sysclk_wco_structs -* \{ -*/ -/** -* This structure is used to configure the clock supervisor for the WCO. -*/ typedef struct { - cy_en_wco_csv_supervisor_clock_t supervisorClock; /**< supervisor clock selection */ - bool enableLossDetection; /**< 1= enabled, 0= disabled. Note that if loss detection is enabled, writes to other register bits are ignored */ - cy_en_csv_loss_window_t lossWindow; /**< \ref cy_en_csv_loss_window_t */ - cy_en_csv_error_actions_t lossAction; /**< \ref cy_en_csv_error_actions_t */ + cy_en_wco_csv_supervisor_clock_t supervisorClock; + bool enableLossDetection; + cy_en_csv_loss_window_t lossWindow; + cy_en_csv_error_actions_t lossAction; } cy_stc_wco_csv_config_t; -/** \} group_sysclk_wco_structs */ +/** \endcond */ /** * \addtogroup group_sysclk_wco_funcs @@ -1373,7 +1471,7 @@ __STATIC_INLINE void Cy_SysClk_WcoBypass(cy_en_wco_bypass_modes_t bypass); * CY_SYSCLK_TIMEOUT - Timeout waiting for WCO to stabilize * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_WcoEnable +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_WcoEnable * *******************************************************************************/ __STATIC_INLINE cy_en_sysclk_status_t Cy_SysClk_WcoEnable(uint32_t timeoutus) @@ -1397,6 +1495,7 @@ __STATIC_INLINE cy_en_sysclk_status_t Cy_SysClk_WcoEnable(uint32_t timeoutus) return (retVal); } + /******************************************************************************* * Function Name: Cy_SysClk_WcoOkay ****************************************************************************//** @@ -1408,7 +1507,7 @@ __STATIC_INLINE cy_en_sysclk_status_t Cy_SysClk_WcoEnable(uint32_t timeoutus) * false = not okay * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_WcoOkay +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_WcoOkay * *******************************************************************************/ __STATIC_INLINE bool Cy_SysClk_WcoOkay(void) @@ -1416,6 +1515,7 @@ __STATIC_INLINE bool Cy_SysClk_WcoOkay(void) return (_FLD2BOOL(BACKUP_STATUS_WCO_OK, BACKUP_STATUS)); } + /******************************************************************************* * Function Name: Cy_SysClk_WcoDisable ****************************************************************************//** @@ -1423,7 +1523,7 @@ __STATIC_INLINE bool Cy_SysClk_WcoOkay(void) * Disables the WCO. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_WcoDisable +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_WcoDisable * *******************************************************************************/ __STATIC_INLINE void Cy_SysClk_WcoDisable(void) @@ -1431,6 +1531,7 @@ __STATIC_INLINE void Cy_SysClk_WcoDisable(void) BACKUP_CTL &= (uint32_t)~BACKUP_CTL_WCO_EN_Msk; } + /******************************************************************************* * Function Name: Cy_SysClk_WcoBypass ****************************************************************************//** @@ -1441,7 +1542,7 @@ __STATIC_INLINE void Cy_SysClk_WcoDisable(void) * \param bypass \ref cy_en_wco_bypass_modes_t * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_WcoBypass +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_WcoBypass * *******************************************************************************/ __STATIC_INLINE void Cy_SysClk_WcoBypass(cy_en_wco_bypass_modes_t bypass) @@ -1452,6 +1553,219 @@ __STATIC_INLINE void Cy_SysClk_WcoBypass(cy_en_wco_bypass_modes_t bypass) /* ========================================================================== */ +/* ============================ MF SECTION ============================ */ +/* ========================================================================== */ +/** +* \addtogroup group_sysclk_mf_funcs +* \{ +*/ +__STATIC_INLINE void Cy_SysClk_MfoEnable(bool deepSleepEnable); +__STATIC_INLINE bool Cy_SysClk_MfoIsEnabled(void); +__STATIC_INLINE void Cy_SysClk_MfoDisable(void); + + +/******************************************************************************* +* Function Name: Cy_SysClk_MfoEnable +****************************************************************************//** +* +* Enables the MFO. +* +* \param deepSleepEnable enables MFO operation is Deep Sleep low power mode. +* +* \funcusage +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkMfEnable +* +*******************************************************************************/ +__STATIC_INLINE void Cy_SysClk_MfoEnable(bool deepSleepEnable) +{ + if (CY_SRSS_MFO_PRESENT) + { + SRSS_CLK_MFO_CONFIG = SRSS_CLK_MFO_CONFIG_ENABLE_Msk | (deepSleepEnable ? SRSS_CLK_MFO_CONFIG_DPSLP_ENABLE_Msk : 0UL); + } +} + + +/******************************************************************************* +* Function Name: Cy_SysClk_MfoIsEnabled +****************************************************************************//** +* +* Reports whether MFO is enabled or not. +* +* \return +* false - disabled \n +* true - enabled +* +* \funcusage +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkMfDisable +* +*******************************************************************************/ +__STATIC_INLINE bool Cy_SysClk_MfoIsEnabled(void) +{ + return (CY_SRSS_MFO_PRESENT && (0UL != (SRSS_CLK_MFO_CONFIG & SRSS_CLK_MFO_CONFIG_ENABLE_Msk))); +} + + +/******************************************************************************* +* Function Name: Cy_SysClk_MfoDisable +****************************************************************************//** +* +* Disables the MFO. +* +* \funcusage +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkMfDisable +* +*******************************************************************************/ +__STATIC_INLINE void Cy_SysClk_MfoDisable(void) +{ + if (CY_SRSS_MFO_PRESENT) + { + SRSS_CLK_MFO_CONFIG = 0UL; + } +} + + +__STATIC_INLINE void Cy_SysClk_ClkMfEnable(void); +__STATIC_INLINE bool Cy_SysClk_ClkMfIsEnabled(void); +__STATIC_INLINE void Cy_SysClk_ClkMfDisable(void); +__STATIC_INLINE void Cy_SysClk_ClkMfSetDivider(uint32_t divider); +__STATIC_INLINE uint32_t Cy_SysClk_ClkMfGetDivider(void); +__STATIC_INLINE uint32_t Cy_SysClk_ClkMfGetFrequency(void); + + +/******************************************************************************* +* Function Name: Cy_SysClk_ClkMfEnable +****************************************************************************//** +* +* Enables the CLK_MF. +* +* \funcusage +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkMfEnable +* +*******************************************************************************/ +__STATIC_INLINE void Cy_SysClk_ClkMfEnable(void) +{ + if (CY_SRSS_MFO_PRESENT) + { + SRSS_CLK_MF_SELECT |= SRSS_CLK_MF_SELECT_ENABLE_Msk; + } +} + + +/******************************************************************************* +* Function Name: Cy_SysClk_ClkMfIsEnabled +****************************************************************************//** +* +* Reports whether CLK_MF is enabled or not. +* +* \return +* false - disabled \n +* true - enabled +* +* \funcusage +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkMfEnable +* +*******************************************************************************/ +__STATIC_INLINE bool Cy_SysClk_ClkMfIsEnabled(void) +{ + return ((CY_SRSS_MFO_PRESENT) && (0UL != (SRSS_CLK_MF_SELECT & SRSS_CLK_MF_SELECT_ENABLE_Msk))); +} + + +/******************************************************************************* +* Function Name: Cy_SysClk_ClkMfDisable +****************************************************************************//** +* +* Disables the CLK_MF. +* +* \funcusage +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkMfDisable +* +*******************************************************************************/ +__STATIC_INLINE void Cy_SysClk_ClkMfDisable(void) +{ + if (CY_SRSS_MFO_PRESENT) + { + SRSS_CLK_MF_SELECT &= ~SRSS_CLK_MF_SELECT_ENABLE_Msk; + } +} + + +/** \cond internal */ +#define CY_SYSCLK_MF_DIVIDER_MIN (1U) +#define CY_SYSCLK_MF_DIVIDER_MAX (256U) +#define CY_SYSCLK_IS_MF_DIVIDER_VALID(locDiv) ((CY_SYSCLK_MF_DIVIDER_MIN <= (locDiv)) && ((locDiv) <= CY_SYSCLK_MF_DIVIDER_MAX)) +/** \endcond */ + + +/******************************************************************************* +* Function Name: Cy_SysClk_ClkMfSetDivider +****************************************************************************//** +* +* Sets the clock divider for CLK_MF. +* +* \pre If the CLK_MF is already enabled - it should be disabled +* prior to use this function by \ref Cy_SysClk_ClkMfDisable. +* +* \param divider divider value between 1 and 256. +* +* \funcusage +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkMfEnable +* +*******************************************************************************/ +__STATIC_INLINE void Cy_SysClk_ClkMfSetDivider(uint32_t divider) +{ + if ((CY_SRSS_MFO_PRESENT) && CY_SYSCLK_IS_MF_DIVIDER_VALID(divider)) + { + if (!Cy_SysClk_ClkMfIsEnabled()) + { + CY_REG32_CLR_SET(SRSS_CLK_MF_SELECT, SRSS_CLK_MF_SELECT_MFCLK_DIV, divider - 1UL); + } + } +} + + +/******************************************************************************* +* Function Name: Cy_SysClk_ClkMfGetDivider +****************************************************************************//** +* +* Returns the clock divider of CLK_MF. +* +* \return divider value in range 1..256. +* +* \funcusage +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkMfEnable +* +*******************************************************************************/ +__STATIC_INLINE uint32_t Cy_SysClk_ClkMfGetDivider(void) +{ + return ((CY_SRSS_MFO_PRESENT) ? (1UL + _FLD2VAL(SRSS_CLK_MF_SELECT_MFCLK_DIV, SRSS_CLK_MF_SELECT)) : 1UL); +} + + +/******************************************************************************* +* Function Name: Cy_SysClk_ClkMfGetFrequency +****************************************************************************//** +* +* Reports the output clock signal frequency of CLK_MF. +* +* \return The frequency, in Hz. +* +* \funcusage +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkMfEnable +* +*******************************************************************************/ +__STATIC_INLINE uint32_t Cy_SysClk_ClkMfGetFrequency(void) +{ + uint32_t locFreq = (Cy_SysClk_MfoIsEnabled()) ? CY_SYSCLK_MFO_FREQ : 0UL; /* Get root frequency */ + uint32_t locDiv = Cy_SysClk_ClkMfGetDivider(); /* clkMf prescaler (1-256) */ + + /* Divide the path input frequency down and return the result */ + return (CY_SYSLIB_DIV_ROUND(locFreq, locDiv)); +} +/** \} group_sysclk_mf_funcs */ + + +/* ========================================================================== */ /* ========================= clkHf[n] SECTION ========================= */ /* ========================================================================== */ /** @@ -1495,38 +1809,33 @@ typedef enum CY_SYSCLK_CLKHF_DIVIDE_BY_4 = 2U, /**< divide clkHf by 4 */ CY_SYSCLK_CLKHF_DIVIDE_BY_8 = 3U /**< divide clkHf by 8 */ } cy_en_clkhf_dividers_t; +/** \} group_sysclk_clk_hf_enums */ -/** -* clkHf clock supervisor input sources. See register CLK_CSV_HF_CTL[CSV_MUX]. -*/ +/** \cond BWC */ typedef enum { - CY_SYSCLK_CLKHF_CSV_SUPERVISOR_IMO = 0U, /**< Supervising clock is the IMO */ - CY_SYSCLK_CLKHF_CSV_SUPERVISOR_EXT = 1U, /**< Supervising clock is the external clock */ - CY_SYSCLK_CLKHF_CSV_SUPERVISOR_ALTHF = 2U /**< Supervising clock is clk_althf */ + CY_SYSCLK_CLKHF_CSV_SUPERVISOR_IMO = 0U, + CY_SYSCLK_CLKHF_CSV_SUPERVISOR_EXT = 1U, + CY_SYSCLK_CLKHF_CSV_SUPERVISOR_ALTHF = 2U } cy_en_clkhf_csv_supervisor_clock_t; -/** \} group_sysclk_clk_hf_enums */ -/** -* \addtogroup group_sysclk_clk_hf_structs -* \{SupervisingWindow -*/ -/** -* This structure is used to configure the clock supervisor for clkHf. -*/ typedef struct { - cy_en_clkhf_csv_supervisor_clock_t supervisorClock; /**< \ref cy_en_clkhf_csv_supervisor_clock_t */ - uint16_t supervisingWindow; /**< Number of supervising clock cycles */ - bool enableFrequencyFaultDetection; /**< 1= enabled, 0= disabled */ - uint16_t frequencyLowerLimit; /**< Lowest frequency in kHz that supervised clock can go */ - uint16_t frequencyUpperLimit; /**< Highest frequency in kHz that supervised clock can go */ - cy_en_csv_error_actions_t frequencyAction; /**< \ref cy_en_csv_error_actions_t */ - bool enableLossDetection; /**< 1= enabled, 0= disabled */ - cy_en_csv_loss_window_t lossWindow; /**< \ref cy_en_csv_loss_window_t */ - cy_en_csv_error_actions_t lossAction; /**< \ref cy_en_csv_error_actions_t */ + cy_en_clkhf_csv_supervisor_clock_t supervisorClock; + uint16_t supervisingWindow; + bool enableFrequencyFaultDetection; + uint16_t frequencyLowerLimit; + uint16_t frequencyUpperLimit; + cy_en_csv_error_actions_t frequencyAction; + bool enableLossDetection; + cy_en_csv_loss_window_t lossWindow; + cy_en_csv_error_actions_t lossAction; } cy_stc_clkhf_csv_config_t; -/** \} group_sysclk_clk_hf_structs */ +/** \endcond */ + +/** \cond INTERNAL */ +extern uint32_t altHfFreq; /* Internal storage for BLE ECO frequency user setting */ +/** \endcond */ /** * \addtogroup group_sysclk_clk_hf_funcs @@ -1538,6 +1847,7 @@ __STATIC_INLINE cy_en_sysclk_status_t Cy_SysClk_ClkHfSetSource(uint32_t clkHf, c __STATIC_INLINE cy_en_clkhf_in_sources_t Cy_SysClk_ClkHfGetSource(uint32_t clkHf); __STATIC_INLINE cy_en_sysclk_status_t Cy_SysClk_ClkHfSetDivider(uint32_t clkHf, cy_en_clkhf_dividers_t divider); __STATIC_INLINE cy_en_clkhf_dividers_t Cy_SysClk_ClkHfGetDivider(uint32_t clkHf); + uint32_t Cy_SysClk_ClkHfGetFrequency(uint32_t clkHf); /******************************************************************************* @@ -1551,7 +1861,7 @@ __STATIC_INLINE cy_en_clkhf_dividers_t Cy_SysClk_ClkHfGetDivider(uint32_t clkHf) * \return \ref cy_en_sysclk_status_t * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_ClkHfEnable +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkPathSetSource * *******************************************************************************/ __STATIC_INLINE cy_en_sysclk_status_t Cy_SysClk_ClkHfEnable(uint32_t clkHf) @@ -1565,6 +1875,7 @@ __STATIC_INLINE cy_en_sysclk_status_t Cy_SysClk_ClkHfEnable(uint32_t clkHf) return (retVal); } + /******************************************************************************* * Function Name: Cy_SysClk_ClkHfDisable ****************************************************************************//** @@ -1578,7 +1889,7 @@ __STATIC_INLINE cy_en_sysclk_status_t Cy_SysClk_ClkHfEnable(uint32_t clkHf) * \note clkHf[0] cannot be disabled. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_ClkHfDisable +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkHfDisable * *******************************************************************************/ __STATIC_INLINE cy_en_sysclk_status_t Cy_SysClk_ClkHfDisable(uint32_t clkHf) @@ -1593,6 +1904,7 @@ __STATIC_INLINE cy_en_sysclk_status_t Cy_SysClk_ClkHfDisable(uint32_t clkHf) return (retVal); } + /******************************************************************************* * Function Name: Cy_SysClk_ClkHfSetSource ****************************************************************************//** @@ -1618,7 +1930,7 @@ __STATIC_INLINE cy_en_sysclk_status_t Cy_SysClk_ClkHfDisable(uint32_t clkHf) * CLK_HF0 frequency is decreasing. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_ClkHfSetSource +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkHfSetSource * *******************************************************************************/ __STATIC_INLINE cy_en_sysclk_status_t Cy_SysClk_ClkHfSetSource(uint32_t clkHf, cy_en_clkhf_in_sources_t source) @@ -1632,6 +1944,7 @@ __STATIC_INLINE cy_en_sysclk_status_t Cy_SysClk_ClkHfSetSource(uint32_t clkHf, c return (retVal); } + /******************************************************************************* * Function Name: Cy_SysClk_ClkHfGetSource ****************************************************************************//** @@ -1643,7 +1956,7 @@ __STATIC_INLINE cy_en_sysclk_status_t Cy_SysClk_ClkHfSetSource(uint32_t clkHf, c * \return \ref cy_en_clkhf_in_sources_t * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_ClkHfSetSource +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkHfSetSource * *******************************************************************************/ __STATIC_INLINE cy_en_clkhf_in_sources_t Cy_SysClk_ClkHfGetSource(uint32_t clkHf) @@ -1652,6 +1965,7 @@ __STATIC_INLINE cy_en_clkhf_in_sources_t Cy_SysClk_ClkHfGetSource(uint32_t clkHf return ((cy_en_clkhf_in_sources_t)(_FLD2VAL(SRSS_CLK_ROOT_SELECT_ROOT_MUX, SRSS_CLK_ROOT_SELECT[clkHf]))); } + /******************************************************************************* * Function Name: Cy_SysClk_ClkHfSetDivider ****************************************************************************//** @@ -1679,7 +1993,7 @@ __STATIC_INLINE cy_en_clkhf_in_sources_t Cy_SysClk_ClkHfGetSource(uint32_t clkHf * CLK_HF0 frequency is decreasing. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_ClkHfSetDivider +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkHfSetDivider * *******************************************************************************/ __STATIC_INLINE cy_en_sysclk_status_t Cy_SysClk_ClkHfSetDivider(uint32_t clkHf, cy_en_clkhf_dividers_t divider) @@ -1693,6 +2007,7 @@ __STATIC_INLINE cy_en_sysclk_status_t Cy_SysClk_ClkHfSetDivider(uint32_t clkHf, return (retVal); } + /******************************************************************************* * Function Name: Cy_SysClk_ClkHfGetDivider ****************************************************************************//** @@ -1704,7 +2019,7 @@ __STATIC_INLINE cy_en_sysclk_status_t Cy_SysClk_ClkHfSetDivider(uint32_t clkHf, * \return \ref cy_en_clkhf_dividers_t * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_ClkHfSetDivider +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkHfSetDivider * *******************************************************************************/ __STATIC_INLINE cy_en_clkhf_dividers_t Cy_SysClk_ClkHfGetDivider(uint32_t clkHf) @@ -1724,6 +2039,30 @@ __STATIC_INLINE cy_en_clkhf_dividers_t Cy_SysClk_ClkHfGetDivider(uint32_t clkHf) */ __STATIC_INLINE void Cy_SysClk_ClkFastSetDivider(uint8_t divider); __STATIC_INLINE uint8_t Cy_SysClk_ClkFastGetDivider(void); +__STATIC_INLINE uint32_t Cy_SysClk_ClkFastGetFrequency(void); + + +/******************************************************************************* +* Function Name: Cy_SysClk_ClkFastGetFrequency +****************************************************************************//** +* +* Reports the frequency of the fast clock. +* +* \return The frequency, in Hz. +* +* \funcusage +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkFastSetDivider +* +*******************************************************************************/ +__STATIC_INLINE uint32_t Cy_SysClk_ClkFastGetFrequency(void) +{ + uint32_t locFreq = Cy_SysClk_ClkHfGetFrequency(0UL); /* Get root frequency */ + uint32_t locDiv = 1UL + (uint32_t)Cy_SysClk_ClkFastGetDivider(); /* fast prescaler (1-256) */ + + /* Divide the path input frequency down and return the result */ + return (CY_SYSLIB_DIV_ROUND(locFreq, locDiv)); +} + /******************************************************************************* * Function Name: Cy_SysClk_ClkFastSetDivider @@ -1747,7 +2086,7 @@ __STATIC_INLINE uint8_t Cy_SysClk_ClkFastGetDivider(void); * CLK_FAST frequency is decreasing. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_ClkFastSetDivider +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkFastSetDivider * *******************************************************************************/ __STATIC_INLINE void Cy_SysClk_ClkFastSetDivider(uint8_t divider) @@ -1755,6 +2094,7 @@ __STATIC_INLINE void Cy_SysClk_ClkFastSetDivider(uint8_t divider) CY_REG32_CLR_SET(CPUSS_CM4_CLOCK_CTL, CPUSS_CM4_CLOCK_CTL_FAST_INT_DIV, divider); } + /******************************************************************************* * Function Name: Cy_SysClk_ClkFastGetDivider ****************************************************************************//** @@ -1765,7 +2105,7 @@ __STATIC_INLINE void Cy_SysClk_ClkFastSetDivider(uint8_t divider) * The integer division done is by (divider value + 1), or division by 1 to 256. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_ClkFastSetDivider +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkFastSetDivider * *******************************************************************************/ __STATIC_INLINE uint8_t Cy_SysClk_ClkFastGetDivider(void) @@ -1784,6 +2124,30 @@ __STATIC_INLINE uint8_t Cy_SysClk_ClkFastGetDivider(void) */ __STATIC_INLINE void Cy_SysClk_ClkPeriSetDivider(uint8_t divider); __STATIC_INLINE uint8_t Cy_SysClk_ClkPeriGetDivider(void); +__STATIC_INLINE uint32_t Cy_SysClk_ClkPeriGetFrequency(void); + + +/******************************************************************************* +* Function Name: Cy_SysClk_ClkPeriGetFrequency +****************************************************************************//** +* +* Reports the frequency of the peri clock. +* +* \return The frequency, in Hz. +* +* \funcusage +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkPeriSetDivider +* +*******************************************************************************/ +__STATIC_INLINE uint32_t Cy_SysClk_ClkPeriGetFrequency(void) +{ + uint32_t locFreq = Cy_SysClk_ClkHfGetFrequency(0UL); /* Get root frequency */ + uint32_t locDiv = 1UL + (uint32_t)Cy_SysClk_ClkPeriGetDivider(); /* peri prescaler (1-256) */ + + /* Divide the path input frequency down and return the result */ + return (CY_SYSLIB_DIV_ROUND(locFreq, locDiv)); +} + /******************************************************************************* * Function Name: Cy_SysClk_ClkPeriSetDivider @@ -1800,7 +2164,7 @@ __STATIC_INLINE uint8_t Cy_SysClk_ClkPeriGetDivider(void); * Call \ref SystemCoreClockUpdate after this function calling. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_ClkPeriSetDivider +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkPeriSetDivider * *******************************************************************************/ __STATIC_INLINE void Cy_SysClk_ClkPeriSetDivider(uint8_t divider) @@ -1808,6 +2172,7 @@ __STATIC_INLINE void Cy_SysClk_ClkPeriSetDivider(uint8_t divider) CY_REG32_CLR_SET(CPUSS_CM0_CLOCK_CTL, CPUSS_CM0_CLOCK_CTL_PERI_INT_DIV, divider); } + /******************************************************************************* * Function Name: Cy_SysClk_ClkPeriGetDivider ****************************************************************************//** @@ -1818,7 +2183,7 @@ __STATIC_INLINE void Cy_SysClk_ClkPeriSetDivider(uint8_t divider) * The integer division done is by (divider value + 1), or division by 1 to 256. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_ClkPeriSetDivider +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkPeriSetDivider * *******************************************************************************/ __STATIC_INLINE uint8_t Cy_SysClk_ClkPeriGetDivider(void) @@ -1845,6 +2210,7 @@ typedef enum } cy_en_divider_types_t; /** \} group_sysclk_clk_peripheral_enums */ + /** * \addtogroup group_sysclk_clk_peripheral_funcs * \{ @@ -1882,7 +2248,7 @@ uint32_t Cy_SysClk_PeriphGetFrequency(cy_en_divider_types_t dividerType, uint32_ * \return \ref cy_en_sysclk_status_t * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_PeriphSetDivider +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_PeriphSetDivider * *******************************************************************************/ __STATIC_INLINE cy_en_sysclk_status_t @@ -1931,7 +2297,7 @@ __STATIC_INLINE cy_en_sysclk_status_t * (8-bit divider) or 1 to 65536 (16-bit divider). * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_PeriphSetDivider +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_PeriphSetDivider * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_SysClk_PeriphGetDivider(cy_en_divider_types_t dividerType, uint32_t dividerNum) @@ -1953,6 +2319,7 @@ __STATIC_INLINE uint32_t Cy_SysClk_PeriphGetDivider(cy_en_divider_types_t divide return (retVal); } + /******************************************************************************* * Function Name: Cy_SysClk_PeriphSetFracDivider ****************************************************************************//** @@ -1979,7 +2346,7 @@ __STATIC_INLINE uint32_t Cy_SysClk_PeriphGetDivider(cy_en_divider_types_t divide * \return \ref cy_en_sysclk_status_t * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_PeriphSetFracDivider +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_PeriphSetFracDivider * *******************************************************************************/ __STATIC_INLINE cy_en_sysclk_status_t @@ -2015,6 +2382,7 @@ __STATIC_INLINE cy_en_sysclk_status_t return (retVal); } + /******************************************************************************* * Function Name: Cy_SysClk_PeriphGetFracDivider ****************************************************************************//** @@ -2032,7 +2400,7 @@ __STATIC_INLINE cy_en_sysclk_status_t * \return None. Loads pointed-to variables. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_PeriphSetFracDivider +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_PeriphSetFracDivider * *******************************************************************************/ __STATIC_INLINE void Cy_SysClk_PeriphGetFracDivider(cy_en_divider_types_t dividerType, uint32_t dividerNum, @@ -2055,6 +2423,7 @@ __STATIC_INLINE void Cy_SysClk_PeriphGetFracDivider(cy_en_divider_types_t divide } } + /******************************************************************************* * Function Name: Cy_SysClk_PeriphAssignDivider ****************************************************************************//** @@ -2070,7 +2439,7 @@ __STATIC_INLINE void Cy_SysClk_PeriphGetFracDivider(cy_en_divider_types_t divide * \return \ref cy_en_sysclk_status_t * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_PeriphAssignDivider +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_PeriphAssignDivider * *******************************************************************************/ __STATIC_INLINE cy_en_sysclk_status_t @@ -2093,6 +2462,7 @@ __STATIC_INLINE cy_en_sysclk_status_t return (retVal); } + /******************************************************************************* * Function Name: Cy_SysClk_PeriphGetAssignedDivider ****************************************************************************//** @@ -2105,7 +2475,7 @@ __STATIC_INLINE cy_en_sysclk_status_t * number within that type * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_PeriphAssignDivider +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_PeriphAssignDivider * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_SysClk_PeriphGetAssignedDivider(en_clk_dst_t ipBlock) @@ -2114,6 +2484,7 @@ __STATIC_INLINE uint32_t Cy_SysClk_PeriphGetAssignedDivider(en_clk_dst_t ipBlock return (PERI_CLOCK_CTL[ipBlock] & (CY_PERI_CLOCK_CTL_DIV_SEL_Msk | CY_PERI_CLOCK_CTL_TYPE_SEL_Msk)); } + /******************************************************************************* * Function Name: Cy_SysClk_PeriphEnableDivider ****************************************************************************//** @@ -2129,7 +2500,7 @@ __STATIC_INLINE uint32_t Cy_SysClk_PeriphGetAssignedDivider(en_clk_dst_t ipBlock * for information on how to phase-align a divider after it is enabled. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_PeriphEnableDivider +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_PeriphEnableDivider * *******************************************************************************/ __STATIC_INLINE cy_en_sysclk_status_t @@ -2156,6 +2527,7 @@ __STATIC_INLINE cy_en_sysclk_status_t return (retVal); } + /******************************************************************************* * Function Name: Cy_SysClk_PeriphDisableDivider ****************************************************************************//** @@ -2167,7 +2539,7 @@ __STATIC_INLINE cy_en_sysclk_status_t * \param dividerNum specifies which divider of the selected type to configure. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_PeriphDisableDivider +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_PeriphDisableDivider * *******************************************************************************/ __STATIC_INLINE cy_en_sysclk_status_t @@ -2191,6 +2563,7 @@ __STATIC_INLINE cy_en_sysclk_status_t return (retVal); } + /******************************************************************************* * Function Name: Cy_SysClk_PeriphEnablePhaseAlignDivider ****************************************************************************//** @@ -2213,7 +2586,7 @@ __STATIC_INLINE cy_en_sysclk_status_t * to 63. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_PeriphEnablePhaseAlignDivider +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_PeriphEnablePhaseAlignDivider * *******************************************************************************/ __STATIC_INLINE cy_en_sysclk_status_t @@ -2246,6 +2619,7 @@ __STATIC_INLINE cy_en_sysclk_status_t return (retVal); } + /******************************************************************************* * Function Name: Cy_SysClk_PeriphGetDividerEnabled ****************************************************************************//** @@ -2261,7 +2635,7 @@ __STATIC_INLINE cy_en_sysclk_status_t * true = enabled * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_PeriphGetDividerEnabled +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_PeriphGetDividerEnabled * *******************************************************************************/ __STATIC_INLINE bool Cy_SysClk_PeriphGetDividerEnabled(cy_en_divider_types_t dividerType, uint32_t dividerNum) @@ -2304,6 +2678,30 @@ __STATIC_INLINE bool Cy_SysClk_PeriphGetDividerEnabled(cy_en_divider_types_t div */ __STATIC_INLINE void Cy_SysClk_ClkSlowSetDivider(uint8_t divider); __STATIC_INLINE uint8_t Cy_SysClk_ClkSlowGetDivider(void); +__STATIC_INLINE uint32_t Cy_SysClk_ClkSlowGetFrequency(void); + + +/******************************************************************************* +* Function Name: Cy_SysClk_ClkSlowGetFrequency +****************************************************************************//** +* +* Reports the frequency of the slow clock. +* +* \return The frequency, in Hz. +* +* \funcusage +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkSlowSetDivider +* +*******************************************************************************/ +__STATIC_INLINE uint32_t Cy_SysClk_ClkSlowGetFrequency(void) +{ + uint32_t locFreq = Cy_SysClk_ClkPeriGetFrequency(); /* Get Peri frequency */ + uint32_t locDiv = 1UL + (uint32_t)Cy_SysClk_ClkSlowGetDivider(); /* peri prescaler (1-256) */ + + /* Divide the path input frequency down and return the result */ + return (CY_SYSLIB_DIV_ROUND(locFreq, locDiv)); +} + /******************************************************************************* * Function Name: Cy_SysClk_ClkSlowSetDivider @@ -2319,7 +2717,7 @@ __STATIC_INLINE uint8_t Cy_SysClk_ClkSlowGetDivider(void); * Call \ref SystemCoreClockUpdate after this function calling. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_ClkSlowSetDivider +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkSlowSetDivider * *******************************************************************************/ __STATIC_INLINE void Cy_SysClk_ClkSlowSetDivider(uint8_t divider) @@ -2327,6 +2725,7 @@ __STATIC_INLINE void Cy_SysClk_ClkSlowSetDivider(uint8_t divider) CY_REG32_CLR_SET(CPUSS_CM0_CLOCK_CTL, CPUSS_CM0_CLOCK_CTL_SLOW_INT_DIV, divider); } + /******************************************************************************* * Function Name: Cy_SysClk_ClkSlowGetDivider ****************************************************************************//** @@ -2337,7 +2736,7 @@ __STATIC_INLINE void Cy_SysClk_ClkSlowSetDivider(uint8_t divider) * The integer division done is by (divider value + 1), or division by 1 to 256. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_ClkSlowSetDivider +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkSlowSetDivider * *******************************************************************************/ __STATIC_INLINE uint8_t Cy_SysClk_ClkSlowGetDivider(void) @@ -2374,6 +2773,7 @@ typedef enum __STATIC_INLINE void Cy_SysClk_ClkLfSetSource(cy_en_clklf_in_sources_t source); __STATIC_INLINE cy_en_clklf_in_sources_t Cy_SysClk_ClkLfGetSource(void); + /******************************************************************************* * Function Name: Cy_SysClk_ClkLfSetSource ****************************************************************************//** @@ -2385,7 +2785,7 @@ __STATIC_INLINE cy_en_clklf_in_sources_t Cy_SysClk_ClkLfGetSource(void); * \note The watchdog timer (WDT) must be unlocked before calling this function. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_ClkLfSetSource +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkLfSetSource * *******************************************************************************/ __STATIC_INLINE void Cy_SysClk_ClkLfSetSource(cy_en_clklf_in_sources_t source) @@ -2394,6 +2794,7 @@ __STATIC_INLINE void Cy_SysClk_ClkLfSetSource(cy_en_clklf_in_sources_t source) CY_REG32_CLR_SET(SRSS_CLK_SELECT, SRSS_CLK_SELECT_LFCLK_SEL, source); } + /******************************************************************************* * Function Name: Cy_SysClk_ClkLfGetSource ****************************************************************************//** @@ -2403,7 +2804,7 @@ __STATIC_INLINE void Cy_SysClk_ClkLfSetSource(cy_en_clklf_in_sources_t source) * \return \ref cy_en_clklf_in_sources_t * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_ClkLfSetSource +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkLfSetSource * *******************************************************************************/ __STATIC_INLINE cy_en_clklf_in_sources_t Cy_SysClk_ClkLfGetSource(void) @@ -2462,7 +2863,7 @@ __STATIC_INLINE void Cy_SysClk_ClkTimerDisable(void); * \param source \ref cy_en_clktimer_in_sources_t * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_ClkTimerSetSource +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkTimerSetSource * *******************************************************************************/ __STATIC_INLINE void Cy_SysClk_ClkTimerSetSource(cy_en_clktimer_in_sources_t source) @@ -2472,6 +2873,7 @@ __STATIC_INLINE void Cy_SysClk_ClkTimerSetSource(cy_en_clktimer_in_sources_t sou CY_REG32_CLR_SET(SRSS_CLK_TIMER_CTL, CY_SRSS_CLK_TIMER_CTL_TIMER, source); } + /******************************************************************************* * Function Name: Cy_SysClk_ClkTimerGetSource ****************************************************************************//** @@ -2481,7 +2883,7 @@ __STATIC_INLINE void Cy_SysClk_ClkTimerSetSource(cy_en_clktimer_in_sources_t sou * \return \ref cy_en_clktimer_in_sources_t * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_ClkTimerSetSource +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkTimerSetSource * *******************************************************************************/ __STATIC_INLINE cy_en_clktimer_in_sources_t Cy_SysClk_ClkTimerGetSource(void) @@ -2490,6 +2892,7 @@ __STATIC_INLINE cy_en_clktimer_in_sources_t Cy_SysClk_ClkTimerGetSource(void) return ((cy_en_clktimer_in_sources_t)(SRSS_CLK_TIMER_CTL & CY_SRSS_CLK_TIMER_CTL_TIMER_Msk)); } + /******************************************************************************* * Function Name: Cy_SysClk_ClkTimerSetDivider ****************************************************************************//** @@ -2503,7 +2906,7 @@ __STATIC_INLINE cy_en_clktimer_in_sources_t Cy_SysClk_ClkTimerGetSource(void) * Do not change the divider value while the timer clock is enabled. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_ClkTimerSetDivider +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkTimerSetDivider * *******************************************************************************/ __STATIC_INLINE void Cy_SysClk_ClkTimerSetDivider(uint8_t divider) @@ -2511,6 +2914,7 @@ __STATIC_INLINE void Cy_SysClk_ClkTimerSetDivider(uint8_t divider) CY_REG32_CLR_SET(SRSS_CLK_TIMER_CTL, SRSS_CLK_TIMER_CTL_TIMER_DIV, divider); } + /******************************************************************************* * Function Name: Cy_SysClk_ClkTimerGetDivider ****************************************************************************//** @@ -2520,7 +2924,7 @@ __STATIC_INLINE void Cy_SysClk_ClkTimerSetDivider(uint8_t divider) * \return The divider value * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_ClkTimerSetDivider +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkTimerSetDivider * *******************************************************************************/ __STATIC_INLINE uint8_t Cy_SysClk_ClkTimerGetDivider(void) @@ -2528,6 +2932,7 @@ __STATIC_INLINE uint8_t Cy_SysClk_ClkTimerGetDivider(void) return ((uint8_t)_FLD2VAL(SRSS_CLK_TIMER_CTL_TIMER_DIV, SRSS_CLK_TIMER_CTL)); } + /******************************************************************************* * Function Name: Cy_SysClk_ClkTimerEnable ****************************************************************************//** @@ -2536,7 +2941,7 @@ __STATIC_INLINE uint8_t Cy_SysClk_ClkTimerGetDivider(void) * for SYSTICK and one or more of the energy profiler counters. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_ClkTimerEnable +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkTimerEnable * *******************************************************************************/ __STATIC_INLINE void Cy_SysClk_ClkTimerEnable(void) @@ -2544,6 +2949,7 @@ __STATIC_INLINE void Cy_SysClk_ClkTimerEnable(void) SRSS_CLK_TIMER_CTL |= SRSS_CLK_TIMER_CTL_ENABLE_Msk; } + /******************************************************************************* * Function Name: Cy_SysClk_ClkTimerDisable ****************************************************************************//** @@ -2551,7 +2957,7 @@ __STATIC_INLINE void Cy_SysClk_ClkTimerEnable(void) * Disables the timer clock (clk_timer). * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_ClkTimerDisable +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkTimerDisable * *******************************************************************************/ __STATIC_INLINE void Cy_SysClk_ClkTimerDisable(void) @@ -2593,6 +2999,7 @@ typedef enum CY_SYSCLK_PUMP_IN_CLKPATH15 /**< Pump clock input is clock path 15 */ } cy_en_clkpump_in_sources_t; + /** * Pump clock (clk_pump) divide options. See CLK_SELECT register, PUMP_DIV bits. * Used with functions \ref Cy_SysClk_ClkPumpSetDivider, and @@ -2627,6 +3034,7 @@ __STATIC_INLINE cy_en_clkpump_divide_t Cy_SysClk_ClkPumpGetDivider(void); __STATIC_INLINE void Cy_SysClk_ClkPumpEnable(void); __STATIC_INLINE void Cy_SysClk_ClkPumpDisable(void); + /******************************************************************************* * Function Name: Cy_SysClk_ClkPumpSetSource ****************************************************************************//** @@ -2640,7 +3048,7 @@ __STATIC_INLINE void Cy_SysClk_ClkPumpDisable(void); * Do not change the source while the pump clock is enabled. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_ClkPumpSetSource +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkPumpSetSource * *******************************************************************************/ __STATIC_INLINE void Cy_SysClk_ClkPumpSetSource(cy_en_clkpump_in_sources_t source) @@ -2649,6 +3057,7 @@ __STATIC_INLINE void Cy_SysClk_ClkPumpSetSource(cy_en_clkpump_in_sources_t sourc CY_REG32_CLR_SET(SRSS_CLK_SELECT, SRSS_CLK_SELECT_PUMP_SEL, source); } + /******************************************************************************* * Function Name: Cy_SysClk_ClkPumpGetSource ****************************************************************************//** @@ -2658,7 +3067,7 @@ __STATIC_INLINE void Cy_SysClk_ClkPumpSetSource(cy_en_clkpump_in_sources_t sourc * \return \ref cy_en_clkpump_in_sources_t * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_ClkPumpSetSource +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkPumpSetSource * *******************************************************************************/ __STATIC_INLINE cy_en_clkpump_in_sources_t Cy_SysClk_ClkPumpGetSource(void) @@ -2666,6 +3075,7 @@ __STATIC_INLINE cy_en_clkpump_in_sources_t Cy_SysClk_ClkPumpGetSource(void) return ((cy_en_clkpump_in_sources_t)_FLD2VAL(SRSS_CLK_SELECT_PUMP_SEL, SRSS_CLK_SELECT)); } + /******************************************************************************* * Function Name: Cy_SysClk_ClkPumpSetDivider ****************************************************************************//** @@ -2678,7 +3088,7 @@ __STATIC_INLINE cy_en_clkpump_in_sources_t Cy_SysClk_ClkPumpGetSource(void) * Do not change the divider value while the pump clock is enabled. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_ClkPumpSetDivider +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkPumpSetDivider * *******************************************************************************/ __STATIC_INLINE void Cy_SysClk_ClkPumpSetDivider(cy_en_clkpump_divide_t divider) @@ -2687,6 +3097,7 @@ __STATIC_INLINE void Cy_SysClk_ClkPumpSetDivider(cy_en_clkpump_divide_t divider) CY_REG32_CLR_SET(SRSS_CLK_SELECT, SRSS_CLK_SELECT_PUMP_DIV, divider); } + /******************************************************************************* * Function Name: Cy_SysClk_ClkPumpGetDivider ****************************************************************************//** @@ -2696,7 +3107,7 @@ __STATIC_INLINE void Cy_SysClk_ClkPumpSetDivider(cy_en_clkpump_divide_t divider) * \return \ref cy_en_clkpump_divide_t * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_ClkPumpSetDivider +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkPumpSetDivider * *******************************************************************************/ __STATIC_INLINE cy_en_clkpump_divide_t Cy_SysClk_ClkPumpGetDivider(void) @@ -2704,6 +3115,7 @@ __STATIC_INLINE cy_en_clkpump_divide_t Cy_SysClk_ClkPumpGetDivider(void) return ((cy_en_clkpump_divide_t)_FLD2VAL(SRSS_CLK_SELECT_PUMP_DIV, SRSS_CLK_SELECT)); } + /******************************************************************************* * Function Name: Cy_SysClk_ClkPumpEnable ****************************************************************************//** @@ -2712,7 +3124,7 @@ __STATIC_INLINE cy_en_clkpump_divide_t Cy_SysClk_ClkPumpGetDivider(void) * pumps in the CTBm block. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_ClkPumpEnable +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkPumpEnable * *******************************************************************************/ __STATIC_INLINE void Cy_SysClk_ClkPumpEnable(void) @@ -2720,6 +3132,7 @@ __STATIC_INLINE void Cy_SysClk_ClkPumpEnable(void) SRSS_CLK_SELECT |= SRSS_CLK_SELECT_PUMP_ENABLE_Msk; } + /******************************************************************************* * Function Name: Cy_SysClk_ClkPumpDisable ****************************************************************************//** @@ -2727,7 +3140,7 @@ __STATIC_INLINE void Cy_SysClk_ClkPumpEnable(void) * Disables the pump clock (clk_pump). * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_ClkPumpDisable +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkPumpDisable * *******************************************************************************/ __STATIC_INLINE void Cy_SysClk_ClkPumpDisable(void) @@ -2756,6 +3169,7 @@ typedef enum } cy_en_clkbak_in_sources_t; /** \} group_sysclk_clk_bak_enums */ + /** * \addtogroup group_sysclk_clk_bak_funcs * \{ @@ -2777,7 +3191,7 @@ __STATIC_INLINE cy_en_clkbak_in_sources_t Cy_SysClk_ClkBakGetSource(void); * (see \ref Cy_SysClk_ClkLfSetSource), select WCO directly - do not select clkLf. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_ClkBakSetSource +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkBakSetSource * *******************************************************************************/ __STATIC_INLINE void Cy_SysClk_ClkBakSetSource(cy_en_clkbak_in_sources_t source) @@ -2786,6 +3200,7 @@ __STATIC_INLINE void Cy_SysClk_ClkBakSetSource(cy_en_clkbak_in_sources_t source) CY_REG32_CLR_SET(BACKUP_CTL, BACKUP_CTL_CLK_SEL, source); } + /******************************************************************************* * Function Name: Cy_SysClk_ClkBakGetSource ****************************************************************************//** @@ -2795,7 +3210,7 @@ __STATIC_INLINE void Cy_SysClk_ClkBakSetSource(cy_en_clkbak_in_sources_t source) * \return \ref cy_en_clkbak_in_sources_t * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_ClkBakSetSource +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkBakSetSource * *******************************************************************************/ __STATIC_INLINE cy_en_clkbak_in_sources_t Cy_SysClk_ClkBakGetSource(void) @@ -2804,6 +3219,14 @@ __STATIC_INLINE cy_en_clkbak_in_sources_t Cy_SysClk_ClkBakGetSource(void) } /** \} group_sysclk_clk_bak_funcs */ + +/** \cond */ +/* Deprecated macros */ +#define CY_SYSCLK_DIV_ROUND(a, b) (CY_SYSLIB_DIV_ROUND((a),(b))) +#define CY_SYSCLK_DIV_ROUNDUP(a, b) (CY_SYSLIB_DIV_ROUNDUP((a),(b))) +/** \endcond */ + + #if defined(__cplusplus) } #endif /* __cplusplus */ diff --git a/platform/ext/target/psoc64/Native_Driver/include/cy_sysint.h b/platform/ext/target/psoc64/Native_Driver/include/cy_sysint.h index 20480da090..ba6977eae7 100644 --- a/platform/ext/target/psoc64/Native_Driver/include/cy_sysint.h +++ b/platform/ext/target/psoc64/Native_Driver/include/cy_sysint.h @@ -1,6 +1,6 @@ /***************************************************************************//** * \file cy_sysint.h -* \version 1.20 +* \version 1.30 * * \brief * Provides an API declaration of the SysInt driver @@ -56,7 +56,7 @@ * } * \endcode * And can be used like this: -* \snippet sysint\1.20\snippet\main.c snippet_Cy_SysInt_flashVT +* \snippet sysint/snippet/main.c snippet_Cy_SysInt_flashVT * Using this method avoids the need for a RAM vector table. However in this scenario, * interrupt handler re-location at run-time is not possible, unless the vector table is * relocated to RAM. @@ -170,6 +170,11 @@ * <table class="doxtable"> * <tr><th>Version</th><th>Changes</th><th>Reason for Change</th></tr> * <tr> +* <td>1.30</td> +* <td>The Cy_SysInt_SetNmiSource is updated with Protection Context check for CM0+.</td> +* <td>User experience enhancement.</td> +* </tr> +* <tr> * <td>1.20.1</td> * <td>The Vector Table section is extended with a code snippet.</td> * <td>Documentation enhancement.</td> @@ -265,7 +270,7 @@ extern cy_israddress __ramVectors[]; /**< Relocated vector table in SRAM */ #define CY_SYSINT_DRV_VERSION_MAJOR 1 /** Driver minor version */ -#define CY_SYSINT_DRV_VERSION_MINOR 20 +#define CY_SYSINT_DRV_VERSION_MINOR 30 /** SysInt driver ID */ #define CY_SYSINT_ID CY_PDL_DRV_ID (0x15U) @@ -360,6 +365,7 @@ typedef struct { ((nmiNum) == CY_SYSINT_NMI2) || \ ((nmiNum) == CY_SYSINT_NMI3) || \ ((nmiNum) == CY_SYSINT_NMI4)) + #define CY_SYSINT_IS_PC_0 (0UL == _FLD2VAL(PROT_MPU_MS_CTL_PC, PROT_MPU_MS_CTL(0U))) /** \endcond */ @@ -420,11 +426,11 @@ cy_israddress Cy_SysInt_GetVector(IRQn_Type IRQn); * Interrupt source. This parameter can either be of type cy_en_intr_t or IRQn_Type * based on the selected core. * +* \note CM0+ may call this function only at PC=0, CM4 may set its NMI handler at any PC. * \note The CM0+ NMI is used for performing system calls that execute out of ROM. -* Hence modification of the NMI source is strongly discouraged for this core. * * \funcusage -* \snippet sysint\1.20\snippet\main.c snippet_Cy_SysInt_SetNmiSource +* \snippet sysint/snippet/main.c snippet_Cy_SysInt_SetNmiSource * *******************************************************************************/ #if (!CY_CPU_CORTEX_M0P) || defined (CY_DOXYGEN) @@ -434,6 +440,10 @@ __STATIC_INLINE void Cy_SysInt_SetNmiSource(cy_en_sysint_nmi_t nmiNum, cy_en_int #endif { CY_ASSERT_L3(CY_SYSINT_IS_NMI_NUM_VALID(nmiNum)); + +#if (CY_CPU_CORTEX_M0P) + CY_ASSERT_L1(CY_SYSINT_IS_PC_0); +#endif if (CY_CPUSS_V1) { @@ -465,7 +475,7 @@ __STATIC_INLINE void Cy_SysInt_SetNmiSource(cy_en_sysint_nmi_t nmiNum, cy_en_int * based on the selected core. * * \funcusage -* \snippet sysint\1.20\snippet\main.c snippet_Cy_SysInt_SetNmiSource +* \snippet sysint/snippet/main.c snippet_Cy_SysInt_SetNmiSource * *******************************************************************************/ #if (!CY_CPU_CORTEX_M0P) || defined (CY_DOXYGEN) @@ -501,7 +511,7 @@ __STATIC_INLINE cy_en_intr_t Cy_SysInt_GetNmiSource(cy_en_sysint_nmi_t nmiNum) * Interrupt source * * \funcusage -* \snippet sysint\1.20\snippet\main.c snippet_Cy_SysInt_SoftwareTrig +* \snippet sysint/snippet/main.c snippet_Cy_SysInt_SoftwareTrig * * \note Only privileged software can enable unprivileged access to the * Software Trigger Interrupt Register (STIR). diff --git a/platform/ext/target/psoc64/Native_Driver/include/cy_syslib.h b/platform/ext/target/psoc64/Native_Driver/include/cy_syslib.h index 8c6cfd966d..b568337cdf 100644 --- a/platform/ext/target/psoc64/Native_Driver/include/cy_syslib.h +++ b/platform/ext/target/psoc64/Native_Driver/include/cy_syslib.h @@ -1,6 +1,6 @@ /***************************************************************************//** * \file cy_syslib.h -* \version 2.20 +* \version 2.40.1 * * Provides an API declaration of the SysLib driver. * @@ -159,6 +159,29 @@ * <table class="doxtable"> * <tr><th>Version</th><th>Changes</th><th>Reason for Change</th></tr> * <tr> +* <td>2.40.1</td> +* <td>Correct the CY_RAMFUNC_BEGIN macro for the IAR compiler.</td> +* <td>Removed the IAR compiler warning.</td> +* </tr> +* <tr> +* <td>2.40</td> +* <td>Added new macros CY_SYSLIB_DIV_ROUND and CY_SYSLIB_DIV_ROUNDUP to easy perform integer division with rounding.</td> +* <td>Improve PDL code base.</td> +* </tr> +* <tr> +* <td rowspan="3">2.30</td> +* <td>Updated implementation of the Cy_SysLib_AsmInfiniteLoop() function to be compatible with ARMC6.</td> +* <td>Provided support for the ARM Compiler 6.</td> +* </tr> +* <tr> +* <td>Minor documentation edits.</td> +* <td>Documentation update and clarification.</td> +* </tr> +* <tr> +* <td>Added new macros CY_RAMFUNC_BEGIN and CY_RAMFUNC_END for convenient placement function in RAM for all supported compilers.</td> +* <td>Improve user experience.</td> +* </tr> +* <tr> * <td rowspan="2">2.20</td> * <td>Updated implementation of the \ref Cy_SysLib_AssertFailed() function to be available in Release and Debug modes.</td> * <td>Provided support for the PDL static library in Release mode.</td> @@ -440,7 +463,7 @@ typedef enum #define CY_SYSLIB_DRV_VERSION_MAJOR 2 /** The driver minor version */ -#define CY_SYSLIB_DRV_VERSION_MINOR 20 +#define CY_SYSLIB_DRV_VERSION_MINOR 40 /******************************************************************************* @@ -477,19 +500,29 @@ typedef enum * attributes at the first place of declaration/definition. * For example: CY_NOINIT uint32_t noinitVar; */ - #define CY_NOINIT __attribute__ ((section(".bss.noinit"))) + #if (__ARMCC_VERSION >= 6010050) + #define CY_NOINIT __attribute__ ((section(".noinit"))) + #else + #define CY_NOINIT __attribute__ ((section(".noinit"), zero_init)) + #endif /* (__ARMCC_VERSION >= 6010050) */ #define CY_SECTION(name) __attribute__ ((section(name))) #define CY_UNUSED __attribute__ ((unused)) #define CY_NOINLINE __attribute__ ((noinline)) /* Specifies the minimum alignment (in bytes) for variables of the specified type. */ #define CY_ALIGN(align) __ALIGNED(align) + #define CY_RAMFUNC_BEGIN __attribute__ ((section(".cy_ramfunc"))) + #define CY_RAMFUNC_END #elif defined (__GNUC__) #if defined (__clang__) #define CY_NOINIT __attribute__ ((section("__DATA, __noinit"))) #define CY_SECTION(name) __attribute__ ((section("__DATA, "name))) + #define CY_RAMFUNC_BEGIN __attribute__ ((section("__DATA, .cy_ramfunc"))) + #define CY_RAMFUNC_END #else #define CY_NOINIT __attribute__ ((section(".noinit"))) #define CY_SECTION(name) __attribute__ ((section(name))) + #define CY_RAMFUNC_BEGIN __attribute__ ((section(".cy_ramfunc"))) + #define CY_RAMFUNC_END #endif #define CY_UNUSED __attribute__ ((unused)) @@ -501,6 +534,8 @@ typedef enum #define CY_SECTION(name) CY_PRAGMA(location = name) #define CY_UNUSED #define CY_NOINLINE CY_PRAGMA(optimize = no_inline) + #define CY_RAMFUNC_BEGIN CY_PRAGMA(diag_suppress = Ta023) __ramfunc + #define CY_RAMFUNC_END CY_PRAGMA(diag_default = Ta023) #if (__VER__ < 8010001) #define CY_ALIGN(align) CY_PRAGMA(data_alignment = align) #else @@ -856,6 +891,28 @@ typedef double float64_t; /**< Specific-length typedef for the basic numerical #define _FLD2BOOL(field, value) (((value) & (field ## _Msk)) != 0UL) +/******************************************************************************* +* Macro Name: CY_SYSLIB_DIV_ROUND +****************************************************************************//** +* +* Calculates a / b with rounding to the nearest integer, +* a and b must have the same sign. +* +*******************************************************************************/ +#define CY_SYSLIB_DIV_ROUND(a, b) (((a) + ((b) / 2U)) / (b)) + + +/******************************************************************************* +* Macro Name: CY_SYSLIB_DIV_ROUNDUP +****************************************************************************//** +* +* Calculates a / b with rounding up if remainder != 0, +* both a and b must be positive. +* +*******************************************************************************/ +#define CY_SYSLIB_DIV_ROUNDUP(a, b) ((((a) - 1U) / (b)) + 1U) + + /****************************************************************************** * Constants *****************************************************************************/ diff --git a/platform/ext/target/psoc64/Native_Driver/include/cy_syspm.h b/platform/ext/target/psoc64/Native_Driver/include/cy_syspm.h index 427ed6fd4d..a762587bf2 100644 --- a/platform/ext/target/psoc64/Native_Driver/include/cy_syspm.h +++ b/platform/ext/target/psoc64/Native_Driver/include/cy_syspm.h @@ -1,6 +1,6 @@ /***************************************************************************//** * \file cy_syspm.h -* \version 4.10 +* \version 4.40 * * Provides the function definitions for the power management API. * @@ -63,6 +63,7 @@ * - \ref group_syspm_cb_structures * - \ref group_syspm_cb_function_implementation * - \ref group_syspm_cb_flow +* - \ref group_syspm_cb_registering * - \ref group_syspm_cb_unregistering * * \ref group_syspm_definitions * @@ -283,7 +284,7 @@ * * Before setting the regulator minimum current mode ensure that current limits * are be met. After current limits are met, call the -* Cy_SysPm_SystemSetNormalRegulatorCurrent() function. +* Cy_SysPm_SystemSetMinRegulatorCurrent() function. * * \subsection group_syspm_system_set_normal_reg_curr_mode Setting Normal System Regulator Current Mode * @@ -381,16 +382,15 @@ * execute when exiting the low power mode. * * The callback structures after registration: -* \image html syspm_2_10_after_registration.png +* \image html syspm_register_eq.png * * Your application must register each callback, so that SysPm can execute it. * Upon registration, the linked list is built by the SysPm driver. Notice * the &myDeepSleep1 address in the myDeepSleep1 -* \ref cy_stc_syspm_callback_t structure. This is filled in by the SysPm driver -* when you register myDeepSleep1. The order in which the callbacks are -* registered in the application defines the order of their execution by the -* SysPm driver. Call \ref Cy_SysPm_RegisterCallback() to register each -* callback function. +* \ref cy_stc_syspm_callback_t structure. This is filled in by the SysPm driver, +* when you register myDeepSleep1. The cy_stc_syspm_callback_t.order element +* defines the order of their execution by the SysPm driver. +* Call \ref Cy_SysPm_RegisterCallback() to register each callback function. * * A callback function is typically associated with a particular driver that * handles the peripheral. So the callback mechanism enables a peripheral to @@ -423,10 +423,10 @@ * We will build the prototype for an application that registers * three callback functions: * -# myDeepSleep1 - Handles CPU Deep Sleep. -* -# myDeepSleep1 - Handles CPU Deep Sleep and is associated with peripheral +* -# myDeepSleep2 - Handles CPU Deep Sleep and is associated with peripheral * HW1_address (see <a href="..\..\pdl_user_guide.pdf">PDL Design</a> * section to learn about the base hardware address). -* -# myDeepSleep2 - Handles entering and exiting system Deep Sleep and is +* -# myDeepSleep3 - Handles entering and exiting system Deep Sleep and is * associated with peripheral HW2_address. * * We set things up so that the myDeepSleep1 and myDeepSleep2 callbacks do @@ -442,43 +442,43 @@ * Let's first declare the callback functions. Each gets the pointer to the * \ref cy_stc_syspm_callback_params_t structure as the argument. * -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_Callback_Func_Declaration +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_Callback_Func_Declaration * * Now we setup the \ref cy_stc_syspm_callback_params_t structures that we will -* pass to the callback functions. Note that for the myDeepSleep1 and -* myDeepSleep2 callbacks we also pass pointers to the peripherals related to +* pass to the callback functions. Note that for the myDeepSleep2 and +* myDeepSleep3 callbacks we also pass pointers to the peripherals related to * that callback (see <a href="..\..\pdl_user_guide.pdf">PDL Design</a> section * to learn about base hardware addresses). * The configuration considerations related to this structure are described * in \ref group_syspm_cb_parameters in \ref group_syspm_cb_config_consideration. * -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_Callback_Params_Declaration +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_Callback_Params_Declaration * * Now we setup the actual callback configuration structures. Each of these * contains, among the other fields, the address of the * \ref cy_stc_syspm_callback_params_t we just set up. We will use the callback * configuration structures later in the code to register the callbacks in the * SysPm driver. Again, we set things up so that the myDeepSleep1 and -* myDeepSleep1 callbacks do nothing while entering the low power mode +* myDeepSleep2 callbacks do nothing while entering the low power mode * (skip on CY_SYSPM_SKIP_BEFORE_TRANSITION) - see * \ref group_syspm_cb_function_implementation in * \ref group_syspm_cb_config_consideration. * -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_Callback_Structure_Declaration +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_Callback_Structure_Declaration * * Note that in each case the last two fields are NULL. These are fields used by * the SysPm driver to set up the linked list of callback functions. * * The callback structures are now defined and allocated in the user's * memory space: -* \image html syspm_2_10_before_registration.png +* \image html syspm_before_registration.png * * Now we implement the callback functions. See * \ref group_syspm_cb_function_implementation in * \ref group_syspm_cb_config_consideration for the instructions on how the * callback functions should be implemented. * -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_Callback_Func_Implementation +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_Callback_Func_Implementation * * Finally, we register the callbacks so that the SysPm driver knows about them. * The order in which the callbacks will be called depends upon the order in @@ -490,7 +490,7 @@ * entering the low power mode, and restore those resources first, as the system * returns from low power mode. * -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_RegisterCallback +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_RegisterCallback * * We are done configuring three callbacks. Now the SysPm driver will execute the * callbacks appropriately whenever there is a call to a power mode transition @@ -532,8 +532,11 @@ * \subsubsection group_syspm_cb_structures Callback Function Structure * For each callback, provide a \ref cy_stc_syspm_callback_t structure. Some * fields in this structure are maintained by the driver. Use NULL for -* <b>prevItm</b> and <b>nextItm</b>. The driver uses these fields to build a -* linked list of callback functions. +* cy_stc_syspm_callback_t.prevItm and cy_stc_syspm_callback_t.nextItm. +* Driver uses these fields to build a linked list of callback functions. +* The value of cy_stc_syspm_callback_t.order element is used to define the order +* how the callbacks are put into linked list, and sequentially, how the +* callbacks are executed. See \ref group_syspm_cb_registering section. * * \warning The Cy_SysPm_RegisterCallback() function stores a pointer to the * cy_stc_syspm_callback_t structure. Do not modify elements of the @@ -588,7 +591,7 @@ * \ref Cy_SysPm_ExecuteCallback() calls each callback with the mode set to * CY_SYSPM_BEFORE_TRANSITION. This triggers execution of the code for that mode * inside each user callback. We then enter the low power mode after all callback -* are executes. +* are executed. * * When exiting the low power mode, the SysPm driver executes * \ref Cy_SysPm_ExecuteCallback() again. This time it calls each callback in @@ -618,14 +621,47 @@ * step before entering the low power mode, and restore those resources first, * as the system returns from low power mode. * +* \subsubsection group_syspm_cb_registering Callback Registering +* While registration the callback is put into the linked list. The +* place where the callback structure is put into the linked list is based on +* cy_stc_syspm_callback_t.order. The callback with the lowest +* cy_stc_syspm_callback_t.order value will be placed at the beginning of linked +* list. The callback with the highest cy_stc_syspm_callback_t.order value will +* be placed at the end of the linked list. +* If there is already a callback structure in the linked list with the same +* cy_stc_syspm_callback_t.order value as you attend to register, then your +* callback will be placed right after such a callback. +* +* Such a registration order defines how the callbacks are executed: +* * Callbacks with the lower cy_stc_syspm_callback_t.order are executed first +* when entering into low power and last when exiting from low power. +* * Callbacks with the higher cy_stc_syspm_callback_t.order are executed last +* when entering into low power and first when exiting from low power. +* +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_RegisterCallback +* +* Callbacks with equal cy_stc_syspm_callback_t.order values are +* registered in the same order as they are registered: +* \image html syspm_register_eq.png + +* Callbacks with a different cy_stc_syspm_callback_t.order value will be +* stored based on the cy_stc_syspm_callback_t.order value, with no matter when +* they when registered: +* +* \image html syspm_register_dif.png +* +* This can be useful to ensure that system resources (clock dividers, etc) are +* changed right before entering low power mode and immediately after exiting +* from low power. +* * \subsubsection group_syspm_cb_unregistering Callback Unregistering * * Unregistering the callback might be useful when you need to dynamically manage * the callbacks. * -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_UnregisterCallback +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_UnregisterCallback * The callback structures after myDeepSleep2 callback is unregistered: -* \image html syspm_2_10_unregistration.png +* \image html syspm_unregistration.png * * \section group_syspm_definitions Definitions * @@ -688,6 +724,66 @@ * <table class="doxtable"> * <tr><th>Version</th><th>Changes</th><th>Reason for Change</th></tr> * <tr> +* <td>4.40</td> +* <td> +* Fixed \ref Cy_SysPm_LdoSetVoltage(), \ref Cy_SysPm_BuckEnable(), and +* \ref Cy_SysPm_BuckSetVoltage1() functions. Corrected the sequence for +* setting the RAM trim value. This behavior is applicable for all +* devices, except CY8C6xx6 and CY8C6xx7. +* </td> +* <td> +* For all devices, except CY8C6xx6 and CY8C6xx7, the trim +* sequence was setting incorrect trim values for RAM. +* This could cause a CPU hard fault. +* </td> +* </tr> +* <tr> +* <td>4.30</td> +* <td> +* Corrected the \ref Cy_SysPm_CpuEnterDeepSleep() function. +* Removed early access to flash values after system Deep Sleep, when +* flash is not ready to be used. Now the \ref Cy_SysPm_CpuEnterDeepSleep() +* function does not access flash until the flash is ready. +* This behavior is applicable only on multi-CPU devices CY8C6xx6 and +* CY8C6xx7. +* </td> +* <td> +* For CY8C6xx6 and CY8C6xx7 early access to flash values after +* system Deep Sleep could potentially cause hard fault. +* Now after system Deep Sleep only ram values are used before +* flash is ready. +* </td> +* </tr> +* <tr> +* <td rowspan="3">4.20</td> +* <td>Updated the \ref Cy_SysPm_RegisterCallback() function. +* Added a new element to callback structure - +* cy_stc_syspm_callback_t.order</td> +* <td>Enhanced the mechanism of callbacks registration and execution. Now +* callbacks can be ordered during registration. This means the +* execution flow now is based on cy_stc_syspm_callback_t.order. +* For more details, see the \ref group_syspm_cb_registering section. </td> +* </tr> +* <tr> +* <td>Updated \ref group_syspm_cb section. +* Added \ref group_syspm_cb_registering section</td> +* <td>Added explanations how to use updated callbacks registration +* mechanism. </td> +* </tr> +* <tr> +* <td>Added new function \ref Cy_SysPm_GetFailedCallback()</td> +* <td>Added new functionality to support callback debugging</td> +* </tr> +* <tr> +* <td>4.10.1</td> +* <td> +* Updated the Cy_SysPm_BackupEnableVoltageMeasurement() description +* </td> +* <td> +* Changed the scale number from 40% to 10% to correctly reflect a real value. +* </td> +* </tr> +* <tr> * <td rowspan="3">4.10</td> * <td>Updated the \ref Cy_SysPm_CpuEnterDeepSleep() function.</td> * <td> @@ -1127,7 +1223,7 @@ extern "C" { #define CY_SYSPM_DRV_VERSION_MAJOR 4 /** Driver minor version */ -#define CY_SYSPM_DRV_VERSION_MINOR 10 +#define CY_SYSPM_DRV_VERSION_MINOR 40 /** SysPm driver identifier */ #define CY_SYSPM_ID (CY_PDL_DRV_ID(0x10U)) @@ -1587,6 +1683,12 @@ typedef struct cy_stc_syspm_callback link this structure to the previous registered structure. It will be updated during callback registration. Do not modify this element at run-time. */ + uint8_t order; /**< Holds the callback execution order value. Range: 0-255. + While entering low power mode, callbacks with lower order values + are executed first. While exiting low power mode, + the callbacks are executed in the opposite order. + Callbacks with the same order value are executed in the + order they are registered in the application. */ } cy_stc_syspm_callback_t; /** This internal structure stores non-retained registers in the system Deep Sleep @@ -1732,9 +1834,9 @@ bool Cy_SysPm_BuckIsOutputEnabled(cy_en_syspm_buck_out_t output); bool Cy_SysPm_RegisterCallback(cy_stc_syspm_callback_t *handler); bool Cy_SysPm_UnregisterCallback(cy_stc_syspm_callback_t const *handler); cy_en_syspm_status_t Cy_SysPm_ExecuteCallback(cy_en_syspm_callback_type_t type, cy_en_syspm_callback_mode_t mode); +cy_stc_syspm_callback_t* Cy_SysPm_GetFailedCallback(cy_en_syspm_callback_type_t type); /** \} group_syspm_functions_callback */ - /** * \addtogroup group_syspm_functions_power_status * \{ @@ -1750,7 +1852,7 @@ cy_en_syspm_status_t Cy_SysPm_ExecuteCallback(cy_en_syspm_callback_type_t type, * - False if the CM4 is not in CPU Active mode. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_Cm4IsActive +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_Cm4IsActive * *******************************************************************************/ __STATIC_INLINE bool Cy_SysPm_Cm4IsActive(void) @@ -1770,7 +1872,7 @@ __STATIC_INLINE bool Cy_SysPm_Cm4IsActive(void) * - False if the CM4 is not in CPU Sleep mode. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_Cm4IsSleep +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_Cm4IsSleep * *******************************************************************************/ __STATIC_INLINE bool Cy_SysPm_Cm4IsSleep(void) @@ -1790,7 +1892,7 @@ __STATIC_INLINE bool Cy_SysPm_Cm4IsSleep(void) * - False if the CM4 is not CPU in Deep Sleep mode. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_Cm4IsDeepSleep +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_Cm4IsDeepSleep * *******************************************************************************/ __STATIC_INLINE bool Cy_SysPm_Cm4IsDeepSleep(void) @@ -1810,7 +1912,7 @@ __STATIC_INLINE bool Cy_SysPm_Cm4IsDeepSleep(void) * - False if the CM0+ is not in CPU Sleep mode. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_Cm0IsActive +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_Cm0IsActive * *******************************************************************************/ __STATIC_INLINE bool Cy_SysPm_Cm0IsActive(void) @@ -1830,7 +1932,7 @@ __STATIC_INLINE bool Cy_SysPm_Cm0IsActive(void) * - False if the CM0+ is not in CPU Sleep mode. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_Cm0IsSleep +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_Cm0IsSleep * *******************************************************************************/ __STATIC_INLINE bool Cy_SysPm_Cm0IsSleep(void) @@ -1850,7 +1952,7 @@ __STATIC_INLINE bool Cy_SysPm_Cm0IsSleep(void) * - False if the CM0+ is not in CPU Deep Sleep mode * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_Cm0IsDeepSleep +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_Cm0IsDeepSleep * *******************************************************************************/ __STATIC_INLINE bool Cy_SysPm_Cm0IsDeepSleep(void) @@ -1870,7 +1972,7 @@ __STATIC_INLINE bool Cy_SysPm_Cm0IsDeepSleep(void) * - False the system is not in LP mode. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_IsSystemLp +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_IsSystemLp * *******************************************************************************/ __STATIC_INLINE bool Cy_SysPm_IsSystemLp(void) @@ -1890,7 +1992,7 @@ __STATIC_INLINE bool Cy_SysPm_IsSystemLp(void) * - False the system is is not ULP mode. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_IsSystemUlp +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_IsSystemUlp * *******************************************************************************/ __STATIC_INLINE bool Cy_SysPm_IsSystemUlp(void) @@ -1911,7 +2013,7 @@ __STATIC_INLINE bool Cy_SysPm_IsSystemUlp(void) * Sends the SEV (Send Event) ARM instruction to the system. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_CpuSendWakeupEvent +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_CpuSendWakeupEvent * *******************************************************************************/ __STATIC_INLINE void Cy_SysPm_CpuSendWakeupEvent(void) @@ -1931,7 +2033,7 @@ __STATIC_INLINE void Cy_SysPm_CpuSendWakeupEvent(void) * - False - system is in normal regulator current mode. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_SystemSetNormalRegulatorCurrent +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_SystemSetNormalRegulatorCurrent * *******************************************************************************/ __STATIC_INLINE bool Cy_SysPm_SystemIsMinRegulatorCurrentSet(void) @@ -1958,7 +2060,7 @@ __STATIC_INLINE bool Cy_SysPm_SystemIsMinRegulatorCurrentSet(void) * - False if it is disabled. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_VoltageRegulator +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_VoltageRegulator * *******************************************************************************/ __STATIC_INLINE bool Cy_SysPm_BuckIsEnabled(void) @@ -1982,7 +2084,7 @@ __STATIC_INLINE bool Cy_SysPm_BuckIsEnabled(void) * See \ref cy_en_syspm_buck_voltage1_t. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_VoltageRegulator +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_VoltageRegulator * *******************************************************************************/ __STATIC_INLINE cy_en_syspm_buck_voltage1_t Cy_SysPm_BuckGetVoltage1(void) @@ -2015,7 +2117,7 @@ __STATIC_INLINE cy_en_syspm_buck_voltage1_t Cy_SysPm_BuckGetVoltage1(void) * a SIMO Buck. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_BuckGetVoltage2 +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_BuckGetVoltage2 * *******************************************************************************/ __STATIC_INLINE cy_en_syspm_buck_voltage2_t Cy_SysPm_BuckGetVoltage2(void) @@ -2051,7 +2153,7 @@ __STATIC_INLINE cy_en_syspm_buck_voltage2_t Cy_SysPm_BuckGetVoltage2(void) * contains a SIMO Buck. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_BuckDisableVoltage2 +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_BuckDisableVoltage2 * *******************************************************************************/ __STATIC_INLINE void Cy_SysPm_BuckDisableVoltage2(void) @@ -2085,7 +2187,7 @@ __STATIC_INLINE void Cy_SysPm_BuckDisableVoltage2(void) * contains a SIMO Buck. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_BuckSetVoltage2HwControl +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_BuckSetVoltage2HwControl * *******************************************************************************/ __STATIC_INLINE void Cy_SysPm_BuckSetVoltage2HwControl(bool hwControl) @@ -2126,7 +2228,7 @@ __STATIC_INLINE void Cy_SysPm_BuckSetVoltage2HwControl(bool hwControl) * SIMO Buck. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_BuckIsVoltage2HwControlled +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_BuckIsVoltage2HwControlled * *******************************************************************************/ __STATIC_INLINE bool Cy_SysPm_BuckIsVoltage2HwControlled(void) @@ -2161,7 +2263,7 @@ __STATIC_INLINE bool Cy_SysPm_BuckIsVoltage2HwControlled(void) * The nominal output voltage of the LDO. See \ref cy_en_syspm_ldo_voltage_t. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_VoltageRegulator +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_VoltageRegulator * *******************************************************************************/ __STATIC_INLINE cy_en_syspm_ldo_voltage_t Cy_SysPm_LdoGetVoltage(void) @@ -2185,7 +2287,7 @@ __STATIC_INLINE cy_en_syspm_ldo_voltage_t Cy_SysPm_LdoGetVoltage(void) * - False means it is disabled. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_VoltageRegulator +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_VoltageRegulator * *******************************************************************************/ __STATIC_INLINE bool Cy_SysPm_LdoIsEnabled(void) @@ -2210,7 +2312,7 @@ __STATIC_INLINE bool Cy_SysPm_LdoIsEnabled(void) * - False if IOs are unfrozen. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_IoUnfreeze +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_IoUnfreeze * *******************************************************************************/ __STATIC_INLINE bool Cy_SysPm_IoIsFrozen(void) @@ -2238,7 +2340,7 @@ __STATIC_INLINE bool Cy_SysPm_IoIsFrozen(void) * Cy_SysPm_PmicUnlock() before enabling the PMIC. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_PmicEnable +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_PmicEnable * *******************************************************************************/ __STATIC_INLINE void Cy_SysPm_PmicEnable(void) @@ -2294,7 +2396,7 @@ __STATIC_INLINE void Cy_SysPm_PmicEnable(void) * device TRM. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_PmicDisable +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_PmicDisable * *******************************************************************************/ __STATIC_INLINE void Cy_SysPm_PmicDisable(cy_en_syspm_pmic_wakeup_polarity_t polarity) @@ -2323,7 +2425,7 @@ __STATIC_INLINE void Cy_SysPm_PmicDisable(cy_en_syspm_pmic_wakeup_polarity_t pol * assignment in the specific devices, refer to the appropriate device TRM. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_PmicAlwaysEnable +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_PmicAlwaysEnable * *******************************************************************************/ __STATIC_INLINE void Cy_SysPm_PmicAlwaysEnable(void) @@ -2345,7 +2447,7 @@ __STATIC_INLINE void Cy_SysPm_PmicAlwaysEnable(void) * specific devices, refer to the appropriate device TRM. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_PmicEnableOutput +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_PmicEnableOutput * *******************************************************************************/ __STATIC_INLINE void Cy_SysPm_PmicEnableOutput(void) @@ -2383,7 +2485,7 @@ __STATIC_INLINE void Cy_SysPm_PmicEnableOutput(void) * controller must remain unlocked. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_PmicDisableOutput +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_PmicDisableOutput * *******************************************************************************/ __STATIC_INLINE void Cy_SysPm_PmicDisableOutput(void) @@ -2411,7 +2513,7 @@ __STATIC_INLINE void Cy_SysPm_PmicDisableOutput(void) * disabled, the PMIC controller must remain unlocked. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_PmicLock +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_PmicLock * *******************************************************************************/ __STATIC_INLINE void Cy_SysPm_PmicLock(void) @@ -2434,7 +2536,7 @@ __STATIC_INLINE void Cy_SysPm_PmicLock(void) * disabled, the PMIC must remain unlocked. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_PmicEnable +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_PmicEnable * *******************************************************************************/ __STATIC_INLINE void Cy_SysPm_PmicUnlock(void) @@ -2454,7 +2556,7 @@ __STATIC_INLINE void Cy_SysPm_PmicUnlock(void) * - False if the PMIC is disabled. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_PmicLock +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_PmicLock * *******************************************************************************/ __STATIC_INLINE bool Cy_SysPm_PmicIsEnabled(void) @@ -2474,7 +2576,7 @@ __STATIC_INLINE bool Cy_SysPm_PmicIsEnabled(void) * - False if the PMIC output is disabled. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_PmicDisable +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_PmicDisable * *******************************************************************************/ __STATIC_INLINE bool Cy_SysPm_PmicIsOutputEnabled(void) @@ -2494,7 +2596,7 @@ __STATIC_INLINE bool Cy_SysPm_PmicIsOutputEnabled(void) * - False if the PMIC is unlocked. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_PmicLock +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_PmicLock * *******************************************************************************/ __STATIC_INLINE bool Cy_SysPm_PmicIsLocked(void) @@ -2522,7 +2624,7 @@ __STATIC_INLINE bool Cy_SysPm_PmicIsLocked(void) * Refer to device TRM for more detail about backup supply modes. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_BackupSetSupply +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_BackupSetSupply * *******************************************************************************/ __STATIC_INLINE void Cy_SysPm_BackupSetSupply(cy_en_syspm_vddbackup_control_t vddBackControl) @@ -2546,7 +2648,7 @@ __STATIC_INLINE void Cy_SysPm_BackupSetSupply(cy_en_syspm_vddbackup_control_t vd * Refer to device TRM for more detail about backup supply modes. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_BackupGetSupply +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_BackupGetSupply * *******************************************************************************/ __STATIC_INLINE cy_en_syspm_vddbackup_control_t Cy_SysPm_BackupGetSupply(void) @@ -2564,13 +2666,13 @@ __STATIC_INLINE cy_en_syspm_vddbackup_control_t Cy_SysPm_BackupGetSupply(void) * * This function enables Vbackup supply measurement by the ADC. The function * connects the Vbackup supply to AMuxBusA. The ADC input can then be connected -* to AMuxBusA. Note that the measured signal is scaled by 40% to allow full +* to AMuxBusA. Note that the measured signal is scaled by 10% to allow full * range measurement by the ADC. * * Refer to device TRM for more detail about Vbackup supply measurement. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_BackupEnableVoltageMeasurement +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_BackupEnableVoltageMeasurement * *******************************************************************************/ __STATIC_INLINE void Cy_SysPm_BackupEnableVoltageMeasurement(void) @@ -2589,7 +2691,7 @@ __STATIC_INLINE void Cy_SysPm_BackupEnableVoltageMeasurement(void) * Refer to device TRM for more detail about Vbackup supply measurement. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_BackupDisableVoltageMeasurement +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_BackupDisableVoltageMeasurement * *******************************************************************************/ __STATIC_INLINE void Cy_SysPm_BackupDisableVoltageMeasurement(void) @@ -2614,7 +2716,7 @@ __STATIC_INLINE void Cy_SysPm_BackupDisableVoltageMeasurement(void) * detail. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_BackupSuperCapCharge +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_BackupSuperCapCharge * *******************************************************************************/ __STATIC_INLINE void Cy_SysPm_BackupSuperCapCharge(cy_en_syspm_sc_charge_key_t key) diff --git a/platform/ext/target/psoc64/Native_Driver/include/cy_tcpwm.h b/platform/ext/target/psoc64/Native_Driver/include/cy_tcpwm.h index beb393ce24..7fbc9830f6 100644 --- a/platform/ext/target/psoc64/Native_Driver/include/cy_tcpwm.h +++ b/platform/ext/target/psoc64/Native_Driver/include/cy_tcpwm.h @@ -1,6 +1,6 @@ /***************************************************************************//** * \file cy_tcpwm.h -* \version 1.10 +* \version 1.10.1 * * The header file of the TCPWM driver. * @@ -162,14 +162,14 @@ * The dedicated TCPWM pins can be used. The HSIOM register must be configured to * connect the block to the pins. Use the \ref group_gpio driver API to do that. * -* \snippet tcpwm\1.10\counter\snippet\main.c snippet_Cy_TCPWM_Pins +* \snippet tcpwm/counter/snippet/main.c snippet_Cy_TCPWM_Pins * * \subsection group_tcpwm_clock Assign Clock Divider * The clock source must be connected to proper working. * Any of the peripheral clock dividers could be used. Use the * \ref group_sysclk driver API to do that. * -* \snippet tcpwm\1.10\counter\snippet\main.c snippet_Cy_TCPWM_Clock +* \snippet tcpwm/counter/snippet/main.c snippet_Cy_TCPWM_Clock * * \section group_tcpwm_more_information More Information * @@ -198,6 +198,11 @@ * <table class="doxtable"> * <tr><th>Version</th><th>Changes</th><th>Reason for Change</th></tr> * <tr> +* <td>1.10.1</td> +* <td>Added header guards CY_IP_MXTCPWM.</td> +* <td>To enable the PDL compilation with wounded out IP blocks.</td> +* </tr> +* <tr> * <td rowspan="2">1.10</td> * <td>Flattened the organization of the driver source code into the single * source directory and the single include directory. @@ -421,7 +426,7 @@ __STATIC_INLINE uint32_t Cy_TCPWM_GetInterruptStatusMasked(TCPWM_Type const *bas * A bit field representing each counter in the TCPWM block. * * \funcusage -* \snippet tcpwm\1.10\counter\snippet\main.c snippet_Cy_TCPWM_Enable_Multiple +* \snippet tcpwm/counter/snippet/main.c snippet_Cy_TCPWM_Enable_Multiple * *******************************************************************************/ __STATIC_INLINE void Cy_TCPWM_Enable_Multiple(TCPWM_Type *base, uint32_t counters) @@ -444,7 +449,7 @@ __STATIC_INLINE void Cy_TCPWM_Enable_Multiple(TCPWM_Type *base, uint32_t counter * A bit field representing each counter in the TCPWM block. * * \funcusage -* \snippet tcpwm\1.10\counter\snippet\main.c snippet_Cy_TCPWM_Disable_Multiple +* \snippet tcpwm/counter/snippet/main.c snippet_Cy_TCPWM_Disable_Multiple * *******************************************************************************/ __STATIC_INLINE void Cy_TCPWM_Disable_Multiple(TCPWM_Type *base, uint32_t counters) @@ -466,7 +471,7 @@ __STATIC_INLINE void Cy_TCPWM_Disable_Multiple(TCPWM_Type *base, uint32_t counte * A bit field representing each counter in the TCPWM block. * * \funcusage -* \snippet tcpwm\1.10\counter\snippet\main.c snippet_Cy_TCPWM_Enable_Multiple +* \snippet tcpwm/counter/snippet/main.c snippet_Cy_TCPWM_Enable_Multiple * *******************************************************************************/ __STATIC_INLINE void Cy_TCPWM_TriggerStart(TCPWM_Type *base, uint32_t counters) @@ -488,7 +493,7 @@ __STATIC_INLINE void Cy_TCPWM_TriggerStart(TCPWM_Type *base, uint32_t counters) * A bit field representing each counter in the TCPWM block. * * \funcusage -* \snippet tcpwm\1.10\counter\snippet\main.c snippet_Cy_TCPWM_TriggerReloadOrIndex +* \snippet tcpwm/counter/snippet/main.c snippet_Cy_TCPWM_TriggerReloadOrIndex * *******************************************************************************/ __STATIC_INLINE void Cy_TCPWM_TriggerReloadOrIndex(TCPWM_Type *base, uint32_t counters) @@ -510,7 +515,7 @@ __STATIC_INLINE void Cy_TCPWM_TriggerReloadOrIndex(TCPWM_Type *base, uint32_t co * A bit field representing each counter in the TCPWM block. * * \funcusage -* \snippet tcpwm\1.10\counter\snippet\main.c snippet_Cy_TCPWM_TriggerStopOrKill +* \snippet tcpwm/counter/snippet/main.c snippet_Cy_TCPWM_TriggerStopOrKill * *******************************************************************************/ __STATIC_INLINE void Cy_TCPWM_TriggerStopOrKill(TCPWM_Type *base, uint32_t counters) @@ -532,7 +537,7 @@ __STATIC_INLINE void Cy_TCPWM_TriggerStopOrKill(TCPWM_Type *base, uint32_t count * A bit field representing each counter in the TCPWM block. * * \funcusage -* \snippet tcpwm\1.10\counter\snippet\main.c snippet_Cy_TCPWM_Counter_Capture +* \snippet tcpwm/counter/snippet/main.c snippet_Cy_TCPWM_Counter_Capture * *******************************************************************************/ __STATIC_INLINE void Cy_TCPWM_TriggerCaptureOrSwap(TCPWM_Type *base, uint32_t counters) @@ -557,7 +562,7 @@ __STATIC_INLINE void Cy_TCPWM_TriggerCaptureOrSwap(TCPWM_Type *base, uint32_t co * See \ref group_tcpwm_interrupt_sources * * \funcusage -* \snippet tcpwm\1.10\counter\snippet\main.c snippet_Cy_TCPWM_GetInterruptStatus +* \snippet tcpwm/counter/snippet/main.c snippet_Cy_TCPWM_GetInterruptStatus * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_TCPWM_GetInterruptStatus(TCPWM_Type const *base, uint32_t cntNum) @@ -582,7 +587,7 @@ __STATIC_INLINE uint32_t Cy_TCPWM_GetInterruptStatus(TCPWM_Type const *base, uin * source to clear. See \ref group_tcpwm_interrupt_sources * * \funcusage -* \snippet tcpwm\1.10\counter\snippet\main.c snippet_Cy_TCPWM_GetInterruptStatusMasked +* \snippet tcpwm/counter/snippet/main.c snippet_Cy_TCPWM_GetInterruptStatusMasked * *******************************************************************************/ __STATIC_INLINE void Cy_TCPWM_ClearInterrupt(TCPWM_Type *base, uint32_t cntNum, uint32_t source) @@ -608,7 +613,7 @@ __STATIC_INLINE void Cy_TCPWM_ClearInterrupt(TCPWM_Type *base, uint32_t cntNum, * The source to set an interrupt. See \ref group_tcpwm_interrupt_sources. * * \funcusage -* \snippet tcpwm\1.10\counter\snippet\main.c snippet_Cy_TCPWM_SetInterrupt +* \snippet tcpwm/counter/snippet/main.c snippet_Cy_TCPWM_SetInterrupt * *******************************************************************************/ __STATIC_INLINE void Cy_TCPWM_SetInterrupt(TCPWM_Type *base, uint32_t cntNum, uint32_t source) @@ -634,7 +639,7 @@ __STATIC_INLINE void Cy_TCPWM_SetInterrupt(TCPWM_Type *base, uint32_t cntNum, u *. See \ref group_tcpwm_interrupt_sources * * \funcusage -* \snippet tcpwm\1.10\counter\snippet\main.c snippet_Cy_TCPWM_SetInterruptMask +* \snippet tcpwm/counter/snippet/main.c snippet_Cy_TCPWM_SetInterruptMask * *******************************************************************************/ __STATIC_INLINE void Cy_TCPWM_SetInterruptMask(TCPWM_Type *base, uint32_t cntNum, uint32_t mask) @@ -659,7 +664,7 @@ __STATIC_INLINE void Cy_TCPWM_SetInterruptMask(TCPWM_Type *base, uint32_t cntNum * Interrupt Mask. See \ref group_tcpwm_interrupt_sources * * \funcusage -* \snippet tcpwm\1.10\counter\snippet\main.c snippet_Cy_TCPWM_SetInterruptMask +* \snippet tcpwm/counter/snippet/main.c snippet_Cy_TCPWM_SetInterruptMask * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_TCPWM_GetInterruptMask(TCPWM_Type const *base, uint32_t cntNum) @@ -684,7 +689,7 @@ __STATIC_INLINE uint32_t Cy_TCPWM_GetInterruptMask(TCPWM_Type const *base, uint3 * Interrupt Mask. See \ref group_tcpwm_interrupt_sources * * \funcusage -* \snippet tcpwm\1.10\counter\snippet\main.c snippet_Cy_TCPWM_GetInterruptStatusMasked +* \snippet tcpwm/counter/snippet/main.c snippet_Cy_TCPWM_GetInterruptStatusMasked * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_TCPWM_GetInterruptStatusMasked(TCPWM_Type const *base, uint32_t cntNum) diff --git a/platform/ext/target/psoc64/Native_Driver/include/cy_tcpwm_pwm.h b/platform/ext/target/psoc64/Native_Driver/include/cy_tcpwm_pwm.h index c3a123922d..b2dafd039e 100644 --- a/platform/ext/target/psoc64/Native_Driver/include/cy_tcpwm_pwm.h +++ b/platform/ext/target/psoc64/Native_Driver/include/cy_tcpwm_pwm.h @@ -1,6 +1,6 @@ /***************************************************************************//** * \file cy_tcpwm_pwm.h -* \version 1.10 +* \version 1.10.1 * * \brief * The header file of the TCPWM PWM driver. @@ -28,6 +28,8 @@ #include "cy_tcpwm.h" +#ifdef CY_IP_MXTCPWM + #if defined(__cplusplus) extern "C" { #endif @@ -241,7 +243,7 @@ __STATIC_INLINE void Cy_TCPWM_PWM_EnablePeriodSwap(TCPWM_Type *base, uint32_t cn * The Counter instance number in the selected TCPWM. * * \funcusage -* \snippet tcpwm\1.10\pwm\snippet\main.c snippet_Cy_TCPWM_PWM_Init +* \snippet tcpwm/pwm/snippet/main.c snippet_Cy_TCPWM_PWM_Init * *******************************************************************************/ __STATIC_INLINE void Cy_TCPWM_PWM_Enable(TCPWM_Type *base, uint32_t cntNum) @@ -262,7 +264,7 @@ __STATIC_INLINE void Cy_TCPWM_PWM_Enable(TCPWM_Type *base, uint32_t cntNum) * The Counter instance number in the selected TCPWM. * * \funcusage -* \snippet tcpwm\1.10\pwm\snippet\main.c snippet_Cy_TCPWM_PWM_DeInit +* \snippet tcpwm/pwm/snippet/main.c snippet_Cy_TCPWM_PWM_DeInit * *******************************************************************************/ __STATIC_INLINE void Cy_TCPWM_PWM_Disable(TCPWM_Type *base, uint32_t cntNum) @@ -287,7 +289,7 @@ __STATIC_INLINE void Cy_TCPWM_PWM_Disable(TCPWM_Type *base, uint32_t cntNum) * The status. See \ref group_tcpwm_pwm_status * * \funcusage -* \snippet tcpwm\1.10\pwm\snippet\main.c snippet_Cy_TCPWM_PWM_GetStatus +* \snippet tcpwm/pwm/snippet/main.c snippet_Cy_TCPWM_PWM_GetStatus * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_TCPWM_PWM_GetStatus(TCPWM_Type const *base, uint32_t cntNum) @@ -319,7 +321,7 @@ __STATIC_INLINE uint32_t Cy_TCPWM_PWM_GetStatus(TCPWM_Type const *base, uint32_t * The Compare0 value. * * \funcusage -* \snippet tcpwm\1.10\pwm\snippet\main.c snippet_Cy_TCPWM_PWM_SetCompare0 +* \snippet tcpwm/pwm/snippet/main.c snippet_Cy_TCPWM_PWM_SetCompare0 * *******************************************************************************/ __STATIC_INLINE void Cy_TCPWM_PWM_SetCompare0(TCPWM_Type *base, uint32_t cntNum, uint32_t compare0) @@ -344,7 +346,7 @@ __STATIC_INLINE void Cy_TCPWM_PWM_SetCompare0(TCPWM_Type *base, uint32_t cntNum, * Compare value 0. * * \funcusage -* \snippet tcpwm\1.10\pwm\snippet\main.c snippet_Cy_TCPWM_PWM_SetCompare0 +* \snippet tcpwm/pwm/snippet/main.c snippet_Cy_TCPWM_PWM_SetCompare0 * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_TCPWM_PWM_GetCompare0(TCPWM_Type const *base, uint32_t cntNum) @@ -369,7 +371,7 @@ __STATIC_INLINE uint32_t Cy_TCPWM_PWM_GetCompare0(TCPWM_Type const *base, uint32 * The Compare1 value. * * \funcusage -* \snippet tcpwm\1.10\pwm\snippet\main.c snippet_Cy_TCPWM_PWM_SetCompare1 +* \snippet tcpwm/pwm/snippet/main.c snippet_Cy_TCPWM_PWM_SetCompare1 * *******************************************************************************/ __STATIC_INLINE void Cy_TCPWM_PWM_SetCompare1(TCPWM_Type *base, uint32_t cntNum, uint32_t compare1) @@ -394,7 +396,7 @@ __STATIC_INLINE void Cy_TCPWM_PWM_SetCompare1(TCPWM_Type *base, uint32_t cntNum, * Compare value 1. * * \funcusage -* \snippet tcpwm\1.10\pwm\snippet\main.c snippet_Cy_TCPWM_PWM_SetCompare1 +* \snippet tcpwm/pwm/snippet/main.c snippet_Cy_TCPWM_PWM_SetCompare1 * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_TCPWM_PWM_GetCompare1(TCPWM_Type const *base, uint32_t cntNum) @@ -419,7 +421,7 @@ __STATIC_INLINE uint32_t Cy_TCPWM_PWM_GetCompare1(TCPWM_Type const *base, uint32 * true = swap enabled; false = swap disabled * * \funcusage -* \snippet tcpwm\1.10\pwm\snippet\main.c snippet_Cy_TCPWM_PWM_EnableCompareSwap +* \snippet tcpwm/pwm/snippet/main.c snippet_Cy_TCPWM_PWM_EnableCompareSwap * *******************************************************************************/ __STATIC_INLINE void Cy_TCPWM_PWM_EnableCompareSwap(TCPWM_Type *base, uint32_t cntNum, bool enable) @@ -451,7 +453,7 @@ __STATIC_INLINE void Cy_TCPWM_PWM_EnableCompareSwap(TCPWM_Type *base, uint32_t c * The value to write into the counter. * * \funcusage -* \snippet tcpwm\1.10\pwm\snippet\main.c snippet_Cy_TCPWM_PWM_SetCounter +* \snippet tcpwm/pwm/snippet/main.c snippet_Cy_TCPWM_PWM_SetCounter * *******************************************************************************/ __STATIC_INLINE void Cy_TCPWM_PWM_SetCounter(TCPWM_Type *base, uint32_t cntNum, uint32_t count) @@ -476,7 +478,7 @@ __STATIC_INLINE void Cy_TCPWM_PWM_SetCounter(TCPWM_Type *base, uint32_t cntNum, * The current counter value. * * \funcusage -* \snippet tcpwm\1.10\pwm\snippet\main.c snippet_Cy_TCPWM_PWM_GetCounter +* \snippet tcpwm/pwm/snippet/main.c snippet_Cy_TCPWM_PWM_GetCounter * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_TCPWM_PWM_GetCounter(TCPWM_Type const *base, uint32_t cntNum) @@ -501,7 +503,7 @@ __STATIC_INLINE uint32_t Cy_TCPWM_PWM_GetCounter(TCPWM_Type const *base, uint32_ * The value to write into a period. * * \funcusage -* \snippet tcpwm\1.10\pwm\snippet\main.c snippet_Cy_TCPWM_PWM_SetPeriod0 +* \snippet tcpwm/pwm/snippet/main.c snippet_Cy_TCPWM_PWM_SetPeriod0 * *******************************************************************************/ __STATIC_INLINE void Cy_TCPWM_PWM_SetPeriod0(TCPWM_Type *base, uint32_t cntNum, uint32_t period0) @@ -526,7 +528,7 @@ __STATIC_INLINE void Cy_TCPWM_PWM_SetPeriod0(TCPWM_Type *base, uint32_t cntNum, * The current period value. * * \funcusage -* \snippet tcpwm\1.10\pwm\snippet\main.c snippet_Cy_TCPWM_PWM_SetPeriod0 +* \snippet tcpwm/pwm/snippet/main.c snippet_Cy_TCPWM_PWM_SetPeriod0 * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_TCPWM_PWM_GetPeriod0(TCPWM_Type const *base, uint32_t cntNum) @@ -551,7 +553,7 @@ __STATIC_INLINE uint32_t Cy_TCPWM_PWM_GetPeriod0(TCPWM_Type const *base, uint32_ * The value to write into a period1. * * \funcusage -* \snippet tcpwm\1.10\pwm\snippet\main.c snippet_Cy_TCPWM_PWM_SetPeriod1 +* \snippet tcpwm/pwm/snippet/main.c snippet_Cy_TCPWM_PWM_SetPeriod1 * *******************************************************************************/ __STATIC_INLINE void Cy_TCPWM_PWM_SetPeriod1(TCPWM_Type *base, uint32_t cntNum, uint32_t period1) @@ -576,7 +578,7 @@ __STATIC_INLINE void Cy_TCPWM_PWM_SetPeriod1(TCPWM_Type *base, uint32_t cntNum, * The current period value. * * \funcusage -* \snippet tcpwm\1.10\pwm\snippet\main.c snippet_Cy_TCPWM_PWM_SetPeriod1 +* \snippet tcpwm/pwm/snippet/main.c snippet_Cy_TCPWM_PWM_SetPeriod1 * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_TCPWM_PWM_GetPeriod1(TCPWM_Type const *base, uint32_t cntNum) @@ -601,7 +603,7 @@ __STATIC_INLINE uint32_t Cy_TCPWM_PWM_GetPeriod1(TCPWM_Type const *base, uint32_ * true = swap enabled; false = swap disabled * * \funcusage -* \snippet tcpwm\1.10\pwm\snippet\main.c snippet_Cy_TCPWM_PWM_EnablePeriodSwap +* \snippet tcpwm/pwm/snippet/main.c snippet_Cy_TCPWM_PWM_EnablePeriodSwap * *******************************************************************************/ __STATIC_INLINE void Cy_TCPWM_PWM_EnablePeriodSwap(TCPWM_Type *base, uint32_t cntNum, bool enable) @@ -624,7 +626,8 @@ __STATIC_INLINE void Cy_TCPWM_PWM_EnablePeriodSwap(TCPWM_Type *base, uint32_t cn } #endif -#endif /* CY_TCPWM_PWM_H */ +#endif /* CY_IP_MXTCPWM */ +#endif /* CY_TCPWM_PWM_H */ /* [] END OF FILE */ diff --git a/platform/ext/target/psoc64/Native_Driver/include/cy_usbfs_dev_drv.h b/platform/ext/target/psoc64/Native_Driver/include/cy_usbfs_dev_drv.h index 753e528c56..ef485ccf9d 100644 --- a/platform/ext/target/psoc64/Native_Driver/include/cy_usbfs_dev_drv.h +++ b/platform/ext/target/psoc64/Native_Driver/include/cy_usbfs_dev_drv.h @@ -1,6 +1,6 @@ /***************************************************************************//** * \file cy_usbfs_dev_drv.h -* \version 1.10 +* \version 2.20 * * Provides API declarations of the USBFS driver. * @@ -26,7 +26,7 @@ /** * \addtogroup group_usbfs_dev_drv * \{ -* The USBFS driver provides API to interact with a fixed-function USB block. +* The USBFS driver provides an API to interact with a fixed-function USB block. * * The functions and other declarations used in this driver are in cy_usbfs_dev_drv.h. * You can include cy_pdl.h (ModusToolbox only) to get access to all functions @@ -39,22 +39,22 @@ * * Complies with USB Specification 2.0 * * Supports full-speed peripheral device operation with a signaling bit * rate of 12 Mbps. -* * Supports eight data endpoints and one control endpoint -* * Provides shared 512-byte buffer for data endpoints -* * Provides dedicated 8-byte memory for control endpoint (EP0) +* * Supports eight data endpoints and one control endpoint. +* * Provides a shared 512-byte buffer for data endpoints. +* * Provides dedicated 8-byte memory for control endpoint (EP0). * * Supports four types of transfers: bulk, interrupt, isochronous, and control * * Supports bus- and self-powered configurations -* * Supports USB suspend, resume, and remove wakeup +* * Supports USB suspend, resume, and remove wakeup. * * Supports three types of logical transfer modes: * * CPU (No DMA) mode (Mode 1). * * Manual DMA mode (Mode 2). * * Automatic DMA mode (Mode 3). -* * Supports maximum packet size: +* * Supports the maximum packet size: * * 512 bytes using Mode 1 and Mode 2. * * 1023 bytes for isochronous transfer using Mode 3. * * Provides integrated 22 Ohm USB termination resistors on D+ and D- lines, -* and 1.5 kOhm pull-up resistor on the D+ line -* * Supports USB 2.0 Link Power Management (LPM) +* and 1.5 kOhm pull-up resistor on the D+ line. +* * Supports USB 2.0 Link Power Management (LPM). * * ******************************************************************************** @@ -62,9 +62,10 @@ ******************************************************************************** * * <b>The primary usage model for the USBFS driver is to provide a defined API -* interface to <a href="../../usbfs_dev_api_reference_manual.html" target="_blank">USB Device Middleware</a> -* component that works on top of it.</b> \n -* The driver also provides an API interface for the application to implement required +* interface to +* <a href="https://cypresssemiconductorco.github.io/usbdev/usbfs_dev_api_reference_manual/html/index.html" target="_blank"> +* USB Device Middleware</a> component that works on top of it.</b> \n +* The driver also provides an API interface for the application to implement the required * functionality: * * \ref group_usbfs_dev_drv_callbacks * * \ref group_usbfs_dev_drv_low_power @@ -75,9 +76,9 @@ * \section group_usbfs_dev_drv_configuration Configuration Considerations ******************************************************************************** * -* This section explains how to configure USBFS driver and system resources to -* enable USB Device operation. The pointers to populated \ref cy_stc_usbfs_dev_drv_config_t configuration -* structure and allocated context are passed in the middleware initialization +* This section explains how to configure the USBFS driver and system resources to +* enable USB Device operation. The pointers to the populated \ref cy_stc_usbfs_dev_drv_config_t configuration +* structure and allocated context are passed in the middleware initialization. * function Cy_USB_Dev_Init. After middleware initialization, it calls * \ref Cy_USBFS_Dev_Drv_Init to initialize the USBFS driver for Device operation. @@ -96,52 +97,52 @@ * \ref group_usbfs_dev_drv_intr to get information about <i>intrLevelSel</i> * configuration. * -* \snippet usbfs/1.0/snippet/main.c snipped_Cy_USBFS_Dev_Drv_CfgCpu +* \snippet usbfs/snippet/main.c snipped_Cy_USBFS_Dev_Drv_CfgCpu * * * \ref CY_USBFS_DEV_DRV_EP_MANAGEMENT_DMA \n -* To enable DMA operation the DMA channels must be assigned for each endpoint -* that will be used. Each DMA channel needs a single DMA descriptor to -* operate. The USBFS driver defines DMA configuration structure -* \ref cy_stc_usbfs_dev_drv_dma_config_t, which must be populated for each DMA +* To enable DMA operation, the DMA channels must be assigned for each endpoint +* to be used. Each DMA channel needs a single DMA descriptor to +* operate. The USBFS driver defines the DMA configuration structure +* \ref cy_stc_usbfs_dev_drv_dma_config_t to be populated for each DMA * channel. -* The code example below provides initialized USBFS driver DMA configuration +* The code example below provides an initialized USBFS driver DMA configuration * structure: * -* \snippet usbfs/1.0/snippet/main.c snipped_Cy_USBFS_Dev_Drv_CfgDma_DmaInit +* \snippet usbfs/snippet/main.c snipped_Cy_USBFS_Dev_Drv_CfgDma_DmaInit * -* The pointers to the DMA configuration structure must provided into the +* The pointers to the DMA configuration structure are required into the * \ref cy_stc_usbfs_dev_drv_config_t USBFS driver configuration structure -* to allow USBFS driver use DMA channels for used endpoints. -* The <i>dmaConfig[0]</i> field expects a pointer to DMA configuration for -* data endpoint 1, the <i>dmaConfig[1]</i> field pointer to DMA configuration +* to allow the USBFS driver to use DMA channels for used endpoints. +* The <i>dmaConfig[0]</i> field expects a pointer to the DMA configuration for +* data endpoint 1, the <i>dmaConfig[1]</i> field pointer to the DMA configuration * for data endpoint 2, and so on up to data endpoint 8. -* The code example below provides initialized USBFS driver configuration -* structure which use endpoint 1: +* The code example below provides an initialized USBFS driver configuration +* structure which uses endpoint 1: * -* \snippet usbfs/1.0/snippet/main.c snipped_Cy_USBFS_Dev_Drv_CfgDma +* \snippet usbfs/snippet/main.c snipped_Cy_USBFS_Dev_Drv_CfgDma * * * \ref CY_USBFS_DEV_DRV_EP_MANAGEMENT_DMA_AUTO \n -* DMA Automatic mode needs the similar DMA channels configuration as described +* DMA Automatic mode needs a DMA channels configuration similar to the described * above. But it also requires one more DMA descriptor for each DMA channel and -* DMA output trigger multiplexer. Find more information about trigger multiplexer -* in the \ref group_usbfs_dev_drv_dma section. -* The code example below provides initialized USBFS driver DMA configuration +* DMA output trigger multiplexer. Refer to the \ref group_usbfs_dev_drv_dma section, +* for more detail about the trigger multiplexer . +* The code example below provides an initialized USBFS driver DMA configuration * structure: * -* \snippet usbfs/1.0/snippet/main.c snipped_Cy_USBFS_Dev_Drv_CfgDmaAuto_DmaInit +* \snippet usbfs/snippet/main.c snipped_Cy_USBFS_Dev_Drv_CfgDmaAuto_DmaInit * * The driver requires a buffer for data endpoints to operate. This buffer must be * allocated by the user. The buffer size is equal to the sum of all used * endpoints maximum packet sizes. If an endpoint belongs to more than * one alternate setting, select the greatest maximum packet size for this * endpoint. The driver configuration structure \ref cy_stc_usbfs_dev_drv_config_t -* parameters have <i>epBuffer and epBufferSize</i> to pass the buffer to the driver. +* parameters <i>epBuffer and epBufferSize</i> pass the buffer to the driver. * -* The code example below provides initialized USBFS driver configuration +* The code example below provides an initialized USBFS driver configuration * structure that uses data endpoint 1 with a maximum packet size of 63 bytes and * set 16-bit access: * -* \snippet usbfs/1.0/snippet/main.c snipped_Cy_USBFS_Dev_Drv_CfgDmaAuto +* \snippet usbfs/snippet/main.c snipped_Cy_USBFS_Dev_Drv_CfgDmaAuto * * * \note @@ -170,58 +171,64 @@ * the IMO must be trimmed with USB SOF signal. Therefore, the driver * \ref Cy_USBFS_Dev_Drv_Init function enables the IMO trim from USB. * -* * Divided Clk_Peri clock (PCLK_USB_CLOCK_DEV_BRS) equal to 100 kHz, which is +* * Divided Clk_Peri clock (PCLK_USB_CLOCK_DEV_BRS) equal to 100 kHz * used to detect a Bus Reset event. Use one of the 8-bit or 16-bit dividers * to provide required clock frequency. * -* The code example below shows connection source path 1 +* The code example below shows the connection source path 1 * (which expected provide 48 MHz -/+ 0.25% clock) to Clk_HF3 and Bus Reset clock * (Clk_Peri assumed to be 50 MHz): * -* \snippet usbfs/1.0/snippet/main.c snipped_Cy_USBFS_Dev_Drv_ClockInit +* \snippet usbfs/snippet/main.c snipped_Cy_USBFS_Dev_Drv_ClockInit * * Refer to \ref group_sysclk driver API for more detail about clock * configuration. * +* The FLL (Clock Path 0) with ECO also can be used as an alternative USB source +* with the next configuration settings, for 48 MHz: +* \snippet usbfs/snippet/main.c snipped_Cy_USBFS_Dev_Drv_fllConfig48MHz +* And for 96 MHz: +* \snippet usbfs/snippet/main.c snipped_Cy_USBFS_Dev_Drv_fllConfig96MHz +* Use these structures with \ref Cy_SysClk_FllManualConfigure +* ******************************************************************************** * \subsection group_usbfs_dev_drv_dma Assign and Route DMA Channels ******************************************************************************** * -* The USBFS driver requires the DMA controller to operate in DMA Manual and Automatic modes. +* The USBFS driver requires a DMA controller to operate in DMA Manual and Automatic modes. * The USB hardware block supports the DMA request and feedback lines for each -* data endpoint. Therefore, up to eight DMA channels are needed to service eight data -* endpoints. -* The connection between the USB block and the DMA channels is established using the trigger +* data endpoint. Therefore, up to eight DMA channels serve eight data endpoints. +* The connection between the USB block and the DMA channels is set using the trigger * muxes infrastructure. The USB block output DMA request line is connected to * the DMA channel trigger input. This allows the USB block to request a DMA transfer. * The DMA completion output is connected to the USB block burst end input. -* This allows the USB block get notification that a DMA transfer has been completed -* and next DMA request can be sent. The USBFS driver DMA configuration +* This allows the USB block to get notification that a DMA transfer has been completed +* and a next DMA request can be sent. The USBFS driver DMA configuration * structure requires the <i>outTrigMux</i> field to provide the trigger mux that * performs DMA completion and USB block burst end connection. * -* Refer to \ref group_trigmux to get more information about routing capabilities. +* Refer to \ref group_trigmux for more detail on the routing capabilities. * -* The code examples below shows connection DMA channel and USB block and define -* for <i>outTrigMux</i> field initialization for CY8C6xx6 or CY8C6xx7 devices. +* The code examples below shows a connection DMA channel and USB block and the define +* for <i>outTrigMux</i> field initialization for the CY8C6xx6 or CY8C6xx7 devices. * -* \snippet usbfs/1.0/snippet/main.c snipped_Cy_USBFS_Dev_Drv_DmaConnect +* \snippet usbfs/snippet/main.c snipped_Cy_USBFS_Dev_Drv_DmaConnect * ******************************************************************************** * \subsection group_usbfs_dev_drv_intr Configure Interrupts ******************************************************************************** * * <b>The interrupts are mandatory for the USBFS driver operation.</b> -* The USBFS block provides multiple interrupt sources, which can be assigned to +* The USBFS block provides multiple interrupt sources to be assigned to * trigger one of the three interrupts: Low, Medium, or High. This allows to -* assign different priority for interrupt sources handling. -* The \ref cy_stc_usbfs_dev_drv_config_t structure provides field -* <i>intrLevelSel</i> that initializes the INTR_LVL_SEL -* register that configures to which interrupt is triggered by interrupt source. +* assign different priority to the interrupt sources handling. +* The \ref cy_stc_usbfs_dev_drv_config_t structure provides the +* <i>intrLevelSel</i> field which initializes the INTR_LVL_SEL +* register. This register configures which interrupt the interrupt source will trigger. * * \note * The interrupt name (Low, Medium, or High) does not specify the interrupt -* priority. The interrupt priority is configured in the NVIC. +* priority. The interrupt priority is configured in NVIC. * * The recommended/default configuration is: * * Interrupt Low: Bus Reset, Control Endpoint and SOF. @@ -230,7 +237,7 @@ * * However, the final configuration must be defined by the application. * -* \snippet usbfs/1.0/snippet/main.c snipped_Cy_USBFS_Dev_Drv_UserLvlSel +* \snippet usbfs/snippet/main.c snipped_Cy_USBFS_Dev_Drv_UserLvlSel * * The \ref Cy_USBFS_Dev_Drv_Interrupt function must be called in the interrupt * handler for the selected USB block instance. Note that @@ -240,13 +247,12 @@ * * \ref Cy_USBFS_Dev_Drv_GetInterruptCauseMed * * \ref Cy_USBFS_Dev_Drv_GetInterruptCauseLo * -* \snippet usbfs/1.0/snippet/main.c snipped_Cy_USBFS_Dev_Drv_IntrHandlers +* \snippet usbfs/snippet/main.c snipped_Cy_USBFS_Dev_Drv_IntrHandlers * * Finally, the interrupts must be configured and interrupt handler routines -* hooked up to NVIC. The code below assigns interrupt priorities accordingly -* to interrupt names: High interrupt has the greater priority than Low and -* Medium interrupts, the Medium interrupt has the greater priority that -* Low interrupt and Low interrupt has lowest priority among USBFS interrupts. +* hook up to NVIC. The code below assigns the interrupt priorities accordingly +* to interrupt names. The priorities among the USBFS interrupts are as follows: +* High - the greatest; Medium - the middle; Low - the lowest. * * \note * For proper operation in Manual DMA mode (Mode 2) the Arbiter interrupt source @@ -254,17 +260,17 @@ * triggered by Data Endpoint 1-8 Completion interrupt sources. \n * For Automatic DMA mode (Mode 3) the rule above is recommend to follow. * -* \snippet usbfs/1.0/snippet/main.c snipped_Cy_USBFS_Dev_Drv_IntrCfg -* \snippet usbfs/1.0/snippet/main.c snipped_Cy_USBFS_Dev_Drv_IntrCfgHook +* \snippet usbfs/snippet/main.c snipped_Cy_USBFS_Dev_Drv_IntrCfg +* \snippet usbfs/snippet/main.c snipped_Cy_USBFS_Dev_Drv_IntrCfgHook * ******************************************************************************** * \section group_usbfs_dev_drv_ep_management Endpoint Buffer Management Modes ******************************************************************************** * * The USBFS hardware block supports three endpoint buffer management modes: -* CPU (No DMA) mode (Mode 1), Manual DMA mode (Mode 2) and Automatic DMA mode (Mode 3). +* CPU (No DMA) mode (Mode 1), Manual DMA mode (Mode 2), and Automatic DMA mode (Mode 3). * These modes are listed using enum \ref cy_en_usbfs_dev_drv_ep_management_mode_t. -* The following sub-sections provide more information about endpoint buffer +* The following sub-sections provide more information about the endpoint buffer * management. * ******************************************************************************** @@ -290,18 +296,18 @@ * * * \ref group_usbfs_dev_drv_ep_management_mode3 * Each data endpoint consumes 32 bytes in the hardware buffer (if all eight -* endpoints are used, consumed buffer space is 32 * 8 = 256 byte). -* This buffer is called the dedicated endpoint buffer. It acts as an endpoint +* endpoints are used, the consumed buffer space is 32 * 8 = 256 byte). +* This buffer is called "dedicated endpoint buffer". It acts as an endpoint * FIFO. The remaining space (256 bytes, if all eight endpoints are * used) in the hardware buffer is used by any endpoint that currently -* communicates. This part of the buffer is called the common area. This hardware -* buffer configuration gives sufficient dedicated buffer size for each used +* communicates. This part of the buffer is called "common area". This hardware +* buffer configuration gives a sufficient dedicated buffer size for each used * endpoint and common area for operation. The total space consumed by all -* endpoints is not restricted by the size of hardware buffer. +* endpoints is not restricted by the size of the hardware buffer. * * To access the hardware buffer, the endpoint data register is read or written by -* the CPU or DMA. On each read or write, the buffer pointers are updated to access -* the next data element. +* CPU or DMA. On each read or write, buffer pointers are updated to access +* a next data element. * ******************************************************************************** * \subsection group_usbfs_dev_drv_ep_management_buf_access Hardware Buffer Access @@ -313,31 +319,31 @@ * by the <i>epAccess</i> field of the driver configuration structure * \ref cy_stc_usbfs_dev_drv_config_t. * The endpoint hardware buffer and SRAM buffer must be allocated using the -* rules below when 16-bit access is used: -* * Buffer size must be even. If endpoint maximum packet size is odd +* rules below when the 16-bit access is used: +* * The buffer size must be even. If the endpoint maximum packet size is odd * the allocated buffer size must be equal to (maximum packet size + 1). -* * Buffer must be aligned to 2-byte boundary. +* * The buffer must be aligned to the 2-byte boundary. * * The driver provides the \ref CY_USBFS_DEV_DRV_ALLOC_ENDPOINT_BUFFER macro that -* applying rules above to allocate the SRAM buffer for endpoint. This macro +* applies the rules above to allocate the SRAM buffer for an endpoint. This macro * should be used by application to hide configuration differences. * <b>However, in this case the application must ignore extra bytes in the buffer.</b> -* Alternately, apply rules above only for 16-bits access type configuration. +* Alternately, apply the rules above only for the 16-bits access type configuration. * -* The driver firmware allocates endpoint hardware buffer (dividing hardware buffer +* The driver firmware allocates an endpoint hardware buffer (dividing hardware buffer * between utilized endpoints). Therefore, for \ref group_usbfs_dev_drv_ep_management_mode1 -* and \ref group_usbfs_dev_drv_ep_management_mode2, the endpoints whose -* maximum packet size is odd consumes an extra byte in the hardware buffer -* when 16-bit access is used. This is not applicable for \ref group_usbfs_dev_drv_ep_management_mode3 +* and \ref group_usbfs_dev_drv_ep_management_mode2, an endpoint whose +* maximum packet size is odd, consumes an extra byte in the hardware buffer +* when the 16-bit access is used. This is not applicable for \ref group_usbfs_dev_drv_ep_management_mode3 * because endpoints dedicated buffer are even and aligned. * * In addition, to operate in \ref group_usbfs_dev_drv_ep_management_mode3, * the driver needs an internal SRAM buffer for endpoints. The buffer size is a -* sum of all endpoint buffers. When 16-bit access is used, each endpoint buffer +* sum of all endpoint buffers. When the 16-bit access is used, each endpoint buffer * must be allocated using the rules above. The driver configuration structure * \ref cy_stc_usbfs_dev_drv_config_t has <i>epBuffer and epBufferSize</i> fields * to pass the allocated buffer to the driver. \n -* For example: the USB Device uses three data endpoint whose max packets are +* For example: the USB Device uses three data endpoints whose max packets are * 63 bytes, 63 bytes, and 8 bytes. The endpoints buffer for the driver must be * allocated as follows: * * 8-bits: uint8_t endpointsBuffer[63 + 63 + 8]; @@ -348,8 +354,8 @@ * \subsection group_usbfs_dev_drv_ep_management_mode1 CPU mode (Mode 1) ******************************************************************************** * -* The CPU handles data transfers between the user provided SRAM endpoint buffer -* and the USB block hardware buffer when \ref Cy_USBFS_Dev_Drv_ReadOutEndpoint +* CPU handles data transfers between the user-provided SRAM endpoint-buffer +* and the USB block hardware-buffer when \ref Cy_USBFS_Dev_Drv_ReadOutEndpoint * or \ref Cy_USBFS_Dev_Drv_LoadInEndpoint is called. * * \image html usbfs_ep_mngmnt_mode1.png @@ -358,8 +364,8 @@ * \subsection group_usbfs_dev_drv_ep_management_mode2 Manual DMA mode (Mode 2) ******************************************************************************** * -* The DMA handles data transfers between the user-provided SRAM endpoint -* buffer and the USB block hardware buffer. The DMA request is issued by the CPU +* DMA handles data transfers between the user-provided SRAM endpoint +* buffer and the USB block hardware buffer. The DMA request is issued by CPU * to execute a data transfer when \ref Cy_USBFS_Dev_Drv_ReadOutEndpoint or * \ref Cy_USBFS_Dev_Drv_LoadInEndpoint. * @@ -369,7 +375,7 @@ * \subsection group_usbfs_dev_drv_ep_management_mode3 Automatic DMA mode (Mode 3) ******************************************************************************** * -* The DMA handles data transfers between the driver SRAM endpoints buffer and +* DMA handles data transfers between the driver SRAM endpoints buffer and * the USB block hardware buffer. The USB block generates DMA requests * automatically. When USB transfer starts, the USB block triggers DMA * requests to transfer data between the driver endpoint buffer and the hardware @@ -381,7 +387,7 @@ * and does not issue new DMA request until it receives notification that the * previous DMA transfer completed. * When the \ref Cy_USBFS_Dev_Drv_ReadOutEndpoint or \ref Cy_USBFS_Dev_Drv_LoadInEndpoint -* function is called, the memcpy function is used to copy data from/into +* function is called, the memcpy function is used to copy data from/into the * driver endpoints buffer to the user-provided endpoint buffer. * The driver provides the \ref Cy_USBFS_Dev_Drv_OverwriteMemcpy function to * replace memcpy function by one that has been custom implemented (the DMA can be used for data copy). @@ -389,17 +395,17 @@ * \image html usbfs_ep_mngmnt_mode3.png * * \warning -* When the DMA is not capable of transferring data fast enough, the overflow or -* underflow interrupt triggers for impacted endpoint. This must never happen -* because this error condition indicates system failure with no recovery. -* To fix this, give the DMA channel assigned to this endpoint greater priority or -* increase the clock that the DMA operates. +* When DMA data transfer is not fast enough, an overflow or underflow +* interrupt triggers for the impacted endpoint. This must never happen +* because this error condition indicates a system failure with no recovery. +* To fix this, get the DMA channel assigned to this endpoint greater priority or +* increase the clock the DMA operates at. * ******************************************************************************** * \section group_usbfs_dev_drv_callbacks Callbacks Usage ******************************************************************************** * -* The driver provides following callbacks that can be used by the application: +* The driver provides the following callbacks that can be used by the application: * 1. Data endpoint 1-8 completion. This callback is invoked when the USB Host * completed communication with the endpoint. For IN endpoints, it means that data has * been read by the USB Host. For OUT endpoints, it means that data has been written @@ -414,7 +420,7 @@ * LPM power optimization. Call \ref Cy_USBFS_Dev_Drv_RegisterLpmCallback to * register callback function. * -* Also the driver provides callbacks for a Bus Reset event and Control Endpoint 0 +* Also, the driver provides callbacks for a Bus Reset event and Control Endpoint 0 * communication events (setup packet, in packet, out packet). But these * callbacks are used by middleware and must not be used by the application directly. * The middleware provides appropriate hooks for these events. @@ -425,20 +431,20 @@ * * The USB specification requires that no device supplies current on VBUS at its * upstream facing port at any time. To meet this requirement, the device must -* monitor for the presence or absence of VBUS and remove power from the Dp/Dm +* monitors for the presence or absence of VBUS and removes power from the Dp/Dm * pull-up resistor if VBUS is absent. The USBFS driver does not provide any * support of VBUS monitoring or detection. The application firmware must implement -* required functionality using a VDDUSB power pad or GPIO. Refer to the section -* Universal Serial Bus (USB) Device Mode sub-section VBUS Detection in the technical -* reference manual (TRM). +* the required functionality using a VDDUSB power pad or GPIO. Refer to the +* Universal Serial Bus (USB) Device Mode section, sub-section VBUS Detection +* in the technical reference manual (TRM). * -* Connect the VBUS through the resistive network when the +* Connect the VBUS through a resistive network when the * regular GPIO is used for VBUS detection to save the pin from voltage picks on VBUS, -* or use GPIO that is tolerant over voltage. An example schematic is shown below. +* or use GPIO tolerant over the voltage. An example schematic is shown below. * * \image html usbfs_vbus_connect_schem.png * -* \note The power is removed when the USB cable is removed from the USB Host +* \note Power is removed when the USB cable is removed from the USB Host * for bus-powered USB Device. Therefore, such a USB Device complies with * specification requirement above. * @@ -446,18 +452,18 @@ * \section group_usbfs_dev_drv_low_power Low Power Support ******************************************************************************** * -* The USBFS driver supports USB Suspend, Resume, and Remote Wakeup functionality. +* The USBFS driver supports the USB Suspend, Resume, and Remote Wakeup functionality. * This functionality is tightly related with the user application. The USBFS -* driver provides only the API interface, which helps the user achieve desired +* driver provides only the API interface which helps the user achieve the desired * low-power behavior. The additional processing is required from the user application. * The description of application processing is provided below. * -* Normally, the USB Host sends SOF packet every 1 ms (at full speed), and this is -* what keeps the USB Device awake. The USB Host suspends the USB Device by not +* Normally, the USB Host sends an SOF packet every 1 ms (at full speed), and this +* keeps the USB Device awake. The USB Host suspends the USB Device by not * sending anything to the USB Device for 3 ms. To recognize this condition, the bus * activity must be checked. This can be done using the \ref Cy_USBFS_Dev_Drv_CheckActivity * function or by monitoring the SOF interrupt. A suspended device may draw no -* more than 0.5 mA from VBUS. Therefore, put device into low-power +* more than 0.5 mA from VBUS. Therefore, put the device into low-power * mode to consume less current. * The \ref Cy_USBFS_Dev_Drv_Suspend function must be called before entering * low-power mode. When the USB Host wants to wake the device after a suspend, @@ -471,9 +477,9 @@ * enabled and IN endpoints must be loaded with data. * * \note After entering low-power mode, the data which was left in the IN or OUT -* endpoint buffers is not restored after device wakes up and is lost. Therefore, -* it must be stored in the SRAM for OUT endpoint or read by the Host for IN -* endpoint before entering low-power mode. +* endpoint buffers is not restored after the device's wake-up and is lost. +* Therefore, it must be stored in the SRAM for OUT endpoint or read by the Host for +* the IN endpoint before entering Low-power mode. * * If the USB Device supports remote wakeup functionality, the application has * to use middleware function Cy_USB_Dev_IsRemoteWakeupEnabled to determine whether @@ -519,21 +525,21 @@ * * \image html usbfs_lpm_responses.png * -* After USB Device is initialized the LPM transaction are to acknowledged (ACKed) -* meaning that device is ready to enter requested low-power mode. To override this +* After USB Device is initialized, the LPM transaction is to be acknowledged (ACKed) +* meaning that the device is ready to enter the requested low-power mode. To override this * behavior, use \ref Cy_USBFS_Dev_Drv_Lpm_SetResponse. \n * -* The USB block provides an interrupt source to define that LPM transaction was +* The USB block provides an interrupt source to define that an LPM transaction was * received and acknowledged (ACKed). Use the \ref Cy_USBFS_Dev_Drv_RegisterLpmCallback -* function to register application level callback function to service the LPM +* function to register the application level callback function to serve the LPM * transaction. The callback function can notify the application about an LPM transaction * and can use \ref Cy_USBFS_Dev_Drv_Lpm_GetBeslValue read to read Best Effort Service * Latency (BESL) values provided as part of an LPM transaction. The BESL value * indicates the amount of time from the start of a resume to when the USB Host * attempts to begin issuing transactions to the USB Device. The * application must use the value BESL to decide which low-power mode is entered -* to meet wakeup timing. The LPM transaction also contains the field that allows -* remote wake up. Use \ref Cy_USBFS_Dev_Drv_Lpm_RemoteWakeUpAllowed to get its +* to meet wakeup timing. The LPM transaction also contains the field that allows a +* remote to wake up. Use \ref Cy_USBFS_Dev_Drv_Lpm_RemoteWakeUpAllowed to get its * value. * * LPM related USB 2.0 Extension Descriptor provides attributes fields named @@ -543,18 +549,18 @@ * expected use is the baseline BESL value communicates a nominal power savings * design point and the deep BESL value communicates a significant power saving * design point. -* For example when the received BESL is less than baseline BESL, leave the device in the +* For example, when the received BESL is less than baseline BESL, leave the device in * Active mode. When it is between baseline BESL and deep BESL, put the device into -* the Deep Sleep mode. When it is greater than deep BESL, put the device into +* Deep Sleep mode. When it is greater than deep BESL, put the device into * Hibernate mode. * * \note -* The driver implements the USB Full-Speed device which does not support LPM +* The driver implements the USB Full-Speed device which does not support the LPM * NYET response. * * \note * The device will restart after Hibernate mode and the USB Device must -* be initialized at the application level. Call initialization functions +* be initialized at the application level. Call the initialization functions * instead of \ref Cy_USBFS_Dev_Drv_Resume. The application must ensure that * the device will resume within the time defined in the BESL value of LPM request. * @@ -562,8 +568,8 @@ * \section group_usbfs_drv_more_information More Information ******************************************************************************** * -* For more information on the USB Full-Speed Device peripheral, refer to the -* section Universal Serial Bus (USB) Device Mode in technical reference +* For more detail on the USB Full-Speed Device peripheral, refer to the +* section Universal Serial Bus (USB) Device Mode in the technical reference * manual (TRM). * ******************************************************************************** @@ -595,11 +601,11 @@ * <td>A cast shall not be performed that removes any const or volatile * qualification from the type addressed by a pointer.</td> * <td> -* 1. The register access macros cast base pointers to USBFS peripheral -* registers losing const qualification. Despite the qualification being -* lost, the driver ensures proper registers access. +* 1. The register access-macros cast base-pointers to the USBFS peripheral +* registers lose the const qualification. Despite the qualification being +* lost, the driver ensures the proper registers access. * 2. The volatile qualification is lost when a register address is passed -* as source or destination to the DMA channel. This does not cause any +* as a source or destination to the DMA channel. This does not cause any * negative impact because the DMA does not optimize any memory access. * </td> * </tr> @@ -618,10 +624,10 @@ * <td>A pointer parameter in a function prototype should be declared as * pointer to const if the pointer is not used to modify the addressed * object.</td> -* <td>The middleware and USBFS driver defines general function -* prototypes and pointers to function types but the function's -* implementation depends on configuration. Therefore, -* some functions' implementations require parameters to be pointer to +* <td>The middleware and USBFS driver define the general function +* prototypes and pointers to the function types but the function's +* implementation depends on the configuration. Therefore, +* some functions' implementations require parameters to be a pointer to * const but this is not met because of the generalized implementation * approach.</td> * </tr> @@ -634,7 +640,60 @@ * <table class="doxtable"> * <tr><th>Version</th><th>Changes</th><th>Reason for Change</th></tr> * <tr> -* <td rowspan="2"> 1.10</td> +* <td rowspan="2">2.20</td> +* <td>Fix configuration register value restoring in resume routine after +* Deep Sleep. +* </td> +* <td>Fix issue that USB Device stops working in DMA modes after wake up +* from Deep Sleep. +* </td> +* </tr> +* <tr> +* <td>The LPM requests are ignored after wake up from Deep Sleep and the +* host starts sending SOFs.</td> +* <td>Updated \ref Cy_USBFS_Dev_Drv_Resume function to restore LPM control +* register after exit Deep Sleep. +* </td> +* </tr> +* <tr> +* <td>2.10</td> +* <td>Returns the data toggle bit into the previous state after detecting +* that the host is retrying an OUT transaction.</td> +* <td>The device was not able to recover the data toggle bit and +* continues communication through the endpoint after the host retried +* the OUT transaction (the retried transaction has the same toggle bit +* as the previous had). +* </td> +* </tr> +* <tr> +* <td>2.0</td> +* <td>The list of changes to support the MBED-OS USB Device stack is provided below: +* - Changed the processing of the control transfers. +* - Updated the endpoint 0 service functions to update the endpoint 0 registers +* before the function returns. +* - Moved the set-device-address processing into the driver from the middleware. +* - Changed the flow to configure endpoints after configuration change: +* unconfigure the device or remove all endpoints, add endpoints, configure +* the device. Updated the functions: +* \ref Cy_USBFS_Dev_Drv_UnConfigureDevice, \ref Cy_USBFS_Dev_Drv_AddEndpoint +* and \ref Cy_USBFS_Dev_Drv_ConfigDevice. +* Removed the Cy_USBFS_Dev_Drv_ConfigDeviceComplete function because it is no needed anymore. +* - Added the functions: \ref Cy_USBFS_Dev_Drv_Ep0ReadResult(), \ref Cy_USBFS_Dev_Drv_SetAddress() +* and \ref Cy_USBFS_Dev_Drv_GetEp0MaxPacket(). +* - Changed the function signature \ref Cy_USBFS_Dev_Drv_Ep0Stall(). +* - Obsolete function Cy_USBFS_Dev_Drv_GetEndpointStallState; the \ref +* Cy_USBFS_Dev_Drv_GetEndpointState() updated to be used instead of the obsolete function. +* - Reduced the time required to complete abort operation in function \ref Cy_USBFS_Dev_Drv_Abort. +* Obsolete function Cy_USBFS_Dev_Drv_AbortComplete because entire abort operation is handled by +* \ref Cy_USBFS_Dev_Drv_Abort. +* - Added the endpoint address argument to the \ref cy_cb_usbfs_dev_drv_ep_callback_t to simplify +* endpoint transfer complete event processing for the MBED-OS USB Device stack. +* </td> +* <td>Updated the driver to support the MBED-OS USB Device stack and Cypress +* USB Device middleware.</td> +* </tr> +* <tr> +* <td rowspan="2">1.10</td> * <td>Fixed the \ref Cy_USBFS_Dev_Drv_Disable function to not disable DMA * in CPU mode.</td> * <td>Calling this function triggers assert because DMA for endpoints is not @@ -699,10 +758,10 @@ extern "C" { */ /** USBFS Driver major version */ -#define CY_USBFS_VERSION_MAJOR (1) +#define CY_USBFS_VERSION_MAJOR (2) /** USBFS Driver minor version */ -#define CY_USBFS_VERSION_MINOR (10) +#define CY_USBFS_VERSION_MINOR (20) /** USBFS Driver identifier */ #define CY_USBFS_ID CY_PDL_DRV_ID(0x3BU) @@ -729,10 +788,10 @@ typedef enum /** Operation completed successfully */ CY_USBFS_DEV_DRV_SUCCESS = 0U, - /** One or more input parameters are invalid */ + /** One or more input parameters are invalid */ CY_USBFS_DEV_DRV_BAD_PARAM = (CY_USBFS_ID | CY_PDL_STATUS_ERROR | CY_USBFS_DEV_DRV_STATUS_CODE | 1U), - /** There is not enough space in the buffer to be allocated for endpoint (hardware or RAM) */ + /** There is not enough space in the buffer to be allocated for the endpoint (hardware or RAM) */ CY_USBFS_DEV_DRV_BUF_ALLOC_FAILED = (CY_USBFS_ID | CY_PDL_STATUS_ERROR | CY_USBFS_DEV_DRV_STATUS_CODE | 2U), /** Failure during DMA configuration */ @@ -741,12 +800,12 @@ typedef enum /** Timeout during dynamic reconfiguration */ CY_USBFS_DEV_DRV_EP_DYN_RECONFIG_TIMEOUT = (CY_USBFS_ID | CY_PDL_STATUS_ERROR | CY_USBFS_DEV_DRV_STATUS_CODE | 4U), - /** Timeout during execution of the DMA read request for OUT endpoint + /** Timeout during execution of the DMA read request for the OUT endpoint * (only applicable in \ref group_usbfs_dev_drv_ep_management_mode2) */ CY_USBFS_DEV_DRV_EP_DMA_READ_TIMEOUT = (CY_USBFS_ID | CY_PDL_STATUS_ERROR | CY_USBFS_DEV_DRV_STATUS_CODE | 5U), - /** Timeout during execution of the DMA read request for OUT endpoint + /** Timeout during execution of the DMA read request for the OUT endpoint * (only applicable in \ref group_usbfs_dev_drv_ep_management_mode2) */ CY_USBFS_DEV_DRV_EP_DMA_WRITE_TIMEOUT = (CY_USBFS_ID | CY_PDL_STATUS_ERROR | CY_USBFS_DEV_DRV_STATUS_CODE | 6U), @@ -757,17 +816,17 @@ typedef enum /** Data Endpoints Buffer Management Mode */ typedef enum { - /** The CPU manages data transfer between the hardware endpoints buffer + /** CPU manages a data transfer between the hardware endpoints buffer * and the user SRAM */ CY_USBFS_DEV_DRV_EP_MANAGEMENT_CPU = 0, - /** The DMA manages data transfer between the hardware endpoints buffer and + /** DMA manages data transfer between the hardware endpoints buffer and * the user SRAM */ CY_USBFS_DEV_DRV_EP_MANAGEMENT_DMA = 1, - /** The DMA automatically manages data transfer between the hardware endpoints + /** The DMA automatically manages a data transfer between the hardware endpoints * FIFO buffer and the user SRAM */ CY_USBFS_DEV_DRV_EP_MANAGEMENT_DMA_AUTO = 2, @@ -776,43 +835,43 @@ typedef enum /** Data Endpoint Register Access Type */ typedef enum { - CY_USBFS_DEV_DRV_USE_8_BITS_DR, /**< Use 8-bits registers to access data endpoints */ - CY_USBFS_DEV_DRV_USE_16_BITS_DR, /**< Use 16-bits registers to access data endpoints */ + CY_USBFS_DEV_DRV_USE_8_BITS_DR, /**< Use 8-bits registers to access the data endpoints */ + CY_USBFS_DEV_DRV_USE_16_BITS_DR, /**< Use 16-bits registers to access the data endpoints */ } cy_en_usbfs_dev_ep_access_t; /** Service Callback Events (this enumerated type is used by middleware) */ typedef enum { - CY_USB_DEV_BUS_RESET = 0U, /**< Callback hooked to bus reset interrupt */ - CY_USB_DEV_EP0_SETUP = 1U, /**< Callback hooked to endpoint 0 SETUP packet interrupt */ - CY_USB_DEV_EP0_IN = 2U, /**< Callback hooked to endpoint 0 IN packet interrupt */ - CY_USB_DEV_EP0_OUT = 3U, /**< Callback hooked to endpoint 0 OUT packet interrupt */ + CY_USB_DEV_BUS_RESET = 0U, /**< Callback hooked to the bus reset interrupt */ + CY_USB_DEV_EP0_SETUP = 1U, /**< Callback hooked to the endpoint 0 SETUP packet interrupt */ + CY_USB_DEV_EP0_IN = 2U, /**< Callback hooked to the endpoint 0 IN packet interrupt */ + CY_USB_DEV_EP0_OUT = 3U, /**< Callback hooked to the endpoint 0 OUT packet interrupt */ } cy_en_usb_dev_service_cb_t; /** Callback Sources */ typedef enum { - CY_USBFS_DEV_DRV_EP1 = 0U, /**< Callback hooked to Data Endpoint 1 completion interrupt */ - CY_USBFS_DEV_DRV_EP2 = 1U, /**< Callback hooked to Data Endpoint 2 completion interrupt */ - CY_USBFS_DEV_DRV_EP3 = 2U, /**< Callback hooked to Data Endpoint 3 completion interrupt */ - CY_USBFS_DEV_DRV_EP4 = 3U, /**< Callback hooked to Data Endpoint 4 completion interrupt */ - CY_USBFS_DEV_DRV_EP5 = 4U, /**< Callback hooked to Data Endpoint 5 completion interrupt */ - CY_USBFS_DEV_DRV_EP6 = 5U, /**< Callback hooked to Data Endpoint 6 completion interrupt */ - CY_USBFS_DEV_DRV_EP7 = 6U, /**< Callback hooked to Data Endpoint 7 completion interrupt */ - CY_USBFS_DEV_DRV_EP8 = 7U, /**< Callback hooked to Data Endpoint 8 completion interrupt */ - CY_USBFS_DEV_DRV_SOF = 8U, /**< Callback hooked to SOF packet received interrupt */ - CY_USBFS_DEV_DRV_LPM = 9U, /**< Callback hooked to LPM request received interrupt */ + CY_USBFS_DEV_DRV_EP1 = 0U, /**< Callback hooked to the Data Endpoint 1 completion interrupt */ + CY_USBFS_DEV_DRV_EP2 = 1U, /**< Callback hooked to the Data Endpoint 2 completion interrupt */ + CY_USBFS_DEV_DRV_EP3 = 2U, /**< Callback hooked to the Data Endpoint 3 completion interrupt */ + CY_USBFS_DEV_DRV_EP4 = 3U, /**< Callback hooked to the Data Endpoint 4 completion interrupt */ + CY_USBFS_DEV_DRV_EP5 = 4U, /**< Callback hooked to the Data Endpoint 5 completion interrupt */ + CY_USBFS_DEV_DRV_EP6 = 5U, /**< Callback hooked to the Data Endpoint 6 completion interrupt */ + CY_USBFS_DEV_DRV_EP7 = 6U, /**< Callback hooked to the Data Endpoint 7 completion interrupt */ + CY_USBFS_DEV_DRV_EP8 = 7U, /**< Callback hooked to the Data Endpoint 8 completion interrupt */ + CY_USBFS_DEV_DRV_SOF = 8U, /**< Callback hooked to the SOF packet received interrupt */ + CY_USBFS_DEV_DRV_LPM = 9U, /**< Callback hooked to the LPM request received interrupt */ } cy_en_usbfs_dev_drv_cb_source_t; /** Data Endpoint States (this enumerated type is used by middleware) */ typedef enum { - CY_USB_DEV_EP_IDLE, /**< Endpoint is in idle state after configuration is set */ - CY_USB_DEV_EP_PENDING, /**< Transfer targeted to an endpoint is in progress */ - CY_USB_DEV_EP_COMPLETED, /**< Transfer targeted to an endpoint is completed */ - CY_USB_DEV_EP_STALLED, /**< Endpoint is stalled */ - CY_USB_DEV_EP_DISABLED, /**< Endpoint is disabled (not used in this configuration) */ - CY_USB_DEV_EP_INVALID, /**< Endpoint does not supported by the hardware */ + CY_USB_DEV_EP_IDLE, /**< The endpoint is in an idle state after the configuration is set */ + CY_USB_DEV_EP_PENDING, /**< The transfer targeted at an endpoint is in progress */ + CY_USB_DEV_EP_COMPLETED, /**< The transfer targeted at an endpoint is completed */ + CY_USB_DEV_EP_STALLED, /**< The endpoint is stalled */ + CY_USB_DEV_EP_DISABLED, /**< The endpoint is disabled (not used in this configuration) */ + CY_USB_DEV_EP_INVALID, /**< The endpoint is not supported by the hardware */ } cy_en_usb_dev_ep_state_t; /** USB Lines Control */ @@ -821,7 +880,7 @@ typedef enum CY_USBFS_DEV_DRV_FORCE_STATE_J = 0xA0U, /**< Force a J State onto the USB lines */ CY_USBFS_DEV_DRV_FORCE_STATE_K = 0x80U, /**< Force a K State onto the USB lines */ CY_USBFS_DEV_DRV_FORCE_STATE_SE0 = 0xC0U, /**< Force a Single Ended 0 onto the USB lines */ - CY_USBFS_DEV_DRV_FORCE_STATE_NONE = 0x00U /**< Return bus to SIE control */ + CY_USBFS_DEV_DRV_FORCE_STATE_NONE = 0x00U /**< Return the bus to the SIE control */ } cy_en_usbfs_dev_drv_force_bus_state_t; /** LPM (Link Power Management) Responses */ @@ -833,6 +892,17 @@ typedef enum /** The next LPM request will be responded with ACK */ CY_USBFS_DEV_DRV_LPM_REQ_ACK = 0x1U, } cy_en_usbfs_dev_drv_lpm_req_t; + +/** USB Control EP0 transfer state */ +typedef enum +{ + CY_USBFS_DEV_DRV_EP0_CTRL_STATE_IDLE, + CY_USBFS_DEV_DRV_EP0_CTRL_STATE_SETUP, + CY_USBFS_DEV_DRV_EP0_CTRL_STATE_DATA, + CY_USBFS_DEV_DRV_EP0_CTRL_STATE_STATUS_IN, + CY_USBFS_DEV_DRV_EP0_CTRL_STATE_STATUS_OUT, +} cy_en_usbfs_dev_drv_ep0_ctrl_state_t; + /** \} group_usbfs_dev_drv_enums */ @@ -848,13 +918,13 @@ typedef enum /** Data Endpoint Configuration Structure */ typedef struct { - bool enableEndpoint; /**< Defines if endpoint becomes active after configuration */ - bool allocBuffer; /**< Defines if buffer allocation is need for endpoint */ - uint16_t maxPacketSize; /**< Endpoint max packet size */ - uint16_t bufferSize; /**< Endpoint buffer size (the biggest max packet size + bool enableEndpoint; /**< Defines if the endpoint becomes active after configuration */ + bool allocBuffer; /**< Defines if the endpoint needs buffer allocation */ + uint16_t maxPacketSize; /**< The endpoint max packet size */ + uint16_t bufferSize; /**< The endpoint buffer size (the biggest max packet size across all alternate for this endpoint) */ - uint8_t endpointAddr; /**< Endpoint address (number plus direction bit) */ - uint8_t attributes; /**< Endpoint attributes */ + uint8_t endpointAddr; /**< The endpoint address (number plus direction bit) */ + uint8_t attributes; /**< The endpoint attributes */ } cy_stc_usb_dev_ep_config_t; /** @@ -876,6 +946,7 @@ typedef void (* cy_cb_usbfs_dev_drv_callback_t)(USBFS_Type *base, * completion event. */ typedef void (* cy_cb_usbfs_dev_drv_ep_callback_t)(USBFS_Type *base, + uint32_t endpointAddr, uint32_t errorType, struct cy_stc_usbfs_dev_drv_context *context); @@ -934,10 +1005,10 @@ typedef struct */ uint32_t outTrigMux; - /** Pointer to the 1st allocated DMA descriptor (required for DMA operation) */ + /** The pointer to the 1st allocated DMA descriptor (required for DMA operation) */ cy_stc_dma_descriptor_t *descr0; - /** Pointer to the 2nd allocated DMA descriptor (required when mode is + /** The pointer to the 2nd allocated DMA descriptor (required when mode is * \ref CY_USBFS_DEV_DRV_EP_MANAGEMENT_DMA_AUTO) */ cy_stc_dma_descriptor_t *descr1; @@ -951,26 +1022,26 @@ typedef struct cy_stc_usbfs_dev_drv_config cy_en_usbfs_dev_drv_ep_management_mode_t mode; /** DMA channels configuration for the endpoints. - * Only DMA channels for active endpoints must be configured. Provide NULL + * Only DMChannels for active endpoints must be configured. Provide NULL * pointer if endpoint is not used. Applicable when \ref mode is * \ref CY_USBFS_DEV_DRV_EP_MANAGEMENT_DMA or \ref CY_USBFS_DEV_DRV_EP_MANAGEMENT_DMA_AUTO. */ const cy_stc_usbfs_dev_drv_dma_config_t *dmaConfig[CY_USBFS_DEV_DRV_NUM_EPS_MAX]; /** - * Pointer to the buffer allocated for OUT endpoints (applicable only when \ref mode + * The pointer to the buffer allocated for the OUT endpoints (applicable only when \ref mode * is \ref CY_USBFS_DEV_DRV_EP_MANAGEMENT_DMA_AUTO) */ - uint8_t *epBuffer; + uint8_t *epBuffer; /** - * The size of the buffer for OUT endpoints (applicable only when \ref mode + * The size of the buffer for the OUT endpoints (applicable only when \ref mode * is \ref CY_USBFS_DEV_DRV_EP_MANAGEMENT_DMA_AUTO) */ uint16_t epBufferSize; - /** Mask that assigns interrupt sources to trigger: Low, Medium, or High interrupt. - * Use macros provided in group_usbfs_dev_drv_macros_intr_level to initialize + /** The mask that assigns interrupt sources to trigger: Low, Medium, or High interrupt. + * Use the macros provided in group_usbfs_dev_drv_macros_intr_level to initialize the * intrLevelSel mask. */ uint32_t intrLevelSel; @@ -990,41 +1061,65 @@ typedef struct volatile uint8_t toggle; /**< Toggle bit in SIE_EP_CNT1 register */ volatile uint8_t sieMode; /**< SIE mode to arm endpoint on the bus */ - uint8_t *buffer; /**< Pointer to the buffer */ + uint8_t *buffer; /**< The pointer to the buffer */ volatile uint16_t bufferSize; /**< Endpoint buffer size */ volatile uint16_t startBuf; /**< Start of the buffer */ - volatile bool isPending; /**< Save pending state before stall endpoint */ + volatile bool isPending; /**< Save the pending state before stall endpoint */ volatile cy_en_usb_dev_ep_state_t state; /**< Endpoint state */ - /** Complete event notification callback */ + /** Completes an event notification callback */ cy_cb_usbfs_dev_drv_ep_callback_t epComplete; - DW_Type *base; /**< Pointer to the DMA base */ + DW_Type *base; /**< The pointer to the DMA base */ uint32_t chNum; /**< DMA Channel number */ uint32_t outTrigMux; /**< Out trigger mux for DMA channel number */ - cy_stc_dma_descriptor_t* descr0; /**< Pointer to the descriptor 0 */ - cy_stc_dma_descriptor_t* descr1; /**< Pointer to the descriptor 1 */ + cy_stc_dma_descriptor_t* descr0; /**< The pointer to the descriptor 0 */ + cy_stc_dma_descriptor_t* descr1; /**< The pointer to the descriptor 1 */ - cy_fn_usbfs_dev_drv_memcpy_ptr_t copyData; /**< Pointer to user memcpy function */ + cy_fn_usbfs_dev_drv_memcpy_ptr_t copyData; /**< The pointer to the user memcpy function */ } cy_stc_usbfs_dev_drv_endpoint_data_t; /** \endcond */ /** USBFS Device context structure. -* All fields for the context structure are internal. Firmware never reads or -* writes these values. Firmware allocates the structure and provides the -* address of the structure to the middleware in HID function calls. Firmware +* All fields for the context structure are internal. The firmware never reads or +* writes these values. The firmware allocates a structure and provides the +* address of the structure to the middleware in HID function calls. The firmware * must ensure that the defined instance of this structure remains in scope while * the middleware is in use. */ typedef struct cy_stc_usbfs_dev_drv_context { /** \cond INTERNAL */ + /** Stores the Endpoint 0 buffer to put the read operation results */ + uint8_t *ep0Buffer; + + /** Stores the Endpoint 0 buffer size */ + uint8_t ep0BufferSize; + + /** Endpoint 0 data toggle bit: 0 or USBFS_USBDEV_EP0_CNT_DATA_TOGGLE_Msk */ + uint8_t ep0DataToggle; + + /** Active endpoint mask */ + uint8_t activeEpMask; + + /** The device address to set */ + uint8_t address; + + /** Defines the list of endpoints that waits for abort completion */ + volatile uint8_t epAbortMask; + /** Endpoints management mode */ cy_en_usbfs_dev_drv_ep_management_mode_t mode; + /** Stores the control transfer state */ + cy_en_usbfs_dev_drv_ep0_ctrl_state_t ep0CtrlState; + + /* Status to set or not the device address after the status state of the control transfer */ + bool setAddress; + /** Defines which endpoint registers to use: 8-bits or 16-bits */ bool useReg16; @@ -1055,9 +1150,6 @@ typedef struct cy_stc_usbfs_dev_drv_context /** Pointer to readOutEndpoint function: depends on operation mode */ cy_fn_usbfs_dev_drv_read_ep_ptr_t readOutEndpoint; - uint32_t ep0ModeReg; /**< Endpoint 0 Mode register */ - uint32_t ep0CntReg; /**< Endpoint 0 Counter register */ - uint8_t *epSharedBuf; /**< Buffer for OUT endpoints */ uint16_t epSharedBufSize; /**< Buffer size */ @@ -1066,10 +1158,9 @@ typedef struct cy_stc_usbfs_dev_drv_context /** Stores endpoints information */ cy_stc_usbfs_dev_drv_endpoint_data_t epPool[CY_USBFS_DEV_DRV_NUM_EPS_MAX]; - /** Pointer to the device context structure */ + /** The pointer to the device context structure */ void *devConext; /** \endcond */ - } cy_stc_usbfs_dev_drv_context_t; /** \} group_usbfs_dev_drv_data_structures */ @@ -1081,7 +1172,7 @@ typedef struct cy_stc_usbfs_dev_drv_context /** * \addtogroup group_usbfs_dev_hal_functions_common * \{ -* The Initialization functions provide the API to begin USBFS driver operation +* The Initialization functions provide an API to begin the USBFS driver operation * (configure and enable) and to stop operation (disable and de-initialize). */ cy_en_usbfs_dev_drv_status_t Cy_USBFS_Dev_Drv_Init(USBFS_Type *base, @@ -1097,6 +1188,8 @@ void Cy_USBFS_Dev_Drv_Enable(USBFS_Type *base, void Cy_USBFS_Dev_Drv_Disable(USBFS_Type *base, cy_stc_usbfs_dev_drv_context_t *context); +__STATIC_INLINE void Cy_USBFS_Dev_Drv_SetAddress(USBFS_Type *base, uint8_t address, + cy_stc_usbfs_dev_drv_context_t *context); __STATIC_INLINE void Cy_USBFS_Dev_Drv_SetDeviceAddress(USBFS_Type *base, uint8_t address); __STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_GetDeviceAddress(USBFS_Type const *base); @@ -1110,9 +1203,6 @@ __STATIC_INLINE void* Cy_USBFS_Dev_Drv_GetDevContext(USBFS_Type const *base, void Cy_USBFS_Dev_Drv_ConfigDevice(USBFS_Type *base, cy_stc_usbfs_dev_drv_context_t *context); -void Cy_USBFS_Dev_Drv_ConfigDeviceComplete(USBFS_Type *base, - cy_stc_usbfs_dev_drv_context_t const *context); - void Cy_USBFS_Dev_Drv_UnConfigureDevice(USBFS_Type *base, cy_stc_usbfs_dev_drv_context_t *context); /** \} group_usbfs_dev_hal_functions_common */ @@ -1120,33 +1210,37 @@ void Cy_USBFS_Dev_Drv_UnConfigureDevice(USBFS_Type *base, /** * \addtogroup group_usbfs_dev_hal_functions_ep0_service * \{ -* The Endpoint 0 Service functions provides API to establish communication with +* The Endpoint 0 Service functions provide an API to establish communication with * the USB Host using control endpoint 0. */ void Cy_USBFS_Dev_Drv_Ep0GetSetup(USBFS_Type const *base, uint8_t *buffer, cy_stc_usbfs_dev_drv_context_t const *context); -uint32_t Cy_USBFS_Dev_Drv_Ep0Write(USBFS_Type *base, - uint8_t const *buffer, - uint32_t size, +uint32_t Cy_USBFS_Dev_Drv_Ep0Write(USBFS_Type *base, + uint8_t const *buffer, + uint32_t size, cy_stc_usbfs_dev_drv_context_t *context); -uint32_t Cy_USBFS_Dev_Drv_Ep0Read(USBFS_Type const *base, - uint8_t *buffer, - uint32_t size, - cy_stc_usbfs_dev_drv_context_t *context); +void Cy_USBFS_Dev_Drv_Ep0Read(USBFS_Type *base, + uint8_t *buffer, + uint32_t size, + cy_stc_usbfs_dev_drv_context_t *context); -__STATIC_INLINE void Cy_USBFS_Dev_Drv_Ep0Stall(USBFS_Type const *base, - cy_stc_usbfs_dev_drv_context_t *context); +uint32_t Cy_USBFS_Dev_Drv_Ep0ReadResult(USBFS_Type const *base, + cy_stc_usbfs_dev_drv_context_t *context); + +__STATIC_INLINE void Cy_USBFS_Dev_Drv_Ep0Stall(USBFS_Type *base); + +__STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_GetEp0MaxPacket(USBFS_Type const *base); /** \} group_usbfs_dev_hal_functions_ep0_service */ /** * \addtogroup group_usbfs_dev_hal_functions_endpoint_config * \{ -* The Data Endpoint Configuration Functions provide the API to allocate and release -* hardware resources and override the memcpy function for data endpoints. +* The Data Endpoint Configuration Functions provide an API to allocate and release +* hardware resources and override the memcpy function for the data endpoints. */ __STATIC_INLINE cy_en_usbfs_dev_drv_status_t Cy_USBFS_Dev_Drv_AddEndpoint(USBFS_Type *base, cy_stc_usb_dev_ep_config_t const *config, @@ -1164,7 +1258,7 @@ __STATIC_INLINE void Cy_USBFS_Dev_Drv_OverwriteMemcpy(USBFS_Type const *base, /** * \addtogroup group_usbfs_dev_hal_functions_data_xfer -* The Data Endpoint Transfer functions provide the API to establish +* The Data Endpoint Transfer functions provide an API to establish * communication with the USB Host using data endpoint. * \{ */ @@ -1189,22 +1283,13 @@ __STATIC_INLINE cy_en_usbfs_dev_drv_status_t Cy_USBFS_Dev_Drv_ReadOutEndpoint(US uint32_t *actSize, cy_stc_usbfs_dev_drv_context_t *context); -cy_en_usb_dev_ep_state_t Cy_USBFS_Dev_Drv_Abort(USBFS_Type *base, - uint32_t endpoint, - cy_stc_usbfs_dev_drv_context_t const *context); - -cy_en_usbfs_dev_drv_status_t Cy_USBFS_Dev_Drv_AbortComplete(USBFS_Type *base, - uint32_t endpoint, - cy_stc_usbfs_dev_drv_context_t *context); +cy_en_usbfs_dev_drv_status_t Cy_USBFS_Dev_Drv_Abort(USBFS_Type *base, + uint32_t endpoint, + cy_stc_usbfs_dev_drv_context_t *context); __STATIC_INLINE bool Cy_USBFS_Dev_Drv_GetEndpointAckState(USBFS_Type const *base, uint32_t endpoint); __STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_GetEndpointCount (USBFS_Type const *base, uint32_t endpoint); - -__STATIC_INLINE cy_en_usb_dev_ep_state_t Cy_USBFS_Dev_Drv_GetEndpointStallState(USBFS_Type const *base, - uint32_t endpoint, - cy_stc_usbfs_dev_drv_context_t const *context); - cy_en_usbfs_dev_drv_status_t Cy_USBFS_Dev_Drv_StallEndpoint(USBFS_Type *base, uint32_t endpoint, cy_stc_usbfs_dev_drv_context_t *context); @@ -1217,7 +1302,7 @@ cy_en_usbfs_dev_drv_status_t Cy_USBFS_Dev_Drv_UnStallEndpoint(USBFS_Type *base, /** * \addtogroup group_usbfs_dev_drv_functions_interrupts -* The Functions Interrupt functions provide the API to register callbacks +* The Functions Interrupt functions provide an API to register callbacks * for interrupt events provided by the USB block, interrupt handler, and configuration functions. * \{ */ @@ -1254,7 +1339,7 @@ __STATIC_INLINE void Cy_USBFS_Dev_Drv_EnableEp0Interrupt(USBFS_Type *base); /** * \addtogroup group_usbfs_dev_drv_functions_low_power -* The Low Power functions provide the API to implement Low Power callback on application level. +* The Low-power functions provide an API to implement Low-power callback at the application level. * \{ */ __STATIC_INLINE bool Cy_USBFS_Dev_Drv_CheckActivity(USBFS_Type *base); @@ -1265,7 +1350,7 @@ __STATIC_INLINE void Cy_USBFS_Dev_Drv_Force (USBFS_Type *base, cy_en_usbf /** * \addtogroup group_usbfs_dev_drv_functions_lpm -* The LPM functions provide the API to use the LPM feature available in the USB block. +* The LPM functions provide an API to use the LPM feature available in the USB block. * \{ */ __STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_Lpm_GetBeslValue (USBFS_Type const *base); @@ -1283,12 +1368,11 @@ __STATIC_INLINE cy_en_usbfs_dev_drv_lpm_req_t Cy_USBFS_Dev_Drv_Lpm_GetResponse(U * \addtogroup group_usbfs_dev_drv_macros * \{ */ -/** Allocates static buffer for data endpoint. The size parameter must be a constant. -* The allocated buffer is aligned on a 2 byte boundary. <b>An odd buffer size is -* converted to even consuming 1 extra byte. The application must discard this -* extra byte</b>. This manipulation is needed to support different 8-bit and 16-bit -* hardware buffer access types in the driver (See section -* \ref group_usbfs_dev_drv_ep_management_buf_access for more information). +/** Allocates a static buffer for the data endpoint. The size parameter must be a constant. +* The allocated buffer is aligned to a 2-byte boundary. <b>An odd buffer size is +* converted to even, consuming 1 extra byte. The application must discard this +* extra byte</b> to support different 8-bit and 16-bit hardware buffer access types +* in the driver. For more detail, refer to \ref group_usbfs_dev_drv_ep_management_buf_access. */ #define CY_USBFS_DEV_DRV_ALLOC_ENDPOINT_BUFFER(buf, size) uint8_t buf[(0U != ((size) & 0x1U)) ? ((size) + 1U) : (size)] CY_ALIGN(2) /** \} group_usbfs_dev_drv_macros */ @@ -1297,40 +1381,40 @@ __STATIC_INLINE cy_en_usbfs_dev_drv_lpm_req_t Cy_USBFS_Dev_Drv_Lpm_GetResponse(U * \addtogroup group_usbfs_dev_drv_macros_intr_level * \{ */ -/** Interrupt source is assigned to trigger High interrupt */ +/** The interrupt source is assigned to a trigger High interrupt */ #define CY_USBFS_DEV_DRV_LVL_HIGH (0U) -/** Interrupt source is assigned to trigger Medium interrupt */ +/** The interrupt source is assigned to a trigger Medium interrupt */ #define CY_USBFS_DEV_DRV_LVL_MEDIUM (1U) -/** Interrupt source is assigned to trigger Low interrupt */ +/** The interrupt source is assigned to a trigger Low interrupt */ #define CY_USBFS_DEV_DRV_LVL_LOW (2U) -/** Assigns SOF interrupt source to trigger interrupt Low, Medium, or High */ +/** Assigns the SOF interrupt source to a trigger interrupt: Low, Medium, or High */ #define CY_USBFS_DEV_DRV_SET_SOF_LVL(level) _VAL2FLD(USBFS_USBLPM_INTR_LVL_SEL_SOF_LVL_SEL, level) -/** Assigns Bus Reset interrupt source to trigger interrupt Low, Medium, or High */ +/** Assigns the Bus Reset interrupt source to a trigger interrupt: Low, Medium, or High */ #define CY_USBFS_DEV_DRV_SET_BUS_RESET_LVL(level) _VAL2FLD(USBFS_USBLPM_INTR_LVL_SEL_BUS_RESET_LVL_SEL, level) -/** Assigns Endpoint 0 interrupt source to trigger interrupt Low, Medium, or High */ +/** Assigns the Endpoint 0 interrupt source to a trigger interrupt Low, Medium, or High */ #define CY_USBFS_DEV_DRV_SET_EP0_LVL(level) _VAL2FLD(USBFS_USBLPM_INTR_LVL_SEL_EP0_LVL_SEL, level) -/** Assigns LPM interrupt source to trigger interrupt Low, Medium, or High */ +/** Assigns the LPM interrupt source to a trigger interrupt: Low, Medium, or High */ #define CY_USBFS_DEV_DRV_SET_LPM_LVL(level) _VAL2FLD(USBFS_USBLPM_INTR_LVL_SEL_LPM_LVL_SEL, level) -/** Assigns Resume interrupt source to trigger interrupt Low, Medium, or High */ +/** Assigns the Resume interrupt source to a trigger interrupt: Low, Medium, or High */ #define CY_USBFS_DEV_DRV_SET_RESUME_LVL(level) _VAL2FLD(USBFS_USBLPM_INTR_LVL_SEL_RESUME_LVL_SEL, level) -/** Assigns Arbiter interrupt source to trigger interrupt Low, Medium, or High */ +/** Assigns the Arbiter interrupt source to a trigger interrupt: Low, Medium, or High */ #define CY_USBFS_DEV_DRV_SET_ARB_EP_LVL(level) _VAL2FLD(USBFS_USBLPM_INTR_LVL_SEL_ARB_EP_LVL_SEL, level) -/** Assigns Endpoint 1 interrupt source to trigger interrupt Low, Medium, or High */ +/** Assigns the Endpoint 1 interrupt source to a trigger interrupt: Low, Medium, or High */ #define CY_USBFS_DEV_DRV_SET_EP1_LVL(level) _VAL2FLD(USBFS_USBLPM_INTR_LVL_SEL_EP1_LVL_SEL, level) -/** Assigns Endpoint 2 interrupt source to trigger interrupt Low, Medium, or High */ +/** Assigns the Endpoint 2 interrupt source to a trigger interrupt: Low, Medium, or High */ #define CY_USBFS_DEV_DRV_SET_EP2_LVL(level) _VAL2FLD(USBFS_USBLPM_INTR_LVL_SEL_EP2_LVL_SEL, level) -/** Assigns Endpoint 3 interrupt source to trigger interrupt Low, Medium, or High */ +/** Assigns the Endpoint 3 interrupt source to a trigger interrupt: Low, Medium, or High */ #define CY_USBFS_DEV_DRV_SET_EP3_LVL(level) _VAL2FLD(USBFS_USBLPM_INTR_LVL_SEL_EP3_LVL_SEL, level) -/** Assigns Endpoint 4 interrupt source to trigger interrupt Low, Medium, or High */ +/** Assigns the Endpoint 4 interrupt source to a trigger interrupt: Low, Medium, or High */ #define CY_USBFS_DEV_DRV_SET_EP4_LVL(level) _VAL2FLD(USBFS_USBLPM_INTR_LVL_SEL_EP4_LVL_SEL, level) -/** Assigns Endpoint 5 interrupt source to trigger interrupt Low, Medium, or High */ +/** Assigns the Endpoint 5 interrupt source to a trigger interrupt: Low, Medium, or High */ #define CY_USBFS_DEV_DRV_SET_EP5_LVL(level) _VAL2FLD(USBFS_USBLPM_INTR_LVL_SEL_EP5_LVL_SEL, level) -/** Assigns Endpoint 6 interrupt source to trigger interrupt Low, Medium, or High */ +/** Assigns the Endpoint 6 interrupt source to a trigger interrupt: Low, Medium, or High */ #define CY_USBFS_DEV_DRV_SET_EP6_LVL(level) _VAL2FLD(USBFS_USBLPM_INTR_LVL_SEL_EP6_LVL_SEL, level) -/** Assigns Endpoint 7 interrupt source to trigger interrupt Low, Medium, or High */ +/** Assigns the Endpoint 7 interrupt source to a trigger interrupt: Low, Medium, or High */ #define CY_USBFS_DEV_DRV_SET_EP7_LVL(level) _VAL2FLD(USBFS_USBLPM_INTR_LVL_SEL_EP7_LVL_SEL, level) -/** Assigns Endpoint 8 interrupt source to trigger interrupt Low, Medium, or High */ +/** Assigns the Endpoint 8 interrupt source to a trigger interrupt: Low, Medium, or High */ #define CY_USBFS_DEV_DRV_SET_EP8_LVL(level) _VAL2FLD(USBFS_USBLPM_INTR_LVL_SEL_EP8_LVL_SEL, level) /** \} group_usbfs_dev_drv_macros_intr_level */ @@ -1358,17 +1442,17 @@ __STATIC_INLINE cy_en_usbfs_dev_drv_lpm_req_t Cy_USBFS_Dev_Drv_Lpm_GetResponse(U * \{ */ /** -* Error occurred during USB transfer. -* For an IN transaction, this indicates a no response from HOST scenario. -* For an OUT transaction, this represents a PID or CRC error or bit-stuff error -* scenario. +* An error occurred during a USB transfer. +* For an IN transaction, this indicates a "no response" from the HOST scenario. +* For an OUT transaction, this represents a "PID or CRC error" or the bit-stuff +* error scenario. */ #define CY_USBFS_DEV_ENDPOINT_TRANSFER_ERROR (0x1U) /** -* Data toggle bit remained the same. +* The data toggle bit remains the same. * The received OUT packet has the same data toggle bit that the previous -* packet had. This indicates that the Host retransmitted packet. +* packet had. This indicates that the Host retransmitted the packet. */ #define CY_USBFS_DEV_ENDPOINT_SAME_DATA_TOGGLE (0x2U) /** \} group_usbfs_dev_drv_macros_ep_xfer_err */ @@ -1379,7 +1463,7 @@ __STATIC_INLINE cy_en_usbfs_dev_drv_lpm_req_t Cy_USBFS_Dev_Drv_Lpm_GetResponse(U *******************************************************************************/ /** \cond INTERNAL */ -/* Start position of data endpoints SIE interrupt sources */ +/* The start position of the data endpoints SIE interrupt sources */ #define USBFS_USBLPM_INTR_CAUSE_LPM_INTR_Msk USBFS_USBLPM_INTR_CAUSE_HI_LPM_INTR_Msk #define USBFS_USBLPM_INTR_CAUSE_ARB_EP_INTR_Msk USBFS_USBLPM_INTR_CAUSE_HI_ARB_EP_INTR_Msk #define USBFS_USBLPM_INTR_CAUSE_EP0_INTR_Msk USBFS_USBLPM_INTR_CAUSE_HI_EP0_INTR_Msk @@ -1400,6 +1484,9 @@ __STATIC_INLINE cy_en_usbfs_dev_drv_lpm_req_t Cy_USBFS_Dev_Drv_Lpm_GetResponse(U #define CY_USBFS_DEV_DRV_IS_MODE_VALID(mode) (((mode) == CY_USBFS_DEV_DRV_EP_MANAGEMENT_CPU) || \ ((mode) == CY_USBFS_DEV_DRV_EP_MANAGEMENT_DMA) || \ ((mode) == CY_USBFS_DEV_DRV_EP_MANAGEMENT_DMA_AUTO)) + +/* Obsolete function */ +#define Cy_USBFS_Dev_Drv_GetEndpointStallState Cy_USBFS_Dev_Drv_GetEndpointState /** \endcond */ /** \} group_usbfs_drv_macros */ @@ -1412,11 +1499,43 @@ __STATIC_INLINE cy_en_usbfs_dev_drv_lpm_req_t Cy_USBFS_Dev_Drv_Lpm_GetResponse(U * \addtogroup group_usbfs_dev_hal_functions_common * \{ */ + +/******************************************************************************* +* Function Name: Cy_USBFS_Dev_Drv_SetAddress +****************************************************************************//** +* +* Posts a request to set the device address after the completion status stage of +* the control transfer. This function must be used if a higher level requests +* to set an address before the status stage of the control transfer. +* +* \param base +* The pointer to the USBFS instance. +* +* \param address +* The device address. +* +* \param context +* The pointer to the context structure \ref cy_stc_usbfs_dev_drv_context_t +* allocated by the user. The structure is used during the USBFS Device +* operation for internal configuration and data retention. The user must not +* modify anything in this structure. +* +*******************************************************************************/ +__STATIC_INLINE void Cy_USBFS_Dev_Drv_SetAddress(USBFS_Type *base, uint8_t address, + cy_stc_usbfs_dev_drv_context_t *context) +{ + (void)base; /* Suppress warning */ + /* Stores the address to set later after the status stage of setup request completed */ + context->address = address; + context->setAddress = true; +} + + /******************************************************************************* * Function Name: Cy_USBFS_Dev_Drv_SetDeviceAddress ****************************************************************************//** * -* Sets the device address. +* Sets the device address (writes the address directly into the register). * * \param base * The pointer to the USBFS instance. @@ -1435,15 +1554,15 @@ __STATIC_INLINE void Cy_USBFS_Dev_Drv_SetDeviceAddress(USBFS_Type *base, uint8_t * Function Name: Cy_USBFS_Dev_Drv_GetDeviceAddress ****************************************************************************//** * -* Returns the device address. +* Returns the device address (reads the address directly from the register). * * \param base * The pointer to the USBFS instance. * * \return -* Device address. +* The device address. * The device address is assigned by the Host during device enumeration. -* Zero means that device address has not yet been assigned. +* Zero means that the device address is not assigned. * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_GetDeviceAddress(USBFS_Type const *base) @@ -1456,7 +1575,7 @@ __STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_GetDeviceAddress(USBFS_Type const *bas * Function Name: Cy_USBFS_Dev_Drv_SetDevContext ****************************************************************************//** * -* Stores pointer to the USB Device context in the driver context. +* Stores a pointer to the USB Device context in the driver context. * * \param base * The pointer to the USBFS instance @@ -1471,14 +1590,14 @@ __STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_GetDeviceAddress(USBFS_Type const *bas * modify anything in this structure. * * \note -* This function is intended to be used by USB Device middleware for operation. +* This function is intended for the USB Device middleware operation. * *******************************************************************************/ __STATIC_INLINE void Cy_USBFS_Dev_Drv_SetDevContext(USBFS_Type const *base, void *devContext, cy_stc_usbfs_dev_drv_context_t *context) { - /* Suppress a compiler warning about unused variables */ + /* Suppresses a compiler warning about unused variables. */ (void) base; context->devConext = devContext; @@ -1489,14 +1608,14 @@ __STATIC_INLINE void Cy_USBFS_Dev_Drv_SetDevContext(USBFS_Type const *base, * Function Name: Cy_USBFS_Dev_Drv_GetDevContext ****************************************************************************//** * -* Returns pointer to the USB Device context. +* Returns a pointer to the USB Device context. * * \param base * The pointer to the USBFS instance. * * \param context * The pointer to the context structure \ref cy_stc_usbfs_dev_drv_context_t -* allocated by the user. The structure is used during the USBFS Device +* allocated by the user. The structure is used during USBFS Device * operation for internal configuration and data retention. The user must not * modify anything in this structure. * @@ -1504,13 +1623,13 @@ __STATIC_INLINE void Cy_USBFS_Dev_Drv_SetDevContext(USBFS_Type const *base, * The pointer to the USB Device context. * * \note -* This function is intended to be used by USB Device middleware for operation. +* This function is intended for the USB Device middleware operation. * *******************************************************************************/ __STATIC_INLINE void* Cy_USBFS_Dev_Drv_GetDevContext(USBFS_Type const *base, cy_stc_usbfs_dev_drv_context_t *context) { - /* Suppress a compiler warning about unused variables */ + /* Suppresses a compiler warning about unused variables */ (void) base; return (context->devConext); @@ -1528,8 +1647,8 @@ __STATIC_INLINE void* Cy_USBFS_Dev_Drv_GetDevContext(USBFS_Type const *base, * * Registers a callback function to notify about an SOF event in * \ref Cy_USBFS_Dev_Drv_Interrupt. The SOF interrupt source is enabled after -* registration. To remove callback function pass NULL as function pointer. -* When callback removed the interrupt source is disabled. +* registration. To remove callback function, pass NULL as the function pointer. +* When the callback is removed, the interrupt source is disabled. * * \param base * The pointer to the USBFS instance. @@ -1555,7 +1674,7 @@ __STATIC_INLINE void Cy_USBFS_Dev_Drv_RegisterSofCallback(USBFS_Type *base, context->cbSof = callback; - /* Enable/Disable SOF interrupt */ + /* Enables/Disables SOF interrupt */ mask = Cy_USBFS_Dev_Drv_GetSieInterruptMask(base); if (NULL != callback) @@ -1578,8 +1697,8 @@ __STATIC_INLINE void Cy_USBFS_Dev_Drv_RegisterSofCallback(USBFS_Type *base, * * Registers a callback function to notify about an LPM event in * \ref Cy_USBFS_Dev_Drv_Interrupt. The LPM interrupt source is enabled after -* registration. To remove the callback function, pass NULL as function pointer. -* When the callback has been removed, the interrupt source is disabled. +* registration. To remove the callback function, pass NULL as the function pointer. +* When the callback is removed, the interrupt source is disabled. * * \param base * The pointer to the USBFS instance. @@ -1594,7 +1713,7 @@ __STATIC_INLINE void Cy_USBFS_Dev_Drv_RegisterSofCallback(USBFS_Type *base, * modify anything in this structure. * * \note -* To remove the callback, pass NULL as the pointer to a callback function. +* To remove the callback, pass NULL as the pointer to the callback function. * *******************************************************************************/ __STATIC_INLINE void Cy_USBFS_Dev_Drv_RegisterLpmCallback(USBFS_Type *base, @@ -1606,7 +1725,7 @@ __STATIC_INLINE void Cy_USBFS_Dev_Drv_RegisterLpmCallback(USBFS_Type *base, context->cbLpm = callback; - /* Enable/Disable LPM interrupt source */ + /* Enables/Disables the LPM interrupt source */ mask = Cy_USBFS_Dev_Drv_GetSieInterruptMask(base); if (NULL != callback) @@ -1629,9 +1748,9 @@ __STATIC_INLINE void Cy_USBFS_Dev_Drv_RegisterLpmCallback(USBFS_Type *base, * * Registers a callback function to notify of an endpoint transfer completion * event in \ref Cy_USBFS_Dev_Drv_Interrupt. -* * IN endpoint - the Host read data from the endpoint and new data can be +* * IN endpoint - The Host read data from the endpoint and new data can be * loaded. -* * OUT endpoint - the Host wrote data into the endpoint and the data is +* * OUT endpoint - The Host has written data into the endpoint and the data is * ready to be read. * To remove the callback function, pass NULL as function pointer. * @@ -1651,7 +1770,7 @@ __STATIC_INLINE void Cy_USBFS_Dev_Drv_RegisterLpmCallback(USBFS_Type *base, * modify anything in this structure. * * \note -* To remove the callback, pass NULL as the pointer to a callback function. +* To remove the callback, pass NULL as the pointer to the callback function. * *******************************************************************************/ __STATIC_INLINE void Cy_USBFS_Dev_Drv_RegisterEndpointCallback(USBFS_Type const *base, @@ -1660,7 +1779,7 @@ __STATIC_INLINE void Cy_USBFS_Dev_Drv_RegisterEndpointCallback(USBFS_Type const cy_stc_usbfs_dev_drv_context_t *context) { - /* Suppress a compiler warning about unused variables */ + /* Suppresses a compiler warning about unused variables */ (void) base; CY_ASSERT_L1(CY_USBFS_DEV_DRV_IS_EP_VALID(endpoint)); @@ -1759,13 +1878,13 @@ __STATIC_INLINE void Cy_USBFS_Dev_Drv_SetInterruptsLevel(USBFS_Type *base, uint3 * Function Name: Cy_USBFS_Dev_Drv_GetInterruptsLevel ****************************************************************************//** * -* Returns INTR_LVL_SEL register that contains groups for all interrupt sources. +* Returns the INTR_LVL_SEL register that contains groups for all interrupt sources. * * \param base * The pointer to the USBFS instance. * * \return -* Returns INTR_LVL_SEL register that contains groups for all interrupt sources. +* Returns the INTR_LVL_SEL register that contains groups for all interrupt sources. * *******************************************************************************/ __STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_GetInterruptsLevel(USBFS_Type const *base) @@ -1774,12 +1893,11 @@ __STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_GetInterruptsLevel(USBFS_Type const *b } - /******************************************************************************* * Function Name: Cy_USBFS_Dev_Drv_DisableEp0Interrupt ****************************************************************************//** * -* Enables Control Endpoint 0 interrupt source. +* Enables the Control Endpoint 0 interrupt source. * * \param base * The pointer to the USBFS instance. @@ -1796,7 +1914,7 @@ __STATIC_INLINE void Cy_USBFS_Dev_Drv_DisableEp0Interrupt(USBFS_Type *base) * Function Name: Cy_USBFS_Dev_Drv_EnableEp0Interrupt ****************************************************************************//** * -* Enables Control Endpoint 0 interrupt. +* Enables the Control Endpoint 0 interrupt. * * \param base * The pointer to the USBFS instance source. @@ -1818,16 +1936,16 @@ __STATIC_INLINE void Cy_USBFS_Dev_Drv_EnableEp0Interrupt(USBFS_Type *base) ****************************************************************************//** * * Returns the activity status of the bus. -* It clears the hardware status to provide updated status on the next call of +* It clears the hardware status to provide an updated status on the next call of * this function. This function is useful to determine whether there is any USB bus -* activity between function calls. The typical use case is to determine whether +* activity between function calls. A typical use case is to determine whether * the USB suspend conditions are met. * * \param base * The pointer to the USBFS instance. * * \return -* Bus activity since last call. +* The bus activity since the last call. * *******************************************************************************/ __STATIC_INLINE bool Cy_USBFS_Dev_Drv_CheckActivity(USBFS_Type *base) @@ -1847,13 +1965,13 @@ __STATIC_INLINE bool Cy_USBFS_Dev_Drv_CheckActivity(USBFS_Type *base) ****************************************************************************//** * * Forces a USB J, K, or SE0 state on the USB lines. -* The typical use case is to signal a Remote Wakeup condition on the USB bus. +* A typical use case is to signal a Remote Wakeup condition on the USB bus. * * \param base * The pointer to the USBFS instance. * * \param state -* Desired bus state. +* The desired bus state. * See \ref cy_en_usbfs_dev_drv_force_bus_state_t for the set of constants. * *******************************************************************************/ @@ -1962,7 +2080,7 @@ __STATIC_INLINE cy_en_usbfs_dev_drv_lpm_req_t Cy_USBFS_Dev_Drv_Lpm_GetResponse(U * Function Name: Cy_USBFS_Dev_Drv_AddEndpoint ****************************************************************************//** * -* Configures data endpoint for the following operation (allocates hardware +* Configures a data endpoint for the following operation (allocates hardware * resources for data endpoint). * * \param base @@ -1978,14 +2096,24 @@ __STATIC_INLINE cy_en_usbfs_dev_drv_lpm_req_t Cy_USBFS_Dev_Drv_Lpm_GetResponse(U * modify anything in this structure. * * \return -* Status code of the function execution \ref cy_en_usbfs_dev_drv_status_t. +* The status code of the function execution \ref cy_en_usbfs_dev_drv_status_t. * *******************************************************************************/ __STATIC_INLINE cy_en_usbfs_dev_drv_status_t Cy_USBFS_Dev_Drv_AddEndpoint(USBFS_Type *base, cy_stc_usb_dev_ep_config_t const *config, cy_stc_usbfs_dev_drv_context_t *context) { - return context->addEndpoint(base, config, context); + cy_en_usbfs_dev_drv_status_t retStatus = CY_USBFS_DEV_DRV_BAD_PARAM; + + uint32_t endpoint = CY_USBFS_DEV_DRV_EPADDR2EP(config->endpointAddr); + + /* Checks if the endpoint is supported by the driver */ + if (CY_USBFS_DEV_DRV_IS_EP_VALID(endpoint)) + { + retStatus = context->addEndpoint(base, config, context); + } + + return retStatus; } @@ -1993,7 +2121,7 @@ __STATIC_INLINE cy_en_usbfs_dev_drv_status_t Cy_USBFS_Dev_Drv_AddEndpoint(USBFS_ * Function Name: Cy_USBFS_Dev_Drv_OverwriteMemcpy ****************************************************************************//** * -* Overwrites the memory copy (memcpy) function used to copy data with the user +* Overwrites the memory copy (memcpy) function used to copy data with the user- * implemented: * * \ref Cy_USBFS_Dev_Drv_ReadOutEndpoint copies data from from the internal * buffer to the application buffer for OUT endpoint. @@ -2066,12 +2194,16 @@ __STATIC_INLINE cy_en_usb_dev_ep_state_t Cy_USBFS_Dev_Drv_GetEndpointState( cy_stc_usbfs_dev_drv_context_t const *context) { - /* Suppress a compiler warning about unused variables */ - (void) base; + cy_en_usb_dev_ep_state_t retState = CY_USB_DEV_EP_INVALID; - CY_ASSERT_L1(CY_USBFS_DEV_DRV_IS_EP_VALID(endpoint)); + (void)base; /* Suppress warning */ - return context->epPool[CY_USBFS_DEV_DRV_EP2PHY(endpoint)].state; + if (CY_USBFS_DEV_DRV_IS_EP_VALID(endpoint)) + { + retState = context->epPool[CY_USBFS_DEV_DRV_EP2PHY(endpoint)].state; + } + + return retState; } @@ -2102,7 +2234,7 @@ __STATIC_INLINE cy_en_usb_dev_ep_state_t Cy_USBFS_Dev_Drv_GetEndpointState( * modify anything in this structure. * * \return -* Status code of the function execution \ref cy_en_usbfs_dev_drv_status_t. +* The status code of the function execution \ref cy_en_usbfs_dev_drv_status_t. * *******************************************************************************/ __STATIC_INLINE cy_en_usbfs_dev_drv_status_t Cy_USBFS_Dev_Drv_LoadInEndpoint( @@ -2124,7 +2256,7 @@ __STATIC_INLINE cy_en_usbfs_dev_drv_status_t Cy_USBFS_Dev_Drv_LoadInEndpoint( ****************************************************************************//** * * Reads data from the OUT endpoint buffer. -* Before executing the next read, the \ref Cy_USBFS_Dev_Drv_EnableOutEndpoint must be +* Before executing a next read, the \ref Cy_USBFS_Dev_Drv_EnableOutEndpoint must be * called to allow the Host to write data into the endpoint. * * \param base @@ -2134,14 +2266,14 @@ __STATIC_INLINE cy_en_usbfs_dev_drv_status_t Cy_USBFS_Dev_Drv_LoadInEndpoint( * The OUT data endpoint number. * * \param buffer -* Pointer to the buffer that stores data that was read. +* The pointer to the buffer that stores read data. * * \param size -* The number of bytes to read from endpoint. -* This value must be less than or equal to endpoint maximum packet size. +* The number of bytes to read from the endpoint. +* This value must be less than or equal to the endpoint maximum packet size. * * \param actSize -* The number of bytes which were actually read. +* The number of actually read bytes. * * \param context * The pointer to the context structure \ref cy_stc_usbfs_dev_drv_context_t @@ -2150,7 +2282,7 @@ __STATIC_INLINE cy_en_usbfs_dev_drv_status_t Cy_USBFS_Dev_Drv_LoadInEndpoint( * modify anything in this structure. * * \return -* Status code of the function execution \ref cy_en_usbfs_dev_drv_status_t. +* The status code of the function execution \ref cy_en_usbfs_dev_drv_status_t. * *******************************************************************************/ __STATIC_INLINE cy_en_usbfs_dev_drv_status_t Cy_USBFS_Dev_Drv_ReadOutEndpoint( @@ -2197,12 +2329,12 @@ __STATIC_INLINE bool Cy_USBFS_Dev_Drv_GetEndpointAckState(USBFS_Type const *base * Function Name: Cy_USBFS_Dev_Drv_GetEndpointCount ****************************************************************************//** * -* Return number of data bytes in the transaction for a certain endpoint. -* Before calling this function ensure that the Host wrote data into the +* Returns the number of data bytes in the transaction for a certain endpoint. +* Before calling this function, ensure the Host has written data into the * endpoint. The returned value is updated after the Host access to the * endpoint but remains unchanged after data has been read from the endpoint * buffer. -* The typical use case is to read number of bytes that the Host wrote into the +* A typical use case is to read the number of bytes that the Host wrote into the * OUT endpoint. * * \param base @@ -2221,74 +2353,53 @@ __STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_GetEndpointCount(USBFS_Type const *bas return Cy_USBFS_Dev_Drv_GetSieEpCount(base, CY_USBFS_DEV_DRV_EP2PHY(endpoint)); } +/** \} group_usbfs_dev_hal_functions_data_xfer */ +/** +* \addtogroup group_usbfs_dev_hal_functions_ep0_service +* \{ +*/ /******************************************************************************* -* Function Name: Cy_USBFS_Dev_Drv_GetEndpointStallState +* Function Name: Cy_USBFS_Dev_Drv_Ep0Stall ****************************************************************************//** * -* This function returns the state of a certain endpoint. +* Stalls endpoint 0. * * \param base * The pointer to the USBFS instance. * -* \param endpoint -* The data endpoint number. -* -* \param context -* The pointer to the context structure \ref cy_stc_usbfs_dev_drv_context_t -* allocated by the user. The structure is used during the USBFS Device -* operation for internal configuration and data retention. The user must not -* modify anything in this structure. -* -* \return -* Endpoint state \ref cy_en_usb_dev_ep_state_t. -* *******************************************************************************/ -__STATIC_INLINE cy_en_usb_dev_ep_state_t Cy_USBFS_Dev_Drv_GetEndpointStallState( - USBFS_Type const *base, - uint32_t endpoint, - cy_stc_usbfs_dev_drv_context_t const *context) -{ - if (CY_USBFS_DEV_DRV_IS_EP_VALID(endpoint)) - { - return Cy_USBFS_Dev_Drv_GetEndpointState(base, endpoint, context); - } - else - { - return CY_USB_DEV_EP_INVALID; - } +__STATIC_INLINE void Cy_USBFS_Dev_Drv_Ep0Stall(USBFS_Type *base) +{ + /* Updates the CR registers to STALL a request (CNT register does not care) */ + Cy_USBFS_Dev_Drv_WriteEp0Mode(base, CY_USBFS_DEV_DRV_EP_CR_STALL_INOUT); } -/** \} group_usbfs_dev_hal_functions_data_xfer */ -/** -* \addtogroup group_usbfs_dev_hal_functions_ep0_service -* \{ -*/ /******************************************************************************* -* Function Name: Cy_USBFS_Dev_Drv_Ep0Stall +* Function Name: Cy_USBFS_Dev_Drv_GetEp0MaxPacket ****************************************************************************//** * -* Stalls endpoint 0. +* Returns the endpoint 0 maximum packet size that can be for read or write from +* the endpoint 0 buffer. * * \param base * The pointer to the USBFS instance. * -* \param context -* The pointer to the context structure \ref cy_stc_usbfs_dev_drv_context_t -* allocated by the user. The structure is used during the USBFS Device -* operation for internal configuration and data retention. The user must not -* modify anything in this structure. +* \return +* The endpoint 0 maximum packet size (endpoint 0 has a dedicated hardware buffer). * *******************************************************************************/ -__STATIC_INLINE void Cy_USBFS_Dev_Drv_Ep0Stall(USBFS_Type const *base, cy_stc_usbfs_dev_drv_context_t *context) +__STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_GetEp0MaxPacket(USBFS_Type const *base) { - /* Suppress a compiler warning about unused variables */ + /* Suppresses a compiler warning about unused variables */ (void) base; - context->ep0ModeReg = CY_USBFS_DEV_DRV_EP_CR_STALL_INOUT; + return (CY_USBFS_DEV_DRV_EP0_BUFFER_SIZE); } + + /** \} group_usbfs_dev_hal_functions_ep0_service */ #if defined(__cplusplus) diff --git a/platform/ext/target/psoc64/Native_Driver/include/cy_usbfs_dev_drv_reg.h b/platform/ext/target/psoc64/Native_Driver/include/cy_usbfs_dev_drv_reg.h index ee206f3fc4..3f87d10b22 100644 --- a/platform/ext/target/psoc64/Native_Driver/include/cy_usbfs_dev_drv_reg.h +++ b/platform/ext/target/psoc64/Native_Driver/include/cy_usbfs_dev_drv_reg.h @@ -1,6 +1,6 @@ /***************************************************************************//** * \file cy_usbfs_dev_drv_reg.h -* \version 1.10 +* \version 2.20 * * Provides register access API implementation of the USBFS driver. * @@ -47,6 +47,7 @@ * \defgroup group_usbfs_drv_drv_reg_functions Functions * \{ * \defgroup group_usbfs_drv_drv_reg_interrupt_sources SIE Interrupt Sources Registers Access +* \defgroup group_usbfs_drv_drv_reg_ep0_access Endpoint 0 Registers Access * \defgroup group_usbfs_drv_drv_reg_sie_access SIE Data Endpoint Registers Access * \defgroup group_usbfs_drv_drv_reg_arbiter Arbiter Endpoint Registers Access * \defgroup group_usbfs_drv_drv_reg_arbiter_data Arbiter Endpoint Data Registers Access @@ -110,6 +111,22 @@ __STATIC_INLINE void Cy_USBFS_Dev_Drv_ClearSieInterrupt (USBFS_Type *base __STATIC_INLINE void Cy_USBFS_Dev_Drv_SetSieInterrupt (USBFS_Type *base, uint32_t mask); /** \} group_usbfs_drv_drv_reg_interrupt_sources */ + +/** +* \addtogroup group_usbfs_drv_drv_reg_ep0_access +* \{ +*/ +/* Access control endpoint CR0.Mode registers */ +__STATIC_INLINE void Cy_USBFS_Dev_Drv_WriteEp0Mode(USBFS_Type *base, uint32_t mode); +__STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_ReadEp0Mode(USBFS_Type const *base); + +__STATIC_INLINE void Cy_USBFS_Dev_Drv_SetEp0Count(USBFS_Type *base, uint32_t count, uint32_t toggle); +__STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_GetEp0Count(USBFS_Type const *base); + +__STATIC_INLINE void Cy_USBFS_Dev_Drv_WriteEp0Data(USBFS_Type *base, uint32_t idx, uint32_t value); +__STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_ReadEp0Data(USBFS_Type const *base, uint32_t idx); +/** \} group_usbfs_drv_drv_reg_ep0_access */ + /** * \addtogroup group_usbfs_drv_drv_reg_sie_access * \{ @@ -154,17 +171,17 @@ __STATIC_INLINE void Cy_USBFS_Dev_Drv_ClearArbCfgEpInReady (USBFS_Type *base, ui __STATIC_INLINE void Cy_USBFS_Dev_Drv_TriggerArbCfgEpDmaReq(USBFS_Type *base, uint32_t endpoint); /* Access Arbiter data endpoints WA (Write Address and RA(Read Address) registers */ -__STATIC_INLINE void Cy_USBFS_Dev_Drv_SetArbWriteAddr (USBFS_Type *base, uint32_t endpoint, uint32_t wa); -__STATIC_INLINE void Cy_USBFS_Dev_Drv_SetArbReadAddr (USBFS_Type *base, uint32_t endpoint, uint32_t ra); -__STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_GetArbWriteAddr (USBFS_Type const *base, uint32_t endpoint); -__STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_GetArbReadAddr (USBFS_Type const *base, uint32_t endpoint); +__STATIC_INLINE void Cy_USBFS_Dev_Drv_SetArbWriteAddr(USBFS_Type *base, uint32_t endpoint, uint32_t wa); +__STATIC_INLINE void Cy_USBFS_Dev_Drv_SetArbReadAddr (USBFS_Type *base, uint32_t endpoint, uint32_t ra); +__STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_GetArbWriteAddr(USBFS_Type const *base, uint32_t endpoint); +__STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_GetArbReadAddr (USBFS_Type const *base, uint32_t endpoint); /** \} group_usbfs_drv_drv_reg_arbiter */ /** * \addtogroup group_usbfs_drv_drv_reg_arbiter_data * \{ */ -/* Access data endpoints data registers. Used to get/put data into endpoint buffer. */ +/* Access data endpoints data registers. Used to get/put data into endpoint buffer */ __STATIC_INLINE void Cy_USBFS_Dev_Drv_WriteData (USBFS_Type *base, uint32_t endpoint, uint8_t byte); __STATIC_INLINE void Cy_USBFS_Dev_Drv_WriteData16(USBFS_Type *base, uint32_t endpoint, uint16_t halfword); __STATIC_INLINE uint8_t Cy_USBFS_Dev_Drv_ReadData (USBFS_Type const *base, uint32_t endpoint); @@ -178,8 +195,8 @@ __STATIC_INLINE void Cy_USBFS_Dev_Drv_FlushInBuffer (USBFS_Type *base, uint3 * \addtogroup group_usbfs_drv_drv_reg_misc * \{ */ -__STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_GetEp0Count(USBFS_Type const *base); __STATIC_INLINE void Cy_USBFS_Dev_Drv_SetEpType (USBFS_Type *base, bool inDirection, uint32_t endpoint); +__STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_GetSofNubmer(USBFS_Type const *base); /** \} group_usbfs_drv_drv_reg_misc */ @@ -425,6 +442,165 @@ __STATIC_INLINE void Cy_USBFS_Dev_Drv_SetSieInterrupt(USBFS_Type *base, uint32_t /** +* \addtogroup group_usbfs_drv_drv_reg_ep0_access +* \{ +*/ +/******************************************************************************* +* Function Name: Cy_USBFS_Dev_Drv_WriteEp0Mode +****************************************************************************//** +* +* Sets a mode in the CR0 register of endpoint 0 (clears all other bits in the +* register). +* +* \param base +* The pointer to the USBFS instance. +* +* \param mode +* SIE mode defines the data endpoint 0 response to a host request. +* See \ref group_usbfs_dev_drv_reg_macros_sie_mode for the set of constants. +* +*******************************************************************************/ +__STATIC_INLINE void Cy_USBFS_Dev_Drv_WriteEp0Mode(USBFS_Type *base, uint32_t mode) +{ + USBFS_DEV_EP0_CR(base) = mode; + (void) USBFS_DEV_EP0_CR(base); +} + +/******************************************************************************* +* Function Name: Cy_USBFS_Dev_Drv_ReadEp0Mode +****************************************************************************//** +* +* Returns a mode in the CR0 register of endpoint 0. +* +* \param base +* The pointer to the USBFS instance. +* +* \return +* SIE mode (defines the endpoint 0 response to a host request). +* See \ref group_usbfs_dev_drv_reg_macros_sie_mode for the set of constants. +* +*******************************************************************************/ +__STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_ReadEp0Mode(USBFS_Type const *base) +{ + return USBFS_DEV_EP0_CR(base); +} + + +/******************************************************************************* +* Function Name: Cy_USBFS_Dev_Drv_SetSieEpCount +****************************************************************************//** +* +* Configures the number of bytes and toggle bit to return to a host read request +* to endpoint 0. +* +* \param base +* The pointer to the USBFS instance. +* +* \param count +* The number of bytes to return to a host read request. +* +* \param toggle +* The data toggle bit. +* The range of valid values: 0 and \ref USBFS_USBDEV_SIE_EP_DATA_TOGGLE_Msk. +* +*******************************************************************************/ +__STATIC_INLINE void Cy_USBFS_Dev_Drv_SetEp0Count(USBFS_Type *base, uint32_t count, uint32_t toggle) +{ + count = _VAL2FLD(USBFS_USBDEV_EP0_CNT_BYTE_COUNT, count); + USBFS_DEV_EP0_CNT(base) = CY_USBFS_DEV_DRV_WRITE_ODD(count | toggle); +} + + +/******************************************************************************* +* Function Name: Cy_USBFS_Dev_Drv_GetEp0Count +****************************************************************************//** +* +* Returns the number of data bytes written into endpoint 0 by the host. +* +* \param base +* The pointer to the USBFS instance. +* +* \return +* The number of bytes written by the host into the endpoint. +* +*******************************************************************************/ +__STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_GetEp0Count(USBFS_Type const *base) +{ + uint32_t ep0Cnt = CY_USBFS_DEV_READ_ODD(USBFS_DEV_EP0_CNT(base)); + + /* Excludes the CRC size */ + return (_FLD2VAL(USBFS_USBDEV_EP0_CNT_BYTE_COUNT, ep0Cnt) - CY_USBFS_DEV_DRV_EP_CRC_SIZE); +} + + +/******************************************************************************* +* Function Name: Cy_USBFS_Dev_Drv_WriteEp0Data +****************************************************************************//** +* +* Writes an 8-bit byte into the endpoint 0 hardware buffer. +* +* \param base +* The pointer to the USBFS instance. +* +* \param idx +* The index of the endpoint 0 hardware buffer entry. +* Valid range: 0 - ( \ref CY_USBFS_DEV_DRV_EP0_BUFFER_SIZE - 1 ). +* +* \param value +* The value to be written into the endpoint 0 hardware buffer. +* +*******************************************************************************/ +__STATIC_INLINE void Cy_USBFS_Dev_Drv_WriteEp0Data(USBFS_Type *base, uint32_t idx, uint32_t value) +{ + if (0U == (idx & 0x1U)) + { + USBFS_DEV_EP0_DR(base, idx) = value; + } + else + { + /* Applies a special write for odd offset registers */ + USBFS_DEV_EP0_DR(base, idx) = CY_USBFS_DEV_DRV_WRITE_ODD(value); + } +} + + +/******************************************************************************* +* Function Name: Cy_USBFS_Dev_Drv_ReadEp0Data +****************************************************************************//** +* +* Reads an 8-bit byte from the endpoint 0 hardware buffer. +* +* \param base +* The pointer to the USBFS instance. +* +* \param idx +* The index of the endpoint 0 hardware buffer entry. +* Valid range: 0 - ( \ref CY_USBFS_DEV_DRV_EP0_BUFFER_SIZE - 1 ). +* +* \return +* The byte of data to read from the hardware buffer. +* +*******************************************************************************/ +__STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_ReadEp0Data(USBFS_Type const *base, uint32_t idx) +{ + uint32_t value; + + if (0U == (idx & 0x1U)) + { + value = USBFS_DEV_EP0_DR(base, idx); + } + else + { + /* Applies a special write for odd offset registers */ + value = CY_USBFS_DEV_READ_ODD(USBFS_DEV_EP0_DR(base, idx)); + } + + return (value); +} +/** \} group_usbfs_drv_drv_reg_ep0_access */ + + +/** * \addtogroup group_usbfs_drv_drv_reg_sie_access * \{ */ @@ -445,7 +621,7 @@ __STATIC_INLINE void Cy_USBFS_Dev_Drv_SetSieInterrupt(USBFS_Type *base, uint32_t * Valid range: 0 - ( \ref CY_USBFS_DEV_DRV_NUM_EPS_MAX - 1 ). * * \param mode -* SIE mode defines data endpoint response to Host request. +* SIE mode defines data endpoint response to host request. * See \ref group_usbfs_dev_drv_reg_macros_sie_mode for the set of constants. * *******************************************************************************/ @@ -648,7 +824,7 @@ __STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_GetSieEpCount(USBFS_Type const *base, * Function Name: Cy_USBFS_Dev_Drv_SetSieEpCount ****************************************************************************//** * -* Configures number of bytes and toggle bit to return on the Host read request +* Configures number of bytes and toggle bit to return on the host read request * to the IN data endpoint. * * \param base @@ -659,7 +835,7 @@ __STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_GetSieEpCount(USBFS_Type const *base, * Valid range: 0 - ( \ref CY_USBFS_DEV_DRV_NUM_EPS_MAX - 1 ). * * \param count -* The number of bytes to return on the Host read request. +* The number of bytes to return on the host read request. * * \param toggle * The data toggle bit. @@ -1289,27 +1465,6 @@ __STATIC_INLINE void Cy_USBFS_Dev_Drv_FlushInBuffer(USBFS_Type *base, uint32_t e * \addtogroup group_usbfs_drv_drv_reg_misc * \{ */ -/******************************************************************************* -* Function Name: Cy_USBFS_Dev_Drv_GetEp0Count -****************************************************************************//** -* -* Returns the number of data bytes written into the endpoint 0 by the host. -* -* \param base -* The pointer to the USBFS instance. -* -* \return -* Number of bytes written by the Host into the endpoint. -* -*******************************************************************************/ -__STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_GetEp0Count(USBFS_Type const *base) -{ - /* Exclude CRC size */ - uint32_t ep0Cnt = CY_USBFS_DEV_READ_ODD(USBFS_DEV_EP0_CNT(base)); - - return (_FLD2VAL(USBFS_USBDEV_EP0_CNT_BYTE_COUNT, ep0Cnt) - CY_USBFS_DEV_DRV_EP_CRC_SIZE); -} - /******************************************************************************* * Function Name: Cy_USBFS_Dev_Drv_SetEpType @@ -1346,6 +1501,25 @@ __STATIC_INLINE void Cy_USBFS_Dev_Drv_SetEpType(USBFS_Type *base, bool inDirecti USBFS_DEV_EP_TYPE(base) = CY_USBFS_DEV_DRV_WRITE_ODD(regValue); } + + +/******************************************************************************* +* Function Name: Cy_USBFS_Dev_Drv_GetSofNubmer +****************************************************************************//** +* +* Returns the SOF frame number. +* +* \param base +* The pointer to the USBFS instance. +* +* \return +* The SOF frame number. +* +*******************************************************************************/ +__STATIC_INLINE uint32_t Cy_USBFS_Dev_Drv_GetSofNubmer(USBFS_Type const *base) +{ + return _FLD2VAL(USBFS_USBDEV_SOF16_FRAME_NUMBER16, USBFS_DEV_SOF16(base)); +} /** \} group_usbfs_drv_drv_reg_misc */ #if defined(__cplusplus) diff --git a/platform/ext/target/psoc64/Native_Driver/source/cy_device.c b/platform/ext/target/psoc64/Native_Driver/source/cy_device.c index adf74186c8..c89104a36d 100644 --- a/platform/ext/target/psoc64/Native_Driver/source/cy_device.c +++ b/platform/ext/target/psoc64/Native_Driver/source/cy_device.c @@ -1,6 +1,6 @@ /***************************************************************************//** * \file cy_device.c -* \version 1.10 +* \version 2.10 * * This file provides the definitions for core and peripheral block HW base * addresses, versions, and parameters. @@ -49,21 +49,19 @@ const cy_stc_device_t cy_deviceIpBlockCfgPSoC6_01 = /* ipcBase */ 0x40230000UL, /* cryptoBase */ 0x40110000UL, - /* IP block versions */ - /* cpussVersion */ 1U, - /* cryptoVersion */ 1U, - /* dwVersion */ 1U, - /* flashcVersion */ 1U, - /* gpioVersion */ 1U, - /* hsiomVersion */ 1U, - /* ipcVersion */ 1U, - /* periVersion */ 1U, - /* protVersion */ 1U, + /* IP block versions [7:4] major, [3:0] minor */ + /* cpussVersion */ 0x10U, + /* cryptoVersion */ 0x10U, + /* dwVersion */ 0x10U, + /* ipcVersion */ 0x10U, + /* periVersion */ 0x10U, + /* srssVersion */ 0x10U, /* Parameters */ /* cpussIpcNr */ 16U, /* cpussIpcIrqNr */ 16U, - /* cpussDwChNr */ 16U, + /* cpussDw0ChNr */ 16U, + /* cpussDw1ChNr */ 16U, /* cpussFlashPaSize */ 128U, /* cpussIpc0Irq */ 25, /* cpussFmIrq */ 85, @@ -93,7 +91,7 @@ const cy_stc_device_t cy_deviceIpBlockCfgPSoC6_01 = /* Peripheral register offsets */ /* DW registers */ - /* dwChOffset */ offsetof(DW_V1_Type, CH_STRUCT), + /* dwChOffset */ (uint16_t)offsetof(DW_V1_Type, CH_STRUCT), /* dwChSize */ sizeof(DW_CH_STRUCT_V1_Type), /* dwChCtlPrioPos */ (uint8_t)DW_CH_STRUCT_CH_CTL_PRIO_Pos, /* dwChCtlPreemptablePos */ (uint8_t)DW_CH_STRUCT_CH_CTL_PREEMPTABLE_Pos, @@ -101,27 +99,27 @@ const cy_stc_device_t cy_deviceIpBlockCfgPSoC6_01 = /* dwStatusChIdxMsk */ DW_STATUS_CH_IDX_Msk, /* PERI registers */ - /* periTrCmdOffset */ offsetof(PERI_V1_Type, TR_CMD), - /* periTrCmdGrSelMsk */ PERI_TR_CMD_GROUP_SEL_Msk, - /* periTrGrOffset */ offsetof(PERI_V1_Type, TR_GR), + /* periTrCmdOffset */ (uint16_t)offsetof(PERI_V1_Type, TR_CMD), + /* periTrCmdGrSelMsk */ (uint16_t)PERI_TR_CMD_GROUP_SEL_Msk, + /* periTrGrOffset */ (uint16_t)offsetof(PERI_V1_Type, TR_GR), /* periTrGrSize */ sizeof(PERI_TR_GR_V1_Type), - /* periDivCmdDivSelMsk */ PERI_DIV_CMD_DIV_SEL_Msk, - /* periDivCmdTypeSelPos */ PERI_DIV_CMD_TYPE_SEL_Pos, - /* periDivCmdPaDivSelPos */ PERI_DIV_CMD_PA_DIV_SEL_Pos, - /* periDivCmdPaTypeSelPos */ PERI_DIV_CMD_PA_TYPE_SEL_Pos, + /* periDivCmdDivSelMsk */ (uint8_t)PERI_DIV_CMD_DIV_SEL_Msk, + /* periDivCmdTypeSelPos */ (uint8_t)PERI_DIV_CMD_TYPE_SEL_Pos, + /* periDivCmdPaDivSelPos */ (uint8_t)PERI_DIV_CMD_PA_DIV_SEL_Pos, + /* periDivCmdPaTypeSelPos */ (uint8_t)PERI_DIV_CMD_PA_TYPE_SEL_Pos, - /* periDiv8CtlOffset */ offsetof(PERI_V1_Type, DIV_8_CTL), - /* periDiv16CtlOffset */ offsetof(PERI_V1_Type, DIV_16_CTL), - /* periDiv16_5CtlOffset */ offsetof(PERI_V1_Type, DIV_16_5_CTL), - /* periDiv24_5CtlOffset */ offsetof(PERI_V1_Type, DIV_24_5_CTL), + /* periDiv8CtlOffset */ (uint16_t)offsetof(PERI_V1_Type, DIV_8_CTL), + /* periDiv16CtlOffset */ (uint16_t)offsetof(PERI_V1_Type, DIV_16_CTL), + /* periDiv16_5CtlOffset */ (uint16_t)offsetof(PERI_V1_Type, DIV_16_5_CTL), + /* periDiv24_5CtlOffset */ (uint16_t)offsetof(PERI_V1_Type, DIV_24_5_CTL), /* GPIO registers */ - /* gpioPrtIntrCfgOffset */ offsetof(GPIO_PRT_V1_Type, INTR_CFG), - /* gpioPrtCfgOffset */ offsetof(GPIO_PRT_V1_Type, CFG), - /* gpioPrtCfgInOffset */ offsetof(GPIO_PRT_V1_Type, CFG_IN), - /* gpioPrtCfgOutOffset */ offsetof(GPIO_PRT_V1_Type, CFG_OUT), - /* gpioPrtCfgSioOffset */ offsetof(GPIO_PRT_V1_Type, CFG_SIO), + /* gpioPrtIntrCfgOffset */ (uint8_t)offsetof(GPIO_PRT_V1_Type, INTR_CFG), + /* gpioPrtCfgOffset */ (uint8_t)offsetof(GPIO_PRT_V1_Type, CFG), + /* gpioPrtCfgInOffset */ (uint8_t)offsetof(GPIO_PRT_V1_Type, CFG_IN), + /* gpioPrtCfgOutOffset */ (uint8_t)offsetof(GPIO_PRT_V1_Type, CFG_OUT), + /* gpioPrtCfgSioOffset */ (uint8_t)offsetof(GPIO_PRT_V1_Type, CFG_SIO), /* CPUSS registers */ /* cpussCm0ClockCtlOffset */ offsetof(CPUSS_V1_Type, CM0_CLOCK_CTL), @@ -159,21 +157,19 @@ const cy_stc_device_t cy_deviceIpBlockCfgPSoC6_02 = /* ipcBase */ 0x40220000UL, /* cryptoBase */ 0x40100000UL, - /* IP block versions */ - /* cpussVersion */ 2U, - /* cryptoVersion */ 2U, - /* dwVersion */ 2U, - /* flashcVersion */ 2U, - /* gpioVersion */ 2U, - /* hsiomVersion */ 2U, - /* ipcVersion */ 2U, - /* periVersion */ 2U, - /* protVersion */ 2U, + /* IP block versions [7:4] major, [3:0] minor */ + /* cpussVersion */ 0x20U, + /* cryptoVersion */ 0x20U, + /* dwVersion */ 0x20U, + /* ipcVersion */ 0x20U, + /* periVersion */ 0x20U, + /* srssVersion */ 0x10U, /* Parameters */ /* cpussIpcNr */ 16U, /* cpussIpcIrqNr */ 16U, - /* cpussDwChNr */ 29U, + /* cpussDw0ChNr */ 29U, + /* cpussDw1ChNr */ 29U, /* cpussFlashPaSize */ 128U, /* cpussIpc0Irq */ 23, /* cpussFmIrq */ 117, @@ -203,7 +199,7 @@ const cy_stc_device_t cy_deviceIpBlockCfgPSoC6_02 = /* Peripheral register offsets */ /* DW registers */ - /* dwChOffset */ offsetof(DW_V2_Type, CH_STRUCT), + /* dwChOffset */ (uint16_t)offsetof(DW_V2_Type, CH_STRUCT), /* dwChSize */ sizeof(DW_CH_STRUCT_V2_Type), /* dwChCtlPrioPos */ (uint8_t)DW_CH_STRUCT_V2_CH_CTL_PRIO_Pos, /* dwChCtlPreemptablePos */ (uint8_t)DW_CH_STRUCT_V2_CH_CTL_PREEMPTABLE_Pos, @@ -211,9 +207,9 @@ const cy_stc_device_t cy_deviceIpBlockCfgPSoC6_02 = /* dwStatusChIdxMsk */ DW_V2_STATUS_CH_IDX_Msk, /* PERI registers */ - /* periTrCmdOffset */ offsetof(PERI_V2_Type, TR_CMD), - /* periTrCmdGrSelMsk */ PERI_V2_TR_CMD_GROUP_SEL_Msk, - /* periTrGrOffset */ offsetof(PERI_V2_Type, TR_GR), + /* periTrCmdOffset */ (uint16_t)offsetof(PERI_V2_Type, TR_CMD), + /* periTrCmdGrSelMsk */ (uint16_t)PERI_V2_TR_CMD_GROUP_SEL_Msk, + /* periTrGrOffset */ (uint16_t)offsetof(PERI_V2_Type, TR_GR), /* periTrGrSize */ sizeof(PERI_TR_GR_V2_Type), /* periDivCmdDivSelMsk */ (uint8_t)PERI_V2_DIV_CMD_DIV_SEL_Msk, @@ -221,17 +217,17 @@ const cy_stc_device_t cy_deviceIpBlockCfgPSoC6_02 = /* periDivCmdPaDivSelPos */ (uint8_t)PERI_V2_DIV_CMD_PA_DIV_SEL_Pos, /* periDivCmdPaTypeSelPos */ (uint8_t)PERI_V2_DIV_CMD_PA_TYPE_SEL_Pos, - /* periDiv8CtlOffset */ offsetof(PERI_V2_Type, DIV_8_CTL), - /* periDiv16CtlOffset */ offsetof(PERI_V2_Type, DIV_16_CTL), - /* periDiv16_5CtlOffset */ offsetof(PERI_V2_Type, DIV_16_5_CTL), - /* periDiv24_5CtlOffset */ offsetof(PERI_V2_Type, DIV_24_5_CTL), + /* periDiv8CtlOffset */ (uint16_t)offsetof(PERI_V2_Type, DIV_8_CTL), + /* periDiv16CtlOffset */ (uint16_t)offsetof(PERI_V2_Type, DIV_16_CTL), + /* periDiv16_5CtlOffset */ (uint16_t)offsetof(PERI_V2_Type, DIV_16_5_CTL), + /* periDiv24_5CtlOffset */ (uint16_t)offsetof(PERI_V2_Type, DIV_24_5_CTL), /* GPIO registers */ - /* gpioPrtIntrCfgOffset */ offsetof(GPIO_PRT_V2_Type, INTR_CFG), - /* gpioPrtCfgOffset */ offsetof(GPIO_PRT_V2_Type, CFG), - /* gpioPrtCfgInOffset */ offsetof(GPIO_PRT_V2_Type, CFG_IN), - /* gpioPrtCfgOutOffset */ offsetof(GPIO_PRT_V2_Type, CFG_OUT), - /* gpioPrtCfgSioOffset */ offsetof(GPIO_PRT_V2_Type, CFG_SIO), + /* gpioPrtIntrCfgOffset */ (uint8_t)offsetof(GPIO_PRT_V2_Type, INTR_CFG), + /* gpioPrtCfgOffset */ (uint8_t)offsetof(GPIO_PRT_V2_Type, CFG), + /* gpioPrtCfgInOffset */ (uint8_t)offsetof(GPIO_PRT_V2_Type, CFG_IN), + /* gpioPrtCfgOutOffset */ (uint8_t)offsetof(GPIO_PRT_V2_Type, CFG_OUT), + /* gpioPrtCfgSioOffset */ (uint8_t)offsetof(GPIO_PRT_V2_Type, CFG_SIO), /* CPUSS registers */ /* cpussCm0ClockCtlOffset */ offsetof(CPUSS_V2_Type, CM0_CLOCK_CTL), @@ -268,21 +264,19 @@ const cy_stc_device_t cy_deviceIpBlockCfgPSoC6_03 = /* ipcBase */ 0x40220000UL, /* cryptoBase */ 0x40100000UL, - /* IP block versions */ - /* cpussVersion */ 2U, - /* cryptoVersion */ 2U, - /* dwVersion */ 2U, - /* flashcVersion */ 2U, - /* gpioVersion */ 2U, - /* hsiomVersion */ 2U, - /* ipcVersion */ 2U, - /* periVersion */ 2U, - /* protVersion */ 2U, + /* IP block versions [7:4] major, [3:0] minor */ + /* cpussVersion */ 0x20U, + /* cryptoVersion */ 0x20U, + /* dwVersion */ 0x20U, + /* ipcVersion */ 0x20U, + /* periVersion */ 0x20U, + /* srssVersion */ 0x13U, /* Parameters */ /* cpussIpcNr */ 16U, /* cpussIpcIrqNr */ 16U, - /* cpussDwChNr */ 22U, + /* cpussDw0ChNr */ 29U, + /* cpussDw1ChNr */ 32U, /* cpussFlashPaSize */ 128U, /* cpussIpc0Irq */ 23, /* cpussFmIrq */ 117, @@ -312,7 +306,7 @@ const cy_stc_device_t cy_deviceIpBlockCfgPSoC6_03 = /* Peripheral register offsets */ /* DW registers */ - /* dwChOffset */ offsetof(DW_V2_Type, CH_STRUCT), + /* dwChOffset */ (uint16_t)offsetof(DW_V2_Type, CH_STRUCT), /* dwChSize */ sizeof(DW_CH_STRUCT_V2_Type), /* dwChCtlPrioPos */ (uint8_t)DW_CH_STRUCT_V2_CH_CTL_PRIO_Pos, /* dwChCtlPreemptablePos */ (uint8_t)DW_CH_STRUCT_V2_CH_CTL_PREEMPTABLE_Pos, @@ -320,9 +314,9 @@ const cy_stc_device_t cy_deviceIpBlockCfgPSoC6_03 = /* dwStatusChIdxMsk */ DW_V2_STATUS_CH_IDX_Msk, /* PERI registers */ - /* periTrCmdOffset */ offsetof(PERI_V2_Type, TR_CMD), - /* periTrCmdGrSelMsk */ PERI_V2_TR_CMD_GROUP_SEL_Msk, - /* periTrGrOffset */ offsetof(PERI_V2_Type, TR_GR), + /* periTrCmdOffset */ (uint16_t)offsetof(PERI_V2_Type, TR_CMD), + /* periTrCmdGrSelMsk */ (uint16_t)PERI_V2_TR_CMD_GROUP_SEL_Msk, + /* periTrGrOffset */ (uint16_t)offsetof(PERI_V2_Type, TR_GR), /* periTrGrSize */ sizeof(PERI_TR_GR_V2_Type), /* periDivCmdDivSelMsk */ (uint8_t)PERI_V2_DIV_CMD_DIV_SEL_Msk, @@ -330,17 +324,17 @@ const cy_stc_device_t cy_deviceIpBlockCfgPSoC6_03 = /* periDivCmdPaDivSelPos */ (uint8_t)PERI_V2_DIV_CMD_PA_DIV_SEL_Pos, /* periDivCmdPaTypeSelPos */ (uint8_t)PERI_V2_DIV_CMD_PA_TYPE_SEL_Pos, - /* periDiv8CtlOffset */ offsetof(PERI_V2_Type, DIV_8_CTL), - /* periDiv16CtlOffset */ offsetof(PERI_V2_Type, DIV_16_CTL), - /* periDiv16_5CtlOffset */ offsetof(PERI_V2_Type, DIV_16_5_CTL), - /* periDiv24_5CtlOffset */ offsetof(PERI_V2_Type, DIV_24_5_CTL), + /* periDiv8CtlOffset */ (uint16_t)offsetof(PERI_V2_Type, DIV_8_CTL), + /* periDiv16CtlOffset */ (uint16_t)offsetof(PERI_V2_Type, DIV_16_CTL), + /* periDiv16_5CtlOffset */ (uint16_t)offsetof(PERI_V2_Type, DIV_16_5_CTL), + /* periDiv24_5CtlOffset */ (uint16_t)offsetof(PERI_V2_Type, DIV_24_5_CTL), /* GPIO registers */ - /* gpioPrtIntrCfgOffset */ offsetof(GPIO_PRT_V2_Type, INTR_CFG), - /* gpioPrtCfgOffset */ offsetof(GPIO_PRT_V2_Type, CFG), - /* gpioPrtCfgInOffset */ offsetof(GPIO_PRT_V2_Type, CFG_IN), - /* gpioPrtCfgOutOffset */ offsetof(GPIO_PRT_V2_Type, CFG_OUT), - /* gpioPrtCfgSioOffset */ offsetof(GPIO_PRT_V2_Type, CFG_SIO), + /* gpioPrtIntrCfgOffset */ (uint8_t)offsetof(GPIO_PRT_V2_Type, INTR_CFG), + /* gpioPrtCfgOffset */ (uint8_t)offsetof(GPIO_PRT_V2_Type, CFG), + /* gpioPrtCfgInOffset */ (uint8_t)offsetof(GPIO_PRT_V2_Type, CFG_IN), + /* gpioPrtCfgOutOffset */ (uint8_t)offsetof(GPIO_PRT_V2_Type, CFG_OUT), + /* gpioPrtCfgSioOffset */ (uint8_t)offsetof(GPIO_PRT_V2_Type, CFG_SIO), /* CPUSS registers */ /* cpussCm0ClockCtlOffset */ offsetof(CPUSS_V2_Type, CM0_CLOCK_CTL), diff --git a/platform/ext/target/psoc64/Native_Driver/source/cy_flash.c b/platform/ext/target/psoc64/Native_Driver/source/cy_flash.c index 475514d286..4c7b385806 100644 --- a/platform/ext/target/psoc64/Native_Driver/source/cy_flash.c +++ b/platform/ext/target/psoc64/Native_Driver/source/cy_flash.c @@ -1,6 +1,6 @@ /***************************************************************************//** * \file cy_flash.c -* \version 3.20 +* \version 3.30.2 * * \brief * Provides the public functions for the API for the PSoC 6 Flash Driver. @@ -29,9 +29,8 @@ #include "cy_ipc_sema.h" #include "cy_ipc_pipe.h" #include "cy_device.h" -#ifdef TFM_MULTI_CORE_TOPOLOGY - #include "region_defs.h" -#endif +#include "cy_syslib.h" + /*************************************** * Data Structure definitions @@ -74,6 +73,10 @@ typedef struct #define CY_FLASH_OPCODE_PROGRAM_ROW ((0x06UL) << 24UL) /** SROM API opcode for row erase operation */ #define CY_FLASH_OPCODE_ERASE_ROW ((0x1CUL) << 24UL) +/** SROM API opcode for sub sector erase operation */ +#define CY_FLASH_OPCODE_ERASE_SUB_SECTOR ((0x1DUL) << 24UL) +/** SROM API opcode for sector erase operation */ +#define CY_FLASH_OPCODE_ERASE_SECTOR ((0x14UL) << 24UL) /** SROM API opcode for flash checksum operation */ #define CY_FLASH_OPCODE_CHECKSUM ((0x0BUL) << 24UL) /** SROM API opcode for flash hash operation */ @@ -148,9 +151,9 @@ typedef cy_en_flashdrv_status_t (*Cy_Flash_Proxy)(cy_stc_flash_context_t *contex #define CY_FLASH_START_PROGRAM_DELAY_TICKS (6000UL) /* Delay time for StartProgram function in us */ #define CY_FLASH_START_PROGRAM_DELAY_TIME (900UL + CY_FLASH_DELAY_CORRECTIVE(CY_FLASH_START_PROGRAM_DELAY_TICKS)) - /* Number of the CM0P ticks for StartErase function delay corrective time */ + /* Number of the CM0P ticks for StartErase functions delay corrective time */ #define CY_FLASH_START_ERASE_DELAY_TICKS (9500UL) - /* Delay time for StartErase function in us */ + /* Delay time for StartErase functions in us */ #define CY_FLASH_START_ERASE_DELAY_TIME (2200UL + CY_FLASH_DELAY_CORRECTIVE(CY_FLASH_START_ERASE_DELAY_TICKS)) /* Number of the CM0P ticks for StartWrite function delay corrective time */ #define CY_FLASH_START_WRITE_DELAY_TICKS (19000UL) @@ -230,23 +233,23 @@ static volatile cy_stc_flash_context_t flashContext; { ipcWaitMessage->clientID = CY_FLASH_IPC_CLIENT_ID; ipcWaitMessage->pktType = CY_FLASH_ENTER_WAIT_LOOP; - ipcWaitMessage->intrRelMask = 0u; + ipcWaitMessage->intrRelMask = 0U; } - if (cy_device->flashRwwRequired != 0u) + if (cy_device->flashRwwRequired != 0U) { #if (CY_CPU_CORTEX_M4) cy_stc_sysint_t flashIntConfig = { (IRQn_Type)cy_device->cpussFmIrq, /* .intrSrc */ - 0u /* .intrPriority */ + 0U /* .intrPriority */ }; (void)Cy_SysInt_Init(&flashIntConfig, &Cy_Flash_ResumeIrqHandler); NVIC_EnableIRQ(flashIntConfig.intrSrc); #endif - if (cy_device->flashPipeRequired != 0u) + if (cy_device->flashPipeRequired != 0U) { (void)Cy_IPC_Pipe_RegisterCallback(CY_IPC_EP_CYPIPE_ADDR, &Cy_Flash_NotifyHandler, (uint32_t)CY_FLASH_IPC_CLIENT_ID); @@ -262,12 +265,9 @@ static volatile cy_stc_flash_context_t flashContext; * This is the interrupt service routine for the pipe notifications. * *******************************************************************************/ - - #if defined (__ICCARM__) - #pragma diag_suppress=Ta023 - __ramfunc - #else - CY_SECTION(".ramfunc") CY_NOINLINE + CY_RAMFUNC_BEGIN + #if !defined (__ICCARM__) + CY_NOINLINE #endif static void Cy_Flash_NotifyHandler(uint32_t * msgPtr) { @@ -302,9 +302,7 @@ static volatile cy_stc_flash_context_t flashContext; Cy_SysLib_ExitCriticalSection(intr); } } - #if defined (__ICCARM__) - #pragma diag_default=Ta023 - #endif + CY_RAMFUNC_END #endif /* !defined(CY_FLASH_RWW_DRV_SUPPORT_DISABLED) */ @@ -322,23 +320,16 @@ static volatile cy_stc_flash_context_t flashContext; * and erase operations. If the default startup file is not used, or the function * SystemInit() is not called in your project, ensure to perform the following steps * before any flash or EmEEPROM write/erase operations: -* \snippet flash\3.20\snippet\main.c Flash Initialization +* \snippet flash/snippet/main.c Flash Initialization * *******************************************************************************/ void Cy_Flash_Init(void) { #if !defined(CY_FLASH_RWW_DRV_SUPPORT_DISABLED) - #if defined TFM_MULTI_CORE_TOPOLOGY && CY_CPU_CORTEX_M0P - cy_stc_flash_notify_t *ipcWaitMessageStc = - (cy_stc_flash_notify_t *)IPC_WAIT_MESSAGE_STC_ADDR; - - Cy_Flash_InitExt(ipcWaitMessageStc); - #else - - CY_ALIGN(4) static cy_stc_flash_notify_t ipcWaitMessageStc; + CY_SECTION(".cy_sharedmem") + CY_ALIGN(4) static cy_stc_flash_notify_t ipcWaitMessageStc; - Cy_Flash_InitExt(&ipcWaitMessageStc); - #endif + Cy_Flash_InitExt(&ipcWaitMessageStc); #endif /* !defined(CY_FLASH_RWW_DRV_SUPPORT_DISABLED) */ } @@ -362,11 +353,9 @@ void Cy_Flash_Init(void) * see \ref cy_en_flashdrv_status_t. * *******************************************************************************/ -#if defined (__ICCARM__) - #pragma diag_suppress=Ta023 - __ramfunc -#else - CY_SECTION(".ramfunc") CY_NOINLINE +CY_RAMFUNC_BEGIN +#if !defined (__ICCARM__) + CY_NOINLINE #endif static cy_en_flashdrv_status_t Cy_Flash_SendCmd(uint32_t mode, uint32_t microseconds) { @@ -378,7 +367,7 @@ static cy_en_flashdrv_status_t Cy_Flash_SendCmd(uint32_t mode, uint32_t microsec uint32_t intr; uint32_t semaTryCount = 0uL; - if (cy_device->flashRwwRequired != 0u) + if (cy_device->flashRwwRequired != 0U) { /* Check for active core is CM0+, or CM4 on single core device */ #if (CY_CPU_CORTEX_M0P) @@ -386,7 +375,7 @@ static cy_en_flashdrv_status_t Cy_Flash_SendCmd(uint32_t mode, uint32_t microsec #else bool isPeerCoreEnabled = false; - if (SFLASH_SINGLE_CORE == 0u) + if (SFLASH_SINGLE_CORE == 0U) { isPeerCoreEnabled = true; } @@ -439,7 +428,7 @@ static cy_en_flashdrv_status_t Cy_Flash_SendCmd(uint32_t mode, uint32_t microsec } else { - while (0u != _FLD2VAL(IPC_STRUCT_ACQUIRE_SUCCESS, *ipcLockStatus)) + while (0U != _FLD2VAL(IPC_STRUCT_ACQUIRE_SUCCESS, *ipcLockStatus)) { /* Polls whether the IPC is released and the Flash operation is performed */ } @@ -486,7 +475,7 @@ static cy_en_flashdrv_status_t Cy_Flash_SendCmd(uint32_t mode, uint32_t microsec } else { - while (0u != _FLD2VAL(IPC_STRUCT_ACQUIRE_SUCCESS, *ipcLockStatus)) + while (0U != _FLD2VAL(IPC_STRUCT_ACQUIRE_SUCCESS, *ipcLockStatus)) { /* Polls whether the IPC is released and the Flash operation is performed */ } @@ -506,9 +495,7 @@ static cy_en_flashdrv_status_t Cy_Flash_SendCmd(uint32_t mode, uint32_t microsec return (result); } -#if defined (__ICCARM__) - #pragma diag_default=Ta023 -#endif +CY_RAMFUNC_END #if !defined(CY_FLASH_RWW_DRV_SUPPORT_DISABLED) @@ -522,11 +509,9 @@ static cy_en_flashdrv_status_t Cy_Flash_SendCmd(uint32_t mode, uint32_t microsec * Delay time in microseconds in range 0-65535 us. * *******************************************************************************/ - #if defined (__ICCARM__) - #pragma diag_suppress=Ta023 - __ramfunc - #else - CY_SECTION(".ramfunc") CY_NOINLINE + CY_RAMFUNC_BEGIN + #if !defined (__ICCARM__) + CY_NOINLINE #endif static void Cy_Flash_RAMDelay(uint32_t microseconds) { @@ -560,9 +545,7 @@ static cy_en_flashdrv_status_t Cy_Flash_SendCmd(uint32_t mode, uint32_t microsec } } } - #if defined (__ICCARM__) - #pragma diag_default=Ta023 - #endif + CY_RAMFUNC_END #if (CY_CPU_CORTEX_M4) @@ -585,11 +568,9 @@ static cy_en_flashdrv_status_t Cy_Flash_SendCmd(uint32_t mode, uint32_t microsec * flash operations resume phase. * *******************************************************************************/ - #if defined (__ICCARM__) - #pragma diag_suppress=Ta023 - __ramfunc - #else - CY_SECTION(".ramfunc") CY_NOINLINE + CY_RAMFUNC_BEGIN + #if !defined (__ICCARM__) + CY_NOINLINE #endif void Cy_Flash_ResumeIrqHandler(void) { @@ -618,9 +599,7 @@ static cy_en_flashdrv_status_t Cy_Flash_SendCmd(uint32_t mode, uint32_t microsec Cy_SysLib_ExitCriticalSection(intr); } - #if defined (__ICCARM__) - #pragma diag_default=Ta023 - #endif + CY_RAMFUNC_END #endif /* (CY_CPU_CORTEX_M4) */ #endif /* !defined(CY_FLASH_RWW_DRV_SUPPORT_DISABLED) */ @@ -633,7 +612,7 @@ static cy_en_flashdrv_status_t Cy_Flash_SendCmd(uint32_t mode, uint32_t microsec * a reason for failure. Does not return until the Write operation is * complete. Returns immediately and reports a \ref CY_FLASH_DRV_IPC_BUSY error in * the case when another process is writing to flash or erasing the row. -* User firmware should not enter the Hibernate or Deep-Sleep mode until flash Erase +* User firmware should not enter the Hibernate or Deep Sleep mode until flash Erase * is complete. The Flash operation is allowed in Sleep mode. * During the Flash operation, the device should not be reset, including the * XRES pin, a software reset, and watchdog reset sources. Also, low-voltage @@ -664,7 +643,120 @@ cy_en_flashdrv_status_t Cy_Flash_EraseRow(uint32_t rowAddr) flashContext.arg2 = 0UL; flashContext.arg3 = 0UL; - if (cy_device->flashEraseDelay != 0u) + if (cy_device->flashEraseDelay != 0U) + { + result = Cy_Flash_SendCmd(CY_FLASH_BLOCKING_MODE, CY_FLASH_START_ERASE_DELAY); + } + else + { + result = Cy_Flash_SendCmd(CY_FLASH_BLOCKING_MODE, CY_FLASH_NO_DELAY); + } + } + + return (result); +} + + +/******************************************************************************* +* Function Name: Cy_Flash_StartEraseRow +****************************************************************************//** +* +* Starts erasing a single row of flash. Returns immediately +* and reports a successful start or reason for failure. +* Reports a \ref CY_FLASH_DRV_IPC_BUSY error in the case when IPC structure is locked +* by another process. User firmware should not enter the Hibernate or Deep Sleep mode until +* flash Erase is complete. The Flash operation is allowed in Sleep mode. +* During the flash operation, the device should not be reset, including the +* XRES pin, a software reset, and watchdog reset sources. Also, the low-voltage +* detect circuits should be configured to generate an interrupt instead of a reset. +* Otherwise, portions of flash may undergo unexpected changes. +* \note Before reading data from previously programmed/erased flash rows, the +* user must clear the flash cache with the Cy_SysLib_ClearFlashCacheAndBuffer() +* function. +* +* \param rowAddr Address of the flash row number. +* The Read-while-Write violation occurs when the flash read operation is +* initiated in the same flash sector where the flash erase operation is +* performing. Refer to the device datasheet for the details. +* Address must match row start address. +* +* \return Returns the status of the Flash operation, +* see \ref cy_en_flashdrv_status_t. +* +*******************************************************************************/ +cy_en_flashdrv_status_t Cy_Flash_StartEraseRow(uint32_t rowAddr) +{ + cy_en_flashdrv_status_t result = CY_FLASH_DRV_INVALID_INPUT_PARAMETERS; + + if (Cy_Flash_BoundsCheck(rowAddr) != false) + { + SystemCoreClockUpdate(); + + /* Prepares arguments to be passed to SROM API */ + flashContext.opcode = CY_FLASH_OPCODE_ERASE_ROW; + if (SFLASH_SINGLE_CORE != 0U) + { + flashContext.opcode |= CY_FLASH_BLOCKING_MODE; + } + + flashContext.arg1 = rowAddr; + flashContext.arg2 = 0UL; + flashContext.arg3 = 0UL; + + if (cy_device->flashEraseDelay != 0U) + { + result = Cy_Flash_SendCmd(CY_FLASH_NON_BLOCKING_MODE, CY_FLASH_START_ERASE_DELAY); + } + else + { + result = Cy_Flash_SendCmd(CY_FLASH_NON_BLOCKING_MODE, CY_FLASH_NO_DELAY); + } + } + + return (result); +} + + +/******************************************************************************* +* Function Name: Cy_Flash_EraseSector +****************************************************************************//** +* +* This function erases a 256KB sector of flash. Reports success or +* a reason for failure. Does not return until the Erase operation is +* complete. Returns immediately and reports a \ref CY_FLASH_DRV_IPC_BUSY error in +* the case when another process is writing to flash or erasing the row. +* User firmware should not enter the Hibernate or Deep Sleep mode until flash Erase +* is complete. The Flash operation is allowed in Sleep mode. +* During the Flash operation, the device should not be reset, including the +* XRES pin, a software reset, and watchdog reset sources. Also, low-voltage +* detect circuits should be configured to generate an interrupt instead of a +* reset. Otherwise, portions of flash may undergo unexpected changes. +* +* \param sectorAddr Address of the flash row number. +* The Read-while-Write violation occurs when the flash read operation is +* initiated in the same flash sector where the flash write operation is +* performing. Refer to the device datasheet for the details. +* Address must match row start address. +* +* \return Returns the status of the Flash operation, +* see \ref cy_en_flashdrv_status_t. +* +*******************************************************************************/ +cy_en_flashdrv_status_t Cy_Flash_EraseSector(uint32_t sectorAddr) +{ + cy_en_flashdrv_status_t result = CY_FLASH_DRV_INVALID_INPUT_PARAMETERS; + + /* Prepares arguments to be passed to SROM API */ + if (Cy_Flash_BoundsCheck(sectorAddr) != false) + { + SystemCoreClockUpdate(); + + flashContext.opcode = CY_FLASH_OPCODE_ERASE_SECTOR | CY_FLASH_BLOCKING_MODE; + flashContext.arg1 = sectorAddr; + flashContext.arg2 = 0UL; + flashContext.arg3 = 0UL; + + if (cy_device->flashEraseDelay != 0U) { result = Cy_Flash_SendCmd(CY_FLASH_BLOCKING_MODE, CY_FLASH_START_ERASE_DELAY); } @@ -679,6 +771,179 @@ cy_en_flashdrv_status_t Cy_Flash_EraseRow(uint32_t rowAddr) /******************************************************************************* +* Function Name: Cy_Flash_StartEraseSector +****************************************************************************//** +* +* Starts erasing a 256KB sector of flash. Returns immediately +* and reports a successful start or reason for failure. +* Reports a \ref CY_FLASH_DRV_IPC_BUSY error in the case when IPC structure is locked +* by another process. User firmware should not enter the Hibernate or Deep Sleep mode until +* flash Erase is complete. The Flash operation is allowed in Sleep mode. +* During the flash operation, the device should not be reset, including the +* XRES pin, a software reset, and watchdog reset sources. Also, the low-voltage +* detect circuits should be configured to generate an interrupt instead of a reset. +* Otherwise, portions of flash may undergo unexpected changes. +* \note Before reading data from previously programmed/erased flash rows, the +* user must clear the flash cache with the Cy_SysLib_ClearFlashCacheAndBuffer() +* function. +* +* \param sectorAddr Address of the flash row number. +* The Read-while-Write violation occurs when the flash read operation is +* initiated in the same flash sector where the flash erase operation is +* performing. Refer to the device datasheet for the details. +* Address must match row start address. +* +* \return Returns the status of the Flash operation, +* see \ref cy_en_flashdrv_status_t. +* +*******************************************************************************/ +cy_en_flashdrv_status_t Cy_Flash_StartEraseSector(uint32_t sectorAddr) +{ + cy_en_flashdrv_status_t result = CY_FLASH_DRV_INVALID_INPUT_PARAMETERS; + + if (Cy_Flash_BoundsCheck(sectorAddr) != false) + { + SystemCoreClockUpdate(); + + /* Prepares arguments to be passed to SROM API */ + flashContext.opcode = CY_FLASH_OPCODE_ERASE_SECTOR; + if (SFLASH_SINGLE_CORE != 0U) + { + flashContext.opcode |= CY_FLASH_BLOCKING_MODE; + } + + flashContext.arg1 = sectorAddr; + flashContext.arg2 = 0UL; + flashContext.arg3 = 0UL; + + if (cy_device->flashEraseDelay != 0U) + { + result = Cy_Flash_SendCmd(CY_FLASH_NON_BLOCKING_MODE, CY_FLASH_START_ERASE_DELAY); + } + else + { + result = Cy_Flash_SendCmd(CY_FLASH_NON_BLOCKING_MODE, CY_FLASH_NO_DELAY); + } + } + + return (result); +} + + +/******************************************************************************* +* Function Name: Cy_Flash_EraseSubsector +****************************************************************************//** +* +* This function erases an 8-row subsector of flash. Reports success or +* a reason for failure. Does not return until the Write operation is +* complete. Returns immediately and reports a \ref CY_FLASH_DRV_IPC_BUSY error in +* the case when another process is writing to flash or erasing the row. +* User firmware should not enter the Hibernate or Deep-Sleep mode until flash Erase +* is complete. The Flash operation is allowed in Sleep mode. +* During the Flash operation, the device should not be reset, including the +* XRES pin, a software reset, and watchdog reset sources. Also, low-voltage +* detect circuits should be configured to generate an interrupt instead of a +* reset. Otherwise, portions of flash may undergo unexpected changes. +* +* \param subSectorAddr Address of the flash row number. +* The Read-while-Write violation occurs when the flash read operation is +* initiated in the same flash sector where the flash write operation is +* performing. Refer to the device datasheet for the details. +* Address must match row start address. +* +* \return Returns the status of the Flash operation, +* see \ref cy_en_flashdrv_status_t. +* +*******************************************************************************/ +cy_en_flashdrv_status_t Cy_Flash_EraseSubsector(uint32_t subSectorAddr) +{ + cy_en_flashdrv_status_t result = CY_FLASH_DRV_INVALID_INPUT_PARAMETERS; + + /* Prepares arguments to be passed to SROM API */ + if (Cy_Flash_BoundsCheck(subSectorAddr) != false) + { + SystemCoreClockUpdate(); + + flashContext.opcode = CY_FLASH_OPCODE_ERASE_SUB_SECTOR | CY_FLASH_BLOCKING_MODE; + flashContext.arg1 = subSectorAddr; + flashContext.arg2 = 0UL; + flashContext.arg3 = 0UL; + + if (cy_device->flashEraseDelay != 0U) + { + result = Cy_Flash_SendCmd(CY_FLASH_BLOCKING_MODE, CY_FLASH_START_ERASE_DELAY); + } + else + { + result = Cy_Flash_SendCmd(CY_FLASH_BLOCKING_MODE, CY_FLASH_NO_DELAY); + } + } + + return (result); +} + + +/******************************************************************************* +* Function Name: Cy_Flash_StartEraseSubsector +****************************************************************************//** +* +* Starts erasing an 8-row subsector of flash. Returns immediately +* and reports a successful start or reason for failure. +* Reports a \ref CY_FLASH_DRV_IPC_BUSY error in the case when IPC structure is locked +* by another process. User firmware should not enter the Hibernate or Deep-Sleep mode until +* flash Erase is complete. The Flash operation is allowed in Sleep mode. +* During the flash operation, the device should not be reset, including the +* XRES pin, a software reset, and watchdog reset sources. Also, the low-voltage +* detect circuits should be configured to generate an interrupt instead of a reset. +* Otherwise, portions of flash may undergo unexpected changes. +* \note Before reading data from previously programmed/erased flash rows, the +* user must clear the flash cache with the Cy_SysLib_ClearFlashCacheAndBuffer() +* function. +* +* \param subSectorAddr Address of the flash row number. +* The Read-while-Write violation occurs when the flash read operation is +* initiated in the same flash sector where the flash erase operation is +* performing. Refer to the device datasheet for the details. +* Address must match row start address. +* +* \return Returns the status of the Flash operation, +* see \ref cy_en_flashdrv_status_t. +* +*******************************************************************************/ +cy_en_flashdrv_status_t Cy_Flash_StartEraseSubsector(uint32_t subSectorAddr) +{ + cy_en_flashdrv_status_t result = CY_FLASH_DRV_INVALID_INPUT_PARAMETERS; + + if (Cy_Flash_BoundsCheck(subSectorAddr) != false) + { + SystemCoreClockUpdate(); + + /* Prepares arguments to be passed to SROM API */ + flashContext.opcode = CY_FLASH_OPCODE_ERASE_SUB_SECTOR; + if (SFLASH_SINGLE_CORE != 0U) + { + flashContext.opcode |= CY_FLASH_BLOCKING_MODE; + } + + flashContext.arg1 = subSectorAddr; + flashContext.arg2 = 0UL; + flashContext.arg3 = 0UL; + + if (cy_device->flashEraseDelay != 0U) + { + result = Cy_Flash_SendCmd(CY_FLASH_NON_BLOCKING_MODE, CY_FLASH_START_ERASE_DELAY); + } + else + { + result = Cy_Flash_SendCmd(CY_FLASH_NON_BLOCKING_MODE, CY_FLASH_NO_DELAY); + } + } + + return (result); +} + + +/******************************************************************************* * Function Name: Cy_Flash_ProgramRow ****************************************************************************//** * @@ -730,7 +995,7 @@ cy_en_flashdrv_status_t Cy_Flash_ProgramRow(uint32_t rowAddr, const uint32_t* da flashContext.arg2 = rowAddr; flashContext.arg3 = (uint32_t)data; - if (cy_device->flashProgramDelay != 0u) + if (cy_device->flashProgramDelay != 0U) { result = Cy_Flash_SendCmd(CY_FLASH_BLOCKING_MODE, CY_FLASH_START_PROGRAM_DELAY); } @@ -792,7 +1057,7 @@ cy_en_flashdrv_status_t Cy_Flash_WriteRow(uint32_t rowAddr, const uint32_t* data flashContext.arg2 = rowAddr; flashContext.arg3 = (uint32_t)data; - if (cy_device->flashWriteDelay != 0u) + if (cy_device->flashWriteDelay != 0U) { result = Cy_Flash_SendCmd(CY_FLASH_BLOCKING_MODE, CY_FLASH_START_WRITE_DELAY); } @@ -846,7 +1111,7 @@ cy_en_flashdrv_status_t Cy_Flash_StartWrite(uint32_t rowAddr, const uint32_t* da /* Checks whether the input parameters are valid */ if ((Cy_Flash_BoundsCheck(rowAddr) != false) && (NULL != data)) { - result = Cy_Flash_StartErase(rowAddr); + result = Cy_Flash_StartEraseRow(rowAddr); if (CY_FLASH_DRV_OPERATION_STARTED == result) { @@ -885,66 +1150,6 @@ cy_en_flashdrv_status_t Cy_Flash_IsOperationComplete(void) /******************************************************************************* -* Function Name: Cy_Flash_StartErase -****************************************************************************//** -* -* Starts erasing a single row of flash. Returns immediately -* and reports a successful start or reason for failure. -* Reports a \ref CY_FLASH_DRV_IPC_BUSY error in the case when IPC structure is locked -* by another process. User firmware should not enter the Hibernate or Deep-Sleep mode until -* flash Erase is complete. The Flash operation is allowed in Sleep mode. -* During the flash operation, the device should not be reset, including the -* XRES pin, a software reset, and watchdog reset sources. Also, the low-voltage -* detect circuits should be configured to generate an interrupt instead of a reset. -* Otherwise, portions of flash may undergo unexpected changes. -* \note Before reading data from previously programmed/erased flash rows, the -* user must clear the flash cache with the Cy_SysLib_ClearFlashCacheAndBuffer() -* function. -* -* \param rowAddr Address of the flash row number. -* The Read-while-Write violation occurs when the flash read operation is -* initiated in the same flash sector where the flash erase operation is -* performing. Refer to the device datasheet for the details. -* Address must match row start address. -* -* \return Returns the status of the Flash operation, -* see \ref cy_en_flashdrv_status_t. -* -*******************************************************************************/ -cy_en_flashdrv_status_t Cy_Flash_StartErase(uint32_t rowAddr) -{ - cy_en_flashdrv_status_t result = CY_FLASH_DRV_INVALID_INPUT_PARAMETERS; - - if (Cy_Flash_BoundsCheck(rowAddr) != false) - { - SystemCoreClockUpdate(); - - /* Prepares arguments to be passed to SROM API */ - flashContext.opcode = CY_FLASH_OPCODE_ERASE_ROW; - if (SFLASH_SINGLE_CORE != 0u) - { - flashContext.opcode |= CY_FLASH_BLOCKING_MODE; - } - - flashContext.arg1 = rowAddr; - flashContext.arg2 = 0UL; - flashContext.arg3 = 0UL; - - if (cy_device->flashEraseDelay != 0u) - { - result = Cy_Flash_SendCmd(CY_FLASH_NON_BLOCKING_MODE, CY_FLASH_START_ERASE_DELAY); - } - else - { - result = Cy_Flash_SendCmd(CY_FLASH_NON_BLOCKING_MODE, CY_FLASH_NO_DELAY); - } - } - - return (result); -} - - -/******************************************************************************* * Function Name: Cy_Flash_StartProgram ****************************************************************************//** * @@ -958,7 +1163,7 @@ cy_en_flashdrv_status_t Cy_Flash_StartErase(uint32_t rowAddr) * detect circuits should be configured to generate an interrupt instead of a reset. * Otherwise, portions of flash may undergo unexpected changes.\n * Before calling this function, the target flash region must be erased by -* the StartErase/EraseRow function.\n +* the StartEraseRow/EraseRow function.\n * Data to be programmed must be located in the SRAM memory region. * \note Before reading data from previously programmed/erased flash rows, the * user must clear the flash cache with the Cy_SysLib_ClearFlashCacheAndBuffer() @@ -989,7 +1194,7 @@ cy_en_flashdrv_status_t Cy_Flash_StartProgram(uint32_t rowAddr, const uint32_t* /* Prepares arguments to be passed to SROM API */ flashContext.opcode = CY_FLASH_OPCODE_PROGRAM_ROW; - if (SFLASH_SINGLE_CORE != 0u) + if (SFLASH_SINGLE_CORE != 0U) { flashContext.opcode |= CY_FLASH_BLOCKING_MODE; } @@ -998,7 +1203,7 @@ cy_en_flashdrv_status_t Cy_Flash_StartProgram(uint32_t rowAddr, const uint32_t* flashContext.arg2 = rowAddr; flashContext.arg3 = (uint32_t)data; - if (cy_device->flashProgramDelay != 0u) + if (cy_device->flashProgramDelay != 0U) { result = Cy_Flash_SendCmd(CY_FLASH_NON_BLOCKING_MODE, CY_FLASH_START_PROGRAM_DELAY); } @@ -1061,7 +1266,7 @@ cy_en_flashdrv_status_t Cy_Flash_RowChecksum (uint32_t rowAddr, uint32_t* checks { result = CY_FLASH_DRV_SUCCESS; - if (1u == cy_device->ipcVersion) + if (CY_IPC_V1) { *checksumPtr = flashContext.opcode & CY_FLASH_RESULT_MASK; } diff --git a/platform/ext/target/psoc64/Native_Driver/source/cy_gpio.c b/platform/ext/target/psoc64/Native_Driver/source/cy_gpio.c index c6cbbd7a0a..938875698a 100644 --- a/platform/ext/target/psoc64/Native_Driver/source/cy_gpio.c +++ b/platform/ext/target/psoc64/Native_Driver/source/cy_gpio.c @@ -64,7 +64,7 @@ extern "C" { * not thread safe as the resource is shared among multiple pins on a port. * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_Pin_Init +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_Pin_Init * *******************************************************************************/ cy_en_gpio_status_t Cy_GPIO_Pin_Init(GPIO_PRT_Type *base, uint32_t pinNum, const cy_stc_gpio_pin_config_t *config) @@ -148,7 +148,7 @@ cy_en_gpio_status_t Cy_GPIO_Pin_Init(GPIO_PRT_Type *base, uint32_t pinNum, const * Cy_SystemInit() before main() entry. * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_Port_Init +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_Port_Init * *******************************************************************************/ cy_en_gpio_status_t Cy_GPIO_Port_Init(GPIO_PRT_Type* base, const cy_stc_gpio_prt_config_t *config) @@ -218,7 +218,7 @@ cy_en_gpio_status_t Cy_GPIO_Port_Init(GPIO_PRT_Type* base, const cy_stc_gpio_prt * Cy_GPIO_Pin_FastInit() function execution is not interrupted. * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_Pin_FastInit +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_Pin_FastInit * *******************************************************************************/ void Cy_GPIO_Pin_FastInit(GPIO_PRT_Type* base, uint32_t pinNum, uint32_t driveMode, @@ -251,7 +251,7 @@ void Cy_GPIO_Pin_FastInit(GPIO_PRT_Type* base, uint32_t pinNum, uint32_t driveMo * Pointer to the pin's port register base address * * \funcusage -* \snippet gpio/gpio_v1_10_sut_01.cydsn/main_cm4.c snippet_Cy_GPIO_Port_Deinit +* \snippet gpio/snippet/main.c snippet_Cy_GPIO_Port_Deinit * *******************************************************************************/ void Cy_GPIO_Port_Deinit(GPIO_PRT_Type* base) diff --git a/platform/ext/target/psoc64/Native_Driver/source/cy_ipc_drv.c b/platform/ext/target/psoc64/Native_Driver/source/cy_ipc_drv.c index 14facc0b29..c70eed7b77 100644 --- a/platform/ext/target/psoc64/Native_Driver/source/cy_ipc_drv.c +++ b/platform/ext/target/psoc64/Native_Driver/source/cy_ipc_drv.c @@ -1,6 +1,6 @@ /***************************************************************************//** * \file cy_ipc_drv.c -* \version 1.30 +* \version 1.40 * * \brief * IPC Driver - This source file contains the low-level driver code for @@ -50,7 +50,7 @@ * function call. * * \funcusage -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_Cy_IPC_Drv_ReadMsgPtr +* \snippet ipc/snippet/main.c snippet_Cy_IPC_Drv_ReadMsgPtr * *******************************************************************************/ cy_en_ipcdrv_status_t Cy_IPC_Drv_LockRelease (IPC_STRUCT_Type* base, uint32_t releaseEventIntr) @@ -101,7 +101,7 @@ cy_en_ipcdrv_status_t Cy_IPC_Drv_LockRelease (IPC_STRUCT_Type* base, uint32_t re * \retval CY_IPC_DRV_ERROR: The IPC channel is unavailable because it is already locked. * * \funcusage -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_Cy_IPC_Drv_SendMsgWord +* \snippet ipc/snippet/main.c snippet_Cy_IPC_Drv_SendMsgWord * *******************************************************************************/ cy_en_ipcdrv_status_t Cy_IPC_Drv_SendMsgWord (IPC_STRUCT_Type* base, uint32_t notifyEventIntr, uint32_t message) @@ -153,7 +153,7 @@ cy_en_ipcdrv_status_t Cy_IPC_Drv_SendMsgWord (IPC_STRUCT_Type* base, uint32_t n * may be invalid. * * \funcusage -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_Cy_IPC_Drv_ReadMsgWord +* \snippet ipc/snippet/main.c snippet_Cy_IPC_Drv_ReadMsgWord * *******************************************************************************/ cy_en_ipcdrv_status_t Cy_IPC_Drv_ReadMsgWord (IPC_STRUCT_Type const * base, uint32_t * message) diff --git a/platform/ext/target/psoc64/Native_Driver/source/cy_ipc_pipe.c b/platform/ext/target/psoc64/Native_Driver/source/cy_ipc_pipe.c index 16675ce882..5800baa614 100644 --- a/platform/ext/target/psoc64/Native_Driver/source/cy_ipc_pipe.c +++ b/platform/ext/target/psoc64/Native_Driver/source/cy_ipc_pipe.c @@ -1,6 +1,6 @@ /***************************************************************************//** * \file cy_ipc_pipe.c -* \version 1.30 +* \version 1.40 * * Description: * IPC Pipe Driver - This source file includes code for the Pipe layer on top @@ -45,8 +45,8 @@ static cy_stc_ipc_pipe_ep_t * cy_ipc_pipe_epArray = NULL; * created and will be used to reference all endpoints. * * \funcusage -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_myIpcPipeEpArray -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_Cy_IPC_Pipe_Config +* \snippet ipc/snippet/main.c snippet_myIpcPipeEpArray +* \snippet ipc/snippet/main.c snippet_Cy_IPC_Pipe_Config * *******************************************************************************/ void Cy_IPC_Pipe_Config(cy_stc_ipc_pipe_ep_t * theEpArray) @@ -74,9 +74,9 @@ void Cy_IPC_Pipe_Config(cy_stc_ipc_pipe_ep_t * theEpArray) * This is the pointer to the pipe configuration structure * * \funcusage -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_myIpcPipeCbArray -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_myIpcPipeEpConfig -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_Cy_IPC_Pipe_Init +* \snippet ipc/snippet/main.c snippet_myIpcPipeCbArray +* \snippet ipc/snippet/main.c snippet_myIpcPipeEpConfig +* \snippet ipc/snippet/main.c snippet_Cy_IPC_Pipe_Init * *******************************************************************************/ void Cy_IPC_Pipe_Init(cy_stc_ipc_pipe_config_t const *config) @@ -178,9 +178,9 @@ void Cy_IPC_Pipe_Init(cy_stc_ipc_pipe_config_t const *config) * This is a pointer to the endpoint interrupt description structure. * * \funcusage -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_myIpcPipeCbArray -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_myIpcPipeEpConfig -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_Cy_IPC_Pipe_EndpointInit +* \snippet ipc/snippet/main.c snippet_myIpcPipeCbArray +* \snippet ipc/snippet/main.c snippet_myIpcPipeEpConfig +* \snippet ipc/snippet/main.c snippet_Cy_IPC_Pipe_EndpointInit * *******************************************************************************/ void Cy_IPC_Pipe_EndpointInit(uint32_t epAddr, cy_ipc_pipe_callback_array_ptr_t cbArray, @@ -246,8 +246,8 @@ void Cy_IPC_Pipe_EndpointInit(uint32_t epAddr, cy_ipc_pipe_callback_array_ptr_t * CY_IPC_PIPE_ERROR_SEND_BUSY: The pipe is already busy sending a message * * \funcusage -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_myReleaseCallback -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_Cy_IPC_Pipe_SendMessage +* \snippet ipc/snippet/main.c snippet_myReleaseCallback +* \snippet ipc/snippet/main.c snippet_Cy_IPC_Pipe_SendMessage * *******************************************************************************/ cy_en_ipc_pipe_status_t Cy_IPC_Pipe_SendMessage(uint32_t toAddr, uint32_t fromAddr, @@ -348,8 +348,8 @@ cy_en_ipc_pipe_status_t Cy_IPC_Pipe_SendMessage(uint32_t toAddr, uint32_t fromAd * CY_IPC_PIPE_ERROR_BAD_CLIENT: Client ID out of range, callback not registered. * * \funcusage -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_myAcquireCallback -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_Cy_IPC_Pipe_RegisterCallback +* \snippet ipc/snippet/main.c snippet_myAcquireCallback +* \snippet ipc/snippet/main.c snippet_Cy_IPC_Pipe_RegisterCallback * *******************************************************************************/ cy_en_ipc_pipe_status_t Cy_IPC_Pipe_RegisterCallback(uint32_t epAddr, cy_ipc_pipe_callback_ptr_t callBackPtr, uint32_t clientId) @@ -399,8 +399,8 @@ cy_en_ipc_pipe_status_t Cy_IPC_Pipe_RegisterCallback(uint32_t epAddr, cy_ipc_pip * None * * \funcusage -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_myDefaultReleaseCallback -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_Cy_IPC_Pipe_RegisterCallbackRel +* \snippet ipc/snippet/main.c snippet_myDefaultReleaseCallback +* \snippet ipc/snippet/main.c snippet_Cy_IPC_Pipe_RegisterCallbackRel * *******************************************************************************/ void Cy_IPC_Pipe_RegisterCallbackRel(uint32_t epAddr, cy_ipc_pipe_relcallback_ptr_t callBackPtr) @@ -432,8 +432,8 @@ void Cy_IPC_Pipe_RegisterCallbackRel(uint32_t epAddr, cy_ipc_pipe_relcallback_pt * next releases. * * \funcusage -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_myIpcPipeEpArray -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_Cy_IPC_Pipe_ExecuteCallback +* \snippet ipc/snippet/main.c snippet_myIpcPipeEpArray +* \snippet ipc/snippet/main.c snippet_Cy_IPC_Pipe_ExecuteCallback * *******************************************************************************/ void Cy_IPC_Pipe_ExecuteCallback(uint32_t epAddr) @@ -555,7 +555,7 @@ void Cy_IPC_Pipe_ExecCallback(cy_stc_ipc_pipe_ep_t * endpoint) * CY_IPC_PIPE_SUCCESS: Callback registered successfully * * \funcusage -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_Cy_IPC_Pipe_EndpointPauseResume +* \snippet ipc/snippet/main.c snippet_Cy_IPC_Pipe_EndpointPauseResume * *******************************************************************************/ cy_en_ipc_pipe_status_t Cy_IPC_Pipe_EndpointPause(uint32_t epAddr) @@ -587,7 +587,7 @@ cy_en_ipc_pipe_status_t Cy_IPC_Pipe_EndpointPause(uint32_t epAddr) * CY_IPC_PIPE_SUCCESS: Callback registered successfully * * \funcusage -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_Cy_IPC_Pipe_EndpointPauseResume +* \snippet ipc/snippet/main.c snippet_Cy_IPC_Pipe_EndpointPauseResume * *******************************************************************************/ cy_en_ipc_pipe_status_t Cy_IPC_Pipe_EndpointResume(uint32_t epAddr) diff --git a/platform/ext/target/psoc64/Native_Driver/source/cy_ipc_sema.c b/platform/ext/target/psoc64/Native_Driver/source/cy_ipc_sema.c index 3da9af89e1..b5120d15d6 100644 --- a/platform/ext/target/psoc64/Native_Driver/source/cy_ipc_sema.c +++ b/platform/ext/target/psoc64/Native_Driver/source/cy_ipc_sema.c @@ -1,6 +1,6 @@ /***************************************************************************//** * \file cy_ipc_sema.c -* \version 1.30 +* \version 1.40 * * Description: * IPC Semaphore Driver - This source file contains the source code for the @@ -66,13 +66,14 @@ static IPC_STRUCT_Type* cy_semaIpcStruct; * \retval CY_IPC_SEMA_ERROR_LOCKED: Could not acquire semaphores IPC channel * * \funcusage -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_Cy_IPC_Sema_Init +* \snippet ipc/snippet/main.c snippet_Cy_IPC_Sema_Init * *******************************************************************************/ cy_en_ipcsema_status_t Cy_IPC_Sema_Init(uint32_t ipcChannel, uint32_t count, uint32_t memPtr[]) { /* Structure containing semaphores control data */ + CY_SECTION(".cy_sharedmem") static cy_stc_ipc_sema_t cy_semaData; cy_en_ipcsema_status_t retStatus = CY_IPC_SEMA_BAD_PARAM; @@ -222,7 +223,7 @@ cy_en_ipcsema_status_t Cy_IPC_Sema_InitExt(uint32_t ipcChannel, cy_stc_ipc_sema_ * \retval CY_IPC_SEMA_OUT_OF_RANGE: The semaphore number is not valid * * \funcusage -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_Cy_IPC_Sema_Set +* \snippet ipc/snippet/main.c snippet_Cy_IPC_Sema_Set * *******************************************************************************/ cy_en_ipcsema_status_t Cy_IPC_Sema_Set(uint32_t semaNumber, bool preemptable) @@ -310,7 +311,7 @@ cy_en_ipcsema_status_t Cy_IPC_Sema_Set(uint32_t semaNumber, bool preemptable) * \retval CY_IPC_SEMA_OUT_OF_RANGE: The semaphore number is not valid * * \funcusage -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_Cy_IPC_Sema_Clear +* \snippet ipc/snippet/main.c snippet_Cy_IPC_Sema_Clear * *******************************************************************************/ cy_en_ipcsema_status_t Cy_IPC_Sema_Clear(uint32_t semaNumber, bool preemptable) @@ -381,7 +382,7 @@ cy_en_ipcsema_status_t Cy_IPC_Sema_Clear(uint32_t semaNumber, bool preemptable) * \retval CY_IPC_SEMA_OUT_OF_RANGE: The semaphore number is not valid * * \funcusage -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_Cy_IPC_Sema_Status +* \snippet ipc/snippet/main.c snippet_Cy_IPC_Sema_Status * *******************************************************************************/ cy_en_ipcsema_status_t Cy_IPC_Sema_Status(uint32_t semaNumber) @@ -427,7 +428,7 @@ cy_en_ipcsema_status_t Cy_IPC_Sema_Status(uint32_t semaNumber) * Returns the semaphores quantity. * * \funcusage -* \snippet IPC_sut_01.cydsn/main_cm4.c snippet_Cy_IPC_Sema_GetMaxSems +* \snippet ipc/snippet/main.c snippet_Cy_IPC_Sema_GetMaxSems * *******************************************************************************/ uint32_t Cy_IPC_Sema_GetMaxSems(void) diff --git a/platform/ext/target/psoc64/Native_Driver/source/cy_prot.c b/platform/ext/target/psoc64/Native_Driver/source/cy_prot.c index 92eb118c57..4731fa7402 100644 --- a/platform/ext/target/psoc64/Native_Driver/source/cy_prot.c +++ b/platform/ext/target/psoc64/Native_Driver/source/cy_prot.c @@ -1,6 +1,6 @@ /***************************************************************************//** * \file cy_prot.c -* \version 1.30 +* \version 1.30.1 * * \brief * Provides an API implementation of the Protection Unit driver @@ -92,7 +92,7 @@ static cy_en_prot_status_t Prot_ConfigPpuAtt(volatile uint32_t * reg, uint16_t p * CY_PROT_FAILURE | The resource is locked. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_ConfigBusMaster +* \snippet prot/snippet/main.c snippet_Cy_Prot_ConfigBusMaster * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_ConfigBusMaster(en_prot_master_t busMaster, bool privileged, bool secure, uint32_t pcMask) @@ -158,7 +158,7 @@ cy_en_prot_status_t Cy_Prot_ConfigBusMaster(en_prot_master_t busMaster, bool pri * CY_PROT_FAILURE | The resource is locked. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_SetActivePC +* \snippet prot/snippet/main.c snippet_Cy_Prot_SetActivePC * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_SetActivePC(en_prot_master_t busMaster, uint32_t pc) @@ -191,7 +191,7 @@ cy_en_prot_status_t Cy_Prot_SetActivePC(en_prot_master_t busMaster, uint32_t pc) * Active protection context of the master \ref cy_en_prot_pc_t. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_SetActivePC +* \snippet prot/snippet/main.c snippet_Cy_Prot_SetActivePC * *******************************************************************************/ uint32_t Cy_Prot_GetActivePC(en_prot_master_t busMaster) @@ -230,7 +230,7 @@ uint32_t Cy_Prot_GetActivePC(en_prot_master_t busMaster) * CY_PROT_FAILURE | Configuration failed due to a protection violation. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_ConfigMpuStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_ConfigMpuStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_ConfigMpuStruct(PROT_MPU_MPU_STRUCT_Type* base, const cy_stc_mpu_cfg_t* config) @@ -279,7 +279,7 @@ cy_en_prot_status_t Cy_Prot_ConfigMpuStruct(PROT_MPU_MPU_STRUCT_Type* base, cons * CY_PROT_FAILURE | The MPU struct is disabled and possibly locked. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_EnableMpuStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_EnableMpuStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_EnableMpuStruct(PROT_MPU_MPU_STRUCT_Type* base) @@ -317,7 +317,7 @@ cy_en_prot_status_t Cy_Prot_EnableMpuStruct(PROT_MPU_MPU_STRUCT_Type* base) * CY_PROT_FAILURE | The MPU struct is enabled and possibly locked. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_DisableMpuStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_DisableMpuStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_DisableMpuStruct(PROT_MPU_MPU_STRUCT_Type* base) @@ -367,7 +367,7 @@ cy_en_prot_status_t Cy_Prot_DisableMpuStruct(PROT_MPU_MPU_STRUCT_Type* base) * CY_PROT_BAD_PARAM | An incorrect/invalid parameter was passed. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_ConfigSmpuMasterStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_ConfigSmpuMasterStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_ConfigSmpuMasterStruct(PROT_SMPU_SMPU_STRUCT_Type* base, const cy_stc_smpu_cfg_t* config) @@ -438,7 +438,7 @@ cy_en_prot_status_t Cy_Prot_ConfigSmpuMasterStruct(PROT_SMPU_SMPU_STRUCT_Type* b * CY_PROT_BAD_PARAM | An incorrect/invalid parameter was passed. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_ConfigSmpuSlaveStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_ConfigSmpuSlaveStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_ConfigSmpuSlaveStruct(PROT_SMPU_SMPU_STRUCT_Type* base, const cy_stc_smpu_cfg_t* config) @@ -501,7 +501,7 @@ cy_en_prot_status_t Cy_Prot_ConfigSmpuSlaveStruct(PROT_SMPU_SMPU_STRUCT_Type* ba * CY_PROT_FAILURE | The Master PU struct is disabled and possibly locked. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_EnableSmpuMasterStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_EnableSmpuMasterStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_EnableSmpuMasterStruct(PROT_SMPU_SMPU_STRUCT_Type* base) @@ -541,7 +541,7 @@ cy_en_prot_status_t Cy_Prot_EnableSmpuMasterStruct(PROT_SMPU_SMPU_STRUCT_Type* b * CY_PROT_FAILURE | The Master PU struct is enabled and possibly locked. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_DisableSmpuMasterStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_DisableSmpuMasterStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_DisableSmpuMasterStruct(PROT_SMPU_SMPU_STRUCT_Type* base) @@ -581,7 +581,7 @@ cy_en_prot_status_t Cy_Prot_DisableSmpuMasterStruct(PROT_SMPU_SMPU_STRUCT_Type* * CY_PROT_FAILURE | The Slave PU struct is disabled and possibly locked. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_EnableSmpuSlaveStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_EnableSmpuSlaveStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_EnableSmpuSlaveStruct(PROT_SMPU_SMPU_STRUCT_Type* base) @@ -621,7 +621,7 @@ cy_en_prot_status_t Cy_Prot_EnableSmpuSlaveStruct(PROT_SMPU_SMPU_STRUCT_Type* ba * CY_PROT_FAILURE | The Slave PU struct is enabled and possibly locked. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_DisableSmpuSlaveStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_DisableSmpuSlaveStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_DisableSmpuSlaveStruct(PROT_SMPU_SMPU_STRUCT_Type* base) @@ -681,7 +681,7 @@ cy_en_prot_status_t Cy_Prot_DisableSmpuSlaveStruct(PROT_SMPU_SMPU_STRUCT_Type* b * CY_PROT_UNAVAILABLE | The requested structure in use or there were no unused structures. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_GetSmpuStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_GetSmpuStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_GetSmpuStruct(PROT_SMPU_SMPU_STRUCT_Type** base, @@ -921,7 +921,7 @@ static cy_en_prot_status_t Prot_ConfigPpuAtt(volatile uint32_t * reg, uint16_t p * \note PC0 accesses are read-only and are always enabled. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_ConfigPpuProgMasterAtt +* \snippet prot/snippet/main.c snippet_Cy_Prot_ConfigPpuProgMasterAtt * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_ConfigPpuProgMasterAtt(PERI_MS_PPU_PR_Type* base, uint16_t pcMask, @@ -1041,7 +1041,7 @@ cy_en_prot_status_t Cy_Prot_ConfigPpuProgSlaveAddr(PERI_MS_PPU_PR_Type* base, ui * \note PC0 accesses are read-only and are always enabled. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_ConfigPpuProgSlaveAtt +* \snippet prot/snippet/main.c snippet_Cy_Prot_ConfigPpuProgSlaveAtt * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_ConfigPpuProgSlaveAtt(PERI_MS_PPU_PR_Type* base, uint16_t pcMask, @@ -1127,7 +1127,7 @@ cy_en_prot_status_t Cy_Prot_EnablePpuProgSlaveRegion(PERI_MS_PPU_PR_Type* base) * CY_PROT_INVALID_STATE | The function was called on the device with an unsupported PERI HW version. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_DisablePpuProgSlaveRegion +* \snippet prot/snippet/main.c snippet_Cy_Prot_DisablePpuProgSlaveRegion * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_DisablePpuProgSlaveRegion(PERI_MS_PPU_PR_Type* base) @@ -1200,7 +1200,7 @@ cy_en_prot_status_t Cy_Prot_DisablePpuProgSlaveRegion(PERI_MS_PPU_PR_Type* base) * \note PC0 accesses are read-only and are always enabled. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_ConfigPpuFixedMasterAtt +* \snippet prot/snippet/main.c snippet_Cy_Prot_ConfigPpuFixedMasterAtt * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_ConfigPpuFixedMasterAtt(PERI_MS_PPU_FX_Type* base, uint16_t pcMask, @@ -1260,7 +1260,7 @@ cy_en_prot_status_t Cy_Prot_ConfigPpuFixedMasterAtt(PERI_MS_PPU_FX_Type* base, u * \note PC0 accesses are read-only and are always enabled. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_ConfigPpuFixedSlaveAtt +* \snippet prot/snippet/main.c snippet_Cy_Prot_ConfigPpuFixedSlaveAtt * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_ConfigPpuFixedSlaveAtt(PERI_MS_PPU_FX_Type* base, uint16_t pcMask, @@ -1309,7 +1309,7 @@ cy_en_prot_status_t Cy_Prot_ConfigPpuFixedSlaveAtt(PERI_MS_PPU_FX_Type* base, ui * CY_PROT_INVALID_STATE | The function was called on the device with an unsupported PERI HW version. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_ConfigPpuProgMasterStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_ConfigPpuProgMasterStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_ConfigPpuProgMasterStruct(PERI_PPU_PR_Type* base, const cy_stc_ppu_prog_cfg_t* config) @@ -1386,7 +1386,7 @@ cy_en_prot_status_t Cy_Prot_ConfigPpuProgMasterStruct(PERI_PPU_PR_Type* base, co * CY_PROT_INVALID_STATE | The function was called on the device with an unsupported PERI HW version. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_ConfigPpuProgSlaveStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_ConfigPpuProgSlaveStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_ConfigPpuProgSlaveStruct(PERI_PPU_PR_Type* base, const cy_stc_ppu_prog_cfg_t* config) @@ -1460,7 +1460,7 @@ cy_en_prot_status_t Cy_Prot_ConfigPpuProgSlaveStruct(PERI_PPU_PR_Type* base, con * CY_PROT_INVALID_STATE | The function was called on the device with an unsupported PERI HW version. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_EnablePpuProgMasterStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_EnablePpuProgMasterStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_EnablePpuProgMasterStruct(PERI_PPU_PR_Type* base) @@ -1505,7 +1505,7 @@ cy_en_prot_status_t Cy_Prot_EnablePpuProgMasterStruct(PERI_PPU_PR_Type* base) * CY_PROT_INVALID_STATE | The function was called on the device with an unsupported PERI HW version. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_DisablePpuProgMasterStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_DisablePpuProgMasterStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_DisablePpuProgMasterStruct(PERI_PPU_PR_Type* base) @@ -1549,7 +1549,7 @@ cy_en_prot_status_t Cy_Prot_DisablePpuProgMasterStruct(PERI_PPU_PR_Type* base) * CY_PROT_INVALID_STATE | The function was called on the device with an unsupported PERI HW version. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_EnablePpuProgSlaveStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_EnablePpuProgSlaveStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_EnablePpuProgSlaveStruct(PERI_PPU_PR_Type* base) @@ -1594,7 +1594,7 @@ cy_en_prot_status_t Cy_Prot_EnablePpuProgSlaveStruct(PERI_PPU_PR_Type* base) * CY_PROT_INVALID_STATE | The function was called on the device with an unsupported PERI HW version. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_DisablePpuProgSlaveStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_DisablePpuProgSlaveStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_DisablePpuProgSlaveStruct(PERI_PPU_PR_Type* base) @@ -1660,7 +1660,7 @@ cy_en_prot_status_t Cy_Prot_DisablePpuProgSlaveStruct(PERI_PPU_PR_Type* base) * CY_PROT_INVALID_STATE | Function was called on unsupported PERI HW version. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_GetPpuProgStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_GetPpuProgStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_GetPpuProgStruct(PERI_PPU_PR_Type** base, cy_en_prot_req_mode_t reqMode, uint32_t ppuProgIndex) @@ -1785,7 +1785,7 @@ cy_en_prot_status_t Cy_Prot_GetPpuProgStruct(PERI_PPU_PR_Type** base, cy_en_prot * CY_PROT_INVALID_STATE | The function was called on the device with an unsupported PERI HW version. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_ConfigPpuFixedGrMasterStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_ConfigPpuFixedGrMasterStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_ConfigPpuFixedGrMasterStruct(PERI_PPU_GR_Type* base, const cy_stc_ppu_gr_cfg_t* config) @@ -1867,7 +1867,7 @@ cy_en_prot_status_t Cy_Prot_ConfigPpuFixedGrMasterStruct(PERI_PPU_GR_Type* base, * CY_PROT_INVALID_STATE | The function was called on the device with an unsupported PERI HW version. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_ConfigPpuFixedGrSlaveStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_ConfigPpuFixedGrSlaveStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_ConfigPpuFixedGrSlaveStruct(PERI_PPU_GR_Type* base, const cy_stc_ppu_gr_cfg_t* config) @@ -1936,7 +1936,7 @@ cy_en_prot_status_t Cy_Prot_ConfigPpuFixedGrSlaveStruct(PERI_PPU_GR_Type* base, * CY_PROT_INVALID_STATE | The function was called on the device with an unsupported PERI HW version. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_EnablePpuFixedGrMasterStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_EnablePpuFixedGrMasterStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_EnablePpuFixedGrMasterStruct(PERI_PPU_GR_Type* base) @@ -1981,7 +1981,7 @@ cy_en_prot_status_t Cy_Prot_EnablePpuFixedGrMasterStruct(PERI_PPU_GR_Type* base) * CY_PROT_INVALID_STATE | The function was called on the device with an unsupported PERI HW version. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_DisablePpuFixedGrMasterStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_DisablePpuFixedGrMasterStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_DisablePpuFixedGrMasterStruct(PERI_PPU_GR_Type* base) @@ -2025,7 +2025,7 @@ cy_en_prot_status_t Cy_Prot_DisablePpuFixedGrMasterStruct(PERI_PPU_GR_Type* base * CY_PROT_INVALID_STATE | The function was called on the device with an unsupported PERI HW version. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_EnablePpuFixedGrSlaveStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_EnablePpuFixedGrSlaveStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_EnablePpuFixedGrSlaveStruct(PERI_PPU_GR_Type* base) @@ -2070,7 +2070,7 @@ cy_en_prot_status_t Cy_Prot_EnablePpuFixedGrSlaveStruct(PERI_PPU_GR_Type* base) * CY_PROT_INVALID_STATE | The function was called on the device with an unsupported PERI HW version. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_DisablePpuFixedGrSlaveStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_DisablePpuFixedGrSlaveStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_DisablePpuFixedGrSlaveStruct(PERI_PPU_GR_Type* base) @@ -2124,7 +2124,7 @@ cy_en_prot_status_t Cy_Prot_DisablePpuFixedGrSlaveStruct(PERI_PPU_GR_Type* base) * CY_PROT_INVALID_STATE | The function was called on the device with an unsupported PERI HW version. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_ConfigPpuFixedSlMasterStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_ConfigPpuFixedSlMasterStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_ConfigPpuFixedSlMasterStruct(PERI_GR_PPU_SL_Type* base, const cy_stc_ppu_sl_cfg_t* config) @@ -2205,7 +2205,7 @@ cy_en_prot_status_t Cy_Prot_ConfigPpuFixedSlMasterStruct(PERI_GR_PPU_SL_Type* ba * CY_PROT_INVALID_STATE | The function was called on the device with an unsupported PERI HW version. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_ConfigPpuFixedSlSlaveStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_ConfigPpuFixedSlSlaveStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_ConfigPpuFixedSlSlaveStruct(PERI_GR_PPU_SL_Type* base, const cy_stc_ppu_sl_cfg_t* config) @@ -2274,7 +2274,7 @@ cy_en_prot_status_t Cy_Prot_ConfigPpuFixedSlSlaveStruct(PERI_GR_PPU_SL_Type* bas * CY_PROT_INVALID_STATE | The function was called on the device with an unsupported PERI HW version. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_EnablePpuFixedSlMasterStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_EnablePpuFixedSlMasterStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_EnablePpuFixedSlMasterStruct(PERI_GR_PPU_SL_Type* base) @@ -2319,7 +2319,7 @@ cy_en_prot_status_t Cy_Prot_EnablePpuFixedSlMasterStruct(PERI_GR_PPU_SL_Type* ba * CY_PROT_INVALID_STATE | The function was called on the device with an unsupported PERI HW version. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_DisablePpuFixedSlMasterStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_DisablePpuFixedSlMasterStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_DisablePpuFixedSlMasterStruct(PERI_GR_PPU_SL_Type* base) @@ -2363,7 +2363,7 @@ cy_en_prot_status_t Cy_Prot_DisablePpuFixedSlMasterStruct(PERI_GR_PPU_SL_Type* b * CY_PROT_INVALID_STATE | The function was called on the device with an unsupported PERI HW version. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_EnablePpuFixedSlSlaveStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_EnablePpuFixedSlSlaveStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_EnablePpuFixedSlSlaveStruct(PERI_GR_PPU_SL_Type* base) @@ -2408,7 +2408,7 @@ cy_en_prot_status_t Cy_Prot_EnablePpuFixedSlSlaveStruct(PERI_GR_PPU_SL_Type* bas * CY_PROT_INVALID_STATE | The function was called on the device with an unsupported PERI HW version. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_DisablePpuFixedSlSlaveStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_DisablePpuFixedSlSlaveStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_DisablePpuFixedSlSlaveStruct(PERI_GR_PPU_SL_Type* base) @@ -2462,7 +2462,7 @@ cy_en_prot_status_t Cy_Prot_DisablePpuFixedSlSlaveStruct(PERI_GR_PPU_SL_Type* ba * CY_PROT_INVALID_STATE | The function was called on the device with an unsupported PERI HW version. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_ConfigPpuFixedRgMasterStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_ConfigPpuFixedRgMasterStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_ConfigPpuFixedRgMasterStruct(PERI_GR_PPU_RG_Type* base, const cy_stc_ppu_rg_cfg_t* config) @@ -2543,7 +2543,7 @@ cy_en_prot_status_t Cy_Prot_ConfigPpuFixedRgMasterStruct(PERI_GR_PPU_RG_Type* ba * CY_PROT_INVALID_STATE | The function was called on the device with an unsupported PERI HW version. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_ConfigPpuFixedRgSlaveStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_ConfigPpuFixedRgSlaveStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_ConfigPpuFixedRgSlaveStruct(PERI_GR_PPU_RG_Type* base, const cy_stc_ppu_rg_cfg_t* config) @@ -2612,7 +2612,7 @@ cy_en_prot_status_t Cy_Prot_ConfigPpuFixedRgSlaveStruct(PERI_GR_PPU_RG_Type* bas * CY_PROT_INVALID_STATE | The function was called on the device with an unsupported PERI HW version. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_EnablePpuFixedRgMasterStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_EnablePpuFixedRgMasterStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_EnablePpuFixedRgMasterStruct(PERI_GR_PPU_RG_Type* base) @@ -2655,7 +2655,7 @@ cy_en_prot_status_t Cy_Prot_EnablePpuFixedRgMasterStruct(PERI_GR_PPU_RG_Type* ba * CY_PROT_INVALID_STATE | The function was called on the device with an unsupported PERI HW version. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_DisablePpuFixedRgMasterStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_DisablePpuFixedRgMasterStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_DisablePpuFixedRgMasterStruct(PERI_GR_PPU_RG_Type* base) @@ -2697,7 +2697,7 @@ cy_en_prot_status_t Cy_Prot_DisablePpuFixedRgMasterStruct(PERI_GR_PPU_RG_Type* b * CY_PROT_INVALID_STATE | The function was called on the device with an unsupported PERI HW version. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_EnablePpuFixedRgSlaveStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_EnablePpuFixedRgSlaveStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_EnablePpuFixedRgSlaveStruct(PERI_GR_PPU_RG_Type* base) @@ -2740,7 +2740,7 @@ cy_en_prot_status_t Cy_Prot_EnablePpuFixedRgSlaveStruct(PERI_GR_PPU_RG_Type* bas * CY_PROT_INVALID_STATE | The function was called on the device with an unsupported PERI HW version. * * \funcusage -* \snippet prot/1.20/snippet/main.c snippet_Cy_Prot_DisablePpuFixedRgSlaveStruct +* \snippet prot/snippet/main.c snippet_Cy_Prot_DisablePpuFixedRgSlaveStruct * *******************************************************************************/ cy_en_prot_status_t Cy_Prot_DisablePpuFixedRgSlaveStruct(PERI_GR_PPU_RG_Type* base) diff --git a/platform/ext/target/psoc64/Native_Driver/source/cy_scb_common.c b/platform/ext/target/psoc64/Native_Driver/source/cy_scb_common.c index 35f067ebc0..8cfb4dba11 100644 --- a/platform/ext/target/psoc64/Native_Driver/source/cy_scb_common.c +++ b/platform/ext/target/psoc64/Native_Driver/source/cy_scb_common.c @@ -1,6 +1,6 @@ /***************************************************************************//** * \file cy_scb_common.c -* \version 2.20 +* \version 2.30.1 * * Provides common API implementation of the SCB driver. * diff --git a/platform/ext/target/psoc64/Native_Driver/source/cy_scb_uart.c b/platform/ext/target/psoc64/Native_Driver/source/cy_scb_uart.c index e71d15b3ea..02babb2603 100644 --- a/platform/ext/target/psoc64/Native_Driver/source/cy_scb_uart.c +++ b/platform/ext/target/psoc64/Native_Driver/source/cy_scb_uart.c @@ -1,6 +1,6 @@ /***************************************************************************//** * \file cy_scb_uart.c -* \version 2.20 +* \version 2.30.1 * * Provides UART API implementation of the SCB driver. * @@ -1131,6 +1131,17 @@ void Cy_SCB_UART_Interrupt(CySCB_Type *base, cy_stc_scb_uart_context_t *context) Cy_SCB_ClearRxInterrupt(base, CY_SCB_RX_INTR_LEVEL); } + + if (0UL != (CY_SCB_RX_INTR_NOT_EMPTY & Cy_SCB_GetRxInterruptStatusMasked(base))) + { + if (NULL != context->cbEvents) + { + context->cbEvents(CY_SCB_UART_RECEIVE_NOT_EMTPY); + } + + Cy_SCB_ClearRxInterrupt(base, CY_SCB_RX_INTR_NOT_EMPTY); + } + } if (0UL != (CY_SCB_TX_INTR & Cy_SCB_GetInterruptCause(base))) @@ -1171,6 +1182,17 @@ void Cy_SCB_UART_Interrupt(CySCB_Type *base, cy_stc_scb_uart_context_t *context) context->cbEvents(CY_SCB_UART_TRANSMIT_DONE_EVENT); } } + + if (0UL != (CY_SCB_UART_TX_EMPTY & Cy_SCB_GetTxInterruptStatusMasked(base))) + { + if (NULL != context->cbEvents) + { + context->cbEvents(CY_SCB_UART_TRANSMIT_EMTPY); + } + + Cy_SCB_ClearTxInterrupt(base, CY_SCB_UART_TX_EMPTY); + } + } } diff --git a/platform/ext/target/psoc64/Native_Driver/source/cy_sysclk.c b/platform/ext/target/psoc64/Native_Driver/source/cy_sysclk.c index f22507f51b..6d49d85fc7 100644 --- a/platform/ext/target/psoc64/Native_Driver/source/cy_sysclk.c +++ b/platform/ext/target/psoc64/Native_Driver/source/cy_sysclk.c @@ -1,6 +1,6 @@ /***************************************************************************//** * \file cy_sysclk.c -* \version 1.30 +* \version 1.40.2 * * Provides an API implementation of the sysclk driver. * @@ -28,8 +28,43 @@ #include <stdlib.h> -/* # of elements in an array */ -#define CY_SYSCLK_N_ELMTS(a) (sizeof(a) / sizeof((a)[0])) +/* ========================================================================== */ +/* ========================= EXTCLK SECTION =========================== */ +/* ========================================================================== */ + +/** \cond INTERNAL */ +static uint32_t extFreq = 0UL; /* Internal storage for external clock frequency user setting */ + +#define CY_SYSCLK_EXTCLK_MAX_FREQ (100000000UL) /* 100 MHz */ +/** \endcond */ + +/** +* \addtogroup group_sysclk_ext_funcs +* \{ +*/ + +/******************************************************************************* +* Function Name: Cy_SysClk_ExtClkSetFrequency +****************************************************************************//** +* +* Sets the signal frequency of the External Clock Source (EXTCLK) into the +* internal storage to be used in \ref Cy_SysClk_ClkHfGetFrequency. +* +* \param freq The frequency of the External Clock Source. +* +* \funcusage +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ExtClkSetFrequency +* +*******************************************************************************/ +void Cy_SysClk_ExtClkSetFrequency(uint32_t freq) +{ + if (freq <= CY_SYSCLK_EXTCLK_MAX_FREQ) + { + extFreq = freq; + } +} +/** \} group_sysclk_ext_funcs */ + /* ========================================================================== */ /* =========================== ECO SECTION ============================ */ @@ -42,7 +77,7 @@ SRSS_CLK_TRIM_ECO_CTL_RTRIM_Msk | \ SRSS_CLK_TRIM_ECO_CTL_GTRIM_Msk) - + /******************************************************************************* * Function Name: cy_sqrt * Calculates square root. @@ -69,8 +104,9 @@ static uint32_t cy_sqrt(uint64_t x) return (res); } -/** \endcond */ +static uint32_t ecoFreq = 0UL; /* Internal storage for ECO frequency user setting */ +/** \endcond */ /** * \addtogroup group_sysclk_eco_funcs @@ -139,7 +175,7 @@ static uint32_t cy_sqrt(uint64_t x) * * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_EcoConfigure +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_EcoConfigure * *******************************************************************************/ cy_en_sysclk_status_t Cy_SysClk_EcoConfigure(uint32_t freq, uint32_t cLoad, uint32_t esr, uint32_t driveLevel) @@ -149,11 +185,11 @@ cy_en_sysclk_status_t Cy_SysClk_EcoConfigure(uint32_t freq, uint32_t cLoad, uint if (0UL == (SRSS_CLK_ECO_CONFIG_ECO_EN_Msk & SRSS_CLK_ECO_CONFIG)) { /* calculate intermediate values */ - uint32_t maxAmplitude = (uint32_t)CY_SYSCLK_DIV_ROUND((1000000000000ULL * /* 1000000.0f * 1000.0f * 10^3 */ - cy_sqrt(CY_SYSCLK_DIV_ROUND(500000ULL * (uint64_t)driveLevel, (uint64_t)esr))), + uint32_t maxAmplitude = (uint32_t)CY_SYSLIB_DIV_ROUND((1000000000000ULL * /* 1000000.0f * 1000.0f * 10^3 */ + cy_sqrt(CY_SYSLIB_DIV_ROUND(500000ULL * (uint64_t)driveLevel, (uint64_t)esr))), (3141ULL * (uint64_t)freq * (uint64_t)cLoad)); /* The result is scaled by 10^3 */ - uint32_t nAmpSections = (uint32_t)CY_SYSCLK_DIV_ROUND((uint64_t)freq * + uint32_t nAmpSections = (uint32_t)CY_SYSLIB_DIV_ROUND((uint64_t)freq * (uint64_t)freq * (uint64_t)cLoad * (uint64_t)cLoad, 5704868154158ULL); /* (4.5 * (10^15) / 788.8), the result is scaled by 10^6 */ @@ -174,7 +210,7 @@ cy_en_sysclk_status_t Cy_SysClk_EcoConfigure(uint32_t freq, uint32_t cLoad, uint uint32_t wdtrim = (maxAmplitude < 1200UL) ? ((maxAmplitude / 100UL) - 4UL) : 6UL; - uint32_t gtrim = ((nAmpSections > 1000000UL) ? CY_SYSCLK_DIV_ROUND(nAmpSections, 1000000UL) : + uint32_t gtrim = ((nAmpSections > 1000000UL) ? CY_SYSLIB_DIV_ROUND(nAmpSections, 1000000UL) : ((nAmpSections == 1000000UL) ? 0UL : 1UL)); uint32_t rtrim = ((freq > 26800000UL) ? 0UL : @@ -190,6 +226,8 @@ cy_en_sysclk_status_t Cy_SysClk_EcoConfigure(uint32_t freq, uint32_t cLoad, uint CY_REG32_CLR_SET(SRSS_CLK_TRIM_ECO_CTL, CY_SYSCLK_TRIM_ECO, reg); + ecoFreq = freq; /* Store ECO frequency */ + retVal = CY_SYSCLK_SUCCESS; } /* if valid parameters */ } /* if ECO not enabled */ @@ -217,7 +255,7 @@ cy_en_sysclk_status_t Cy_SysClk_EcoConfigure(uint32_t freq, uint32_t cLoad, uint * if it affects the CLK_HF0 frequency. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_EcoEnable +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_EcoEnable * *******************************************************************************/ cy_en_sysclk_status_t Cy_SysClk_EcoEnable(uint32_t timeoutus) @@ -283,7 +321,7 @@ cy_en_sysclk_status_t Cy_SysClk_EcoEnable(uint32_t timeoutus) * it affects the CLK_HF0 frequency and the frequency is decreasing. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_ClkPathSetSource +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkPathSetSource * *******************************************************************************/ cy_en_sysclk_status_t Cy_SysClk_ClkPathSetSource(uint32_t clkPath, cy_en_clkpath_in_sources_t source) @@ -319,7 +357,7 @@ cy_en_sysclk_status_t Cy_SysClk_ClkPathSetSource(uint32_t clkPath, cy_en_clkpath * \return \ref cy_en_clkpath_in_sources_t * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_ClkPathGetSource +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkPathGetSource * *******************************************************************************/ cy_en_clkpath_in_sources_t Cy_SysClk_ClkPathGetSource(uint32_t clkPath) @@ -406,7 +444,7 @@ cy_en_clkpath_in_sources_t Cy_SysClk_ClkPathGetSource(uint32_t clkPath) * the FLL is the source of CLK_HF0 and the FLL frequency is decreasing. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_FllConfigure +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_FllConfigure * *******************************************************************************/ cy_en_sysclk_status_t Cy_SysClk_FllConfigure(uint32_t inputFreq, uint32_t outputFreq, cy_en_fll_pll_output_mode_t outputMode) @@ -444,17 +482,17 @@ cy_en_sysclk_status_t Cy_SysClk_FllConfigure(uint32_t inputFreq, uint32_t output /* 4. Compute the FLL reference divider value. refDiv is a constant if the WCO is the FLL source, otherwise the formula is refDiv = ROUNDUP((inputFreq / outputFreq) * 250) */ - config.refDiv = wcoSource ? 19U : (uint16_t)CY_SYSCLK_DIV_ROUNDUP((uint64_t)inputFreq * 250ULL, (uint64_t)outputFreq); + config.refDiv = wcoSource ? 19U : (uint16_t)CY_SYSLIB_DIV_ROUNDUP((uint64_t)inputFreq * 250ULL, (uint64_t)outputFreq); /* 5. Compute the FLL multiplier value. Formula is fllMult = ccoFreq / (inputFreq / refDiv) */ - config.fllMult = (uint32_t)CY_SYSCLK_DIV_ROUNDUP((uint64_t)ccoFreq * (uint64_t)config.refDiv, (uint64_t)inputFreq); + config.fllMult = (uint32_t)CY_SYSLIB_DIV_ROUNDUP((uint64_t)ccoFreq * (uint64_t)config.refDiv, (uint64_t)inputFreq); /* 6. Compute the lock tolerance. Formula is lock tolerance = 1.5 * fllMult * (((1 + CCO accuracy) / (1 - source clock accuracy)) - 1) We assume CCO accuracy is 0.25%. We assume the source clock accuracy = 1%. This is the accuracy of the IMO. Therefore the formula is lock tolerance = 1.5 * fllMult * 0.012626 = 0.018939 * fllMult */ - config.lockTolerance = (uint16_t)CY_SYSCLK_DIV_ROUNDUP(config.fllMult * 18939UL, 1000000UL); + config.lockTolerance = (uint16_t)CY_SYSLIB_DIV_ROUNDUP(config.fllMult * 18939UL, 1000000UL); { /* constants indexed by ccoRange */ @@ -464,7 +502,7 @@ cy_en_sysclk_status_t Cy_SysClk_FllConfigure(uint32_t inputFreq, uint32_t output { /* intermediate parameters */ uint32_t kcco = (trimSteps[config.ccoRange] * margin[config.ccoRange]); - uint32_t ki_p = (uint32_t)CY_SYSCLK_DIV_ROUND(850ULL * CY_SYSCLK_FLL_INT_COEF * inputFreq, (uint64_t)kcco * (uint64_t)config.refDiv); + uint32_t ki_p = (uint32_t)CY_SYSLIB_DIV_ROUND(850ULL * CY_SYSCLK_FLL_INT_COEF * inputFreq, (uint64_t)kcco * (uint64_t)config.refDiv); /* find the largest IGAIN value that is less than or equal to ki_p */ uint32_t locigain = CY_SYSCLK_FLL_GAIN_VAL; @@ -496,7 +534,7 @@ cy_en_sysclk_status_t Cy_SysClk_FllConfigure(uint32_t inputFreq, uint32_t output /* 8. Compute the CCO_FREQ bits in CLK_FLL_CONFIG4 register */ { - uint64_t cmp = CY_SYSCLK_DIV_ROUND(((TRIM_STEPS_SCALE / MARGIN_SCALE) * (uint64_t)ccoFreq), (uint64_t)margin[config.ccoRange]); + uint64_t cmp = CY_SYSLIB_DIV_ROUND(((TRIM_STEPS_SCALE / MARGIN_SCALE) * (uint64_t)ccoFreq), (uint64_t)margin[config.ccoRange]); uint64_t mlt = TRIM_STEPS_SCALE + (uint64_t)trimSteps[config.ccoRange]; uint64_t res = mlt; @@ -513,9 +551,9 @@ cy_en_sysclk_status_t Cy_SysClk_FllConfigure(uint32_t inputFreq, uint32_t output /* 9. Compute the settling count, using a 1 usec settling time. Use a constant if the WCO is the FLL source */ { - uint64_t fref = CY_SYSCLK_DIV_ROUND(6000ULL * (uint64_t)inputFreq, (uint64_t)config.refDiv); - uint32_t divval = CY_SYSCLK_DIV_ROUNDUP(inputFreq, 1000000UL); - uint32_t altval = (uint32_t)CY_SYSCLK_DIV_ROUNDUP((uint64_t)divval * fref, 6000000ULL) + 1UL; + uint64_t fref = CY_SYSLIB_DIV_ROUND(6000ULL * (uint64_t)inputFreq, (uint64_t)config.refDiv); + uint32_t divval = CY_SYSLIB_DIV_ROUNDUP(inputFreq, 1000000UL); + uint32_t altval = (uint32_t)CY_SYSLIB_DIV_ROUNDUP((uint64_t)divval * fref, 6000000ULL) + 1UL; config.settlingCount = wcoSource ? 200U : (uint16_t) ((outputFreq < fref) ? divval : @@ -566,7 +604,7 @@ cy_en_sysclk_status_t Cy_SysClk_FllConfigure(uint32_t inputFreq, uint32_t output * the FLL is the source of CLK_HF0 and the FLL frequency is decreasing. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_FllManualConfigure +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_FllManualConfigure * *******************************************************************************/ cy_en_sysclk_status_t Cy_SysClk_FllManualConfigure(const cy_stc_fll_manual_config_t *config) @@ -576,7 +614,7 @@ cy_en_sysclk_status_t Cy_SysClk_FllManualConfigure(const cy_stc_fll_manual_confi /* Check for errors */ CY_ASSERT_L1(config != NULL); - if (!_FLD2BOOL(SRSS_CLK_FLL_CONFIG_FLL_ENABLE, SRSS_CLK_FLL_CONFIG)) /* If disabled */ + if (!Cy_SysClk_FllIsEnabled()) /* If disabled */ { /* update CLK_FLL_CONFIG register with 2 parameters; FLL_ENABLE is already 0 */ /* asserts just check for bitfield overflow */ @@ -627,7 +665,7 @@ cy_en_sysclk_status_t Cy_SysClk_FllManualConfigure(const cy_stc_fll_manual_confi * \param config \ref cy_stc_fll_manual_config_t * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_FllGetConfiguration +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_FllGetConfiguration * *******************************************************************************/ void Cy_SysClk_FllGetConfiguration(cy_stc_fll_manual_config_t *config) @@ -680,7 +718,7 @@ void Cy_SysClk_FllGetConfiguration(cy_stc_fll_manual_config_t *config) * the FLL is the source of CLK_HF0 and the CLK_HF0 frequency is increasing. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_FllEnable +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_FllEnable * *******************************************************************************/ cy_en_sysclk_status_t Cy_SysClk_FllEnable(uint32_t timeoutus) @@ -815,7 +853,7 @@ cy_en_sysclk_status_t Cy_SysClk_FllEnable(uint32_t timeoutus) * the PLL is the source of CLK_HF0 and the PLL frequency is decreasing. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_PllConfigure +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_PllConfigure * *******************************************************************************/ cy_en_sysclk_status_t Cy_SysClk_PllConfigure(uint32_t clkPath, const cy_stc_pll_config_t *config) @@ -829,14 +867,10 @@ cy_en_sysclk_status_t Cy_SysClk_PllConfigure(uint32_t clkPath, const cy_stc_pll_ } else { - cy_stc_pll_manual_config_t manualConfig; - manualConfig.feedbackDiv = 0U; - manualConfig.referenceDiv = 0U; - manualConfig.outputDiv = 0U; + cy_stc_pll_manual_config_t manualConfig = {0U, 0U, 0U, false, CY_SYSCLK_FLLPLL_OUTPUT_AUTO}; - /* If output mode is bypass (input routed directly to output), then done. - The output frequency equals the input frequency regardless of the - frequency parameters. */ + /* If output mode is not bypass (input routed directly to output), then + calculate new parameters. */ if (config->outputMode != CY_SYSCLK_FLLPLL_OUTPUT_INPUT) { /* for each possible value of OUTPUT_DIV and REFERENCE_DIV (Q), try @@ -874,10 +908,18 @@ cy_en_sysclk_status_t Cy_SysClk_PllConfigure(uint32_t clkPath, const cy_stc_pll_ } } /* exit loops if foutBest equals outputFreq */ + + manualConfig.lfMode = config->lfMode; } /* if not, bypass output mode */ + /* If output mode is bypass (input routed directly to output), then + use old parameters. */ + else + { + (void)Cy_SysClk_PllGetConfiguration(clkPath, &manualConfig); + } /* configure PLL based on calculated values */ - manualConfig.lfMode = config->lfMode; + manualConfig.outputMode = config->outputMode; retVal = Cy_SysClk_PllManualConfigure(clkPath, &manualConfig); @@ -922,19 +964,19 @@ cy_en_sysclk_status_t Cy_SysClk_PllConfigure(uint32_t clkPath, const cy_stc_pll_ * the PLL is the source of CLK_HF0 and the PLL frequency is decreasing. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_PllManualConfigure +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_PllManualConfigure * *******************************************************************************/ cy_en_sysclk_status_t Cy_SysClk_PllManualConfigure(uint32_t clkPath, const cy_stc_pll_manual_config_t *config) { cy_en_sysclk_status_t retVal = CY_SYSCLK_SUCCESS; - clkPath--; /* to correctly access PLL config registers structure */ + /* check for errors */ - if (clkPath >= CY_SRSS_NUM_PLL) /* invalid clock path number */ + if (clkPath > CY_SRSS_NUM_PLL) /* invalid clock path number */ { retVal = CY_SYSCLK_BAD_PARAM; } - else if (_FLD2BOOL(SRSS_CLK_PLL_CONFIG_ENABLE, SRSS_CLK_PLL_CONFIG[clkPath])) + else if (Cy_SysClk_PllIsEnabled(clkPath)) { retVal = CY_SYSCLK_INVALID_STATE; } @@ -947,6 +989,7 @@ cy_en_sysclk_status_t Cy_SysClk_PllManualConfigure(uint32_t clkPath, const cy_st } else /* no errors */ { + clkPath--; /* to correctly access PLL config registers structure */ /* If output mode is bypass (input routed directly to output), then done. The output frequency equals the input frequency regardless of the frequency parameters. */ if (config->outputMode != CY_SYSCLK_FLLPLL_OUTPUT_INPUT) @@ -979,7 +1022,7 @@ cy_en_sysclk_status_t Cy_SysClk_PllManualConfigure(uint32_t clkPath, const cy_st * CY_SYSCLK_BAD_PARAM - invalid clock path number * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_PllGetConfiguration +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_PllGetConfiguration * *******************************************************************************/ cy_en_sysclk_status_t Cy_SysClk_PllGetConfiguration(uint32_t clkPath, cy_stc_pll_manual_config_t *config) @@ -1029,12 +1072,13 @@ cy_en_sysclk_status_t Cy_SysClk_PllGetConfiguration(uint32_t clkPath, cy_stc_pll * the PLL is the source of CLK_HF0 and the CLK_HF0 frequency is decreasing. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_PllEnable +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_PllEnable * *******************************************************************************/ cy_en_sysclk_status_t Cy_SysClk_PllEnable(uint32_t clkPath, uint32_t timeoutus) { cy_en_sysclk_status_t retVal = CY_SYSCLK_BAD_PARAM; + bool nonZeroTimeout = (timeoutus != 0ul); clkPath--; /* to correctly access PLL config and status registers structures */ if (clkPath < CY_SRSS_NUM_PLL) { @@ -1048,7 +1092,7 @@ cy_en_sysclk_status_t Cy_SysClk_PllEnable(uint32_t clkPath, uint32_t timeoutus) { Cy_SysLib_DelayUs(1U); } - retVal = ((timeoutus == 0UL) ? CY_SYSCLK_TIMEOUT : CY_SYSCLK_SUCCESS); + retVal = ((nonZeroTimeout && (timeoutus == 0ul)) ? CY_SYSCLK_TIMEOUT : CY_SYSCLK_SUCCESS); } return (retVal); } @@ -1133,7 +1177,7 @@ static bool preventCounting = false; * the measured clock frequency may not be accurate. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_StartClkMeasurementCounters +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_StartClkMeasurementCounters * *******************************************************************************/ cy_en_sysclk_status_t Cy_SysClk_StartClkMeasurementCounters(cy_en_meas_clks_t clock1, uint32_t count1, cy_en_meas_clks_t clock2) @@ -1320,11 +1364,11 @@ uint32_t Cy_SysClk_ClkMeasurementCountersGetFreq(bool measuredClock, uint32_t re { if (!measuredClock) { /* clock1 is the measured clock */ - retVal = (uint32_t)CY_SYSCLK_DIV_ROUND((uint64_t)clk1Count1 * (uint64_t)refClkFreq, (uint64_t)retVal); + retVal = (uint32_t)CY_SYSLIB_DIV_ROUND((uint64_t)clk1Count1 * (uint64_t)refClkFreq, (uint64_t)retVal); } else { /* clock2 is the measured clock */ - retVal = (uint32_t)CY_SYSCLK_DIV_ROUND((uint64_t)retVal * (uint64_t)refClkFreq, (uint64_t)clk1Count1); + retVal = (uint32_t)CY_SYSLIB_DIV_ROUND((uint64_t)retVal * (uint64_t)refClkFreq, (uint64_t)clk1Count1); } } else @@ -1360,14 +1404,14 @@ uint32_t Cy_SysClk_ClkMeasurementCountersGetFreq(bool measuredClock, uint32_t re * \note The watchdog timer (WDT) must be unlocked before calling this function. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_IloTrim +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_IloTrim * *******************************************************************************/ /** \cond INTERNAL */ /* target frequency */ #define CY_SYSCLK_ILO_TARGET_FREQ (32768UL) /* Nominal trim step size is 1.5% of "the frequency". Using the target frequency */ -#define CY_SYSCLK_ILO_TRIM_STEP (CY_SYSCLK_DIV_ROUND(CY_SYSCLK_ILO_TARGET_FREQ * 15UL, 1000UL)) +#define CY_SYSCLK_ILO_TRIM_STEP (CY_SYSLIB_DIV_ROUND(CY_SYSCLK_ILO_TARGET_FREQ * 15UL, 1000UL)) /** \endcond */ int32_t Cy_SysClk_IloTrim(uint32_t iloFreq) @@ -1395,7 +1439,7 @@ int32_t Cy_SysClk_IloTrim(uint32_t iloFreq) /* Get current trim value */ uint32_t trim = _FLD2VAL(SRSS_CLK_TRIM_ILO_CTL_ILO_FTRIM, SRSS_CLK_TRIM_ILO_CTL); - diff = CY_SYSCLK_DIV_ROUND(diff, CY_SYSCLK_ILO_TRIM_STEP); + diff = CY_SYSLIB_DIV_ROUND(diff, CY_SYSCLK_ILO_TRIM_STEP); if(sign) { @@ -1425,7 +1469,7 @@ int32_t Cy_SysClk_IloTrim(uint32_t iloFreq) * \return Change in trim value; 0 if done, that is, no change in trim value. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_PiloTrim +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_PiloTrim * *******************************************************************************/ /** \cond INTERNAL */ @@ -1460,7 +1504,7 @@ int32_t Cy_SysClk_PiloTrim(uint32_t piloFreq) /* Get current trim value */ uint32_t trim = Cy_SysClk_PiloGetTrim(); - diff = CY_SYSCLK_DIV_ROUND(diff, CY_SYSCLK_PILO_TRIM_STEP); + diff = CY_SYSLIB_DIV_ROUND(diff, CY_SYSCLK_PILO_TRIM_STEP); if(sign) {/* piloFreq too low. Increase the trim value */ @@ -1550,7 +1594,7 @@ int32_t Cy_SysClk_PiloTrim(uint32_t piloFreq) * or PLL to get stable / regain its frequency lock. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_DeepSleepCallback +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_DeepSleepCallback * *******************************************************************************/ cy_en_syspm_status_t Cy_SysClk_DeepSleepCallback(cy_stc_syspm_callback_params_t * callbackParams, cy_en_syspm_callback_mode_t mode) @@ -1596,8 +1640,7 @@ cy_en_syspm_status_t Cy_SysClk_DeepSleepCallback(cy_stc_syspm_callback_params_t for (fllpll = 0UL; fllpll <= CY_SRSS_NUM_PLL; fllpll++) { /* If FLL or PLL is enabled */ - if ((0UL == fllpll) ? (_FLD2BOOL(SRSS_CLK_FLL_CONFIG_FLL_ENABLE, SRSS_CLK_FLL_CONFIG)) : - (_FLD2BOOL(SRSS_CLK_PLL_CONFIG_ENABLE, SRSS_CLK_PLL_CONFIG[fllpll - 1UL]))) + if ((0UL == fllpll) ? Cy_SysClk_FllIsEnabled() : Cy_SysClk_PllIsEnabled(fllpll)) { /* And the FLL/PLL has ECO as a source */ if (Cy_SysClk_ClkPathGetSource(fllpll) == CY_SYSCLK_CLKPATH_IN_ECO) @@ -1710,7 +1753,7 @@ cy_en_syspm_status_t Cy_SysClk_DeepSleepCallback(cy_stc_syspm_callback_params_t } } } - else if (_FLD2BOOL(SRSS_CLK_FLL_CONFIG_FLL_ENABLE, SRSS_CLK_FLL_CONFIG)) + else if (Cy_SysClk_FllIsEnabled()) { /* Timeout wait for FLL to regain lock */ while ((!Cy_SysClk_FllLocked()) && (0UL != timeout)) @@ -1742,55 +1785,49 @@ cy_en_syspm_status_t Cy_SysClk_DeepSleepCallback(cy_stc_syspm_callback_params_t } /** \} group_sysclk_pm_funcs */ - /* ========================================================================== */ -/* ===================== clk_peripherals SECTION ====================== */ +/* ========================= clkHf[n] SECTION ========================= */ /* ========================================================================== */ +/** \cond INTERNAL */ +uint32_t altHfFreq = 0UL; /* Internal storage for BLE ECO frequency user setting */ +/** \endcond */ /** -* \addtogroup group_sysclk_clk_peripheral_funcs +* \addtogroup group_sysclk_clk_hf_funcs * \{ */ + + /******************************************************************************* -* Function Name: Cy_SysClk_PeriphGetFrequency +* Function Name: Cy_SysClk_ClkHfGetFrequency ****************************************************************************//** * -* Reports the frequency of the output of a given peripheral divider. +* Reports the frequency of the selected clkHf * -* \param dividerType specifies which type of divider to use; \ref cy_en_divider_types_t -* -* \param dividerNum specifies which divider of the selected type to configure +* \param clkHf Selects the clkHf * * \return The frequency, in Hz. * * \note * The reported frequency may be zero, which indicates unknown. This happens if -* the source input is clk_ext, ECO, clk_althf, dsi_out, or clk_altlf. +* the source input is dsi_out or clk_altlf. * * \funcusage -* \snippet sysclk/1.30/snippet/main.c snippet_Cy_SysClk_PeriphGetFrequency +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_ClkHfSetDivider * *******************************************************************************/ -uint32_t Cy_SysClk_PeriphGetFrequency(cy_en_divider_types_t dividerType, uint32_t dividerNum) +uint32_t Cy_SysClk_ClkHfGetFrequency(uint32_t clkHf) { /* variables holding intermediate clock frequencies, dividers and FLL/PLL settings */ - bool enabled = false; /* FLL or PLL enable status; n/a for direct */ - uint32_t freq = 0UL; /* path (FLL, PLL, or direct) frequency, in Hz, 0 = unknown frequency */ - uint32_t rootDiv = 0UL; /* root prescaler (1/2/4/8) */ - uint32_t periDiv = 0UL; /* predivider to clk_peri */ - uint32_t fDiv = 0UL; /* FLL/PLL multiplier/feedback divider */ - uint32_t rDiv = 0UL; /* FLL/PLL reference divider */ - uint32_t oDiv = 0UL; /* FLL/PLL output divider */ - uint32_t integer = 0UL; /* Integer part of peripheral divider */ - uint32_t frac = 0UL; /* Fractional part of peripheral divider */ - cy_en_clkhf_in_sources_t path = Cy_SysClk_ClkHfGetSource(0UL); /* path input for root 0 (clkHf[0]) */ - cy_en_clkpath_in_sources_t source = Cy_SysClk_ClkPathGetSource((uint32_t)path); /* source input for path (FLL, PLL, or direct) */ - - CY_ASSERT_L1(((dividerType == CY_SYSCLK_DIV_8_BIT) && (dividerNum < PERI_DIV_8_NR)) || - ((dividerType == CY_SYSCLK_DIV_16_BIT) && (dividerNum < PERI_DIV_16_NR)) || - ((dividerType == CY_SYSCLK_DIV_16_5_BIT) && (dividerNum < PERI_DIV_16_5_NR)) || - ((dividerType == CY_SYSCLK_DIV_24_5_BIT) && (dividerNum < PERI_DIV_24_5_NR))); + bool enabled = false; /* FLL or PLL enable status; n/a for direct */ + uint32_t freq = 0UL; /* path (FLL, PLL, or direct) frequency, in Hz, 0 = unknown frequency */ + uint32_t fDiv = 0UL; /* FLL/PLL multiplier/feedback divider */ + uint32_t rDiv = 0UL; /* FLL/PLL reference divider */ + uint32_t oDiv = 0UL; /* FLL/PLL output divider */ + uint32_t pDiv = 1UL << (uint32_t)Cy_SysClk_ClkHfGetDivider(clkHf); /* root prescaler (1/2/4/8) */ + uint32_t path = (uint32_t) Cy_SysClk_ClkHfGetSource(clkHf); /* path input for root 0 (clkHf[0]) */ + cy_en_clkpath_in_sources_t source = Cy_SysClk_ClkPathGetSource((uint32_t)path); /* source input for path (FLL, PLL, or direct) */ /* get the frequency of the source, i.e., the path mux input */ switch(source) @@ -1798,31 +1835,51 @@ uint32_t Cy_SysClk_PeriphGetFrequency(cy_en_divider_types_t dividerType, uint32_ case CY_SYSCLK_CLKPATH_IN_IMO: /* IMO frequency is fixed at 8 MHz */ freq = CY_SYSCLK_IMO_FREQ; break; - case CY_SYSCLK_CLKPATH_IN_ILO: /* ILO, WCO and PILO frequencies are nominally 32.768 kHz */ + + case CY_SYSCLK_CLKPATH_IN_EXT: + freq = extFreq; + break; + + case CY_SYSCLK_CLKPATH_IN_ECO: + freq = (CY_SYSCLK_ECOSTAT_STABLE == Cy_SysClk_EcoGetStatus()) ? ecoFreq : 0UL; + break; + + case CY_SYSCLK_CLKPATH_IN_ALTHF: + freq = altHfFreq; + break; + + case CY_SYSCLK_CLKPATH_IN_ILO: + freq = (0UL != (SRSS_CLK_ILO_CONFIG & SRSS_CLK_ILO_CONFIG_ENABLE_Msk)) ? CY_SYSCLK_ILO_FREQ : 0UL; + break; + case CY_SYSCLK_CLKPATH_IN_WCO: + freq = (Cy_SysClk_WcoOkay()) ? CY_SYSCLK_WCO_FREQ : 0UL; + break; + case CY_SYSCLK_CLKPATH_IN_PILO: - freq = CY_SYSCLK_ILO_FREQ; + freq = (0UL != (SRSS_CLK_PILO_CONFIG & SRSS_CLK_PILO_CONFIG_PILO_EN_Msk)) ? CY_SYSCLK_PILO_FREQ : 0UL; break; + default: - /* don't know the frequency of clk_ext, ECO, clk_althf, dsi_out, or clk_altlf */ + /* don't know the frequency of dsi_out, or clk_altlf */ freq = 0UL; /* unknown frequency */ break; } - if (path == CY_SYSCLK_CLKHF_IN_CLKPATH0) /* FLL? (always path 0) */ + if (path == (uint32_t)CY_SYSCLK_CLKHF_IN_CLKPATH0) /* FLL? (always path 0) */ { cy_stc_fll_manual_config_t fllCfg = {0UL,0U,CY_SYSCLK_FLL_CCO_RANGE0,false,0U,0U,0U,0U,CY_SYSCLK_FLLPLL_OUTPUT_AUTO,0U}; Cy_SysClk_FllGetConfiguration(&fllCfg); - enabled = (_FLD2BOOL(SRSS_CLK_FLL_CONFIG_FLL_ENABLE, SRSS_CLK_FLL_CONFIG)) && (fllCfg.outputMode != CY_SYSCLK_FLLPLL_OUTPUT_INPUT); + enabled = (Cy_SysClk_FllIsEnabled()) && (CY_SYSCLK_FLLPLL_OUTPUT_INPUT != fllCfg.outputMode); fDiv = fllCfg.fllMult; rDiv = fllCfg.refDiv; oDiv = (fllCfg.enableOutputDiv) ? 2UL : 1UL; } - else if ((uint32_t)path <= CY_SRSS_NUM_PLL) /* PLL? (always path 1...N)*/ + else if (path <= CY_SRSS_NUM_PLL) /* PLL? (always path 1...N)*/ { cy_stc_pll_manual_config_t pllcfg = {0U,0U,0U,false,CY_SYSCLK_FLLPLL_OUTPUT_AUTO}; - (void)Cy_SysClk_PllGetConfiguration((uint32_t)path, &pllcfg); - enabled = (_FLD2BOOL(SRSS_CLK_PLL_CONFIG_ENABLE, SRSS_CLK_PLL_CONFIG[(uint32_t)path - 1UL])) && (pllcfg.outputMode != CY_SYSCLK_FLLPLL_OUTPUT_INPUT); + (void)Cy_SysClk_PllGetConfiguration(path, &pllcfg); + enabled = (Cy_SysClk_PllIsEnabled(path)) && (CY_SYSCLK_FLLPLL_OUTPUT_INPUT != pllcfg.outputMode); fDiv = pllcfg.feedbackDiv; rDiv = pllcfg.referenceDiv; oDiv = pllcfg.outputDiv; @@ -1834,42 +1891,83 @@ uint32_t Cy_SysClk_PeriphGetFrequency(cy_en_divider_types_t dividerType, uint32_ if (enabled) /* if FLL or PLL enabled and not bypassed */ { - freq = (uint32_t)(((uint64_t)freq * (uint64_t)fDiv) / - ((uint64_t)rDiv * (uint64_t)oDiv)); + freq = (uint32_t)CY_SYSLIB_DIV_ROUND(((uint64_t)freq * (uint64_t)fDiv), + ((uint64_t)rDiv * (uint64_t)oDiv)); } - - /* get the prescaler value for root 0, or clkHf[0]: 1/2/4/8 */ - rootDiv = 1UL << (uint32_t)Cy_SysClk_ClkHfGetDivider(0UL); - /* get the predivider value for clkHf[0] to clk_peri */ - periDiv = 1UL + (uint32_t)Cy_SysClk_ClkPeriGetDivider(); + /* Divide the path input frequency down and return the result */ + return (CY_SYSLIB_DIV_ROUND(freq, pDiv)); +} + +/** \} group_sysclk_clk_hf_funcs */ - /* Divide the path input frequency down and return the result. - Stepping through the following code shows the frequency at each stage. - */ - freq /= (rootDiv * periDiv); /* clk_peri frequency */ + + +/* ========================================================================== */ +/* ===================== clk_peripherals SECTION ====================== */ +/* ========================================================================== */ + + +/** +* \addtogroup group_sysclk_clk_peripheral_funcs +* \{ +*/ +/******************************************************************************* +* Function Name: Cy_SysClk_PeriphGetFrequency +****************************************************************************//** +* +* Reports the frequency of the output of a given peripheral divider. +* +* \param dividerType specifies which type of divider to use; \ref cy_en_divider_types_t +* +* \param dividerNum specifies which divider of the selected type to configure +* +* \return The frequency, in Hz. +* +* \note +* The reported frequency may be zero, which indicates unknown. This happens if +* the source input is dsi_out or clk_altlf. +* +* \funcusage +* \snippet sysclk/snippet/main.c snippet_Cy_SysClk_PeriphGetFrequency +* +*******************************************************************************/ +uint32_t Cy_SysClk_PeriphGetFrequency(cy_en_divider_types_t dividerType, uint32_t dividerNum) +{ + uint32_t integer = 0UL; /* Integer part of peripheral divider */ + uint32_t freq = Cy_SysClk_ClkPeriGetFrequency(); /* Get Peri frequency */ + + CY_ASSERT_L1(((dividerType == CY_SYSCLK_DIV_8_BIT) && (dividerNum < PERI_DIV_8_NR)) || + ((dividerType == CY_SYSCLK_DIV_16_BIT) && (dividerNum < PERI_DIV_16_NR)) || + ((dividerType == CY_SYSCLK_DIV_16_5_BIT) && (dividerNum < PERI_DIV_16_5_NR)) || + ((dividerType == CY_SYSCLK_DIV_24_5_BIT) && (dividerNum < PERI_DIV_24_5_NR))); /* get the divider value for clk_peri to the selected peripheral clock */ switch(dividerType) { case CY_SYSCLK_DIV_8_BIT: case CY_SYSCLK_DIV_16_BIT: - integer = (uint32_t)Cy_SysClk_PeriphGetDivider(dividerType, dividerNum); - /* frac = 0 means it is an integer divider */ + integer = 1UL + Cy_SysClk_PeriphGetDivider(dividerType, dividerNum); + freq = CY_SYSLIB_DIV_ROUND(freq, integer); break; + case CY_SYSCLK_DIV_16_5_BIT: case CY_SYSCLK_DIV_24_5_BIT: - (void)Cy_SysClk_PeriphGetFracDivider(dividerType, dividerNum, &integer, &frac); + { + uint32_t locFrac; + uint32_t locDiv; + uint64_t locFreq = freq * 32ULL; + Cy_SysClk_PeriphGetFracDivider(dividerType, dividerNum, &integer, &locFrac); + /* For fractional dividers, the divider is (int + 1) + frac/32 */ + locDiv = ((1UL + integer) * 32UL) + locFrac; + freq = (uint32_t) CY_SYSLIB_DIV_ROUND(locFreq, (uint64_t)locDiv); + } break; + default: break; } - /* For fractional dividers, the divider is (int + 1) + frac/32. - * Use the fractional value to round the divider to the nearest integer. - */ - freq /= (integer + 1UL + ((frac >= 16UL) ? 1UL : 0UL)); /* peripheral divider output frequency */ - return (freq); } /** \} group_sysclk_clk_peripheral_funcs */ diff --git a/platform/ext/target/psoc64/Native_Driver/source/cy_sysint.c b/platform/ext/target/psoc64/Native_Driver/source/cy_sysint.c index e3fe447707..834b111aff 100644 --- a/platform/ext/target/psoc64/Native_Driver/source/cy_sysint.c +++ b/platform/ext/target/psoc64/Native_Driver/source/cy_sysint.c @@ -1,6 +1,6 @@ /***************************************************************************//** * \file cy_sysint.c -* \version 1.20 +* \version 1.30 * * \brief * Provides an API implementation of the SysInt driver. @@ -48,7 +48,7 @@ * moved to __ramVectors in SRAM. Otherwise it is ignored. * * \funcusage -* \snippet sysint\1.20\snippet\main.c snippet_Cy_SysInt_Init +* \snippet sysint/snippet/main.c snippet_Cy_SysInt_Init * *******************************************************************************/ cy_en_sysint_status_t Cy_SysInt_Init(const cy_stc_sysint_t* config, cy_israddress userIsr) @@ -107,7 +107,7 @@ cy_en_sysint_status_t Cy_SysInt_Init(const cy_stc_sysint_t* config, cy_israddres * \note This function is available for CM0+ core only. * * \funcusage -* \snippet sysint\1.20\snippet\main.c snippet_Cy_SysInt_SetInterruptSource +* \snippet sysint/snippet/main.c snippet_Cy_SysInt_SetInterruptSource * *******************************************************************************/ void Cy_SysInt_SetInterruptSource(IRQn_Type IRQn, cy_en_intr_t devIntrSrc) @@ -150,7 +150,7 @@ void Cy_SysInt_SetInterruptSource(IRQn_Type IRQn, cy_en_intr_t devIntrSrc) * \note This function is available for CM0+ core only. * * \funcusage -* \snippet sysint\1.20\snippet\main.c snippet_Cy_SysInt_DisconnectInterruptSource +* \snippet sysint/snippet/main.c snippet_Cy_SysInt_DisconnectInterruptSource * *******************************************************************************/ void Cy_SysInt_DisconnectInterruptSource(IRQn_Type IRQn, cy_en_intr_t devIntrSrc) @@ -185,7 +185,7 @@ void Cy_SysInt_DisconnectInterruptSource(IRQn_Type IRQn, cy_en_intr_t devIntrSrc * other devices, use the Cy_SysInt_GetNvicConnection() function. * * \funcusage -* \snippet sysint\1.20\snippet\main.c snippet_Cy_SysInt_SetInterruptSource +* \snippet sysint/snippet/main.c snippet_Cy_SysInt_SetInterruptSource * *******************************************************************************/ cy_en_intr_t Cy_SysInt_GetInterruptSource(IRQn_Type IRQn) @@ -226,7 +226,7 @@ cy_en_intr_t Cy_SysInt_GetInterruptSource(IRQn_Type IRQn) * \note This function supports only devices using CPUSS_ver2 or higher. * * \funcusage -* \snippet sysint\1.20\snippet\main.c snippet_Cy_SysInt_SetInterruptSource +* \snippet sysint/snippet/main.c snippet_Cy_SysInt_SetInterruptSource * *******************************************************************************/ IRQn_Type Cy_SysInt_GetNvicConnection(cy_en_intr_t devIntrSrc) @@ -267,7 +267,7 @@ IRQn_Type Cy_SysInt_GetNvicConnection(cy_en_intr_t devIntrSrc) * \note This function supports only devices using CPUSS_ver2 or higher. * * \funcusage -* \snippet sysint\1.20\snippet\main.c snippet_Cy_SysInt_GetInterruptActive +* \snippet sysint/snippet/main.c snippet_Cy_SysInt_GetInterruptActive * *******************************************************************************/ cy_en_intr_t Cy_SysInt_GetInterruptActive(IRQn_Type IRQn) @@ -308,7 +308,7 @@ cy_en_intr_t Cy_SysInt_GetInterruptActive(IRQn_Type IRQn) * channel on the NVIC. * * \funcusage -* \snippet sysint\1.20\snippet\main.c snippet_Cy_SysInt_SetVector +* \snippet sysint/snippet/main.c snippet_Cy_SysInt_SetVector * *******************************************************************************/ cy_israddress Cy_SysInt_SetVector(IRQn_Type IRQn, cy_israddress userIsr) @@ -352,7 +352,7 @@ cy_israddress Cy_SysInt_SetVector(IRQn_Type IRQn, cy_israddress userIsr) * channel on the NVIC. * * \funcusage -* \snippet sysint\1.20\snippet\main.c snippet_Cy_SysInt_SetVector +* \snippet sysint/snippet/main.c snippet_Cy_SysInt_SetVector * *******************************************************************************/ cy_israddress Cy_SysInt_GetVector(IRQn_Type IRQn) diff --git a/platform/ext/target/psoc64/Native_Driver/source/cy_syslib.c b/platform/ext/target/psoc64/Native_Driver/source/cy_syslib.c index fe41e5ac85..fbbab869c0 100644 --- a/platform/ext/target/psoc64/Native_Driver/source/cy_syslib.c +++ b/platform/ext/target/psoc64/Native_Driver/source/cy_syslib.c @@ -1,6 +1,6 @@ /***************************************************************************//** * \file cy_syslib.c -* \version 2.20 +* \version 2.40.1 * * Description: * Provides system API implementation for the SysLib driver. @@ -51,9 +51,13 @@ CY_NOINIT cy_stc_fault_frame_t cy_faultFrame; #endif /* (CY_ARM_FAULT_DEBUG == CY_ARM_FAULT_DEBUG_ENABLED) */ -#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 6010050) - static __ASM void Cy_SysLib_AsmInfiniteLoop(void) { b . }; -#endif /* (__ARMCC_VERSION) && (__ARMCC_VERSION < 6010050) */ +#if defined(__ARMCC_VERSION) + #if (__ARMCC_VERSION >= 6010050) + static void Cy_SysLib_AsmInfiniteLoop(void) { __ASM (" b . "); }; + #else + static __ASM void Cy_SysLib_AsmInfiniteLoop(void) { b . }; + #endif /* (__ARMCC_VERSION >= 6010050) */ +#endif /* (__ARMCC_VERSION) */ /******************************************************************************* @@ -474,7 +478,7 @@ void Cy_SysLib_FaultHandler(uint32_t const *faultStackAddr) *******************************************************************************/ __WEAK void Cy_SysLib_ProcessingFault(void) { - #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 6010050) + #if defined(__ARMCC_VERSION) /* Assembly implementation of an infinite loop * is used for the armcc compiler to preserve the call stack. * Otherwise, the compiler destroys the call stack, @@ -483,7 +487,7 @@ __WEAK void Cy_SysLib_ProcessingFault(void) Cy_SysLib_AsmInfiniteLoop(); #else while(1) {} - #endif /* (__ARMCC_VERSION) && (__ARMCC_VERSION < 6010050) */ + #endif /* (__ARMCC_VERSION) */ } #endif /* (CY_ARM_FAULT_DEBUG == CY_ARM_FAULT_DEBUG_ENABLED) || defined(CY_DOXYGEN) */ diff --git a/platform/ext/target/psoc64/Native_Driver/source/cy_syspm.c b/platform/ext/target/psoc64/Native_Driver/source/cy_syspm.c index 1bffe8f6d6..7b1244edfe 100644 --- a/platform/ext/target/psoc64/Native_Driver/source/cy_syspm.c +++ b/platform/ext/target/psoc64/Native_Driver/source/cy_syspm.c @@ -1,6 +1,6 @@ /***************************************************************************//** * \file cy_syspm.c -* \version 4.10 +* \version 4.40 * * This driver provides the source code for API power management. * @@ -275,6 +275,9 @@ typedef void (*cy_cb_syspm_deep_sleep_t)(cy_en_syspm_waitfor_t waitFor, bool *wa /* Array of the callback roots */ static cy_stc_syspm_callback_t* pmCallbackRoot[CALLBACK_ROOT_NR] = {NULL, NULL, NULL, NULL, NULL}; +/* The array of the pointers to failed callback */ +static cy_stc_syspm_callback_t* failedCallback[CALLBACK_ROOT_NR] = {NULL, NULL, NULL, NULL, NULL}; + /* Structure for registers that should retain while Deep Sleep mode */ static cy_stc_syspm_backup_regs_t bkpRegs; @@ -294,7 +297,7 @@ static cy_stc_syspm_backup_regs_t bkpRegs; * The current power mode. See \ref group_syspm_return_status. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_ReadStatus +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_ReadStatus * *******************************************************************************/ uint32_t Cy_SysPm_ReadStatus(void) @@ -448,7 +451,7 @@ uint32_t Cy_SysPm_ReadStatus(void) * CM4 CPU after wakeup from WFE. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_CpuEnterSleep +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_CpuEnterSleep * *******************************************************************************/ cy_en_syspm_status_t Cy_SysPm_CpuEnterSleep(cy_en_syspm_waitfor_t waitFor) @@ -675,7 +678,7 @@ cy_en_syspm_status_t Cy_SysPm_CpuEnterSleep(cy_en_syspm_waitfor_t waitFor) * is settled prior executing the WFI/WFE instruction. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_CpuEnterDeepSleep +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_CpuEnterDeepSleep * *******************************************************************************/ cy_en_syspm_status_t Cy_SysPm_CpuEnterDeepSleep(cy_en_syspm_waitfor_t waitFor) @@ -900,7 +903,7 @@ cy_en_syspm_status_t Cy_SysPm_CpuEnterDeepSleep(cy_en_syspm_waitfor_t waitFor) * Entered status, see \ref cy_en_syspm_status_t. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_SystemEnterHibernate +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_SystemEnterHibernate * *******************************************************************************/ cy_en_syspm_status_t Cy_SysPm_SystemEnterHibernate(void) @@ -1042,7 +1045,7 @@ he LP mode * - CY_SYSPM_FAIL - The system LP mode is not entered. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_SystemEnterLp +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_SystemEnterLp * *******************************************************************************/ cy_en_syspm_status_t Cy_SysPm_SystemEnterLp(void) @@ -1184,7 +1187,7 @@ cy_en_syspm_status_t Cy_SysPm_SystemEnterLp(void) * - CY_SYSPM_FAIL - The system ULP mode is not entered. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_SystemEnterUlp +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_SystemEnterUlp * *******************************************************************************/ cy_en_syspm_status_t Cy_SysPm_SystemEnterUlp(void) @@ -1295,7 +1298,7 @@ cy_en_syspm_status_t Cy_SysPm_SystemEnterUlp(void) * current mode. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_SystemSetMinRegulatorCurrent +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_SystemSetMinRegulatorCurrent * *******************************************************************************/ cy_en_syspm_status_t Cy_SysPm_SystemSetMinRegulatorCurrent(void) @@ -1358,7 +1361,7 @@ cy_en_syspm_status_t Cy_SysPm_SystemSetMinRegulatorCurrent(void) * ready to enter into the normal regulator current mode * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_SystemSetNormalRegulatorCurrent +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_SystemSetNormalRegulatorCurrent * *******************************************************************************/ cy_en_syspm_status_t Cy_SysPm_SystemSetNormalRegulatorCurrent(void) @@ -1431,7 +1434,7 @@ cy_en_syspm_status_t Cy_SysPm_SystemSetNormalRegulatorCurrent(void) * - False if disable sleep-on-exit feature. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_CpuSleepOnExit +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_CpuSleepOnExit * *******************************************************************************/ void Cy_SysPm_CpuSleepOnExit(bool enable) @@ -1503,7 +1506,7 @@ void Cy_SysPm_CpuSleepOnExit(bool enable) * Cy_SysPm_SetHibernateWakeupSource(CY_SYSPM_HIBERNATE_LPCOMP0_LOW, CY_SYSPM_HIBERNATE_LPCOMP0_HIGH); * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_SetHibernateWakeupSource +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_SetHibernateWakeupSource * *******************************************************************************/ void Cy_SysPm_SetHibernateWakeupSource(uint32_t wakeupSource) @@ -1557,7 +1560,7 @@ void Cy_SysPm_SetHibernateWakeupSource(uint32_t wakeupSource) * Cy_SysPm_ClearHibernateWakeupSource(CY_SYSPM_HIBERNATE_LPCOMP0_HIGH | CY_SYSPM_HIBERNATE_WDT). * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_ClearHibernateWakeupSource +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_ClearHibernateWakeupSource * *******************************************************************************/ void Cy_SysPm_ClearHibernateWakeupSource(uint32_t wakeupSource) @@ -1676,7 +1679,7 @@ void Cy_SysPm_ClearHibernateWakeupSource(uint32_t wakeupSource) * switch. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_BuckEnable +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_BuckEnable * *******************************************************************************/ cy_en_syspm_status_t Cy_SysPm_BuckEnable(cy_en_syspm_buck_voltage1_t voltage) @@ -1838,7 +1841,7 @@ cy_en_syspm_status_t Cy_SysPm_BuckEnable(cy_en_syspm_buck_voltage1_t voltage) * the function returns CY_SYSPM_SUCCESS. See \ref cy_en_syspm_status_t. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_VoltageRegulator +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_VoltageRegulator * *******************************************************************************/ cy_en_syspm_status_t Cy_SysPm_BuckSetVoltage1(cy_en_syspm_buck_voltage1_t voltage) @@ -1934,7 +1937,7 @@ cy_en_syspm_status_t Cy_SysPm_BuckSetVoltage1(cy_en_syspm_buck_voltage1_t voltag * - False if the requested output is disabled. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_BuckIsOutputEnabled +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_BuckIsOutputEnabled * *******************************************************************************/ bool Cy_SysPm_BuckIsOutputEnabled(cy_en_syspm_buck_out_t output) @@ -1986,7 +1989,7 @@ bool Cy_SysPm_BuckIsOutputEnabled(cy_en_syspm_buck_out_t output) * the SIMO Buck. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_BuckEnableVoltage2 +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_BuckEnableVoltage2 * *******************************************************************************/ void Cy_SysPm_BuckEnableVoltage2(void) @@ -2035,7 +2038,7 @@ void Cy_SysPm_BuckEnableVoltage2(void) * SIMO Buck. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_BuckSetVoltage2 +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_BuckSetVoltage2 * *******************************************************************************/ void Cy_SysPm_BuckSetVoltage2(cy_en_syspm_buck_voltage2_t voltage, bool waitToSettle) @@ -2124,7 +2127,7 @@ void Cy_SysPm_BuckSetVoltage2(cy_en_syspm_buck_voltage2_t voltage, bool waitToSe * the function returns CY_SYSPM_SUCCESS. See \ref cy_en_syspm_status_t. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_VoltageRegulator +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_VoltageRegulator * *******************************************************************************/ cy_en_syspm_status_t Cy_SysPm_LdoSetVoltage(cy_en_syspm_ldo_voltage_t voltage) @@ -2346,65 +2349,77 @@ cy_en_syspm_ldo_mode_t Cy_SysPm_LdoGetMode(void) * allocated during power mode transition. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_Callback_Func_Declaration -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_Callback_Params_Declaration -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_Callback_Structure_Declaration -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_Callback_Func_Implementation -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_RegisterCallback +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_Callback_Func_Declaration +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_Callback_Params_Declaration +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_Callback_Structure_Declaration +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_Callback_Func_Implementation +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_RegisterCallback * *******************************************************************************/ bool Cy_SysPm_RegisterCallback(cy_stc_syspm_callback_t* handler) { bool retVal = false; - /* Verify input */ + /* Verify the input parameters. */ if ((handler != NULL) && (handler->callbackParams != NULL) && (handler->callback != NULL)) { uint32_t callbackRootIdx = (uint32_t) handler->type; - retVal = true; - /* Get the required power mode root */ - cy_stc_syspm_callback_t* curCallback = pmCallbackRoot[callbackRootIdx]; - cy_stc_syspm_callback_t* lastRegCallback = NULL; - - /* Search last registered callback item */ - while (curCallback != NULL) + /* If the callback list is not empty. */ + if (pmCallbackRoot[callbackRootIdx] != NULL) { - if (curCallback == handler) - { - /* Do not register already registered callback item */ - retVal = false; - break; - } + cy_stc_syspm_callback_t* curCallback = pmCallbackRoot[callbackRootIdx]; + cy_stc_syspm_callback_t* insertPos = curCallback; - /* Safe callback before switching into the next item */ - lastRegCallback = curCallback; - - curCallback = curCallback->nextItm; - } - - /* Link requested callback item to the linked list */ - if (retVal) - { - if (pmCallbackRoot[callbackRootIdx] == NULL) + /* Find the callback after which the new callback is to be + * inserted. Ensure the given callback has not been registered. + */ + while ((NULL != curCallback->nextItm) && (curCallback != handler)) { - /* Link first callback item to the linked list */ - pmCallbackRoot[callbackRootIdx] = handler; + curCallback = curCallback->nextItm; + /* Callbacks with the same order value are stored in the order + * they are registered. + */ + if (curCallback->order <= handler->order) + { + insertPos = curCallback; + } } - else + /* If the callback has not been registered. */ + if (curCallback != handler) { - /* Link requested item to previous item */ - lastRegCallback->nextItm = handler; - } + /* If the callback is to be inserted at the beginning of the list. */ + if ((insertPos->prevItm == NULL) && (handler->order < insertPos->order)) + { + handler->nextItm = insertPos; + handler->prevItm = NULL; + handler->nextItm->prevItm = handler; + pmCallbackRoot[callbackRootIdx] = handler; + } + else + { + handler->nextItm = insertPos->nextItm; + handler->prevItm = insertPos; - /* Update links to next and previous callback items of requested - * callback item - */ - handler->prevItm = lastRegCallback; + /* If the callback is not inserted at the end of the list. */ + if (handler->nextItm != NULL) + { + handler->nextItm->prevItm = handler; + } + insertPos->nextItm = handler; + } + retVal = true; + } + } + else + { + /* The callback list is empty. */ + pmCallbackRoot[callbackRootIdx] = handler; handler->nextItm = NULL; + handler->prevItm = NULL; + retVal = true; } } - return retVal; } @@ -2426,7 +2441,7 @@ bool Cy_SysPm_RegisterCallback(cy_stc_syspm_callback_t* handler) * - False if it was not unregistered or no callbacks are registered. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_UnregisterCallback +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_UnregisterCallback * *******************************************************************************/ bool Cy_SysPm_UnregisterCallback(cy_stc_syspm_callback_t const *handler) @@ -2526,7 +2541,7 @@ bool Cy_SysPm_UnregisterCallback(cy_stc_syspm_callback_t const *handler) * - CY_SYSPM_FAIL one of the executed callback(s) returned fail. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_ExecuteCallback +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_ExecuteCallback * *******************************************************************************/ cy_en_syspm_status_t Cy_SysPm_ExecuteCallback(cy_en_syspm_callback_type_t type, cy_en_syspm_callback_mode_t mode) @@ -2566,6 +2581,23 @@ cy_en_syspm_status_t Cy_SysPm_ExecuteCallback(cy_en_syspm_callback_type_t type, } curCallback = curCallback->nextItm; } + + if (mode == CY_SYSPM_CHECK_READY) + { + /* Update the pointer to the failed callback with the result of the callback execution. + * If the callback fails, the value of the pointer will be updated + * with the address of the callback which returned CY_SYSPM_FAIL, else, + * it will be updated with NULL. + */ + if(retVal == CY_SYSPM_FAIL) + { + failedCallback[(uint32_t) type] = lastExecutedCallback; + } + else + { + failedCallback[(uint32_t) type] = NULL; + } + } } else { @@ -2616,6 +2648,37 @@ cy_en_syspm_status_t Cy_SysPm_ExecuteCallback(cy_en_syspm_callback_type_t type, /******************************************************************************* +* Function Name: Cy_SysPm_GetFailedCallback +****************************************************************************//** +* +* Reads the result of the callback execution after the power mode functions +* execution. +* +* This function reads the value of the pointer that stores the result of callback +* execution. It takes power mode as the parameter and returns the address of the +* callback configuration structure in the case of failure or NULL in the case of +* success. This address of the failed callback allows finding the callback that +* blocks entering power mode. +* +* \param type +* Power mode for which a callback execution result is required. +* +* \return +* - The address of the callback configuration structure if the callback handler +* function failed. +* - NULL if the callback skipped or executed successfully. +* +* \funcusage +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_GetFailedCallback +* +*******************************************************************************/ +cy_stc_syspm_callback_t* Cy_SysPm_GetFailedCallback(cy_en_syspm_callback_type_t type) +{ + return failedCallback[(uint32_t) type]; +} + + +/******************************************************************************* * Function Name: Cy_SysPm_IoUnfreeze ****************************************************************************//** * @@ -2635,7 +2698,7 @@ cy_en_syspm_status_t Cy_SysPm_ExecuteCallback(cy_en_syspm_callback_type_t type, * configuration becomes effective only after the pins are unfrozen. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_IoUnfreeze +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_IoUnfreeze * *******************************************************************************/ void Cy_SysPm_IoUnfreeze(void) @@ -2680,7 +2743,7 @@ void Cy_SysPm_IoUnfreeze(void) * the function returns CY_SYSPM_SUCCESS. See \ref cy_en_syspm_status_t. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_WriteVoltageBitForFlash +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_WriteVoltageBitForFlash * *******************************************************************************/ cy_en_syspm_status_t Cy_SysPm_WriteVoltageBitForFlash(cy_en_syspm_flash_voltage_bit_t value) @@ -2765,7 +2828,7 @@ cy_en_syspm_status_t Cy_SysPm_WriteVoltageBitForFlash(cy_en_syspm_flash_voltage_ * The structure where the registers are saved. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_SaveRestoreRegisters +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_SaveRestoreRegisters * *******************************************************************************/ void Cy_SysPm_SaveRegisters(cy_stc_syspm_backup_regs_t *regs) @@ -2805,7 +2868,7 @@ void Cy_SysPm_SaveRegisters(cy_stc_syspm_backup_regs_t *regs) * required non-retained registers after Deep Sleep. * * \funcusage -* \snippet syspm/4.0/snippet/main.c snippet_Cy_SysPm_SaveRestoreRegisters +* \snippet syspm/snippet/main.c snippet_Cy_SysPm_SaveRestoreRegisters * *******************************************************************************/ void Cy_SysPm_RestoreRegisters(cy_stc_syspm_backup_regs_t const *regs) @@ -2844,10 +2907,13 @@ void Cy_SysPm_RestoreRegisters(cy_stc_syspm_backup_regs_t const *regs) #pragma diag_suppress=Ta023 __ramfunc #else - CY_SECTION(".ramfunc") CY_NOINLINE + CY_SECTION(".cy_ramfunc") CY_NOINLINE #endif static bool EnterDeepSleepRam(cy_en_syspm_waitfor_t waitFor) { + /* Store the address of the IPC7 acquire register into the RAM */ + volatile uint32_t *ipcAcquire = ((uint32_t *) (®_IPC_STRUCT_ACQUIRE(CY_IPC_STRUCT_PTR(CY_IPC_CHAN_DDFT)))); + /* Store the address of the Deep Sleep indicator into the RAM */ volatile uint32_t *delayDoneFlag = &FLASHC_BIST_DATA_0; @@ -2941,7 +3007,7 @@ static bool EnterDeepSleepRam(cy_en_syspm_waitfor_t waitFor) #endif /* (CY_CPU_CORTEX_M4) */ /* Acquire the IPC to prevent changing of the shared resources at the same time */ - while (0U == _FLD2VAL(IPC_STRUCT_ACQUIRE_SUCCESS, REG_IPC_STRUCT_ACQUIRE(CY_IPC_STRUCT_PTR(CY_IPC_CHAN_DDFT)))) + while (0U == _FLD2VAL(IPC_STRUCT_ACQUIRE_SUCCESS, (*ipcAcquire))) { /* Wait until the IPC structure is released by another CPU */ } @@ -3044,7 +3110,7 @@ static void SetReadMarginTrimUlp(void) else { CPUSS_TRIM_RAM_CTL = (SFLASH_CPUSS_TRIM_RAM_CTL_HALF_ULP & ((uint32_t) ~CPUSS_TRIM_RAM_CTL_RA_MASK)) | - (CPUSS_TRIM_RAM_CTL | CPUSS_TRIM_RAM_CTL_RA_MASK); + (CPUSS_TRIM_RAM_CTL & CPUSS_TRIM_RAM_CTL_RA_MASK); CPUSS_TRIM_ROM_CTL = SFLASH_CPUSS_TRIM_ROM_CTL_HALF_ULP; } @@ -3073,8 +3139,8 @@ static void SetReadMarginTrimLp(void) } else { - CPUSS_TRIM_RAM_CTL = (SFLASH_CPUSS_TRIM_ROM_CTL_LP & ((uint32_t) ~CPUSS_TRIM_RAM_CTL_RA_MASK)) | - (CPUSS_TRIM_RAM_CTL | CPUSS_TRIM_RAM_CTL_RA_MASK); + CPUSS_TRIM_RAM_CTL = (SFLASH_CPUSS_TRIM_RAM_CTL_LP & ((uint32_t) ~CPUSS_TRIM_RAM_CTL_RA_MASK)) | + (CPUSS_TRIM_RAM_CTL & CPUSS_TRIM_RAM_CTL_RA_MASK); CPUSS_TRIM_ROM_CTL = SFLASH_CPUSS_TRIM_ROM_CTL_LP; } @@ -3100,8 +3166,8 @@ static void SetWriteAssistTrimUlp(void) } else { - CPUSS_TRIM_RAM_CTL = (SFLASH_CPUSS_TRIM_ROM_CTL_ULP & ((uint32_t) ~CPUSS_TRIM_RAM_CTL_RA_MASK)) | - (CPUSS_TRIM_RAM_CTL | CPUSS_TRIM_RAM_CTL_RA_MASK); + CPUSS_TRIM_RAM_CTL = (SFLASH_CPUSS_TRIM_RAM_CTL_ULP & ((uint32_t) ~CPUSS_TRIM_RAM_CTL_RA_MASK)) | + (CPUSS_TRIM_RAM_CTL & CPUSS_TRIM_RAM_CTL_RA_MASK); } } @@ -3125,8 +3191,8 @@ static void SetWriteAssistTrimLp(void) } else { - CPUSS_TRIM_RAM_CTL = (SFLASH_CPUSS_TRIM_ROM_CTL_HALF_LP & ((uint32_t) ~CPUSS_TRIM_RAM_CTL_RA_MASK)) | - (CPUSS_TRIM_RAM_CTL | CPUSS_TRIM_RAM_CTL_RA_MASK); + CPUSS_TRIM_RAM_CTL = (SFLASH_CPUSS_TRIM_RAM_CTL_HALF_LP & ((uint32_t) ~CPUSS_TRIM_RAM_CTL_RA_MASK)) | + (CPUSS_TRIM_RAM_CTL & CPUSS_TRIM_RAM_CTL_RA_MASK); CPUSS_TRIM_ROM_CTL = SFLASH_CPUSS_TRIM_ROM_CTL_HALF_LP; } diff --git a/platform/ext/target/psoc64/Native_Driver/source/cy_trigmux.c b/platform/ext/target/psoc64/Native_Driver/source/cy_trigmux.c index 5eb5784ae1..6956f61ef1 100644 --- a/platform/ext/target/psoc64/Native_Driver/source/cy_trigmux.c +++ b/platform/ext/target/psoc64/Native_Driver/source/cy_trigmux.c @@ -92,7 +92,7 @@ * - CY_TRIGMUX_BAD_PARAM: Some parameter is invalid. * * \funcusage -* \snippet trigmux\1.20\snippet\main.c snippet_Cy_TrigMux_Connect +* \snippet trigmux/snippet/main.c snippet_Cy_TrigMux_Connect * *******************************************************************************/ cy_en_trigmux_status_t Cy_TrigMux_Connect(uint32_t inTrig, uint32_t outTrig, bool invert, en_trig_type_t trigType) @@ -151,7 +151,7 @@ cy_en_trigmux_status_t Cy_TrigMux_Connect(uint32_t inTrig, uint32_t outTrig, boo * - CY_TRIGMUX_BAD_PARAM: Some parameter is invalid. * * \funcusage -* \snippet trigmux\1.20\snippet\main.c snippet_Cy_TrigMux_Select +* \snippet trigmux/snippet/main.c snippet_Cy_TrigMux_Select * *******************************************************************************/ cy_en_trigmux_status_t Cy_TrigMux_Select(uint32_t outTrig, bool invert, en_trig_type_t trigType) @@ -201,7 +201,7 @@ cy_en_trigmux_status_t Cy_TrigMux_Select(uint32_t outTrig, bool invert, en_trig_ * - CY_TRIGMUX_BAD_PARAM: Some parameter is invalid. * * \funcusage -* \snippet trigmux\1.20\snippet\main.c snippet_Cy_TrigMux_Deselect +* \snippet trigmux/snippet/main.c snippet_Cy_TrigMux_Deselect * *******************************************************************************/ cy_en_trigmux_status_t Cy_TrigMux_Deselect(uint32_t outTrig) @@ -251,7 +251,7 @@ cy_en_trigmux_status_t Cy_TrigMux_Deselect(uint32_t outTrig) * - CY_TRIGMUX_BAD_PARAM: The outTrig parameter is invalid. * * \funcusage -* \snippet trigmux\1.20\snippet\main.c snippet_Cy_TrigMux_SetDebugFreeze +* \snippet trigmux/snippet/main.c snippet_Cy_TrigMux_SetDebugFreeze * *******************************************************************************/ cy_en_trigmux_status_t Cy_TrigMux_SetDebugFreeze(uint32_t outTrig, bool enable) @@ -322,7 +322,7 @@ cy_en_trigmux_status_t Cy_TrigMux_SetDebugFreeze(uint32_t outTrig, bool enable) * - CY_TRIGMUX_BAD_PARAM: Some parameter is invalid. * * \funcusage -* \snippet trigmux\1.20\snippet\main.c snippet_Cy_TrigMux_SwTrigger +* \snippet trigmux/snippet/main.c snippet_Cy_TrigMux_SwTrigger * *******************************************************************************/ cy_en_trigmux_status_t Cy_TrigMux_SwTrigger(uint32_t trigLine, uint32_t cycles) |