mirror of https://github.com/ARMmbed/mbed-os.git
Added a multiplied by 2 in the SDIO clock divider calculation to account for internal UDB divider.
Note: Fixes issues with intermittent WiFi firmware load failures on CY8CKIT_062_WIFI_BT, CYW943012P6EVB_01, CYW9P62S1_43012EVB_01, CYW9P62S1_43438EVB_01.pull/12394/head
parent
5f496a694c
commit
df5ac6483b
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
********************************************************************************
|
********************************************************************************
|
||||||
* \copyright
|
* \copyright
|
||||||
* Copyright 2016-2019 Cypress Semiconductor Corporation
|
* Copyright 2016-2020 Cypress Semiconductor Corporation
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
|
@ -111,7 +111,7 @@ cy_en_syspm_status_t SDIO_DeepSleepCallback(cy_stc_syspm_callback_params_t *para
|
||||||
CY_UNUSED_PARAMETER(params);
|
CY_UNUSED_PARAMETER(params);
|
||||||
cy_en_syspm_status_t status = CY_SYSPM_FAIL;
|
cy_en_syspm_status_t status = CY_SYSPM_FAIL;
|
||||||
|
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case CY_SYSPM_CHECK_READY:
|
case CY_SYSPM_CHECK_READY:
|
||||||
case CY_SYSPM_CHECK_FAIL:
|
case CY_SYSPM_CHECK_FAIL:
|
||||||
|
|
@ -656,7 +656,7 @@ en_sdio_result_t SDIO_SendCommandAndWait(stc_sdio_cmd_t *pstcCmd)
|
||||||
cy_rslt_t result;
|
cy_rslt_t result;
|
||||||
|
|
||||||
/* Initialize the semaphore. This is not done in init because init is called
|
/* Initialize the semaphore. This is not done in init because init is called
|
||||||
* in interrupt thread. cy_rtos_init_semaphore call is prohibited in
|
* in interrupt thread. cy_rtos_init_semaphore call is prohibited in
|
||||||
* interrupt thread.
|
* interrupt thread.
|
||||||
*/
|
*/
|
||||||
if(!sema_initialized)
|
if(!sema_initialized)
|
||||||
|
|
@ -770,16 +770,16 @@ en_sdio_result_t SDIO_SendCommandAndWait(stc_sdio_cmd_t *pstcCmd)
|
||||||
|
|
||||||
#ifdef CY_RTOS_AWARE
|
#ifdef CY_RTOS_AWARE
|
||||||
/* Wait for the transfer to finish.
|
/* Wait for the transfer to finish.
|
||||||
* Acquire semaphore and wait until it will be released
|
* Acquire semaphore and wait until it will be released
|
||||||
* in SDIO_IRQ:
|
* in SDIO_IRQ:
|
||||||
* 1. sdio_transfer_finished_semaphore count is equal to
|
* 1. sdio_transfer_finished_semaphore count is equal to
|
||||||
* zero. cy_rtos_get_semaphore waits until semaphore
|
* zero. cy_rtos_get_semaphore waits until semaphore
|
||||||
* count is increased by cy_rtos_set_semaphore() in
|
* count is increased by cy_rtos_set_semaphore() in
|
||||||
* SDIO_IRQ.
|
* SDIO_IRQ.
|
||||||
* 2. The cy_rtos_set_semaphore() increases
|
* 2. The cy_rtos_set_semaphore() increases
|
||||||
* sdio_transfer_finished_semaphore count.
|
* sdio_transfer_finished_semaphore count.
|
||||||
* 3. The cy_rtos_get_semaphore() function decreases
|
* 3. The cy_rtos_get_semaphore() function decreases
|
||||||
* sdio_transfer_finished_semaphore back to zero
|
* sdio_transfer_finished_semaphore back to zero
|
||||||
* and exit. Or timeout occurs
|
* and exit. Or timeout occurs
|
||||||
*/
|
*/
|
||||||
result = cy_rtos_get_semaphore( &sdio_transfer_finished_semaphore, 10, false );
|
result = cy_rtos_get_semaphore( &sdio_transfer_finished_semaphore, 10, false );
|
||||||
|
|
@ -1080,7 +1080,12 @@ void SDIO_DisableSdClk(void)
|
||||||
void SDIO_SetSdClkFrequency(uint32_t u32SdClkFreqHz)
|
void SDIO_SetSdClkFrequency(uint32_t u32SdClkFreqHz)
|
||||||
{
|
{
|
||||||
uint16_t u16Div;
|
uint16_t u16Div;
|
||||||
u16Div = Cy_SysClk_ClkPeriGetFrequency() / u32SdClkFreqHz;
|
/*
|
||||||
|
* The UDB SDIO implemenation has a extra divider internally that divides the input clock to the UDB
|
||||||
|
* by 2. The desired clock frequency is hence intentionally multiplied by 2 in order to get the required
|
||||||
|
* SDIO operating frequency.
|
||||||
|
*/
|
||||||
|
u16Div = Cy_SysClk_ClkPeriGetFrequency() / (2 * u32SdClkFreqHz);
|
||||||
Cy_SysClk_PeriphSetDivider(SDIO_HOST_Internal_Clock_DIV_TYPE, SDIO_HOST_Internal_Clock_DIV_NUM, (u16Div-1));
|
Cy_SysClk_PeriphSetDivider(SDIO_HOST_Internal_Clock_DIV_TYPE, SDIO_HOST_Internal_Clock_DIV_NUM, (u16Div-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1247,10 +1252,10 @@ void SDIO_IRQ(void)
|
||||||
{
|
{
|
||||||
pfnCardInt_count++;
|
pfnCardInt_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Execute card interrupt callback if neccesary */
|
/* Execute card interrupt callback if neccesary */
|
||||||
if (0 != pfnCardInt_count)
|
if (0 != pfnCardInt_count)
|
||||||
{
|
{
|
||||||
if (NULL != gstcInternalData.pstcCallBacks.pfnCardIntCb)
|
if (NULL != gstcInternalData.pstcCallBacks.pfnCardIntCb)
|
||||||
{
|
{
|
||||||
gstcInternalData.pstcCallBacks.pfnCardIntCb();
|
gstcInternalData.pstcCallBacks.pfnCardIntCb();
|
||||||
|
|
@ -1277,7 +1282,7 @@ void SDIO_IRQ(void)
|
||||||
/* CRC was bad, set the flag */
|
/* CRC was bad, set the flag */
|
||||||
gstcInternalData.stcEvents.u8CRCError++;
|
gstcInternalData.stcEvents.u8CRCError++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the done flag */
|
/* Set the done flag */
|
||||||
|
|
||||||
#ifdef CY_RTOS_AWARE
|
#ifdef CY_RTOS_AWARE
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
********************************************************************************
|
********************************************************************************
|
||||||
* \copyright
|
* \copyright
|
||||||
* Copyright 2016-2019 Cypress Semiconductor Corporation
|
* Copyright 2016-2020 Cypress Semiconductor Corporation
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
********************************************************************************
|
********************************************************************************
|
||||||
* \copyright
|
* \copyright
|
||||||
* Copyright 2016-2019 Cypress Semiconductor Corporation
|
* Copyright 2016-2020 Cypress Semiconductor Corporation
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
********************************************************************************
|
********************************************************************************
|
||||||
* \copyright
|
* \copyright
|
||||||
* Copyright 2016-2019 Cypress Semiconductor Corporation
|
* Copyright 2016-2020 Cypress Semiconductor Corporation
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
********************************************************************************
|
********************************************************************************
|
||||||
* \copyright
|
* \copyright
|
||||||
* Copyright 2016-2019 Cypress Semiconductor Corporation
|
* Copyright 2016-2020 Cypress Semiconductor Corporation
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
|
@ -111,7 +111,7 @@ cy_en_syspm_status_t SDIO_DeepSleepCallback(cy_stc_syspm_callback_params_t *para
|
||||||
CY_UNUSED_PARAMETER(params);
|
CY_UNUSED_PARAMETER(params);
|
||||||
cy_en_syspm_status_t status = CY_SYSPM_FAIL;
|
cy_en_syspm_status_t status = CY_SYSPM_FAIL;
|
||||||
|
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case CY_SYSPM_CHECK_READY:
|
case CY_SYSPM_CHECK_READY:
|
||||||
case CY_SYSPM_CHECK_FAIL:
|
case CY_SYSPM_CHECK_FAIL:
|
||||||
|
|
@ -656,7 +656,7 @@ en_sdio_result_t SDIO_SendCommandAndWait(stc_sdio_cmd_t *pstcCmd)
|
||||||
cy_rslt_t result;
|
cy_rslt_t result;
|
||||||
|
|
||||||
/* Initialize the semaphore. This is not done in init because init is called
|
/* Initialize the semaphore. This is not done in init because init is called
|
||||||
* in interrupt thread. cy_rtos_init_semaphore call is prohibited in
|
* in interrupt thread. cy_rtos_init_semaphore call is prohibited in
|
||||||
* interrupt thread.
|
* interrupt thread.
|
||||||
*/
|
*/
|
||||||
if(!sema_initialized)
|
if(!sema_initialized)
|
||||||
|
|
@ -770,16 +770,16 @@ en_sdio_result_t SDIO_SendCommandAndWait(stc_sdio_cmd_t *pstcCmd)
|
||||||
|
|
||||||
#ifdef CY_RTOS_AWARE
|
#ifdef CY_RTOS_AWARE
|
||||||
/* Wait for the transfer to finish.
|
/* Wait for the transfer to finish.
|
||||||
* Acquire semaphore and wait until it will be released
|
* Acquire semaphore and wait until it will be released
|
||||||
* in SDIO_IRQ:
|
* in SDIO_IRQ:
|
||||||
* 1. sdio_transfer_finished_semaphore count is equal to
|
* 1. sdio_transfer_finished_semaphore count is equal to
|
||||||
* zero. cy_rtos_get_semaphore waits until semaphore
|
* zero. cy_rtos_get_semaphore waits until semaphore
|
||||||
* count is increased by cy_rtos_set_semaphore() in
|
* count is increased by cy_rtos_set_semaphore() in
|
||||||
* SDIO_IRQ.
|
* SDIO_IRQ.
|
||||||
* 2. The cy_rtos_set_semaphore() increases
|
* 2. The cy_rtos_set_semaphore() increases
|
||||||
* sdio_transfer_finished_semaphore count.
|
* sdio_transfer_finished_semaphore count.
|
||||||
* 3. The cy_rtos_get_semaphore() function decreases
|
* 3. The cy_rtos_get_semaphore() function decreases
|
||||||
* sdio_transfer_finished_semaphore back to zero
|
* sdio_transfer_finished_semaphore back to zero
|
||||||
* and exit. Or timeout occurs
|
* and exit. Or timeout occurs
|
||||||
*/
|
*/
|
||||||
result = cy_rtos_get_semaphore( &sdio_transfer_finished_semaphore, 10, false );
|
result = cy_rtos_get_semaphore( &sdio_transfer_finished_semaphore, 10, false );
|
||||||
|
|
@ -1080,7 +1080,12 @@ void SDIO_DisableSdClk(void)
|
||||||
void SDIO_SetSdClkFrequency(uint32_t u32SdClkFreqHz)
|
void SDIO_SetSdClkFrequency(uint32_t u32SdClkFreqHz)
|
||||||
{
|
{
|
||||||
uint16_t u16Div;
|
uint16_t u16Div;
|
||||||
u16Div = Cy_SysClk_ClkPeriGetFrequency() / u32SdClkFreqHz;
|
/*
|
||||||
|
* The UDB SDIO implemenation has a extra divider internally that divides the input clock to the UDB
|
||||||
|
* by 2. The desired clock frequency is hence intentionally multiplied by 2 in order to get the required
|
||||||
|
* SDIO operating frequency.
|
||||||
|
*/
|
||||||
|
u16Div = Cy_SysClk_ClkPeriGetFrequency() / (2 * u32SdClkFreqHz);
|
||||||
Cy_SysClk_PeriphSetDivider(SDIO_HOST_Internal_Clock_DIV_TYPE, SDIO_HOST_Internal_Clock_DIV_NUM, (u16Div-1));
|
Cy_SysClk_PeriphSetDivider(SDIO_HOST_Internal_Clock_DIV_TYPE, SDIO_HOST_Internal_Clock_DIV_NUM, (u16Div-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1247,10 +1252,10 @@ void SDIO_IRQ(void)
|
||||||
{
|
{
|
||||||
pfnCardInt_count++;
|
pfnCardInt_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Execute card interrupt callback if neccesary */
|
/* Execute card interrupt callback if neccesary */
|
||||||
if (0 != pfnCardInt_count)
|
if (0 != pfnCardInt_count)
|
||||||
{
|
{
|
||||||
if (NULL != gstcInternalData.pstcCallBacks.pfnCardIntCb)
|
if (NULL != gstcInternalData.pstcCallBacks.pfnCardIntCb)
|
||||||
{
|
{
|
||||||
gstcInternalData.pstcCallBacks.pfnCardIntCb();
|
gstcInternalData.pstcCallBacks.pfnCardIntCb();
|
||||||
|
|
@ -1277,7 +1282,7 @@ void SDIO_IRQ(void)
|
||||||
/* CRC was bad, set the flag */
|
/* CRC was bad, set the flag */
|
||||||
gstcInternalData.stcEvents.u8CRCError++;
|
gstcInternalData.stcEvents.u8CRCError++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the done flag */
|
/* Set the done flag */
|
||||||
|
|
||||||
#ifdef CY_RTOS_AWARE
|
#ifdef CY_RTOS_AWARE
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
********************************************************************************
|
********************************************************************************
|
||||||
* \copyright
|
* \copyright
|
||||||
* Copyright 2016-2019 Cypress Semiconductor Corporation
|
* Copyright 2016-2020 Cypress Semiconductor Corporation
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
********************************************************************************
|
********************************************************************************
|
||||||
* \copyright
|
* \copyright
|
||||||
* Copyright 2016-2019 Cypress Semiconductor Corporation
|
* Copyright 2016-2020 Cypress Semiconductor Corporation
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
********************************************************************************
|
********************************************************************************
|
||||||
* \copyright
|
* \copyright
|
||||||
* Copyright 2016-2019 Cypress Semiconductor Corporation
|
* Copyright 2016-2020 Cypress Semiconductor Corporation
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
********************************************************************************
|
********************************************************************************
|
||||||
* \copyright
|
* \copyright
|
||||||
* Copyright 2016-2019 Cypress Semiconductor Corporation
|
* Copyright 2016-2020 Cypress Semiconductor Corporation
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
|
@ -111,7 +111,7 @@ cy_en_syspm_status_t SDIO_DeepSleepCallback(cy_stc_syspm_callback_params_t *para
|
||||||
CY_UNUSED_PARAMETER(params);
|
CY_UNUSED_PARAMETER(params);
|
||||||
cy_en_syspm_status_t status = CY_SYSPM_FAIL;
|
cy_en_syspm_status_t status = CY_SYSPM_FAIL;
|
||||||
|
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case CY_SYSPM_CHECK_READY:
|
case CY_SYSPM_CHECK_READY:
|
||||||
case CY_SYSPM_CHECK_FAIL:
|
case CY_SYSPM_CHECK_FAIL:
|
||||||
|
|
@ -656,7 +656,7 @@ en_sdio_result_t SDIO_SendCommandAndWait(stc_sdio_cmd_t *pstcCmd)
|
||||||
cy_rslt_t result;
|
cy_rslt_t result;
|
||||||
|
|
||||||
/* Initialize the semaphore. This is not done in init because init is called
|
/* Initialize the semaphore. This is not done in init because init is called
|
||||||
* in interrupt thread. cy_rtos_init_semaphore call is prohibited in
|
* in interrupt thread. cy_rtos_init_semaphore call is prohibited in
|
||||||
* interrupt thread.
|
* interrupt thread.
|
||||||
*/
|
*/
|
||||||
if(!sema_initialized)
|
if(!sema_initialized)
|
||||||
|
|
@ -770,16 +770,16 @@ en_sdio_result_t SDIO_SendCommandAndWait(stc_sdio_cmd_t *pstcCmd)
|
||||||
|
|
||||||
#ifdef CY_RTOS_AWARE
|
#ifdef CY_RTOS_AWARE
|
||||||
/* Wait for the transfer to finish.
|
/* Wait for the transfer to finish.
|
||||||
* Acquire semaphore and wait until it will be released
|
* Acquire semaphore and wait until it will be released
|
||||||
* in SDIO_IRQ:
|
* in SDIO_IRQ:
|
||||||
* 1. sdio_transfer_finished_semaphore count is equal to
|
* 1. sdio_transfer_finished_semaphore count is equal to
|
||||||
* zero. cy_rtos_get_semaphore waits until semaphore
|
* zero. cy_rtos_get_semaphore waits until semaphore
|
||||||
* count is increased by cy_rtos_set_semaphore() in
|
* count is increased by cy_rtos_set_semaphore() in
|
||||||
* SDIO_IRQ.
|
* SDIO_IRQ.
|
||||||
* 2. The cy_rtos_set_semaphore() increases
|
* 2. The cy_rtos_set_semaphore() increases
|
||||||
* sdio_transfer_finished_semaphore count.
|
* sdio_transfer_finished_semaphore count.
|
||||||
* 3. The cy_rtos_get_semaphore() function decreases
|
* 3. The cy_rtos_get_semaphore() function decreases
|
||||||
* sdio_transfer_finished_semaphore back to zero
|
* sdio_transfer_finished_semaphore back to zero
|
||||||
* and exit. Or timeout occurs
|
* and exit. Or timeout occurs
|
||||||
*/
|
*/
|
||||||
result = cy_rtos_get_semaphore( &sdio_transfer_finished_semaphore, 10, false );
|
result = cy_rtos_get_semaphore( &sdio_transfer_finished_semaphore, 10, false );
|
||||||
|
|
@ -1080,7 +1080,12 @@ void SDIO_DisableSdClk(void)
|
||||||
void SDIO_SetSdClkFrequency(uint32_t u32SdClkFreqHz)
|
void SDIO_SetSdClkFrequency(uint32_t u32SdClkFreqHz)
|
||||||
{
|
{
|
||||||
uint16_t u16Div;
|
uint16_t u16Div;
|
||||||
u16Div = Cy_SysClk_ClkPeriGetFrequency() / u32SdClkFreqHz;
|
/*
|
||||||
|
* The UDB SDIO implemenation has a extra divider internally that divides the input clock to the UDB
|
||||||
|
* by 2. The desired clock frequency is hence intentionally multiplied by 2 in order to get the required
|
||||||
|
* SDIO operating frequency.
|
||||||
|
*/
|
||||||
|
u16Div = Cy_SysClk_ClkPeriGetFrequency() / (2 * u32SdClkFreqHz);
|
||||||
Cy_SysClk_PeriphSetDivider(SDIO_HOST_Internal_Clock_DIV_TYPE, SDIO_HOST_Internal_Clock_DIV_NUM, (u16Div-1));
|
Cy_SysClk_PeriphSetDivider(SDIO_HOST_Internal_Clock_DIV_TYPE, SDIO_HOST_Internal_Clock_DIV_NUM, (u16Div-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1247,10 +1252,10 @@ void SDIO_IRQ(void)
|
||||||
{
|
{
|
||||||
pfnCardInt_count++;
|
pfnCardInt_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Execute card interrupt callback if neccesary */
|
/* Execute card interrupt callback if neccesary */
|
||||||
if (0 != pfnCardInt_count)
|
if (0 != pfnCardInt_count)
|
||||||
{
|
{
|
||||||
if (NULL != gstcInternalData.pstcCallBacks.pfnCardIntCb)
|
if (NULL != gstcInternalData.pstcCallBacks.pfnCardIntCb)
|
||||||
{
|
{
|
||||||
gstcInternalData.pstcCallBacks.pfnCardIntCb();
|
gstcInternalData.pstcCallBacks.pfnCardIntCb();
|
||||||
|
|
@ -1277,7 +1282,7 @@ void SDIO_IRQ(void)
|
||||||
/* CRC was bad, set the flag */
|
/* CRC was bad, set the flag */
|
||||||
gstcInternalData.stcEvents.u8CRCError++;
|
gstcInternalData.stcEvents.u8CRCError++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the done flag */
|
/* Set the done flag */
|
||||||
|
|
||||||
#ifdef CY_RTOS_AWARE
|
#ifdef CY_RTOS_AWARE
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
********************************************************************************
|
********************************************************************************
|
||||||
* \copyright
|
* \copyright
|
||||||
* Copyright 2016-2019 Cypress Semiconductor Corporation
|
* Copyright 2016-2020 Cypress Semiconductor Corporation
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
********************************************************************************
|
********************************************************************************
|
||||||
* \copyright
|
* \copyright
|
||||||
* Copyright 2016-2019 Cypress Semiconductor Corporation
|
* Copyright 2016-2020 Cypress Semiconductor Corporation
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
********************************************************************************
|
********************************************************************************
|
||||||
* \copyright
|
* \copyright
|
||||||
* Copyright 2016-2019 Cypress Semiconductor Corporation
|
* Copyright 2016-2020 Cypress Semiconductor Corporation
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
********************************************************************************
|
********************************************************************************
|
||||||
* \copyright
|
* \copyright
|
||||||
* Copyright 2016-2019 Cypress Semiconductor Corporation
|
* Copyright 2016-2020 Cypress Semiconductor Corporation
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
|
@ -111,7 +111,7 @@ cy_en_syspm_status_t SDIO_DeepSleepCallback(cy_stc_syspm_callback_params_t *para
|
||||||
CY_UNUSED_PARAMETER(params);
|
CY_UNUSED_PARAMETER(params);
|
||||||
cy_en_syspm_status_t status = CY_SYSPM_FAIL;
|
cy_en_syspm_status_t status = CY_SYSPM_FAIL;
|
||||||
|
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case CY_SYSPM_CHECK_READY:
|
case CY_SYSPM_CHECK_READY:
|
||||||
case CY_SYSPM_CHECK_FAIL:
|
case CY_SYSPM_CHECK_FAIL:
|
||||||
|
|
@ -656,7 +656,7 @@ en_sdio_result_t SDIO_SendCommandAndWait(stc_sdio_cmd_t *pstcCmd)
|
||||||
cy_rslt_t result;
|
cy_rslt_t result;
|
||||||
|
|
||||||
/* Initialize the semaphore. This is not done in init because init is called
|
/* Initialize the semaphore. This is not done in init because init is called
|
||||||
* in interrupt thread. cy_rtos_init_semaphore call is prohibited in
|
* in interrupt thread. cy_rtos_init_semaphore call is prohibited in
|
||||||
* interrupt thread.
|
* interrupt thread.
|
||||||
*/
|
*/
|
||||||
if(!sema_initialized)
|
if(!sema_initialized)
|
||||||
|
|
@ -770,16 +770,16 @@ en_sdio_result_t SDIO_SendCommandAndWait(stc_sdio_cmd_t *pstcCmd)
|
||||||
|
|
||||||
#ifdef CY_RTOS_AWARE
|
#ifdef CY_RTOS_AWARE
|
||||||
/* Wait for the transfer to finish.
|
/* Wait for the transfer to finish.
|
||||||
* Acquire semaphore and wait until it will be released
|
* Acquire semaphore and wait until it will be released
|
||||||
* in SDIO_IRQ:
|
* in SDIO_IRQ:
|
||||||
* 1. sdio_transfer_finished_semaphore count is equal to
|
* 1. sdio_transfer_finished_semaphore count is equal to
|
||||||
* zero. cy_rtos_get_semaphore waits until semaphore
|
* zero. cy_rtos_get_semaphore waits until semaphore
|
||||||
* count is increased by cy_rtos_set_semaphore() in
|
* count is increased by cy_rtos_set_semaphore() in
|
||||||
* SDIO_IRQ.
|
* SDIO_IRQ.
|
||||||
* 2. The cy_rtos_set_semaphore() increases
|
* 2. The cy_rtos_set_semaphore() increases
|
||||||
* sdio_transfer_finished_semaphore count.
|
* sdio_transfer_finished_semaphore count.
|
||||||
* 3. The cy_rtos_get_semaphore() function decreases
|
* 3. The cy_rtos_get_semaphore() function decreases
|
||||||
* sdio_transfer_finished_semaphore back to zero
|
* sdio_transfer_finished_semaphore back to zero
|
||||||
* and exit. Or timeout occurs
|
* and exit. Or timeout occurs
|
||||||
*/
|
*/
|
||||||
result = cy_rtos_get_semaphore( &sdio_transfer_finished_semaphore, 10, false );
|
result = cy_rtos_get_semaphore( &sdio_transfer_finished_semaphore, 10, false );
|
||||||
|
|
@ -1080,7 +1080,12 @@ void SDIO_DisableSdClk(void)
|
||||||
void SDIO_SetSdClkFrequency(uint32_t u32SdClkFreqHz)
|
void SDIO_SetSdClkFrequency(uint32_t u32SdClkFreqHz)
|
||||||
{
|
{
|
||||||
uint16_t u16Div;
|
uint16_t u16Div;
|
||||||
u16Div = Cy_SysClk_ClkPeriGetFrequency() / u32SdClkFreqHz;
|
/*
|
||||||
|
* The UDB SDIO implemenation has a extra divider internally that divides the input clock to the UDB
|
||||||
|
* by 2. The desired clock frequency is hence intentionally multiplied by 2 in order to get the required
|
||||||
|
* SDIO operating frequency.
|
||||||
|
*/
|
||||||
|
u16Div = Cy_SysClk_ClkPeriGetFrequency() / (2 * u32SdClkFreqHz);
|
||||||
Cy_SysClk_PeriphSetDivider(SDIO_HOST_Internal_Clock_DIV_TYPE, SDIO_HOST_Internal_Clock_DIV_NUM, (u16Div-1));
|
Cy_SysClk_PeriphSetDivider(SDIO_HOST_Internal_Clock_DIV_TYPE, SDIO_HOST_Internal_Clock_DIV_NUM, (u16Div-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1247,10 +1252,10 @@ void SDIO_IRQ(void)
|
||||||
{
|
{
|
||||||
pfnCardInt_count++;
|
pfnCardInt_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Execute card interrupt callback if neccesary */
|
/* Execute card interrupt callback if neccesary */
|
||||||
if (0 != pfnCardInt_count)
|
if (0 != pfnCardInt_count)
|
||||||
{
|
{
|
||||||
if (NULL != gstcInternalData.pstcCallBacks.pfnCardIntCb)
|
if (NULL != gstcInternalData.pstcCallBacks.pfnCardIntCb)
|
||||||
{
|
{
|
||||||
gstcInternalData.pstcCallBacks.pfnCardIntCb();
|
gstcInternalData.pstcCallBacks.pfnCardIntCb();
|
||||||
|
|
@ -1277,7 +1282,7 @@ void SDIO_IRQ(void)
|
||||||
/* CRC was bad, set the flag */
|
/* CRC was bad, set the flag */
|
||||||
gstcInternalData.stcEvents.u8CRCError++;
|
gstcInternalData.stcEvents.u8CRCError++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the done flag */
|
/* Set the done flag */
|
||||||
|
|
||||||
#ifdef CY_RTOS_AWARE
|
#ifdef CY_RTOS_AWARE
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
********************************************************************************
|
********************************************************************************
|
||||||
* \copyright
|
* \copyright
|
||||||
* Copyright 2016-2019 Cypress Semiconductor Corporation
|
* Copyright 2016-2020 Cypress Semiconductor Corporation
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
********************************************************************************
|
********************************************************************************
|
||||||
* \copyright
|
* \copyright
|
||||||
* Copyright 2016-2019 Cypress Semiconductor Corporation
|
* Copyright 2016-2020 Cypress Semiconductor Corporation
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
********************************************************************************
|
********************************************************************************
|
||||||
* \copyright
|
* \copyright
|
||||||
* Copyright 2016-2019 Cypress Semiconductor Corporation
|
* Copyright 2016-2020 Cypress Semiconductor Corporation
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue